operp-print-designer 1.0.1 → 1.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.react-grid-layout{position:relative;transition:height .2s ease}.react-grid-item{transition:all .2s ease;transition-property:left,top,width,height}.react-grid-item img{pointer-events:none;-webkit-user-select:none;user-select:none}.react-grid-item.cssTransforms{transition-property:transform,width,height}.react-grid-item.resizing{transition:none;z-index:1;will-change:width,height}.react-grid-item.react-draggable-dragging{transition:none;z-index:3;will-change:transform}.react-grid-item.dropping{visibility:hidden}.react-grid-item.react-grid-placeholder{background:red;opacity:.2;transition-duration:.1s;z-index:2;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.react-grid-item.react-grid-placeholder.placeholder-resizing{transition:none}.react-grid-item>.react-resizable-handle{position:absolute;width:20px;height:20px}.react-grid-item>.react-resizable-handle:after{content:"";position:absolute;right:3px;bottom:3px;width:5px;height:5px;border-right:2px solid rgba(0,0,0,.4);border-bottom:2px solid rgba(0,0,0,.4)}.react-resizable-hide>.react-resizable-handle{display:none}.react-grid-item>.react-resizable-handle.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-w,.react-grid-item>.react-resizable-handle.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-n,.react-grid-item>.react-resizable-handle.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}.react-resizable{position:relative}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+);background-position:bottom right;padding:0 3px 3px 0}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-resizable-handle-w,.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-resizable-handle-n,.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}
|
|
1
|
+
.react-grid-layout{position:relative;transition:height .2s ease}.react-grid-item{transition:all .2s ease;transition-property:left,top,width,height}.react-grid-item img{pointer-events:none;-webkit-user-select:none;user-select:none}.react-grid-item.cssTransforms{transition-property:transform,width,height}.react-grid-item.resizing{transition:none;z-index:1;will-change:width,height}.react-grid-item.react-draggable-dragging{transition:none;z-index:3;will-change:transform}.react-grid-item.dropping{visibility:hidden}.react-grid-item.react-grid-placeholder{background:red;opacity:.2;transition-duration:.1s;z-index:2;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.react-grid-item.react-grid-placeholder.placeholder-resizing{transition:none}.react-grid-item>.react-resizable-handle{position:absolute;width:20px;height:20px}.react-grid-item>.react-resizable-handle:after{content:"";position:absolute;right:3px;bottom:3px;width:5px;height:5px;border-right:2px solid rgba(0,0,0,.4);border-bottom:2px solid rgba(0,0,0,.4)}.react-resizable-hide>.react-resizable-handle{display:none}.react-grid-item>.react-resizable-handle.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-w,.react-grid-item>.react-resizable-handle.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-n,.react-grid-item>.react-resizable-handle.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-grid-item>.react-resizable-handle.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-grid-item>.react-resizable-handle.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}.react-resizable{position:relative}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+);background-position:bottom right;padding:0 3px 3px 0}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg)}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg)}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg)}.react-resizable-handle-w,.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize}.react-resizable-handle-w{left:0;transform:rotate(135deg)}.react-resizable-handle-e{right:0;transform:rotate(315deg)}.react-resizable-handle-n,.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize}.react-resizable-handle-n{top:0;transform:rotate(225deg)}.react-resizable-handle-s{bottom:0;transform:rotate(45deg)}*{margin:0;padding:0;box-sizing:border-box}html,body,#root{width:100%;height:100%;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.app-container{display:flex;flex-direction:column;height:100vh;overflow:hidden}.app-body{display:flex;flex:1;overflow:hidden}.app-left-panel{width:280px;min-width:220px;display:flex;flex-direction:column;border-right:1px solid #e8e8e8;background:#fff;overflow:hidden}.app-left-top{flex-shrink:0}.app-left-bottom{flex:1;overflow:auto}.app-right-panel{width:260px;min-width:260px;border-left:1px solid #e8e8e8;background:#fff;overflow:auto}.canvas-grid{background-image:linear-gradient(rgba(0,0,0,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(0,0,0,.05) 1px,transparent 1px);background-size:20px 20px}.react-grid-item.react-grid-placeholder{background:#1677ff!important;opacity:.15!important;border-radius:4px}
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/return o.NODE_ENV!=="production"&&(function(){var d=w,a=Symbol.for("react.element"),n=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),u=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),N=Symbol.for("react.offscreen"),y=Symbol.iterator,
|
|
17
|
+
*/return o.NODE_ENV!=="production"&&(function(){var d=w,a=Symbol.for("react.element"),n=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),u=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),N=Symbol.for("react.offscreen"),y=Symbol.iterator,O="@@iterator";function r(t){if(t===null||typeof t!="object")return null;var c=y&&t[y]||t[O];return typeof c=="function"?c:null}var f=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(t){{for(var c=arguments.length,p=new Array(c>1?c-1:0),C=1;C<c;C++)p[C-1]=arguments[C];_("error",t,p)}}function _(t,c,p){{var C=f.ReactDebugCurrentFrame,D=C.getStackAddendum();D!==""&&(c+="%s",p=p.concat([D]));var $=p.map(function(I){return String(I)});$.unshift("Warning: "+c),Function.prototype.apply.call(console[t],console,$)}}var h=!1,S=!1,F=!1,V=!1,H=!1,q;q=Symbol.for("react.module.reference");function W(t){return!!(typeof t=="string"||typeof t=="function"||t===l||t===v||H||t===i||t===b||t===P||V||t===N||h||S||F||typeof t=="object"&&t!==null&&(t.$$typeof===z||t.$$typeof===g||t.$$typeof===m||t.$$typeof===u||t.$$typeof===j||t.$$typeof===q||t.getModuleId!==void 0))}function re(t,c,p){var C=t.displayName;if(C)return C;var D=c.displayName||c.name||"";return D!==""?p+"("+D+")":p}function ne(t){return t.displayName||"Context"}function U(t){if(t==null)return null;if(typeof t.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case l:return"Fragment";case n:return"Portal";case v:return"Profiler";case i:return"StrictMode";case b:return"Suspense";case P:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case u:var c=t;return ne(c)+".Consumer";case m:var p=t;return ne(p._context)+".Provider";case j:return re(t,t.render,"ForwardRef");case g:var C=t.displayName||null;return C!==null?C:U(t.type)||"Memo";case z:{var D=t,$=D._payload,I=D._init;try{return U(I($))}catch{return null}}}return null}var k=Object.assign,R=0,K,Z,Ye,He,Ue,qe,Ke;function Ge(){}Ge.__reactDisabledLog=!0;function Dt(){{if(R===0){K=console.log,Z=console.info,Ye=console.warn,He=console.error,Ue=console.group,qe=console.groupCollapsed,Ke=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Ge,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}R++}}function Rt(){{if(R--,R===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},t,{value:K}),info:k({},t,{value:Z}),warn:k({},t,{value:Ye}),error:k({},t,{value:He}),group:k({},t,{value:Ue}),groupCollapsed:k({},t,{value:qe}),groupEnd:k({},t,{value:Ke})})}R<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Te=f.ReactCurrentDispatcher,ke;function ye(t,c,p){{if(ke===void 0)try{throw Error()}catch(D){var C=D.stack.trim().match(/\n( *(at )?)/);ke=C&&C[1]||""}return`
|
|
18
18
|
`+ke+t}}var Pe=!1,ve;{var At=typeof WeakMap=="function"?WeakMap:Map;ve=new At}function Xe(t,c){if(!t||Pe)return"";{var p=ve.get(t);if(p!==void 0)return p}var C;Pe=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $;$=Te.current,Te.current=null,Dt();try{if(c){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(X){C=X}Reflect.construct(t,[],I)}else{try{I.call()}catch(X){C=X}t.call(I.prototype)}}else{try{throw Error()}catch(X){C=X}t()}}catch(X){if(X&&C&&typeof X.stack=="string"){for(var E=X.stack.split(`
|
|
19
19
|
`),G=C.stack.split(`
|
|
20
20
|
`),L=E.length-1,J=G.length-1;L>=1&&J>=0&&E[L]!==G[J];)J--;for(;L>=1&&J>=0;L--,J--)if(E[L]!==G[J]){if(L!==1||J!==1)do if(L--,J--,J<0||E[L]!==G[J]){var Q=`
|
|
21
|
-
`+E[L].replace(" at new "," at ");return t.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",t.displayName)),typeof t=="function"&&ve.set(t,Q),Q}while(L>=1&&J>=0);break}}}finally{Pe=!1,Te.current=$,Rt(),Error.prepareStackTrace=D}var se=t?t.displayName||t.name:"",te=se?ye(se):"";return typeof t=="function"&&ve.set(t,te),te}function Nt(t,c,p){return Xe(t,!1)}function Ft(t){var c=t.prototype;return!!(c&&c.isReactComponent)}function be(t,c,p){if(t==null)return"";if(typeof t=="function")return Xe(t,Ft(t));if(typeof t=="string")return ye(t);switch(t){case b:return ye("Suspense");case P:return ye("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case j:return Nt(t.render);case g:return be(t.type,c,p);case z:{var C=t,D=C._payload,$=C._init;try{return be($(D),c,p)}catch{}}}return""}var de=Object.prototype.hasOwnProperty,Ze={},Qe=f.ReactDebugCurrentFrame;function je(t){if(t){var c=t._owner,p=be(t.type,t._source,c?c.type:null);Qe.setExtraStackFrame(p)}else Qe.setExtraStackFrame(null)}function $t(t,c,p,C,D){{var $=Function.call.bind(de);for(var I in t)if($(t,I)){var E=void 0;try{if(typeof t[I]!="function"){var G=Error((C||"React class")+": "+p+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw G.name="Invariant Violation",G}E=t[I](c,I,C,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(L){E=L}E&&!(E instanceof Error)&&(je(D),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",C||"React class",p,I,typeof E),je(null)),E instanceof Error&&!(E.message in Ze)&&(Ze[E.message]=!0,je(D),x("Failed %s type: %s",p,E.message),je(null))}}}var Bt=Array.isArray;function Ee(t){return Bt(t)}function Vt(t){{var c=typeof Symbol=="function"&&Symbol.toStringTag,p=c&&t[Symbol.toStringTag]||t.constructor.name||"Object";return p}}function Wt(t){try{return et(t),!1}catch{return!0}}function et(t){return""+t}function tt(t){if(Wt(t))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Vt(t)),et(t)}var rt=f.ReactCurrentOwner,Lt={key:!0,ref:!0,__self:!0,__source:!0},nt,it;function Mt(t){if(de.call(t,"ref")){var c=Object.getOwnPropertyDescriptor(t,"ref").get;if(c&&c.isReactWarning)return!1}return t.ref!==void 0}function Jt(t){if(de.call(t,"key")){var c=Object.getOwnPropertyDescriptor(t,"key").get;if(c&&c.isReactWarning)return!1}return t.key!==void 0}function Yt(t,c){typeof t.ref=="string"&&rt.current}function Ht(t,c){{var p=function(){nt||(nt=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};p.isReactWarning=!0,Object.defineProperty(t,"key",{get:p,configurable:!0})}}function Ut(t,c){{var p=function(){it||(it=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};p.isReactWarning=!0,Object.defineProperty(t,"ref",{get:p,configurable:!0})}}var qt=function(t,c,p,C,D,$,I){var E={$$typeof:a,type:t,key:c,ref:p,props:I,_owner:$};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function Kt(t,c,p,C,D){{var $,I={},E=null,G=null;p!==void 0&&(tt(p),E=""+p),Jt(c)&&(tt(c.key),E=""+c.key),Mt(c)&&(G=c.ref,Yt(c,D));for($ in c)de.call(c,$)&&!Lt.hasOwnProperty($)&&(I[$]=c[$]);if(t&&t.defaultProps){var L=t.defaultProps;for($ in L)I[$]===void 0&&(I[$]=L[$])}if(E||G){var J=typeof t=="function"?t.displayName||t.name||"Unknown":t;E&&Ht(I,J),G&&Ut(I,J)}return qt(t,E,G,D,C,rt.current,I)}}var
|
|
21
|
+
`+E[L].replace(" at new "," at ");return t.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",t.displayName)),typeof t=="function"&&ve.set(t,Q),Q}while(L>=1&&J>=0);break}}}finally{Pe=!1,Te.current=$,Rt(),Error.prepareStackTrace=D}var se=t?t.displayName||t.name:"",te=se?ye(se):"";return typeof t=="function"&&ve.set(t,te),te}function Nt(t,c,p){return Xe(t,!1)}function Ft(t){var c=t.prototype;return!!(c&&c.isReactComponent)}function be(t,c,p){if(t==null)return"";if(typeof t=="function")return Xe(t,Ft(t));if(typeof t=="string")return ye(t);switch(t){case b:return ye("Suspense");case P:return ye("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case j:return Nt(t.render);case g:return be(t.type,c,p);case z:{var C=t,D=C._payload,$=C._init;try{return be($(D),c,p)}catch{}}}return""}var de=Object.prototype.hasOwnProperty,Ze={},Qe=f.ReactDebugCurrentFrame;function je(t){if(t){var c=t._owner,p=be(t.type,t._source,c?c.type:null);Qe.setExtraStackFrame(p)}else Qe.setExtraStackFrame(null)}function $t(t,c,p,C,D){{var $=Function.call.bind(de);for(var I in t)if($(t,I)){var E=void 0;try{if(typeof t[I]!="function"){var G=Error((C||"React class")+": "+p+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw G.name="Invariant Violation",G}E=t[I](c,I,C,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(L){E=L}E&&!(E instanceof Error)&&(je(D),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",C||"React class",p,I,typeof E),je(null)),E instanceof Error&&!(E.message in Ze)&&(Ze[E.message]=!0,je(D),x("Failed %s type: %s",p,E.message),je(null))}}}var Bt=Array.isArray;function Ee(t){return Bt(t)}function Vt(t){{var c=typeof Symbol=="function"&&Symbol.toStringTag,p=c&&t[Symbol.toStringTag]||t.constructor.name||"Object";return p}}function Wt(t){try{return et(t),!1}catch{return!0}}function et(t){return""+t}function tt(t){if(Wt(t))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Vt(t)),et(t)}var rt=f.ReactCurrentOwner,Lt={key:!0,ref:!0,__self:!0,__source:!0},nt,it;function Mt(t){if(de.call(t,"ref")){var c=Object.getOwnPropertyDescriptor(t,"ref").get;if(c&&c.isReactWarning)return!1}return t.ref!==void 0}function Jt(t){if(de.call(t,"key")){var c=Object.getOwnPropertyDescriptor(t,"key").get;if(c&&c.isReactWarning)return!1}return t.key!==void 0}function Yt(t,c){typeof t.ref=="string"&&rt.current}function Ht(t,c){{var p=function(){nt||(nt=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};p.isReactWarning=!0,Object.defineProperty(t,"key",{get:p,configurable:!0})}}function Ut(t,c){{var p=function(){it||(it=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};p.isReactWarning=!0,Object.defineProperty(t,"ref",{get:p,configurable:!0})}}var qt=function(t,c,p,C,D,$,I){var E={$$typeof:a,type:t,key:c,ref:p,props:I,_owner:$};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function Kt(t,c,p,C,D){{var $,I={},E=null,G=null;p!==void 0&&(tt(p),E=""+p),Jt(c)&&(tt(c.key),E=""+c.key),Mt(c)&&(G=c.ref,Yt(c,D));for($ in c)de.call(c,$)&&!Lt.hasOwnProperty($)&&(I[$]=c[$]);if(t&&t.defaultProps){var L=t.defaultProps;for($ in L)I[$]===void 0&&(I[$]=L[$])}if(E||G){var J=typeof t=="function"?t.displayName||t.name||"Unknown":t;E&&Ht(I,J),G&&Ut(I,J)}return qt(t,E,G,D,C,rt.current,I)}}var _e=f.ReactCurrentOwner,st=f.ReactDebugCurrentFrame;function ie(t){if(t){var c=t._owner,p=be(t.type,t._source,c?c.type:null);st.setExtraStackFrame(p)}else st.setExtraStackFrame(null)}var Oe;Oe=!1;function Ie(t){return typeof t=="object"&&t!==null&&t.$$typeof===a}function ot(){{if(_e.current){var t=U(_e.current.type);if(t)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+t+"`."}return""}}function Gt(t){return""}var lt={};function Xt(t){{var c=ot();if(!c){var p=typeof t=="string"?t:t.displayName||t.name;p&&(c=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+p+">.")}return c}}function at(t,c){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var p=Xt(c);if(lt[p])return;lt[p]=!0;var C="";t&&t._owner&&t._owner!==
|
|
25
|
+
Check the top-level render call using <`+p+">.")}return c}}function at(t,c){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var p=Xt(c);if(lt[p])return;lt[p]=!0;var C="";t&&t._owner&&t._owner!==_e.current&&(C=" It was passed a child from "+U(t._owner.type)+"."),ie(t),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,C),ie(null)}}function ct(t,c){{if(typeof t!="object")return;if(Ee(t))for(var p=0;p<t.length;p++){var C=t[p];Ie(C)&&at(C,c)}else if(Ie(t))t._store&&(t._store.validated=!0);else if(t){var D=r(t);if(typeof D=="function"&&D!==t.entries)for(var $=D.call(t),I;!(I=$.next()).done;)Ie(I.value)&&at(I.value,c)}}}function Zt(t){{var c=t.type;if(c==null||typeof c=="string")return;var p;if(typeof c=="function")p=c.propTypes;else if(typeof c=="object"&&(c.$$typeof===j||c.$$typeof===g))p=c.propTypes;else return;if(p){var C=U(c);$t(p,t.props,"prop",C,t)}else if(c.PropTypes!==void 0&&!Oe){Oe=!0;var D=U(c);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof c.getDefaultProps=="function"&&!c.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Qt(t){{for(var c=Object.keys(t.props),p=0;p<c.length;p++){var C=c[p];if(C!=="children"&&C!=="key"){ie(t),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",C),ie(null);break}}t.ref!==null&&(ie(t),x("Invalid attribute `ref` supplied to `React.Fragment`."),ie(null))}}var dt={};function ut(t,c,p,C,D,$){{var I=W(t);if(!I){var E="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(E+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var G=Gt();G?E+=G:E+=ot();var L;t===null?L="null":Ee(t)?L="array":t!==void 0&&t.$$typeof===a?(L="<"+(U(t.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):L=typeof t,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",L,E)}var J=Kt(t,c,p,D,$);if(J==null)return J;if(I){var Q=c.children;if(Q!==void 0)if(C)if(Ee(Q)){for(var se=0;se<Q.length;se++)ct(Q[se],t);Object.freeze&&Object.freeze(Q)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ct(Q,t)}if(de.call(c,"key")){var te=U(t),X=Object.keys(c).filter(function(sr){return sr!=="key"}),ze=X.length>0?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}";if(!dt[te+ze]){var ir=X.length>0?"{"+X.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,ze,te,ir,te),dt[te+ze]=!0}}return t===l?Qt(J):Zt(J),J}}function er(t,c,p){return ut(t,c,p,!0)}function tr(t,c,p){return ut(t,c,p,!1)}var rr=tr,nr=er;le.Fragment=l,le.jsx=rr,le.jsxs=nr})(),le}var Ne;function mt(){if(Ne)return ue.exports;Ne=1;var o={};return o.NODE_ENV==="production"?ue.exports=pt():ue.exports=gt(),ue.exports}var e=mt();const he={A4:{width:210,height:297},A3:{width:297,height:420},A5:{width:148,height:210},Letter:{width:215.9,height:279.4},Legal:{width:215.9,height:355.6}},Fe={paperSize:"A4",customWidth:210,customHeight:297,orientation:"portrait",marginTop:10,marginRight:10,marginBottom:10,marginLeft:10,showHeader:!1,headerContent:"页眉文字",showFooter:!1,footerContent:"页脚文字",showPageNumber:!0,pageNumberFormat:"第 {page} 页"},A=3,fe={cellSize:1,cols:100},$e={text:"文本",image:"图片",table:"表格",barcode:"条形码",line:"分割线"},xt={text:{content:"双击编辑文字",fontSize:14,fontWeight:"normal",fontStyle:"normal",textAlign:"left",color:"#000000",backgroundColor:"transparent"},image:{src:"",fit:"contain",content:""},table:{rows:3,cols:3,borderWidth:1,borderColor:"#000000",content:""},barcode:{value:"1234567890",format:"CODE128",content:""},line:{color:"#000000",thickness:1,style:"solid",content:""}};let Se=0,Ce=0;function Be(){return`comp_${++Se}`}function Ve(){return`ds_${++Ce}`}const T=ht.create((o,d)=>({components:[],selectedId:null,pageSettings:{...Fe},gridSettings:{...fe},previewVisible:!1,templateName:"未命名模板",headerFooterVisible:!1,dataSources:[],activeDataSourceId:null,addComponent:(a,n,l)=>{const i=Be(),v=$e[a]||a,m={...xt[a]||{}};a==="text"&&(m.content=v);const u={id:i,type:a,x:n??0,y:l??0,w:a==="line"?20:15,h:a==="line"?1:8,props:m,...a==="table"?{tableColumns:[{title:"列1"},{title:"列2"},{title:"列3"}]}:{}};o(j=>({components:[...j.components,u],selectedId:i}))},updateComponent:(a,n)=>{o(l=>({components:l.components.map(i=>i.id===a?{...i,...n}:i)}))},selectComponent:a=>{o({selectedId:a})},removeComponent:a=>{o(n=>({components:n.components.filter(l=>l.id!==a),selectedId:n.selectedId===a?null:n.selectedId}))},setComponents:a=>{o({components:a})},setPageSettings:a=>{o(n=>({pageSettings:{...n.pageSettings,...a}}))},setPreviewVisible:a=>{o({previewVisible:a})},setTemplateName:a=>{o({templateName:a})},setHeaderFooterVisible:a=>{o({headerFooterVisible:a})},addDataSource:(a,n,l)=>{const v={id:Ve(),name:a,type:n,data:l,createdAt:Date.now()};o(m=>({dataSources:[...m.dataSources,v]}))},updateDataSource:(a,n)=>{o(l=>({dataSources:l.dataSources.map(i=>i.id===a?{...i,...n}:i)}))},removeDataSource:a=>{o(n=>({dataSources:n.dataSources.filter(l=>l.id!==a),activeDataSourceId:n.activeDataSourceId===a?null:n.activeDataSourceId}))},setActiveDataSourceId:a=>{o({activeDataSourceId:a})},updateComponentTableColumns:(a,n)=>{o(l=>({components:l.components.map(i=>i.id===a?{...i,tableColumns:n}:i)}))},exportJSON:()=>{const a=d(),n={version:"1.0",templateName:a.templateName,pageSettings:a.pageSettings,components:a.components.map(({id:l,...i})=>i),dataSources:a.dataSources.map(({id:l,...i})=>i)};return JSON.stringify(n,null,2)},importJSON:a=>{try{const n=JSON.parse(a);if(!n.version||!n.pageSettings||!Array.isArray(n.components))return"JSON 格式不正确,缺少必要字段";Se=0,Ce=0;const l=n.components.map(v=>({...v,id:Be()})),i=(n.dataSources||[]).map(v=>({...v,id:Ve()}));return o({components:l,dataSources:i,pageSettings:n.pageSettings,templateName:n.templateName||"导入的模板",selectedId:null,activeDataSourceId:null}),null}catch{return"JSON 解析失败,请检查文件内容"}},reset:()=>{Se=0,Ce=0,o({components:[],selectedId:null,pageSettings:{...Fe},gridSettings:{...fe},templateName:"未命名模板",headerFooterVisible:!1,previewVisible:!1,dataSources:[],activeDataSourceId:null})}})),{Text:or}=s.Typography,yt=({onCustomSave:o,onCustomPrint:d})=>{const a=T(f=>f.templateName),n=T(f=>f.setTemplateName),l=T(f=>f.setPreviewVisible),i=T(f=>f.setHeaderFooterVisible),v=T(f=>f.selectedId),m=T(f=>f.removeComponent),u=T(f=>f.exportJSON),j=T(f=>f.importJSON),b=T(f=>f.reset),P=w.useRef(null),{message:g}=s.App.useApp(),z=w.useCallback(()=>{v&&m(v)},[v,m]),N=w.useCallback(()=>{const f=u(),x=new Blob([f],{type:"application/json"}),O=URL.createObjectURL(x),h=document.createElement("a");h.href=O,h.download=`${a||"模板"}.json`,h.click(),URL.revokeObjectURL(O),g.success("模板已导出")},[u,a,g]),y=w.useCallback(()=>{var f;(f=P.current)==null||f.click()},[]),_=w.useCallback(f=>{var h;const x=(h=f.target.files)==null?void 0:h[0];if(!x)return;const O=new FileReader;O.onload=()=>{const S=j(O.result);S?g.error(S):g.success("模板已导入")},O.readAsText(x),f.target.value=""},[j,g]),r=w.useCallback(()=>{b(),g.info("已新建空白模板")},[b,g]);return e.jsxs("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",borderBottom:"1px solid #e8e8e8",background:"#fff"},children:[e.jsx(s.Space,{children:e.jsx(s.Input,{value:a,onChange:f=>n(f.target.value),variant:"borderless",style:{width:200,fontSize:16,fontWeight:600},placeholder:"模板名称"})}),e.jsxs(s.Space,{children:[e.jsx(s.Button,{icon:e.jsx(B.PlusOutlined,{}),onClick:r,children:"新建"}),e.jsx("input",{ref:P,type:"file",accept:".json",style:{display:"none"},onChange:_}),o?e.jsx(s.Button,{icon:e.jsx(B.SaveOutlined,{}),onClick:o,type:"primary",children:"保存"}):e.jsx(s.Button,{icon:e.jsx(B.DownloadOutlined,{}),onClick:N,children:"导出"}),e.jsx(s.Button,{icon:e.jsx(B.UploadOutlined,{}),onClick:y,children:"导入"}),e.jsx(s.Button,{icon:e.jsx(B.SettingOutlined,{}),onClick:()=>i(!0),children:"页眉页脚"}),e.jsx(s.Button,{danger:!0,icon:e.jsx(B.DeleteOutlined,{}),disabled:!v,onClick:z,children:"删除"}),d?e.jsx(s.Button,{type:"primary",icon:e.jsx(B.PrinterOutlined,{}),onClick:d,children:"打印"}):e.jsx(s.Button,{type:"primary",icon:e.jsx(B.EyeOutlined,{}),onClick:()=>l(!0),children:"预览"})]})]})},{Text:ee}=s.Typography,vt=()=>{const o=T(i=>i.pageSettings),d=T(i=>i.setPageSettings),a=o.paperSize==="custom",n=w.useCallback(i=>{d({paperSize:i})},[d]),l=w.useCallback(i=>{d({orientation:i})},[d]);return e.jsx(s.Card,{title:"页面设置",size:"small",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:12},children:"纸张大小"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:o.paperSize,onChange:n,options:[...Object.keys(he).map(i=>({value:i,label:i})),{value:"custom",label:"自定义"}]})]}),a&&e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(ee,{style:{fontSize:12},children:"宽度 (mm)"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.customWidth,min:10,max:2e3,onChange:i=>d({customWidth:i??210})})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(ee,{style:{fontSize:12},children:"高度 (mm)"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.customHeight,min:10,max:2e3,onChange:i=>d({customHeight:i??297})})]})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:12},children:"方向"}),e.jsxs(s.Radio.Group,{value:o.orientation,onChange:i=>l(i.target.value),size:"small",style:{width:"100%",display:"flex"},children:[e.jsx(s.Radio.Button,{value:"portrait",style:{flex:1,textAlign:"center"},children:"纵向"}),e.jsx(s.Radio.Button,{value:"landscape",style:{flex:1,textAlign:"center"},children:"横向"})]})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:12},children:"页边距 (mm)"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"上"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginTop,min:0,max:100,onChange:i=>d({marginTop:i??10})})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"右"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginRight,min:0,max:100,onChange:i=>d({marginRight:i??10})})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"下"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginBottom,min:0,max:100,onChange:i=>d({marginBottom:i??10})})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"左"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginLeft,min:0,max:100,onChange:i=>d({marginLeft:i??10})})]})]})]})]})})},{Text:bt}=s.Typography,jt=[{type:"text",icon:e.jsx(B.FontSizeOutlined,{}),label:"文本"},{type:"image",icon:e.jsx(B.PictureOutlined,{}),label:"图片"},{type:"table",icon:e.jsx(B.TableOutlined,{}),label:"表格"},{type:"barcode",icon:e.jsx(B.BarcodeOutlined,{}),label:"条形码"},{type:"line",icon:e.jsx(B.MinusOutlined,{}),label:"分割线"}],St=()=>{const o=T(n=>n.addComponent),d=w.useCallback((n,l)=>{n.dataTransfer.setData("componentType",l),n.dataTransfer.effectAllowed="copy"},[]),a=w.useCallback(n=>{o(n)},[o]);return e.jsx(s.Card,{title:"组件面板",size:"small",children:e.jsx(s.Space,{direction:"vertical",style:{width:"100%"},size:4,children:jt.map(n=>e.jsxs("div",{draggable:!0,onDragStart:l=>d(l,n.type),onClick:()=>a(n.type),style:{cursor:"grab",padding:"8px 12px",border:"1px solid #d9d9d9",borderRadius:6,display:"flex",alignItems:"center",gap:8,background:"#fafafa",userSelect:"none",transition:"all 0.2s"},onMouseEnter:l=>{l.currentTarget.style.background="#e6f4ff",l.currentTarget.style.borderColor="#1677ff"},onMouseLeave:l=>{l.currentTarget.style.background="#fafafa",l.currentTarget.style.borderColor="#d9d9d9"},children:[n.icon,e.jsx(bt,{children:n.label})]},n.type))})})};function ae(o){try{return JSON.parse(o)}catch{return null}}function ce(o,d,a){const n=`${d}Binding`,l=o.props[n];if(l&&l.dataSourceId&&l.fieldPath){const v=a.find(m=>m.id===l.dataSourceId);if(v){const m=ge(v);if(m){const u=pe(m,l.fieldPath);if(u)return u}}}return o.props[d]||(l==null?void 0:l.staticValue)||""}function pe(o,d){if(!o||!d)return"";try{const a=d.split(".");let n=o;for(const l of a){if(typeof n!="object"||n===null)return"";n=n[l]}return n!=null?String(n):""}catch{return""}}function ge(o){const d=ae(o.data);return o.type==="object"&&d&&typeof d=="object"&&!Array.isArray(d)?d:null}function me(o){const d=ae(o.data);return o.type==="array"&&Array.isArray(d)?d:null}const{TextArea:Ct}=s.Input,{Text:xe,Title:lr}=s.Typography,We=JSON.stringify({name:"张三",age:28,department:"技术部",email:"zhangsan@example.com"},null,2),wt=JSON.stringify([{id:1,product:"商品A",quantity:2,price:100},{id:2,product:"商品B",quantity:5,price:80},{id:3,product:"商品C",quantity:1,price:200}],null,2),Tt=()=>{const o=T(g=>g.dataSources),d=T(g=>g.addDataSource),a=T(g=>g.updateDataSource),n=T(g=>g.removeDataSource),[l,i]=w.useState(!1),[v,m]=w.useState(null),[u,j]=w.useState({name:"",type:"object",data:""}),b=g=>{g?(m(g.id),j({name:g.name,type:g.type,data:g.data})):(m(null),j({name:"新数据源",type:"object",data:We})),i(!0)},P=()=>{const g=ae(u.data);if(g===null){s.message.error("JSON 格式不正确");return}if(u.type==="object"&&(Array.isArray(g)||typeof g!="object")){s.message.error("对象类型数据源必须为对象格式");return}if(u.type==="array"&&!Array.isArray(g)){s.message.error("数组类型数据源必须为数组格式");return}v?(a(v,u),s.message.success("数据源已更新")):(d(u.name,u.type,u.data),s.message.success("数据源已添加")),i(!1)};return e.jsxs(s.Card,{title:"数据源",size:"small",extra:e.jsx(s.Button,{type:"link",size:"small",icon:e.jsx(B.PlusOutlined,{}),onClick:()=>b(),children:"添加"}),children:[e.jsx(s.List,{size:"small",dataSource:o,locale:{emptyText:"暂无数据源"},renderItem:g=>e.jsx(s.List.Item,{actions:[e.jsx(s.Dropdown,{menu:{items:[{key:"edit",label:"编辑",icon:e.jsx(B.EditOutlined,{}),onClick:()=>b(g)},{type:"divider"},{key:"delete",label:e.jsx(s.Popconfirm,{title:"确定要删除这个数据源吗?",onConfirm:z=>{z==null||z.stopPropagation(),n(g.id),s.message.success("已删除")},okText:"确定",cancelText:"取消",onCancel:z=>z==null?void 0:z.stopPropagation(),children:e.jsx("span",{style:{color:"#ff4d4f",cursor:"pointer"},children:"删除"})}),icon:e.jsx(B.DeleteOutlined,{style:{color:"#ff4d4f"}})}]},placement:"bottomRight",children:e.jsx(s.Button,{type:"text",size:"small",icon:e.jsx(B.MoreOutlined,{})})})],children:e.jsx(s.List.Item.Meta,{avatar:e.jsx(B.DatabaseOutlined,{}),title:e.jsx(xe,{strong:!0,children:g.name}),description:e.jsx(s.Space,{size:4,children:e.jsx(s.Tag,{color:g.type==="object"?"blue":"green",children:g.type==="object"?"对象":"数组"})})})})}),e.jsx(s.Modal,{title:v?"编辑数据源":"添加数据源",open:l,onOk:P,onCancel:()=>i(!1),okText:"保存",cancelText:"取消",children:e.jsxs(s.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[e.jsxs("div",{children:[e.jsx(xe,{strong:!0,style:{display:"block",marginBottom:4},children:"名称"}),e.jsx(s.Input,{placeholder:"请输入数据源名称",value:u.name,onChange:g=>j({...u,name:g.target.value})})]}),e.jsxs("div",{children:[e.jsx(xe,{strong:!0,style:{display:"block",marginBottom:4},children:"类型"}),e.jsx(s.Select,{options:[{label:"对象",value:"object"},{label:"数组",value:"array"}],style:{width:"100%"},value:u.type,onChange:g=>{j({...u,type:g,data:g==="object"?We:wt})}})]}),e.jsx(s.Divider,{style:{margin:"8px 0"}}),e.jsxs("div",{children:[e.jsx(xe,{strong:!0,style:{display:"block",marginBottom:4},children:"JSON 数据"}),e.jsx(Ct,{rows:12,placeholder:"请输入 JSON 数据",value:u.data,onChange:g=>j({...u,data:g.target.value})})]})]})})]})},kt=()=>e.jsx(s.Collapse,{bordered:!1,defaultActiveKey:["1","2"],expandIcon:({isActive:o})=>e.jsx(B.CaretRightOutlined,{rotate:o?90:0}),style:{height:"100%",overflowY:"auto"},items:[{key:"1",label:"页面设置",children:e.jsx(vt,{})},{key:"2",label:"组件",children:e.jsx(St,{})},{key:"3",label:"数据源",children:e.jsx(Tt,{})}]});function Le(o){const d=[];d.push(1,1,0,1,1,0,1,1);for(let a=0;a<o.length;a++){const l=(o.charCodeAt(a)%103).toString(2).padStart(7,"0");for(const i of l)d.push(i==="1"?1:0)}return d.push(1,1,0,0,0,1,1,0,0,0,1,1),d}const we=({value:o,format:d})=>{const a=w.useMemo(()=>Le(o),[o,d]);if(!o)return e.jsx("div",{style:{fontSize:11,color:"#999"},children:"请设置条形码值"});const n=2,l=44,i=a.length*n;return e.jsxs("div",{style:{textAlign:"center",overflow:"hidden",maxWidth:"100%"},children:[e.jsx("canvas",{ref:v=>{if(!v)return;const m=v.getContext("2d");m&&(v.width=i,v.height=l,m.clearRect(0,0,i,l),a.forEach((u,j)=>{m.fillStyle=u===1?"#000":"#fff",m.fillRect(j*n,0,n,l)}))},style:{width:"100%",maxWidth:i,height:l}}),e.jsx("div",{style:{fontSize:10,marginTop:1,letterSpacing:1},children:o})]})},Me=w.memo(({comp:o,selected:d,isPreview:a=!1,dataSources:n=[]})=>{const l={width:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",outline:a?"none":d?"2px solid #1677ff":"1px dashed #d9d9d9",outlineOffset:-1},i=v=>ce(o,v,n);switch(o.type){case"text":return e.jsx("div",{style:{...l,fontSize:o.props.fontSize||14,fontWeight:o.props.fontWeight||"normal",fontStyle:o.props.fontStyle||"normal",textAlign:o.props.textAlign||"left",color:o.props.color||"#000",backgroundColor:o.props.backgroundColor||"transparent",padding:4,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i("content")||""});case"image":const v=i("src")||o.props.src;return e.jsx("div",{style:l,children:v?e.jsx("img",{src:v,style:{width:"100%",height:"100%",objectFit:o.props.fit||"contain"},alt:""}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#bbb",fontSize:12},children:"请在属性中设置图片地址"})});case"table":return e.jsx(Pt,{comp:o,style:l,dataSources:n});case"barcode":const m=i("value")||o.props.value||"123456";return e.jsx("div",{style:{...l,display:"flex",alignItems:"center",justifyContent:"center",padding:4},children:e.jsx(we,{value:m,format:o.props.format||"CODE128"})});case"line":return e.jsx("div",{style:{...l,display:"flex",alignItems:"center",border:"none",outline:d?"2px solid #1677ff":"1px dashed transparent"},children:e.jsx("hr",{style:{width:"100%",border:"none",borderTop:`${o.props.thickness||1}px ${o.props.style||"solid"} ${o.props.color||"#000"}`,margin:0}})});default:return e.jsx("div",{style:l,children:o.type})}}),Pt=({comp:o,style:d,dataSources:a=[]})=>{const n=o.props.borderWidth||1,l=o.props.borderColor||"#000",i=o.tableColumns||[],v=o.props.tableDataSourceId,m=v?a.find(P=>P.id===v):null,u=m?me(m):null;if(u&&u.length>0)return e.jsxs("table",{style:{...d,borderCollapse:"collapse",width:"100%",height:"100%"},children:[i.length>0&&e.jsx("thead",{children:e.jsx("tr",{style:{backgroundColor:"#f5f5f5"},children:i.map((P,g)=>e.jsx("th",{style:{border:`${n}px solid ${l}`,padding:4,fontSize:12,fontWeight:"bold",textAlign:"center"},children:P.title},g))})}),e.jsx("tbody",{children:u.map((P,g)=>e.jsx("tr",{children:i.map((z,N)=>e.jsx("td",{style:{border:`${n}px solid ${l}`,padding:4,fontSize:12,textAlign:"center"},children:z.fieldPath?P[z.fieldPath]:""},N))},g))})]});const j=o.props.rows||3,b=Math.max(o.props.cols||3,i.length||3);return e.jsx("table",{style:{...d,borderCollapse:"collapse",width:"100%",height:"100%"},children:e.jsx("tbody",{children:Array.from({length:j}).map((P,g)=>e.jsx("tr",{children:Array.from({length:b}).map((z,N)=>e.jsx("td",{style:{border:`${n}px solid ${l}`,padding:2,fontSize:12,textAlign:"center"},children:" "},N))},g))})})},Je=({isPreview:o=!1})=>{const d=T(r=>r.components),a=T(r=>r.selectedId),n=T(r=>r.pageSettings),l=T(r=>r.selectComponent);T(r=>r.updateComponent);const i=T(r=>r.setComponents),v=T(r=>r.addComponent),m=T(r=>r.gridSettings),u=T(r=>r.dataSources),j=w.useMemo(()=>{const r=he[n.paperSize];if(!r)return{width:n.customWidth*A,height:n.customHeight*A};const f=r.width*A,x=r.height*A;return n.orientation==="landscape"?{width:x,height:f}:{width:f,height:x}},[n]),b=w.useMemo(()=>({top:n.marginTop*A,right:n.marginRight*A,bottom:n.marginBottom*A,left:n.marginLeft*A}),[n]),P=j.width-b.left-b.right,g=j.height-b.top-b.bottom,z=w.useMemo(()=>d.map(r=>({i:r.id,x:r.x,y:r.y,w:r.w,h:r.h})),[d]),N=w.useCallback(r=>{const f=d.map((x,O)=>{const h=r[O];return h?{...x,x:h.x,y:h.y,w:h.w,h:h.h}:x});i(f)},[d,i]),y=w.useCallback((r,f,x)=>{var F,V;const O=x,h=(F=O.dataTransfer)==null?void 0:F.getData("componentType");if(!h)return;const S=(V=x.target.closest(".react-grid-layout"))==null?void 0:V.getBoundingClientRect();if(S){const H=Math.floor((O.clientX-S.left)/(P/m.cols)),q=Math.floor((O.clientY-S.top)/(P/m.cols));v(h,Math.max(0,H),Math.max(0,q))}else v(h)},[v,P,m.cols]),_=w.useCallback(r=>{l(r===a?null:r)},[l,a]);return e.jsx("div",{style:{flex:1,overflow:"auto",background:"#e8e8e8",display:"flex",justifyContent:"center",padding:"24px 0"},children:e.jsxs("div",{id:"print-paper",style:{width:j.width,height:j.height,background:"#fff",boxShadow:"0 2px 12px rgba(0,0,0,0.15)",position:"relative",flexShrink:0},children:[n.showHeader&&e.jsx("div",{style:{position:"absolute",top:0,left:b.left,right:b.right,height:b.top,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"#999",borderBottom:"1px dashed #ddd",overflow:"hidden"},children:n.headerContent}),n.showFooter&&e.jsxs("div",{style:{position:"absolute",bottom:0,left:b.left,right:b.right,height:b.bottom,display:"flex",alignItems:"center",justifyContent:n.showPageNumber?"space-between":"center",fontSize:12,color:"#999",borderTop:"1px dashed #ddd",overflow:"hidden",padding:"0 8px"},children:[e.jsx("span",{children:n.footerContent}),n.showPageNumber&&e.jsx("span",{children:n.pageNumberFormat.replace("{page}","1")})]}),e.jsx("div",{style:{position:"absolute",top:b.top,left:b.left,width:P,height:g},children:o?e.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:d.map(r=>{const f=P/m.cols,x=P/m.cols,O={position:"absolute",left:r.x*f,top:r.y*x,width:r.w*f,height:r.h*x};return e.jsx("div",{style:O,children:e.jsx(Me,{comp:r,selected:!1,isPreview:!0,dataSources:u})},r.id)})}):e.jsx(ft,{className:"canvas-grid",layout:z,cols:m.cols,rowHeight:P/m.cols,width:P,margin:[0,0],containerPadding:[0,0],onLayoutChange:N,onDrop:y,isDroppable:!0,isResizable:!0,isDraggable:!0,compactType:null,preventCollision:!0,draggableHandle:".grid-item-drag-handle",style:{minHeight:g},children:d.map(r=>e.jsx("div",{className:"grid-item-drag-handle",onClick:()=>_(r.id),style:{cursor:"move"},children:e.jsx(Me,{comp:r,selected:r.id===a,dataSources:u})},r.id))})})]})})},{Text:M,Title:ar}=s.Typography,{TextArea:Et}=s.Input,Ot=()=>{const o=T(r=>r.components),d=T(r=>r.selectedId),a=T(r=>r.dataSources),n=T(r=>r.updateComponent),l=T(r=>r.updateComponentTableColumns),i=w.useMemo(()=>o.find(r=>r.id===d)||null,[o,d]),[v,m]=w.useState([]),u=w.useMemo(()=>[{label:"无(使用静态值)",value:""},...a.map(r=>({label:r.name,value:r.id,type:r.type}))],[a]),j=w.useCallback((r,f)=>{d&&n(d,{props:{...i==null?void 0:i.props,[r]:f}})},[d,i,n]),b=w.useCallback((r,f,x,O)=>{if(!d)return;let h=O;f&&x&&(h=O);const S=`${r}Binding`;n(d,{props:{...i==null?void 0:i.props,[r]:h,[S]:{dataSourceId:f,fieldPath:x,staticValue:O}}})},[d,i,n]),P=w.useCallback(r=>{const f=i==null?void 0:i.props[`${r}Binding`],x=String((i==null?void 0:i.props[r])||"");return f?{field:r,dataSourceId:f.dataSourceId||null,fieldPath:f.fieldPath||"",staticValue:f.staticValue??x}:{field:r,dataSourceId:null,fieldPath:"",staticValue:x}},[i]);if(!i)return e.jsx(s.Card,{title:"属性面板",size:"small",style:{height:"100%",borderRadius:0,borderLeft:0},styles:{body:{padding:16}},children:e.jsx(s.Empty,{description:"请选择画布中的组件",image:s.Empty.PRESENTED_IMAGE_SIMPLE})});const g=$e[i.type]||i.type,z=e.jsxs(e.Fragment,{children:[e.jsx(M,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:8},children:"位置和大小"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"X"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.x,onChange:r=>n(d,{x:r??0})})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"Y"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.y,onChange:r=>n(d,{y:r??0})})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"宽度"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.w,min:1,onChange:r=>n(d,{w:r??1})})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"高度"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.h,min:1,onChange:r=>n(d,{h:r??1})})]})]})]}),N=({field:r,label:f,placeholder:x,isTextarea:O=!1})=>{const h=P(r),S=a.find(W=>W.id===h.dataSourceId),F=S?ge(S):null,V=F?Object.keys(F):[],[H,q]=w.useState(h.staticValue);return w.useEffect(()=>{q(h.staticValue)},[h.staticValue,h.dataSourceId]),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12,display:"block",marginBottom:4},children:f}),e.jsx("div",{style:{marginBottom:4},children:e.jsx(s.Select,{size:"small",style:{width:"100%"},placeholder:"选择数据源",value:h.dataSourceId||"",onChange:W=>{b(r,W||null,W&&h.fieldPath||"",h.staticValue)},options:u})}),h.dataSourceId&&e.jsx("div",{style:{marginBottom:4},children:e.jsx(s.Select,{size:"small",style:{width:"100%"},placeholder:"选择字段",value:h.fieldPath,onChange:W=>{b(r,h.dataSourceId,W||"",h.staticValue)},options:[{label:"请选择字段",value:""},...V.map(W=>({label:W,value:W}))]})}),h.dataSourceId?e.jsxs("div",{style:{padding:6,background:"#f0f5ff",border:"1px solid #adc6ff",borderRadius:4,fontSize:12},children:[e.jsx(B.DatabaseOutlined,{style:{marginRight:4,color:"#1890ff"}}),e.jsx("span",{style:{fontWeight:500},children:"数据绑定已启用"}),S&&h.fieldPath&&e.jsxs("span",{style:{marginLeft:8},children:[e.jsx(s.Tag,{color:"blue",children:S.name}),e.jsx(s.Tag,{color:"green",children:h.fieldPath})]})]}):O?e.jsx(Et,{rows:3,placeholder:x,value:H,onChange:W=>q(W.target.value),onBlur:()=>{b(r,null,"",H)}}):e.jsx(s.Input,{placeholder:x,value:H,onChange:W=>q(W.target.value),onBlur:()=>{b(r,null,"",H)}})]})},y=()=>{const r=i.tableColumns||[],f=a.filter(k=>k.type==="array"),x=i.props.tableDataSourceId||"",O=f.find(k=>k.id===x),h=v.length>0?v:r,[S,F]=w.useState({}),V=()=>{l(d,h)},H=()=>{const k=[...h,{title:`列${h.length+1}`}];m(k)},q=k=>{const R=h.filter((K,Z)=>Z!==k);m(R)},W=(k,R,K)=>{const Z=[...h];Z[k]={...Z[k],[R]:K},m(Z)};let re=[];if(O){const k=ae(O.data);Array.isArray(k)&&k.length>0&&typeof k[0]=="object"&&(re=Object.keys(k[0]))}const ne=[{title:"列标题",dataIndex:"title",width:100,render:(k,R)=>{const K=R.key in S?S[R.key]:R.title;return e.jsx(s.Input,{size:"small",value:K,placeholder:"列标题",onChange:Z=>{F({...S,[R.key]:Z.target.value})},onBlur:()=>{if(R.key in S){W(Number(R.key),"title",S[R.key]);const Z={...S};delete Z[R.key],F(Z),V()}}})}},{title:"绑定字段",dataIndex:"fieldPath",width:120,render:(k,R)=>e.jsx(s.Select,{size:"small",style:{width:"100%"},value:R.fieldPath||"",placeholder:O?"绑定字段":"选择数据源先",disabled:!O,onChange:K=>{W(Number(R.key),"fieldPath",K||""),V()},options:[{label:"无绑定",value:""},...re.map(K=>({label:K,value:K}))]})},{title:"操作",width:60,render:(k,R)=>e.jsx(s.Popconfirm,{title:"确定要删除吗?",onConfirm:()=>{q(Number(R.key)),V()},okText:"确定",cancelText:"取消",children:e.jsx(s.Button,{type:"text",danger:!0,size:"small",icon:e.jsx(B.DeleteOutlined,{})})})}],U=h.map((k,R)=>({...k,key:String(R)}));return e.jsxs("div",{children:[e.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:e.jsx(M,{style:{fontSize:12},children:"表格数据源"})}),e.jsx(s.Select,{size:"small",style:{width:"100%",marginBottom:8},placeholder:"选择数组类型数据源",value:x,onChange:k=>j("tableDataSourceId",k||""),options:[{label:"无(仅静态展示)",value:""},...f.map(k=>({label:k.name,value:k.id}))]}),e.jsx(s.Divider,{}),e.jsxs(s.Space,{style:{marginBottom:8},children:[e.jsx(M,{style:{fontSize:12},children:"列配置"}),e.jsx(s.Button,{size:"small",type:"dashed",icon:e.jsx(B.PlusOutlined,{}),onClick:H}),e.jsx(s.Button,{size:"small",type:"primary",onClick:V,icon:e.jsx(B.SaveOutlined,{})})]}),e.jsx(s.Table,{dataSource:U,columns:ne,pagination:!1,size:"small",bordered:!0,rowKey:"key"})]})},_=()=>{switch(i.type){case"text":return e.jsxs(e.Fragment,{children:[e.jsx(N,{field:"content",label:"内容",placeholder:"请输入文本内容",isTextarea:!0}),e.jsx(s.Divider,{style:{margin:"4px 0"}}),e.jsx(M,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:4},children:"文字样式"}),e.jsxs(s.Space,{style:{width:"100%"},direction:"vertical",size:4,children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"字号"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.props.fontSize||14,min:6,max:200,onChange:r=>j("fontSize",r??14)})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"对齐"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.textAlign||"left",onChange:r=>j("textAlign",r),options:[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"}]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"字重"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.fontWeight||"normal",onChange:r=>j("fontWeight",r),options:[{value:"normal",label:"常规"},{value:"bold",label:"加粗"}]})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"样式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.fontStyle||"normal",onChange:r=>j("fontStyle",r),options:[{value:"normal",label:"常规"},{value:"italic",label:"斜体"}]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"字体颜色"}),e.jsx(s.ColorPicker,{size:"small",value:i.props.color||"#000000",onChange:(r,f)=>j("color",f)})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"背景色"}),e.jsx(s.ColorPicker,{size:"small",value:i.props.backgroundColor||"transparent",onChange:(r,f)=>j("backgroundColor",f)})]})]})]})]});case"image":return e.jsxs(e.Fragment,{children:[e.jsx(N,{field:"src",label:"图片地址",placeholder:"输入图片 URL"}),e.jsx(s.Divider,{style:{margin:"4px 0"}}),e.jsx(M,{style:{fontSize:12,marginTop:8,display:"block"},children:"适应方式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.fit||"contain",onChange:r=>j("fit",r),options:[{value:"contain",label:"适应"},{value:"cover",label:"填充"},{value:"fill",label:"拉伸"}]})]});case"table":return e.jsx(y,{});case"barcode":return e.jsxs(e.Fragment,{children:[e.jsx(N,{field:"value",label:"条码值",placeholder:"输入条码内容"}),e.jsx(s.Divider,{style:{margin:"4px 0"}}),e.jsx(M,{style:{fontSize:12,marginTop:8,display:"block"},children:"格式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.format||"CODE128",onChange:r=>j("format",r),options:[{value:"CODE128",label:"CODE128"}]})]});case"line":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"粗细"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.props.thickness||1,min:1,max:20,onChange:r=>j("thickness",r??1)})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"样式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.style||"solid",onChange:r=>j("style",r),options:[{value:"solid",label:"实线"},{value:"dashed",label:"虚线"},{value:"dotted",label:"点线"}]})]})]}),e.jsxs("div",{style:{marginTop:8},children:[e.jsx(M,{style:{fontSize:12},children:"颜色"}),e.jsx(s.ColorPicker,{size:"small",value:i.props.color||"#000000",onChange:(r,f)=>j("color",f)})]})]});default:return null}};return e.jsx(s.Card,{title:`属性 - ${g}`,size:"small",style:{height:"100%",borderRadius:0,borderLeft:0},styles:{body:{padding:16,overflowY:"auto"}},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[z,e.jsx(s.Divider,{style:{margin:"4px 0"}}),_()]})})},{Text:cr}=s.Typography,_t=()=>{const o=T(y=>y.previewVisible),d=T(y=>y.setPreviewVisible),a=T(y=>y.components),n=T(y=>y.pageSettings),l=T(y=>y.gridSettings)||fe,i=T(y=>y.dataSources),v=w.useRef(null),m=w.useMemo(()=>{const y=he[n.paperSize];if(!y)return{width:n.customWidth*A,height:n.customHeight*A};const _=y.width*A,r=y.height*A;return n.orientation==="landscape"?{width:r,height:_}:{width:_,height:r}},[n]),u=w.useMemo(()=>({top:n.marginTop*A,right:n.marginRight*A,bottom:n.marginBottom*A,left:n.marginLeft*A}),[n]),j=m.width-u.left-u.right,b=j/l.cols,P=De.useReactToPrint({contentRef:v,documentTitle:"打印模板",pageStyle:`
|
|
30
|
+
<%s key={someKey} {...props} />`,ze,te,ir,te),dt[te+ze]=!0}}return t===l?Qt(J):Zt(J),J}}function er(t,c,p){return ut(t,c,p,!0)}function tr(t,c,p){return ut(t,c,p,!1)}var rr=tr,nr=er;le.Fragment=l,le.jsx=rr,le.jsxs=nr})(),le}var Ne;function mt(){if(Ne)return ue.exports;Ne=1;var o={};return o.NODE_ENV==="production"?ue.exports=pt():ue.exports=gt(),ue.exports}var e=mt();const he={A4:{width:210,height:297},A3:{width:297,height:420},A5:{width:148,height:210},Letter:{width:215.9,height:279.4},Legal:{width:215.9,height:355.6}},Fe={paperSize:"A4",customWidth:210,customHeight:297,orientation:"portrait",marginTop:10,marginRight:10,marginBottom:10,marginLeft:10,showHeader:!1,headerContent:"页眉文字",showFooter:!1,footerContent:"页脚文字",showPageNumber:!0,pageNumberFormat:"第 {page} 页"},A=3,fe={cellSize:1,cols:100},$e={text:"文本",image:"图片",table:"表格",barcode:"条形码",line:"分割线"},xt={text:{content:"双击编辑文字",fontSize:14,fontWeight:"normal",fontStyle:"normal",textAlign:"left",color:"#000000",backgroundColor:"transparent"},image:{src:"",fit:"contain",content:""},table:{rows:3,cols:3,borderWidth:1,borderColor:"#000000",content:""},barcode:{value:"1234567890",format:"CODE128",content:""},line:{color:"#000000",thickness:1,style:"solid",content:""}};let Se=0,Ce=0;function Be(){return`comp_${++Se}`}function Ve(){return`ds_${++Ce}`}const T=ht.create((o,d)=>({components:[],selectedId:null,pageSettings:{...Fe},gridSettings:{...fe},previewVisible:!1,templateName:"未命名模板",headerFooterVisible:!1,dataSources:[],activeDataSourceId:null,addComponent:(a,n,l)=>{const i=Be(),v=$e[a]||a,m={...xt[a]||{}};a==="text"&&(m.content=v);const u={id:i,type:a,x:n??0,y:l??0,w:a==="line"?20:15,h:a==="line"?1:8,props:m,...a==="table"?{tableColumns:[{title:"列1"},{title:"列2"},{title:"列3"}]}:{}};o(j=>({components:[...j.components,u],selectedId:i}))},updateComponent:(a,n)=>{o(l=>({components:l.components.map(i=>i.id===a?{...i,...n}:i)}))},selectComponent:a=>{o({selectedId:a})},removeComponent:a=>{o(n=>({components:n.components.filter(l=>l.id!==a),selectedId:n.selectedId===a?null:n.selectedId}))},setComponents:a=>{o({components:a})},setPageSettings:a=>{o(n=>({pageSettings:{...n.pageSettings,...a}}))},setPreviewVisible:a=>{o({previewVisible:a})},setTemplateName:a=>{o({templateName:a})},setHeaderFooterVisible:a=>{o({headerFooterVisible:a})},addDataSource:(a,n,l)=>{const v={id:Ve(),name:a,type:n,data:l,createdAt:Date.now()};o(m=>({dataSources:[...m.dataSources,v]}))},updateDataSource:(a,n)=>{o(l=>({dataSources:l.dataSources.map(i=>i.id===a?{...i,...n}:i)}))},removeDataSource:a=>{o(n=>({dataSources:n.dataSources.filter(l=>l.id!==a),activeDataSourceId:n.activeDataSourceId===a?null:n.activeDataSourceId}))},setActiveDataSourceId:a=>{o({activeDataSourceId:a})},updateComponentTableColumns:(a,n)=>{o(l=>({components:l.components.map(i=>i.id===a?{...i,tableColumns:n}:i)}))},exportJSON:()=>{const a=d(),n={version:"1.0",templateName:a.templateName,pageSettings:a.pageSettings,components:a.components.map(({id:l,...i})=>i),dataSources:a.dataSources.map(({id:l,...i})=>i)};return JSON.stringify(n,null,2)},importJSON:a=>{try{const n=JSON.parse(a);if(!n.version||!n.pageSettings||!Array.isArray(n.components))return"JSON 格式不正确,缺少必要字段";Se=0,Ce=0;const l=n.components.map(v=>({...v,id:Be()})),i=(n.dataSources||[]).map(v=>({...v,id:Ve()}));return o({components:l,dataSources:i,pageSettings:n.pageSettings,templateName:n.templateName||"导入的模板",selectedId:null,activeDataSourceId:null}),null}catch{return"JSON 解析失败,请检查文件内容"}},reset:()=>{Se=0,Ce=0,o({components:[],selectedId:null,pageSettings:{...Fe},gridSettings:{...fe},templateName:"未命名模板",headerFooterVisible:!1,previewVisible:!1,dataSources:[],activeDataSourceId:null})}})),{Text:or}=s.Typography,yt=({onCustomSave:o,onCustomPrint:d})=>{const a=T(f=>f.templateName),n=T(f=>f.setTemplateName),l=T(f=>f.setPreviewVisible),i=T(f=>f.setHeaderFooterVisible),v=T(f=>f.selectedId),m=T(f=>f.removeComponent),u=T(f=>f.exportJSON),j=T(f=>f.importJSON),b=T(f=>f.reset),P=w.useRef(null),{message:g}=s.App.useApp(),z=w.useCallback(()=>{v&&m(v)},[v,m]),N=w.useCallback(()=>{const f=u(),x=new Blob([f],{type:"application/json"}),_=URL.createObjectURL(x),h=document.createElement("a");h.href=_,h.download=`${a||"模板"}.json`,h.click(),URL.revokeObjectURL(_),g.success("模板已导出")},[u,a,g]),y=w.useCallback(()=>{var f;(f=P.current)==null||f.click()},[]),O=w.useCallback(f=>{var h;const x=(h=f.target.files)==null?void 0:h[0];if(!x)return;const _=new FileReader;_.onload=()=>{const S=j(_.result);S?g.error(S):g.success("模板已导入")},_.readAsText(x),f.target.value=""},[j,g]),r=w.useCallback(()=>{b(),g.info("已新建空白模板")},[b,g]);return e.jsxs("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",borderBottom:"1px solid #e8e8e8",background:"#fff"},children:[e.jsx(s.Space,{children:e.jsx(s.Input,{value:a,onChange:f=>n(f.target.value),variant:"borderless",style:{width:200,fontSize:16,fontWeight:600},placeholder:"模板名称"})}),e.jsxs(s.Space,{children:[e.jsx(s.Button,{icon:e.jsx(B.PlusOutlined,{}),onClick:r,children:"新建"}),e.jsx("input",{ref:P,type:"file",accept:".json",style:{display:"none"},onChange:O}),o?e.jsx(s.Button,{icon:e.jsx(B.SaveOutlined,{}),onClick:o,type:"primary",children:"保存"}):e.jsx(s.Button,{icon:e.jsx(B.DownloadOutlined,{}),onClick:N,children:"导出"}),e.jsx(s.Button,{icon:e.jsx(B.UploadOutlined,{}),onClick:y,children:"导入"}),e.jsx(s.Button,{icon:e.jsx(B.SettingOutlined,{}),onClick:()=>i(!0),children:"页眉页脚"}),e.jsx(s.Button,{danger:!0,icon:e.jsx(B.DeleteOutlined,{}),disabled:!v,onClick:z,children:"删除"}),d?e.jsx(s.Button,{type:"primary",icon:e.jsx(B.PrinterOutlined,{}),onClick:d,children:"打印"}):e.jsx(s.Button,{type:"primary",icon:e.jsx(B.EyeOutlined,{}),onClick:()=>l(!0),children:"预览"})]})]})},{Text:ee}=s.Typography,vt=()=>{const o=T(i=>i.pageSettings),d=T(i=>i.setPageSettings),a=o.paperSize==="custom",n=w.useCallback(i=>{d({paperSize:i})},[d]),l=w.useCallback(i=>{d({orientation:i})},[d]);return e.jsx(s.Card,{title:"页面设置",size:"small",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:12},children:"纸张大小"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:o.paperSize,onChange:n,options:[...Object.keys(he).map(i=>({value:i,label:i})),{value:"custom",label:"自定义"}]})]}),a&&e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(ee,{style:{fontSize:12},children:"宽度 (mm)"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.customWidth,min:10,max:2e3,onChange:i=>d({customWidth:i??210})})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(ee,{style:{fontSize:12},children:"高度 (mm)"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.customHeight,min:10,max:2e3,onChange:i=>d({customHeight:i??297})})]})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:12},children:"方向"}),e.jsxs(s.Radio.Group,{value:o.orientation,onChange:i=>l(i.target.value),size:"small",style:{width:"100%",display:"flex"},children:[e.jsx(s.Radio.Button,{value:"portrait",style:{flex:1,textAlign:"center"},children:"纵向"}),e.jsx(s.Radio.Button,{value:"landscape",style:{flex:1,textAlign:"center"},children:"横向"})]})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:12},children:"页边距 (mm)"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"上"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginTop,min:0,max:100,onChange:i=>d({marginTop:i??10})})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"右"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginRight,min:0,max:100,onChange:i=>d({marginRight:i??10})})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"下"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginBottom,min:0,max:100,onChange:i=>d({marginBottom:i??10})})]}),e.jsxs("div",{children:[e.jsx(ee,{style:{fontSize:11},children:"左"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:o.marginLeft,min:0,max:100,onChange:i=>d({marginLeft:i??10})})]})]})]})]})})},{Text:bt}=s.Typography,jt=[{type:"text",icon:e.jsx(B.FontSizeOutlined,{}),label:"文本"},{type:"image",icon:e.jsx(B.PictureOutlined,{}),label:"图片"},{type:"table",icon:e.jsx(B.TableOutlined,{}),label:"表格"},{type:"barcode",icon:e.jsx(B.BarcodeOutlined,{}),label:"条形码"},{type:"line",icon:e.jsx(B.MinusOutlined,{}),label:"分割线"}],St=()=>{const o=T(n=>n.addComponent),d=w.useCallback((n,l)=>{n.dataTransfer.setData("componentType",l),n.dataTransfer.effectAllowed="copy"},[]),a=w.useCallback(n=>{o(n)},[o]);return e.jsx(s.Card,{title:"组件面板",size:"small",children:e.jsx(s.Space,{direction:"vertical",style:{width:"100%"},size:4,children:jt.map(n=>e.jsxs("div",{draggable:!0,onDragStart:l=>d(l,n.type),onClick:()=>a(n.type),style:{cursor:"grab",padding:"8px 12px",border:"1px solid #d9d9d9",borderRadius:6,display:"flex",alignItems:"center",gap:8,background:"#fafafa",userSelect:"none",transition:"all 0.2s"},onMouseEnter:l=>{l.currentTarget.style.background="#e6f4ff",l.currentTarget.style.borderColor="#1677ff"},onMouseLeave:l=>{l.currentTarget.style.background="#fafafa",l.currentTarget.style.borderColor="#d9d9d9"},children:[n.icon,e.jsx(bt,{children:n.label})]},n.type))})})};function ae(o){try{return JSON.parse(o)}catch{return null}}function ce(o,d,a){const n=`${d}Binding`,l=o.props[n];if(l&&l.dataSourceId&&l.fieldPath){const v=a.find(m=>m.id===l.dataSourceId);if(v){const m=ge(v);if(m){const u=pe(m,l.fieldPath);if(u)return u}}}return o.props[d]||(l==null?void 0:l.staticValue)||""}function pe(o,d){if(!o||!d)return"";try{const a=d.split(".");let n=o;for(const l of a){if(typeof n!="object"||n===null)return"";n=n[l]}return n!=null?String(n):""}catch{return""}}function ge(o){const d=ae(o.data);return o.type==="object"&&d&&typeof d=="object"&&!Array.isArray(d)?d:null}function me(o){const d=ae(o.data);return o.type==="array"&&Array.isArray(d)?d:null}const{TextArea:Ct}=s.Input,{Text:xe,Title:lr}=s.Typography,We=JSON.stringify({name:"张三",age:28,department:"技术部",email:"zhangsan@example.com"},null,2),wt=JSON.stringify([{id:1,product:"商品A",quantity:2,price:100},{id:2,product:"商品B",quantity:5,price:80},{id:3,product:"商品C",quantity:1,price:200}],null,2),Tt=()=>{const o=T(g=>g.dataSources),d=T(g=>g.addDataSource),a=T(g=>g.updateDataSource),n=T(g=>g.removeDataSource),[l,i]=w.useState(!1),[v,m]=w.useState(null),[u,j]=w.useState({name:"",type:"object",data:""}),b=g=>{g?(m(g.id),j({name:g.name,type:g.type,data:g.data})):(m(null),j({name:"新数据源",type:"object",data:We})),i(!0)},P=()=>{const g=ae(u.data);if(g===null){s.message.error("JSON 格式不正确");return}if(u.type==="object"&&(Array.isArray(g)||typeof g!="object")){s.message.error("对象类型数据源必须为对象格式");return}if(u.type==="array"&&!Array.isArray(g)){s.message.error("数组类型数据源必须为数组格式");return}v?(a(v,u),s.message.success("数据源已更新")):(d(u.name,u.type,u.data),s.message.success("数据源已添加")),i(!1)};return e.jsxs(s.Card,{title:"数据源",size:"small",extra:e.jsx(s.Button,{type:"link",size:"small",icon:e.jsx(B.PlusOutlined,{}),onClick:()=>b(),children:"添加"}),children:[e.jsx(s.List,{size:"small",dataSource:o,locale:{emptyText:"暂无数据源"},renderItem:g=>e.jsx(s.List.Item,{actions:[e.jsx(s.Dropdown,{menu:{items:[{key:"edit",label:"编辑",icon:e.jsx(B.EditOutlined,{}),onClick:()=>b(g)},{type:"divider"},{key:"delete",label:e.jsx(s.Popconfirm,{title:"确定要删除这个数据源吗?",onConfirm:z=>{z==null||z.stopPropagation(),n(g.id),s.message.success("已删除")},okText:"确定",cancelText:"取消",onCancel:z=>z==null?void 0:z.stopPropagation(),children:e.jsx("span",{style:{color:"#ff4d4f",cursor:"pointer"},children:"删除"})}),icon:e.jsx(B.DeleteOutlined,{style:{color:"#ff4d4f"}})}]},placement:"bottomRight",children:e.jsx(s.Button,{type:"text",size:"small",icon:e.jsx(B.MoreOutlined,{})})})],children:e.jsx(s.List.Item.Meta,{avatar:e.jsx(B.DatabaseOutlined,{}),title:e.jsx(xe,{strong:!0,children:g.name}),description:e.jsx(s.Space,{size:4,children:e.jsx(s.Tag,{color:g.type==="object"?"blue":"green",children:g.type==="object"?"对象":"数组"})})})})}),e.jsx(s.Modal,{title:v?"编辑数据源":"添加数据源",open:l,onOk:P,onCancel:()=>i(!1),okText:"保存",cancelText:"取消",children:e.jsxs(s.Space,{direction:"vertical",style:{width:"100%"},size:"middle",children:[e.jsxs("div",{children:[e.jsx(xe,{strong:!0,style:{display:"block",marginBottom:4},children:"名称"}),e.jsx(s.Input,{placeholder:"请输入数据源名称",value:u.name,onChange:g=>j({...u,name:g.target.value})})]}),e.jsxs("div",{children:[e.jsx(xe,{strong:!0,style:{display:"block",marginBottom:4},children:"类型"}),e.jsx(s.Select,{options:[{label:"对象",value:"object"},{label:"数组",value:"array"}],style:{width:"100%"},value:u.type,onChange:g=>{j({...u,type:g,data:g==="object"?We:wt})}})]}),e.jsx(s.Divider,{style:{margin:"8px 0"}}),e.jsxs("div",{children:[e.jsx(xe,{strong:!0,style:{display:"block",marginBottom:4},children:"JSON 数据"}),e.jsx(Ct,{rows:12,placeholder:"请输入 JSON 数据",value:u.data,onChange:g=>j({...u,data:g.target.value})})]})]})})]})},kt=()=>e.jsx(s.Collapse,{bordered:!1,defaultActiveKey:["1","2"],expandIcon:({isActive:o})=>e.jsx(B.CaretRightOutlined,{rotate:o?90:0}),style:{height:"100%",overflowY:"auto"},items:[{key:"1",label:"页面设置",children:e.jsx(vt,{})},{key:"2",label:"组件",children:e.jsx(St,{})},{key:"3",label:"数据源",children:e.jsx(Tt,{})}]});function Le(o){const d=[];d.push(1,1,0,1,1,0,1,1);for(let a=0;a<o.length;a++){const l=(o.charCodeAt(a)%103).toString(2).padStart(7,"0");for(const i of l)d.push(i==="1"?1:0)}return d.push(1,1,0,0,0,1,1,0,0,0,1,1),d}const we=({value:o,format:d})=>{const a=w.useMemo(()=>Le(o),[o,d]);if(!o)return e.jsx("div",{style:{fontSize:11,color:"#999"},children:"请设置条形码值"});const n=2,l=44,i=a.length*n;return e.jsxs("div",{style:{textAlign:"center",overflow:"hidden",maxWidth:"100%"},children:[e.jsx("canvas",{ref:v=>{if(!v)return;const m=v.getContext("2d");m&&(v.width=i,v.height=l,m.clearRect(0,0,i,l),a.forEach((u,j)=>{m.fillStyle=u===1?"#000":"#fff",m.fillRect(j*n,0,n,l)}))},style:{width:"100%",maxWidth:i,height:l}}),e.jsx("div",{style:{fontSize:10,marginTop:1,letterSpacing:1},children:o})]})},Me=w.memo(({comp:o,selected:d,isPreview:a=!1,dataSources:n=[]})=>{const l={width:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box",outline:a?"none":d?"2px solid #1677ff":"1px dashed #d9d9d9",outlineOffset:-1},i=v=>ce(o,v,n);switch(o.type){case"text":return e.jsx("div",{style:{...l,fontSize:o.props.fontSize||14,fontWeight:o.props.fontWeight||"normal",fontStyle:o.props.fontStyle||"normal",textAlign:o.props.textAlign||"left",color:o.props.color||"#000",backgroundColor:o.props.backgroundColor||"transparent",padding:4,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i("content")||""});case"image":const v=i("src")||o.props.src;return e.jsx("div",{style:l,children:v?e.jsx("img",{src:v,style:{width:"100%",height:"100%",objectFit:o.props.fit||"contain"},alt:""}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#bbb",fontSize:12},children:"请在属性中设置图片地址"})});case"table":return e.jsx(Pt,{comp:o,style:l,dataSources:n});case"barcode":const m=i("value")||o.props.value||"123456";return e.jsx("div",{style:{...l,display:"flex",alignItems:"center",justifyContent:"center",padding:4},children:e.jsx(we,{value:m,format:o.props.format||"CODE128"})});case"line":return e.jsx("div",{style:{...l,display:"flex",alignItems:"center",border:"none",outline:d?"2px solid #1677ff":"1px dashed transparent"},children:e.jsx("hr",{style:{width:"100%",border:"none",borderTop:`${o.props.thickness||1}px ${o.props.style||"solid"} ${o.props.color||"#000"}`,margin:0}})});default:return e.jsx("div",{style:l,children:o.type})}}),Pt=({comp:o,style:d,dataSources:a=[]})=>{const n=o.props.borderWidth||1,l=o.props.borderColor||"#000",i=o.tableColumns||[],v=o.props.tableDataSourceId,m=v?a.find(P=>P.id===v):null,u=m?me(m):null;if(u&&u.length>0)return e.jsxs("table",{style:{...d,borderCollapse:"collapse",width:"100%",height:"100%"},children:[i.length>0&&e.jsx("thead",{children:e.jsx("tr",{style:{backgroundColor:"#f5f5f5"},children:i.map((P,g)=>e.jsx("th",{style:{border:`${n}px solid ${l}`,padding:4,fontSize:12,fontWeight:"bold",textAlign:"center"},children:P.title},g))})}),e.jsx("tbody",{children:u.map((P,g)=>e.jsx("tr",{children:i.map((z,N)=>e.jsx("td",{style:{border:`${n}px solid ${l}`,padding:4,fontSize:12,textAlign:"center"},children:z.fieldPath?P[z.fieldPath]:""},N))},g))})]});const j=o.props.rows||3,b=Math.max(o.props.cols||3,i.length||3);return e.jsx("table",{style:{...d,borderCollapse:"collapse",width:"100%",height:"100%"},children:e.jsx("tbody",{children:Array.from({length:j}).map((P,g)=>e.jsx("tr",{children:Array.from({length:b}).map((z,N)=>e.jsx("td",{style:{border:`${n}px solid ${l}`,padding:2,fontSize:12,textAlign:"center"},children:" "},N))},g))})})},Je=({isPreview:o=!1})=>{const d=T(r=>r.components),a=T(r=>r.selectedId),n=T(r=>r.pageSettings),l=T(r=>r.selectComponent);T(r=>r.updateComponent);const i=T(r=>r.setComponents),v=T(r=>r.addComponent),m=T(r=>r.gridSettings),u=T(r=>r.dataSources),j=w.useMemo(()=>{const r=he[n.paperSize];if(!r)return{width:n.customWidth*A,height:n.customHeight*A};const f=r.width*A,x=r.height*A;return n.orientation==="landscape"?{width:x,height:f}:{width:f,height:x}},[n]),b=w.useMemo(()=>({top:n.marginTop*A,right:n.marginRight*A,bottom:n.marginBottom*A,left:n.marginLeft*A}),[n]),P=j.width-b.left-b.right,g=j.height-b.top-b.bottom,z=w.useMemo(()=>d.map(r=>({i:r.id,x:r.x,y:r.y,w:r.w,h:r.h})),[d]),N=w.useCallback(r=>{const f=d.map((x,_)=>{const h=r[_];return h?{...x,x:h.x,y:h.y,w:h.w,h:h.h}:x});i(f)},[d,i]),y=w.useCallback((r,f,x)=>{var F,V;const _=x,h=(F=_.dataTransfer)==null?void 0:F.getData("componentType");if(!h)return;const S=(V=x.target.closest(".react-grid-layout"))==null?void 0:V.getBoundingClientRect();if(S){const H=Math.floor((_.clientX-S.left)/(P/m.cols)),q=Math.floor((_.clientY-S.top)/(P/m.cols));v(h,Math.max(0,H),Math.max(0,q))}else v(h)},[v,P,m.cols]),O=w.useCallback(r=>{l(r===a?null:r)},[l,a]);return e.jsx("div",{style:{flex:1,overflow:"auto",background:"#e8e8e8",display:"flex",justifyContent:"center",padding:"24px 0"},children:e.jsxs("div",{id:"print-paper",style:{width:j.width,height:j.height,background:"#fff",boxShadow:"0 2px 12px rgba(0,0,0,0.15)",position:"relative",flexShrink:0},children:[n.showHeader&&e.jsx("div",{style:{position:"absolute",top:0,left:b.left,right:b.right,height:b.top,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"#999",borderBottom:"1px dashed #ddd",overflow:"hidden"},children:n.headerContent}),n.showFooter&&e.jsxs("div",{style:{position:"absolute",bottom:0,left:b.left,right:b.right,height:b.bottom,display:"flex",alignItems:"center",justifyContent:n.showPageNumber?"space-between":"center",fontSize:12,color:"#999",borderTop:"1px dashed #ddd",overflow:"hidden",padding:"0 8px"},children:[e.jsx("span",{children:n.footerContent}),n.showPageNumber&&e.jsx("span",{children:n.pageNumberFormat.replace("{page}","1")})]}),e.jsx("div",{style:{position:"absolute",top:b.top,left:b.left,width:P,height:g},children:o?e.jsx("div",{style:{width:"100%",height:"100%",position:"relative"},children:d.map(r=>{const f=P/m.cols,x=P/m.cols,_={position:"absolute",left:r.x*f,top:r.y*x,width:r.w*f,height:r.h*x};return e.jsx("div",{style:_,children:e.jsx(Me,{comp:r,selected:!1,isPreview:!0,dataSources:u})},r.id)})}):e.jsx(ft,{className:"canvas-grid",layout:z,cols:m.cols,rowHeight:P/m.cols,width:P,margin:[0,0],containerPadding:[0,0],onLayoutChange:N,onDrop:y,isDroppable:!0,isResizable:!0,isDraggable:!0,compactType:null,preventCollision:!0,draggableHandle:".grid-item-drag-handle",style:{minHeight:g},children:d.map(r=>e.jsx("div",{className:"grid-item-drag-handle",onClick:()=>O(r.id),style:{cursor:"move"},children:e.jsx(Me,{comp:r,selected:r.id===a,dataSources:u})},r.id))})})]})})},{Text:M,Title:ar}=s.Typography,{TextArea:Et}=s.Input,_t=()=>{const o=T(r=>r.components),d=T(r=>r.selectedId),a=T(r=>r.dataSources),n=T(r=>r.updateComponent),l=T(r=>r.updateComponentTableColumns),i=w.useMemo(()=>o.find(r=>r.id===d)||null,[o,d]),[v,m]=w.useState([]),u=w.useMemo(()=>[{label:"无(使用静态值)",value:""},...a.map(r=>({label:r.name,value:r.id,type:r.type}))],[a]),j=w.useCallback((r,f)=>{d&&n(d,{props:{...i==null?void 0:i.props,[r]:f}})},[d,i,n]),b=w.useCallback((r,f,x,_)=>{if(!d)return;let h=_;f&&x&&(h=_);const S=`${r}Binding`;n(d,{props:{...i==null?void 0:i.props,[r]:h,[S]:{dataSourceId:f,fieldPath:x,staticValue:_}}})},[d,i,n]),P=w.useCallback(r=>{const f=i==null?void 0:i.props[`${r}Binding`],x=String((i==null?void 0:i.props[r])||"");return f?{field:r,dataSourceId:f.dataSourceId||null,fieldPath:f.fieldPath||"",staticValue:f.staticValue??x}:{field:r,dataSourceId:null,fieldPath:"",staticValue:x}},[i]);if(!i)return e.jsx(s.Card,{title:"属性面板",size:"small",style:{height:"100%",borderRadius:0,borderLeft:0},styles:{body:{padding:16}},children:e.jsx(s.Empty,{description:"请选择画布中的组件",image:s.Empty.PRESENTED_IMAGE_SIMPLE})});const g=$e[i.type]||i.type,z=e.jsxs(e.Fragment,{children:[e.jsx(M,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:8},children:"位置和大小"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"X"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.x,onChange:r=>n(d,{x:r??0})})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"Y"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.y,onChange:r=>n(d,{y:r??0})})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"宽度"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.w,min:1,onChange:r=>n(d,{w:r??1})})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"高度"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.h,min:1,onChange:r=>n(d,{h:r??1})})]})]})]}),N=({field:r,label:f,placeholder:x,isTextarea:_=!1})=>{const h=P(r),S=a.find(W=>W.id===h.dataSourceId),F=S?ge(S):null,V=F?Object.keys(F):[],[H,q]=w.useState(h.staticValue);return w.useEffect(()=>{q(h.staticValue)},[h.staticValue,h.dataSourceId]),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12,display:"block",marginBottom:4},children:f}),e.jsx("div",{style:{marginBottom:4},children:e.jsx(s.Select,{size:"small",style:{width:"100%"},placeholder:"选择数据源",value:h.dataSourceId||"",onChange:W=>{b(r,W||null,W&&h.fieldPath||"",h.staticValue)},options:u})}),h.dataSourceId&&e.jsx("div",{style:{marginBottom:4},children:e.jsx(s.Select,{size:"small",style:{width:"100%"},placeholder:"选择字段",value:h.fieldPath,onChange:W=>{b(r,h.dataSourceId,W||"",h.staticValue)},options:[{label:"请选择字段",value:""},...V.map(W=>({label:W,value:W}))]})}),h.dataSourceId?e.jsxs("div",{style:{padding:6,background:"#f0f5ff",border:"1px solid #adc6ff",borderRadius:4,fontSize:12},children:[e.jsx(B.DatabaseOutlined,{style:{marginRight:4,color:"#1890ff"}}),e.jsx("span",{style:{fontWeight:500},children:"数据绑定已启用"}),S&&h.fieldPath&&e.jsxs("span",{style:{marginLeft:8},children:[e.jsx(s.Tag,{color:"blue",children:S.name}),e.jsx(s.Tag,{color:"green",children:h.fieldPath})]})]}):_?e.jsx(Et,{rows:3,placeholder:x,value:H,onChange:W=>q(W.target.value),onBlur:()=>{b(r,null,"",H)}}):e.jsx(s.Input,{placeholder:x,value:H,onChange:W=>q(W.target.value),onBlur:()=>{b(r,null,"",H)}})]})},y=()=>{const r=i.tableColumns||[],f=a.filter(k=>k.type==="array"),x=i.props.tableDataSourceId||"",_=f.find(k=>k.id===x),h=v.length>0?v:r,[S,F]=w.useState({}),V=()=>{l(d,h)},H=()=>{const k=[...h,{title:`列${h.length+1}`}];m(k)},q=k=>{const R=h.filter((K,Z)=>Z!==k);m(R)},W=(k,R,K)=>{const Z=[...h];Z[k]={...Z[k],[R]:K},m(Z)};let re=[];if(_){const k=ae(_.data);Array.isArray(k)&&k.length>0&&typeof k[0]=="object"&&(re=Object.keys(k[0]))}const ne=[{title:"列标题",dataIndex:"title",width:100,render:(k,R)=>{const K=R.key in S?S[R.key]:R.title;return e.jsx(s.Input,{size:"small",value:K,placeholder:"列标题",onChange:Z=>{F({...S,[R.key]:Z.target.value})},onBlur:()=>{if(R.key in S){W(Number(R.key),"title",S[R.key]);const Z={...S};delete Z[R.key],F(Z),V()}}})}},{title:"绑定字段",dataIndex:"fieldPath",width:120,render:(k,R)=>e.jsx(s.Select,{size:"small",style:{width:"100%"},value:R.fieldPath||"",placeholder:_?"绑定字段":"选择数据源先",disabled:!_,onChange:K=>{W(Number(R.key),"fieldPath",K||""),V()},options:[{label:"无绑定",value:""},...re.map(K=>({label:K,value:K}))]})},{title:"操作",width:60,render:(k,R)=>e.jsx(s.Popconfirm,{title:"确定要删除吗?",onConfirm:()=>{q(Number(R.key)),V()},okText:"确定",cancelText:"取消",children:e.jsx(s.Button,{type:"text",danger:!0,size:"small",icon:e.jsx(B.DeleteOutlined,{})})})}],U=h.map((k,R)=>({...k,key:String(R)}));return e.jsxs("div",{children:[e.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:e.jsx(M,{style:{fontSize:12},children:"表格数据源"})}),e.jsx(s.Select,{size:"small",style:{width:"100%",marginBottom:8},placeholder:"选择数组类型数据源",value:x,onChange:k=>j("tableDataSourceId",k||""),options:[{label:"无(仅静态展示)",value:""},...f.map(k=>({label:k.name,value:k.id}))]}),e.jsx(s.Divider,{}),e.jsxs(s.Space,{style:{marginBottom:8},children:[e.jsx(M,{style:{fontSize:12},children:"列配置"}),e.jsx(s.Button,{size:"small",type:"dashed",icon:e.jsx(B.PlusOutlined,{}),onClick:H}),e.jsx(s.Button,{size:"small",type:"primary",onClick:V,icon:e.jsx(B.SaveOutlined,{})})]}),e.jsx(s.Table,{dataSource:U,columns:ne,pagination:!1,size:"small",bordered:!0,rowKey:"key"})]})},O=()=>{switch(i.type){case"text":return e.jsxs(e.Fragment,{children:[e.jsx(N,{field:"content",label:"内容",placeholder:"请输入文本内容",isTextarea:!0}),e.jsx(s.Divider,{style:{margin:"4px 0"}}),e.jsx(M,{type:"secondary",style:{fontSize:12,display:"block",marginBottom:4},children:"文字样式"}),e.jsxs(s.Space,{style:{width:"100%"},direction:"vertical",size:4,children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"字号"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.props.fontSize||14,min:6,max:200,onChange:r=>j("fontSize",r??14)})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"对齐"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.textAlign||"left",onChange:r=>j("textAlign",r),options:[{value:"left",label:"左"},{value:"center",label:"中"},{value:"right",label:"右"}]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"字重"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.fontWeight||"normal",onChange:r=>j("fontWeight",r),options:[{value:"normal",label:"常规"},{value:"bold",label:"加粗"}]})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"样式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.fontStyle||"normal",onChange:r=>j("fontStyle",r),options:[{value:"normal",label:"常规"},{value:"italic",label:"斜体"}]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"字体颜色"}),e.jsx(s.ColorPicker,{size:"small",value:i.props.color||"#000000",onChange:(r,f)=>j("color",f)})]}),e.jsxs("div",{children:[e.jsx(M,{style:{fontSize:12},children:"背景色"}),e.jsx(s.ColorPicker,{size:"small",value:i.props.backgroundColor||"transparent",onChange:(r,f)=>j("backgroundColor",f)})]})]})]})]});case"image":return e.jsxs(e.Fragment,{children:[e.jsx(N,{field:"src",label:"图片地址",placeholder:"输入图片 URL"}),e.jsx(s.Divider,{style:{margin:"4px 0"}}),e.jsx(M,{style:{fontSize:12,marginTop:8,display:"block"},children:"适应方式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.fit||"contain",onChange:r=>j("fit",r),options:[{value:"contain",label:"适应"},{value:"cover",label:"填充"},{value:"fill",label:"拉伸"}]})]});case"table":return e.jsx(y,{});case"barcode":return e.jsxs(e.Fragment,{children:[e.jsx(N,{field:"value",label:"条码值",placeholder:"输入条码内容"}),e.jsx(s.Divider,{style:{margin:"4px 0"}}),e.jsx(M,{style:{fontSize:12,marginTop:8,display:"block"},children:"格式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.format||"CODE128",onChange:r=>j("format",r),options:[{value:"CODE128",label:"CODE128"}]})]});case"line":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"粗细"}),e.jsx(s.InputNumber,{size:"small",style:{width:"100%"},value:i.props.thickness||1,min:1,max:20,onChange:r=>j("thickness",r??1)})]}),e.jsxs("div",{style:{flex:1},children:[e.jsx(M,{style:{fontSize:12},children:"样式"}),e.jsx(s.Select,{size:"small",style:{width:"100%"},value:i.props.style||"solid",onChange:r=>j("style",r),options:[{value:"solid",label:"实线"},{value:"dashed",label:"虚线"},{value:"dotted",label:"点线"}]})]})]}),e.jsxs("div",{style:{marginTop:8},children:[e.jsx(M,{style:{fontSize:12},children:"颜色"}),e.jsx(s.ColorPicker,{size:"small",value:i.props.color||"#000000",onChange:(r,f)=>j("color",f)})]})]});default:return null}};return e.jsx(s.Card,{title:`属性 - ${g}`,size:"small",style:{height:"100%",borderRadius:0,borderLeft:0},styles:{body:{padding:16,overflowY:"auto"}},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[z,e.jsx(s.Divider,{style:{margin:"4px 0"}}),O()]})})},{Text:cr}=s.Typography,Ot=()=>{const o=T(y=>y.previewVisible),d=T(y=>y.setPreviewVisible),a=T(y=>y.components),n=T(y=>y.pageSettings),l=T(y=>y.gridSettings)||fe,i=T(y=>y.dataSources),v=w.useRef(null),m=w.useMemo(()=>{const y=he[n.paperSize];if(!y)return{width:n.customWidth*A,height:n.customHeight*A};const O=y.width*A,r=y.height*A;return n.orientation==="landscape"?{width:r,height:O}:{width:O,height:r}},[n]),u=w.useMemo(()=>({top:n.marginTop*A,right:n.marginRight*A,bottom:n.marginBottom*A,left:n.marginLeft*A}),[n]),j=m.width-u.left-u.right,b=j/l.cols,P=De.useReactToPrint({contentRef:v,documentTitle:"打印模板",pageStyle:`
|
|
31
31
|
@page {
|
|
32
32
|
size: ${m.width/A}mm ${m.height/A}mm;
|
|
33
33
|
margin: ${n.marginTop}mm ${n.marginRight}mm ${n.marginBottom}mm ${n.marginLeft}mm;
|
|
@@ -35,7 +35,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
35
35
|
@media print {
|
|
36
36
|
html, body { margin: 0; padding: 0; }
|
|
37
37
|
}
|
|
38
|
-
`}),g=(y,
|
|
38
|
+
`}),g=(y,O)=>{const r=y.props[`${O}Binding`];if(r&&r.dataSourceId&&r.fieldPath){const f=i.find(x=>x.id===r.dataSourceId);if(f&&f.type==="object"){const x=ge(f);if(x){const _=pe(x,r.fieldPath);if(_!=="")return _}}}return(r==null?void 0:r.staticValue)??String(y.props[O]||"")},z=y=>{const O=y.props.tableDataSourceId,r=O?i.find(F=>F.id===O):null,f=r?me(r):null,x=y.tableColumns||[],_=y.props.borderWidth||1,h=y.props.borderColor||"#000000",S=f||Array.from({length:y.props.rows||3}).map(()=>({}));return e.jsxs("table",{style:{width:"100%",height:"100%",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsx("tr",{children:x.map((F,V)=>e.jsx("th",{style:{border:`${_}px solid ${h}`,padding:4,textAlign:"center",fontSize:12,fontWeight:"bold",backgroundColor:"#f5f5f5"},children:F.title||`列${V+1}`},V))})}),e.jsx("tbody",{children:S.map((F,V)=>e.jsx("tr",{children:x.map((H,q)=>e.jsx("td",{style:{border:`${_}px solid ${h}`,padding:4,textAlign:"center",fontSize:12},children:H.fieldPath?pe(F,H.fieldPath):""},q))},V))})]})},N=y=>{const O=y.props,r={position:"absolute",left:y.x*b,top:y.y*b,width:y.w*b,height:y.h*b,overflow:"hidden"},f={width:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box"};switch(y.type){case"text":return e.jsx("div",{style:r,children:e.jsx("div",{style:{...f,fontSize:O.fontSize||14,fontWeight:O.fontWeight||"normal",fontStyle:O.fontStyle||"normal",textAlign:O.textAlign||"left",color:O.color||"#000",backgroundColor:O.backgroundColor||"transparent",padding:4,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:g(y,"content")})},y.id);case"image":return e.jsx("div",{style:r,children:e.jsx("div",{style:f,children:O.src?e.jsx("img",{src:g(y,"src"),style:{width:"100%",height:"100%",objectFit:O.fit||"contain"},alt:""}):null})},y.id);case"table":return e.jsx("div",{style:r,children:z(y)},y.id);case"barcode":return e.jsx("div",{style:r,children:e.jsx("div",{style:{...f,display:"flex",alignItems:"center",justifyContent:"center",padding:4},children:e.jsx(we,{value:g(y,"value"),format:O.format||"CODE128"})})},y.id);case"line":return e.jsx("div",{style:r,children:e.jsx("div",{style:{...f,display:"flex",alignItems:"center",border:"none"},children:e.jsx("hr",{style:{width:"100%",border:"none",borderTop:`${O.thickness||1}px ${O.style||"solid"} ${O.color||"#000"}`,margin:0}})})},y.id);default:return null}};return e.jsxs(s.Modal,{title:"打印预览",open:o,onCancel:()=>d(!1),width:m.width+80,footer:e.jsxs(s.Space,{children:[e.jsx(s.Button,{onClick:()=>d(!1),children:"关闭"}),e.jsx(s.Button,{type:"primary",icon:e.jsx(B.PrinterOutlined,{}),onClick:()=>P(),children:"打印"})]}),styles:{body:{padding:16,display:"flex",flexDirection:"column",alignItems:"center"}},children:[e.jsx(s.Divider,{style:{margin:"4px 0 12px 0"}}),e.jsxs("div",{ref:v,style:{width:m.width,height:m.height,background:"#fff",border:"1px solid #d9d9d9",position:"relative",overflow:"hidden",flexShrink:0},children:[n.showHeader&&e.jsx("div",{style:{position:"absolute",top:0,left:u.left,right:u.right,height:u.top,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,overflow:"hidden"},children:n.headerContent}),n.showFooter&&e.jsxs("div",{style:{position:"absolute",bottom:0,left:u.left,right:u.right,height:u.bottom,display:"flex",alignItems:"center",justifyContent:n.showPageNumber?"space-between":"center",fontSize:12,overflow:"hidden",padding:"0 8px"},children:[e.jsx("span",{children:n.footerContent}),n.showPageNumber&&e.jsx("span",{children:n.pageNumberFormat.replace("{page}","1")})]}),e.jsx("div",{style:{position:"absolute",top:u.top,left:u.left,width:j,height:m.height-u.top-u.bottom},children:a.map(N)})]})]})},It=()=>{const o=T(l=>l.headerFooterVisible),d=T(l=>l.pageSettings),a=T(l=>l.setPageSettings),n=T(l=>l.setHeaderFooterVisible);return e.jsx(s.Modal,{title:"页眉页脚设置",open:o,onCancel:()=>n(!1),onOk:()=>n(!1),width:480,children:e.jsxs(s.Form,{layout:"vertical",style:{marginTop:8},children:[e.jsx(s.Form.Item,{label:"显示页眉",children:e.jsx(s.Switch,{checked:d.showHeader,onChange:l=>a({showHeader:l})})}),d.showHeader&&e.jsx(s.Form.Item,{label:"页眉内容",children:e.jsx(s.Input,{value:d.headerContent,onChange:l=>a({headerContent:l.target.value})})}),e.jsx(s.Form.Item,{label:"显示页脚",children:e.jsx(s.Switch,{checked:d.showFooter,onChange:l=>a({showFooter:l})})}),d.showFooter&&e.jsxs(e.Fragment,{children:[e.jsx(s.Form.Item,{label:"页脚内容",children:e.jsx(s.Input,{value:d.footerContent,onChange:l=>a({footerContent:l.target.value})})}),e.jsx(s.Form.Item,{label:"显示页码",children:e.jsx(s.Switch,{checked:d.showPageNumber,onChange:l=>a({showPageNumber:l})})}),d.showPageNumber&&e.jsx(s.Form.Item,{label:"页码格式",children:e.jsx(s.Input,{value:d.pageNumberFormat,onChange:l=>a({pageNumberFormat:l.target.value}),placeholder:"第 {page} 页"})})]})]})})},zt=({isPreview:o=!1,initialTemplateData:d,onSave:a,onPrint:n})=>{const{importJSON:l,exportJSON:i,reset:v,components:m,pageSettings:u,gridSettings:j,dataSources:b}=T(),P=w.useRef(null);w.useEffect(()=>{if(d){const h=JSON.stringify(d),S=l(h);S&&(console.error("导入失败:",S),v())}},[d,l,v]);const g=()=>{if(a)try{const h=i();a(JSON.parse(h))}catch(h){console.error("导出失败:",h)}},z=w.useMemo(()=>{const h=he[u.paperSize];if(!h)return{width:u.customWidth*A,height:u.customHeight*A};const S=h.width*A,F=h.height*A;return u.orientation==="landscape"?{width:F,height:S}:{width:S,height:F}},[u]),N=w.useMemo(()=>({top:u.marginTop*A,right:u.marginRight*A,bottom:u.marginBottom*A,left:u.marginLeft*A}),[u]),y=z.width-N.left-N.right,O=y/((j==null?void 0:j.cols)||fe.cols),r=De.useReactToPrint({contentRef:P,documentTitle:"打印模板",pageStyle:`
|
|
39
39
|
@page {
|
|
40
40
|
size: ${z.width/A}mm ${z.height/A}mm;
|
|
41
41
|
margin: ${u.marginTop}mm ${u.marginRight}mm ${u.marginBottom}mm ${u.marginLeft}mm;
|
|
@@ -43,4 +43,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
43
43
|
@media print {
|
|
44
44
|
html, body { margin: 0; padding: 0; }
|
|
45
45
|
}
|
|
46
|
-
`}),f=()=>{n?n():r()},x=h=>{const S=h.props,F={position:"absolute",left:h.x*
|
|
46
|
+
`}),f=()=>{n?n():r()},x=h=>{const S=h.props,F={position:"absolute",left:h.x*O,top:h.y*O,width:h.w*O,height:h.h*O,overflow:"hidden"},V={width:"100%",height:"100%",overflow:"hidden",boxSizing:"border-box"};switch(h.type){case"text":return e.jsx("div",{style:F,children:e.jsx("div",{style:{...V,fontSize:S.fontSize||14,fontWeight:S.fontWeight||"normal",fontStyle:S.fontStyle||"normal",textAlign:S.textAlign||"left",color:S.color||"#000",backgroundColor:S.backgroundColor||"transparent",padding:4,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:ce(h,"content",b)})},h.id);case"image":return e.jsx("div",{style:F,children:e.jsx("div",{style:V,children:S.src?e.jsx("img",{src:ce(h,"src",b),style:{width:"100%",height:"100%",objectFit:S.fit||"contain"},alt:""}):null})},h.id);case"table":return e.jsx("div",{style:F,children:_(h)},h.id);case"barcode":return e.jsx("div",{style:F,children:e.jsx("div",{style:{...V,display:"flex",alignItems:"center",justifyContent:"center",padding:4},children:e.jsx(we,{value:ce(h,"value",b),format:S.format||"CODE128"})})},h.id);case"line":return e.jsx("div",{style:F,children:e.jsx("div",{style:{...V,display:"flex",alignItems:"center",border:"none"},children:e.jsx("hr",{style:{width:"100%",border:"none",borderTop:`${S.thickness||1}px ${S.style||"solid"} ${S.color||"#000"}`,margin:0}})})},h.id);default:return null}},_=h=>{const S=h.props.tableDataSourceId,F=S?b.find(U=>U.id===S):null,V=F?me(F):null,H=h.tableColumns||[],q=h.props.borderWidth||1,W=h.props.borderColor||"#000000";if(V&&V.length>0)return e.jsxs("table",{style:{width:"100%",height:"100%",borderCollapse:"collapse"},children:[H.length>0&&e.jsx("thead",{children:e.jsx("tr",{style:{backgroundColor:"#f5f5f5"},children:H.map((U,k)=>e.jsx("th",{style:{border:`${q}px solid ${W}`,padding:4,fontSize:12,fontWeight:"bold",textAlign:"center"},children:U.title},k))})}),e.jsx("tbody",{children:V.map((U,k)=>e.jsx("tr",{children:H.map((R,K)=>e.jsx("td",{style:{border:`${q}px solid ${W}`,padding:4,fontSize:12,textAlign:"center"},children:R.fieldPath?U[R.fieldPath]:""},K))},k))})]});const re=h.props.rows||3,ne=Math.max(h.props.cols||3,H.length||3);return e.jsx("table",{style:{width:"100%",height:"100%",borderCollapse:"collapse"},children:e.jsx("tbody",{children:Array.from({length:re}).map((U,k)=>e.jsx("tr",{children:Array.from({length:ne}).map((R,K)=>e.jsx("td",{style:{border:`${q}px solid ${W}`,padding:2,fontSize:12,textAlign:"center"},children:" "},K))},k))})})};return o?e.jsx(s.App,{children:e.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid #e8e8e8",background:"#fff"},children:e.jsx(s.Space,{children:e.jsx(s.Button,{type:"primary",icon:e.jsx(B.PrinterOutlined,{}),onClick:f,children:"打印"})})}),e.jsx("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"flex-start",padding:"16px",boxSizing:"border-box",overflowY:"auto",background:"#e8e8e8"},children:e.jsx("div",{style:{flexShrink:0},children:e.jsx(Je,{isPreview:!0})})}),e.jsx("div",{style:{position:"absolute",left:"-9999px",top:"-9999px"},children:e.jsxs("div",{ref:P,style:{width:z.width,height:z.height,background:"#fff",position:"relative",overflow:"hidden"},children:[u.showHeader&&e.jsx("div",{style:{position:"absolute",top:0,left:N.left,right:N.right,height:N.top,display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,overflow:"hidden"},children:u.headerContent}),u.showFooter&&e.jsxs("div",{style:{position:"absolute",bottom:0,left:N.left,right:N.right,height:N.bottom,display:"flex",alignItems:"center",justifyContent:u.showPageNumber?"space-between":"center",fontSize:12,overflow:"hidden",padding:"0 8px"},children:[e.jsx("span",{children:u.footerContent}),u.showPageNumber&&e.jsx("span",{children:u.pageNumberFormat.replace("{page}","1")})]}),e.jsx("div",{style:{position:"absolute",top:N.top,left:N.left,width:y,height:z.height-N.top-N.bottom},children:m.map(x)})]})})]})}):e.jsx(s.App,{children:e.jsxs("div",{className:"app-container",children:[e.jsx(yt,{onCustomSave:a?g:void 0,onCustomPrint:n}),e.jsxs("div",{className:"app-body",children:[e.jsx("div",{className:"app-left-panel",children:e.jsx(kt,{})}),e.jsx(Je,{}),e.jsx("div",{className:"app-right-panel",children:e.jsx(_t,{})})]}),e.jsx(Ot,{}),e.jsx(It,{})]})})};Y.default=zt,Y.getArrayFromDataSource=me,Y.getObjectFromDataSource=ge,Y.getRenderValue=ce,Y.getValueByPath=pe,Y.safeParseJSON=ae,Y.useDesignerStore=T,Object.defineProperties(Y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|