@superdoc-dev/template-builder 0.2.0-next.1 → 0.2.0-next.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.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +87 -85
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AA0GhC,QAAA,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,KAAK,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAElD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AA0GhC,QAAA,MAAM,uBAAuB,oJA2jB3B,CAAC;AAIH,eAAe,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ae=Object.create;var ge=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Le=Object.prototype.hasOwnProperty;var We=(
|
|
1
|
+
"use strict";var Ae=Object.create;var ge=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Le=Object.prototype.hasOwnProperty;var We=(o,d,f,l)=>{if(d&&typeof d=="object"||typeof d=="function")for(let n of Ie(d))!Le.call(o,n)&&n!==f&&ge(o,n,{get:()=>d[n],enumerable:!(l=Me(d,n))||l.enumerable});return o};var Be=(o,d,f)=>(f=o!=null?Ae(De(o)):{},We(d||!o||!o.__esModule?ge(f,"default",{value:o,enumerable:!0}):f,o));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react");var ie={exports:{}},ne={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var be;function $e(){if(be)return ne;be=1;var
|
|
9
|
+
*/var be;function $e(){if(be)return ne;be=1;var o=Symbol.for("react.transitional.element"),d=Symbol.for("react.fragment");function f(l,n,c){var F=null;if(c!==void 0&&(F=""+c),n.key!==void 0&&(F=""+n.key),"key"in n){c={};for(var D in n)D!=="key"&&(c[D]=n[D])}else c=n;return n=c.ref,{$$typeof:o,type:l,key:F,ref:n!==void 0?n:null,props:c}}return ne.Fragment=d,ne.jsx=f,ne.jsxs=f,ne}var oe={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
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
|
-
*/var he;function Ve(){return he||(he=1,process.env.NODE_ENV!=="production"&&(function(){function
|
|
17
|
+
*/var he;function Ve(){return he||(he=1,process.env.NODE_ENV!=="production"&&(function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case E:return"Profiler";case Q:return"StrictMode";case b:return"Suspense";case R:return"SuspenseList";case W:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case U:return"Portal";case A:return e.displayName||"Context";case Y:return(e._context.displayName||"Context")+".Consumer";case u:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case T:return a=e.displayName||null,a!==null?a:o(e.type)||"Memo";case j:a=e._payload,e=e._init;try{return o(e(a))}catch{}}return null}function d(e){return""+e}function f(e){try{d(e);var a=!1}catch{a=!0}if(a){a=console;var x=a.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return x.call(a,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),d(e)}}function l(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===j)return"<...>";try{var a=o(e);return a?"<"+a+">":"<...>"}catch{return"<...>"}}function n(){var e=Z.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function F(e){if(se.call(e,"key")){var a=Object.getOwnPropertyDescriptor(e,"key").get;if(a&&a.isReactWarning)return!1}return e.key!==void 0}function D(e,a){function x(){M||(M=!0,console.error("%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://react.dev/link/special-props)",a))}x.isReactWarning=!0,Object.defineProperty(e,"key",{get:x,configurable:!0})}function z(){var e=o(this.type);return ee[e]||(ee[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function H(e,a,x,p,B,re){var h=x.ref;return e={$$typeof:L,type:e,key:a,props:x,_owner:p},(h!==void 0?h:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:z}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function P(e,a,x,p,B,re){var h=a.children;if(h!==void 0)if(p)if(K(h)){for(p=0;p<h.length;p++)N(h[p]);Object.freeze&&Object.freeze(h)}else console.error("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 N(h);if(se.call(a,"key")){h=o(e);var w=Object.keys(a).filter(function(ue){return ue!=="key"});p=0<w.length?"{key: someKey, "+w.join(": ..., ")+": ...}":"{key: someKey}",q[h+p]||(w=0<w.length?"{"+w.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,p,h,w,h),q[h+p]=!0)}if(h=null,x!==void 0&&(f(x),h=""+x),F(a)&&(f(a.key),h=""+a.key),"key"in a){x={};for(var G in a)G!=="key"&&(x[G]=a[G])}else x=a;return h&&M(x,typeof e=="function"?e.displayName||e.name||"Unknown":e),H(e,h,x,r(),B,re)}function N(e){T(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===j&&(e._payload.status==="fulfilled"?T(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function T(e){return typeof e=="object"&&e!==null&&e.$$typeof===I}var V=i,I=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),A=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),Z=V.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=Object.prototype.hasOwnProperty,K=Array.isArray,C=console.createTask?console.createTask:function(){return null};V={react_stack_bottom_frame:function(e){return e()}};var L,ee={},W=V.react_stack_bottom_frame.bind(V,c)(),te=C(l(c)),q={};oe.Fragment=O,oe.jsx=function(e,a,x){var p=1e4>Z.recentlyCreatedOwnerStacks++;return P(e,a,x,!1,p?Error("react-stack-top-frame"):W,p?C(l(e)):te)},oe.jsxs=function(e,a,x){var p=1e4>Z.recentlyCreatedOwnerStacks++;return P(e,a,x,!0,p?Error("react-stack-top-frame"):W,p?C(l(e)):te)}})()),oe}var ye;function Ye(){return ye||(ye=1,process.env.NODE_ENV==="production"?ie.exports=$e():ie.exports=Ve()),ie.exports}var s=Ye();const Ce=({isVisible:n,position:d,availableFields:f,filteredFields:l,filterQuery:r,allowCreate:c,onSelect:F,onClose:M,onCreateField:z})=>{const[H,P]=i.useState(!1),[N,T]=i.useState("");i.useEffect(()=>{n||(P(!1),T(""))},[n]);const V=i.useMemo(()=>({position:"absolute",left:d?.left,top:d?.top,zIndex:1e3,background:"white",border:"1px solid #ddd",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",padding:"8px 0",minWidth:"200px"}),[d]),I=l??f,U=!!r,O=i.useMemo(()=>{const u=[],b=new Map;return I.forEach(R=>{const k=R.category?.trim()||"Uncategorized",j=b.get(k);if(j!==void 0){u[j].fields.push(R);return}b.set(k,u.length),u.push({category:k,fields:[R]})}),u},[I]),[Q,E]=i.useState({});i.useEffect(()=>{E(u=>{if(O.length===0)return Object.keys(u).length===0?u:{};const b={};let R=Object.keys(u).length!==O.length;return O.forEach(({category:k},j)=>{const D=U?!0:u[k]??j===0;b[k]=D,!R&&u[k]!==D&&(R=!0)}),R?b:u})},[O,U]);const Y=i.useCallback(u=>{E(b=>({...b,[u]:!b[u]}))},[]);if(!n)return null;const A=async()=>{const u=N.trim();if(!u)return;const b={id:`custom_${Date.now()}`,label:u,category:"Custom"};try{if(z){const R=await z(b);F(R||b)}else F(b)}finally{P(!1),T("")}};return s.jsxs("div",{className:"superdoc-field-menu",style:V,children:[U&&s.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid #f0f0f0",marginBottom:"4px"},children:s.jsxs("div",{style:{fontSize:"12px",color:"#6b7280"},children:["Filtering results for",s.jsx("span",{style:{fontWeight:600,color:"#111827",marginLeft:"4px"},children:r})]})}),c&&!H&&s.jsx("div",{className:"field-menu-item",onClick:()=>P(!0),style:{padding:"8px 16px",cursor:"pointer",color:"#0066cc",fontWeight:500},children:"+ Create New Field"}),c&&H&&s.jsxs("div",{style:{padding:"8px 16px"},children:[s.jsx("input",{type:"text",value:N,placeholder:"Field name...",onChange:u=>T(u.target.value),onKeyDown:u=>{u.key==="Enter"&&A(),u.key==="Escape"&&(P(!1),T(""))},autoFocus:!0,style:{width:"100%",padding:"4px 8px",border:"1px solid #ddd",borderRadius:"3px"}}),s.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px"},children:[s.jsx("button",{onClick:A,disabled:!N.trim(),style:{padding:"4px 12px",background:N.trim()?"#0066cc":"#ccc",color:"white",border:"none",borderRadius:"3px",cursor:N.trim()?"pointer":"not-allowed"},children:"Create"}),s.jsx("button",{onClick:()=>{P(!1),T("")},style:{padding:"4px 12px",background:"white",border:"1px solid #ddd",borderRadius:"3px",cursor:"pointer"},children:"Cancel"})]})]}),c&&f.length>0&&s.jsx("div",{style:{borderTop:"1px solid #eee",margin:"4px 0"}}),O.length===0?s.jsx("div",{style:{padding:"16px",fontSize:"13px",color:"#6b7280",textAlign:"center"},children:"No matching fields"}):O.map(({category:u,fields:b},R)=>{const k=!!Q[u],j=`${Math.max(b.length*40,0)}px`;return s.jsxs("div",{style:{borderTop:R===0&&c?void 0:"1px solid #f0f0f0"},children:[s.jsxs("button",{type:"button",onClick:()=>Y(u),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",background:"transparent",border:"none",cursor:"pointer",fontWeight:500,textAlign:"left"},children:[s.jsxs("span",{children:[u," (",b.length,")"]}),s.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:"8px",height:"8px",borderRight:"2px solid #666",borderBottom:"2px solid #666",transform:k?"rotate(45deg)":"rotate(-45deg)",transition:"transform 0.2s ease",marginLeft:"12px"}})]}),s.jsx("div",{"data-category":u,"aria-hidden":!k,style:{overflow:"hidden",maxHeight:k?j:"0px",opacity:k?1:0,transition:"max-height 0.2s ease, opacity 0.2s ease",pointerEvents:k?"auto":"none"},children:s.jsx("div",{style:{padding:k?"4px 0":0},children:b.map(D=>s.jsx("div",{className:"field-menu-item",onClick:()=>F(D),style:{padding:"8px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},children:s.jsx("span",{style:{fontWeight:500},children:D.label})},D.id))})})]},u)}),s.jsx("div",{style:{borderTop:"1px solid #eee",marginTop:"4px"},children:s.jsx("button",{onClick:M,style:{width:"100%",padding:"6px 16px",background:"#f3f4f6",border:"none",borderRadius:"0 0 4px 4px",cursor:"pointer"},children:"Close"})})]})},Te=({fields:n,onSelect:d,onDelete:f,selectedFieldId:l})=>s.jsxs("div",{className:"superdoc-field-list",style:{width:"250px",background:"white",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px"},children:[s.jsxs("h3",{style:{margin:"0 0 16px 0",fontSize:"16px",fontWeight:"600"},children:["Template Fields (",n.length,")"]}),n.length===0?s.jsxs("div",{style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",padding:"20px 0"},children:["No fields yet. Type ","{{"," to add a field."]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:n.map(r=>s.jsxs("div",{onClick:()=>d(r),style:{position:"relative",padding:"12px",background:l===r.id?"#eff6ff":"#f9fafb",border:l===r.id?"1px solid #3b82f6":"1px solid #e5e7eb",borderRadius:"6px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:c=>{l!==r.id&&(c.currentTarget.style.background="#f3f4f6")},onMouseLeave:c=>{l!==r.id&&(c.currentTarget.style.background="#f9fafb")},title:r.alias,children:[s.jsx("button",{onClick:c=>{c.stopPropagation(),f(r.id)},style:{position:"absolute",top:"8px",right:"8px",padding:"4px",background:"transparent",border:"none",cursor:"pointer",color:"#9ca3af",transition:"color 0.2s",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:c=>{c.currentTarget.style.color="#ef4444"},onMouseLeave:c=>{c.currentTarget.style.color="#9ca3af"},title:"Delete field",children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{d:"M6 2V1.5C6 1.22386 6.22386 1 6.5 1H9.5C9.77614 1 10 1.22386 10 1.5V2M2 4H14M12.6667 4L12.1991 11.0129C12.129 12.065 12.0939 12.5911 11.8667 12.99C11.6666 13.3412 11.3648 13.6235 11.0011 13.7998C10.588 14 10.0607 14 9.00623 14H6.99377C5.93927 14 5.41202 14 4.99889 13.7998C4.63517 13.6235 4.33339 13.3412 4.13332 12.99C3.90607 12.5911 3.871 12.065 3.80086 11.0129L3.33333 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsxs("div",{style:{paddingRight:"24px"},children:[s.jsx("div",{style:{fontWeight:"500",fontSize:"14px",marginBottom:r.alias&&r.alias!==r.id?"4px":"0"},children:r.id}),r.alias&&r.alias!==r.id&&s.jsx("div",{style:{fontSize:"12px",color:"#4b5563"},children:r.alias})]})]},r.id))})]}),ve=n=>{const d=n.helpers?.structuredContentCommands;return d?.getStructuredContentTags?(d.getStructuredContentTags(n.state)||[]).map(l=>{const c=(l?.node??l)?.attrs??{};return{id:c.id,alias:c.alias||c.label||"",tag:c.tag}}).filter(l=>!!l.id):[]},Ee=(n,d)=>{if(n===d)return!0;if(n.length!==d.length)return!1;for(let f=0;f<n.length;f+=1){const l=n[f],r=d[f];if(!r||l.id!==r.id||l.alias!==r.alias||l.tag!==r.tag||l.position!==r.position)return!1}return!0},ze=n=>{if(!n)return null;if(n===!0)return{selector:"#superdoc-toolbar",config:{},renderDefaultContainer:!0};if(typeof n=="string")return{selector:n,config:{},renderDefaultContainer:!1};const{selector:d,...f}=n;return{selector:d||"#superdoc-toolbar",config:f,renderDefaultContainer:d===void 0}},le=10,He=250,Ue=300,Re=n=>{const d=window.innerWidth-He-le,f=window.innerHeight-Ue-le,l=Math.min(n.left,d),r=Math.min(n.top,f);return new DOMRect(Math.max(l,le),Math.max(r,le),n.width,n.height)},ke=i.forwardRef((n,d)=>{const{document:f,fields:l={},menu:r={},list:c={},toolbar:F,onReady:M,onTrigger:z,onFieldInsert:H,onFieldUpdate:P,onFieldDelete:N,onFieldsChange:T,onFieldSelect:V,onFieldCreate:I,className:U,style:O,documentHeight:Q="600px"}=n,[E,Y]=i.useState(l.initial||[]),[A,u]=i.useState(null),[b,R]=i.useState(!1),[k,j]=i.useState(),[D,ce]=i.useState(""),[Z,se]=i.useState(()=>l.available||[]),K=i.useRef(null),C=i.useRef(null),L=i.useRef(null),ee=i.useRef(l);ee.current=l;const W=i.useRef(null),te=i.useRef(b);i.useEffect(()=>{te.current=b},[b]);const q=r.trigger||"{{",e=ee.current.available||[],a=i.useCallback(t=>{const o=t.trim().toLowerCase();return o?e.filter(y=>{const v=y.label.toLowerCase(),S=y.category?.toLowerCase()||"";return v.includes(o)||S.includes(o)}):e},[e]),x=i.useCallback(t=>{ce(t),se(a(t))},[a]),p=i.useCallback(()=>{x("")},[x]),B=i.useCallback((t,o)=>{if(!C.current?.activeEditor)return!1;const y=C.current.activeEditor,v=`field_${Date.now()}`,S=t==="inline"?y.commands.insertStructuredContentInline?.({attrs:{id:v,alias:o.alias,tag:o.metadata?JSON.stringify(o.metadata):o.category},text:o.defaultValue||o.alias}):y.commands.insertStructuredContentBlock?.({attrs:{id:v,alias:o.alias,tag:o.metadata?JSON.stringify(o.metadata):o.category},text:o.defaultValue||o.alias});if(S){const _={id:v,alias:o.alias,tag:o.category};Y(g=>{const m=[...g,_];return T?.(m),m}),H?.(_)}return S},[H,T]),re=i.useCallback((t,o)=>{if(!C.current?.activeEditor)return!1;const v=C.current.activeEditor.commands.updateStructuredContentById?.(t,{attrs:o});return v&&Y(S=>{const _=S.map(m=>m.id===t?{...m,...o}:m);T?.(_);const g=_.find(m=>m.id===t);return g&&P?.(g),_}),v},[P,T]),h=i.useCallback(t=>{const o=C.current?.activeEditor;if(!o){console.warn("[SuperDocTemplateBuilder] deleteField called without active editor");let g=!1;return Y(m=>{if(!m.some($=>$.id===t))return m;const X=m.filter($=>$.id!==t);return g=!0,T?.(X),X}),g&&(N?.(t),u(m=>m===t?null:m)),g}let y=!1;try{y=o.commands.deleteStructuredContentById?.(t)??!1}catch(g){console.error("[SuperDocTemplateBuilder] Delete command failed:",g)}let v=ve(o);const S=v.some(g=>g.id===t);!y&&S&&(v=v.filter(g=>g.id!==t));let _=!1;return Y(g=>{if(Ee(g,v))return g;const m=g.some($=>$.id===t),X=v.some($=>$.id===t);return m&&!X&&(_=!0),T?.(v),v}),_&&(N?.(t),u(g=>g===t?null:g)),y||_},[N,T]),w=i.useCallback(t=>{if(!C.current?.activeEditor)return;C.current.activeEditor.commands.selectStructuredContentById?.(t),u(t);const y=E.find(v=>v.id===t);y&&V?.(y)},[E,V]),G=i.useCallback(t=>{if(!t)return;const o=ve(t);Y(y=>Ee(y,o)?y:(T?.(o),o))},[T]);i.useEffect(()=>K.current?((async()=>{const{SuperDoc:o}=await import("superdoc"),y={selector:K.current,document:f?.source,documentMode:f?.mode||"editing",onReady:()=>{if(v.activeEditor){const S=v.activeEditor;S.on("update",({editor:_})=>{const{state:g}=_,{from:m}=g.selection;if(m>=q.length){const de=m-q.length;if(g.doc.textBetween(de,m)===q){const pe=_.view.coordsAtPos(m),me=Re(new DOMRect(pe.left,pe.top,0,0)),xe=()=>{const ae=C.current?.activeEditor;if(!ae)return;const Oe=ae.state.selection.from,Pe=ae.state.tr.delete(de,Oe);ae.view.dispatch(Pe)};L.current=xe,W.current=m,j(me),R(!0),p(),z?.({position:{from:de,to:m},bounds:me,cleanup:xe});return}}if(!te.current)return;if(W.current==null){R(!1),p();return}if(m<W.current){R(!1),W.current=null,p();return}const X=g.doc.textBetween(W.current,m);x(X);const $=_.view.coordsAtPos(m),Ne=Re(new DOMRect($.left,$.top,0,0));j(Ne)}),S.on("update",()=>{G(S)}),G(S)}M?.()}},v=new o({...y,...J&&{toolbar:J.selector,modules:{toolbar:{selector:J.selector,toolbarGroups:J.config.toolbarGroups||["center"],excludeItems:J.config.excludeItems||[],...J.config}}}});C.current=v})(),()=>{C.current&&(typeof C.current.destroy=="function"&&C.current.destroy(),C.current=null)}):void 0,[f?.source,f?.mode,q,G,M,z,F]);const ue=i.useCallback(async t=>{if(L.current&&(L.current(),L.current=null),W.current=null,p(),t.id.startsWith("custom_")&&I)try{const o=await I(t);if(o){B("inline",{alias:o.label,category:o.category,metadata:o.metadata,defaultValue:o.defaultValue}),R(!1);return}}catch(o){console.error("Field creation failed:",o)}B("inline",{alias:t.label,category:t.category,metadata:t.metadata,defaultValue:t.defaultValue}),R(!1)},[B,I,p]),we=i.useCallback(()=>{R(!1),W.current=null,p(),L.current&&(L.current(),L.current=null)},[p]),_e=i.useCallback(()=>{if(!C.current?.activeEditor||E.length===0)return;const t=E.findIndex(y=>y.id===A),o=t>=0?(t+1)%E.length:0;w(E[o].id)},[E,A,w]),je=i.useCallback(()=>{if(!C.current?.activeEditor||E.length===0)return;const t=E.findIndex(y=>y.id===A),o=t>0?t-1:E.length-1;w(E[o].id)},[E,A,w]),Se=i.useCallback(async t=>{try{await C.current?.export({exportType:["docx"],exportedName:t?.fileName?t?.fileName:"document"})}catch(o){throw console.error("Failed to export DOCX",o),o}},[]);i.useImperativeHandle(d,()=>({insertField:t=>B("inline",t),insertBlockField:t=>B("block",t),updateField:re,deleteField:h,selectField:w,nextField:_e,previousField:je,getFields:()=>E,exportTemplate:Se}));const Fe=r.component||Ce,fe=c.component||Te,J=ze(F);return s.jsxs("div",{className:`superdoc-template-builder ${U||""}`,style:O,children:[s.jsxs("div",{style:{display:"flex",gap:"20px"},children:[c.position==="left"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(fe,{fields:E,onSelect:t=>w(t.id),onDelete:h,selectedFieldId:A||void 0})}),s.jsxs("div",{className:"superdoc-template-builder-document",style:{flex:1},children:[J?.renderDefaultContainer&&s.jsx("div",{id:"superdoc-toolbar",className:"superdoc-template-builder-toolbar","data-testid":"template-builder-toolbar"}),s.jsx("div",{ref:K,className:"superdoc-template-builder-editor",style:{height:Q},"data-testid":"template-builder-editor"})]}),c.position==="right"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(fe,{fields:E,onSelect:t=>w(t.id),onDelete:h,selectedFieldId:A||void 0})})]}),s.jsx(Fe,{isVisible:b,position:k,availableFields:l.available||[],filteredFields:Z,filterQuery:D,allowCreate:l.allowCreate||!1,onSelect:ue,onClose:we,onCreateField:I})]})});ke.displayName="SuperDocTemplateBuilder";exports.FieldList=Te;exports.FieldMenu=Ce;exports.default=ke;
|
|
22
|
+
<%s key={someKey} {...props} />`,p,h,w,h),q[h+p]=!0)}if(h=null,x!==void 0&&(f(x),h=""+x),F(a)&&(f(a.key),h=""+a.key),"key"in a){x={};for(var G in a)G!=="key"&&(x[G]=a[G])}else x=a;return h&&D(x,typeof e=="function"?e.displayName||e.name||"Unknown":e),H(e,h,x,n(),B,re)}function N(e){C(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===j&&(e._payload.status==="fulfilled"?C(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function C(e){return typeof e=="object"&&e!==null&&e.$$typeof===L}var V=i,L=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),A=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),Z=V.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=Object.prototype.hasOwnProperty,K=Array.isArray,k=console.createTask?console.createTask:function(){return null};V={react_stack_bottom_frame:function(e){return e()}};var M,ee={},I=V.react_stack_bottom_frame.bind(V,c)(),te=k(l(c)),q={};oe.Fragment=O,oe.jsx=function(e,a,x){var p=1e4>Z.recentlyCreatedOwnerStacks++;return P(e,a,x,!1,p?Error("react-stack-top-frame"):I,p?k(l(e)):te)},oe.jsxs=function(e,a,x){var p=1e4>Z.recentlyCreatedOwnerStacks++;return P(e,a,x,!0,p?Error("react-stack-top-frame"):I,p?k(l(e)):te)}})()),oe}var ye;function Ye(){return ye||(ye=1,process.env.NODE_ENV==="production"?ie.exports=$e():ie.exports=Ve()),ie.exports}var s=Ye();const Ce=({isVisible:o,position:d,availableFields:f,filteredFields:l,filterQuery:n,allowCreate:c,onSelect:F,onClose:D,onCreateField:z})=>{const[H,P]=i.useState(!1),[N,C]=i.useState("");i.useEffect(()=>{o||(P(!1),C(""))},[o]);const V=i.useMemo(()=>({position:"absolute",left:d?.left,top:d?.top,zIndex:1e3,background:"white",border:"1px solid #ddd",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",padding:"8px 0",minWidth:"200px"}),[d]),L=l??f,U=!!n,O=i.useMemo(()=>{const u=[],b=new Map;return L.forEach(R=>{const T=R.category?.trim()||"Uncategorized",j=b.get(T);if(j!==void 0){u[j].fields.push(R);return}b.set(T,u.length),u.push({category:T,fields:[R]})}),u},[L]),[Q,E]=i.useState({});i.useEffect(()=>{E(u=>{if(O.length===0)return Object.keys(u).length===0?u:{};const b={};let R=Object.keys(u).length!==O.length;return O.forEach(({category:T},j)=>{const W=U?!0:u[T]??j===0;b[T]=W,!R&&u[T]!==W&&(R=!0)}),R?b:u})},[O,U]);const Y=i.useCallback(u=>{E(b=>({...b,[u]:!b[u]}))},[]);if(!o)return null;const A=async()=>{const u=N.trim();if(!u)return;const b={id:`custom_${Date.now()}`,label:u,category:"Custom"};try{if(z){const R=await z(b);F(R||b)}else F(b)}finally{P(!1),C("")}};return s.jsxs("div",{className:"superdoc-field-menu",style:V,children:[U&&s.jsx("div",{style:{padding:"8px 16px",borderBottom:"1px solid #f0f0f0",marginBottom:"4px"},children:s.jsxs("div",{style:{fontSize:"12px",color:"#6b7280"},children:["Filtering results for",s.jsx("span",{style:{fontWeight:600,color:"#111827",marginLeft:"4px"},children:n})]})}),c&&!H&&s.jsx("div",{className:"field-menu-item",onClick:()=>P(!0),style:{padding:"8px 16px",cursor:"pointer",color:"#0066cc",fontWeight:500},children:"+ Create New Field"}),c&&H&&s.jsxs("div",{style:{padding:"8px 16px"},children:[s.jsx("input",{type:"text",value:N,placeholder:"Field name...",onChange:u=>C(u.target.value),onKeyDown:u=>{u.key==="Enter"&&A(),u.key==="Escape"&&(P(!1),C(""))},autoFocus:!0,style:{width:"100%",padding:"4px 8px",border:"1px solid #ddd",borderRadius:"3px"}}),s.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px"},children:[s.jsx("button",{onClick:A,disabled:!N.trim(),style:{padding:"4px 12px",background:N.trim()?"#0066cc":"#ccc",color:"white",border:"none",borderRadius:"3px",cursor:N.trim()?"pointer":"not-allowed"},children:"Create"}),s.jsx("button",{onClick:()=>{P(!1),C("")},style:{padding:"4px 12px",background:"white",border:"1px solid #ddd",borderRadius:"3px",cursor:"pointer"},children:"Cancel"})]})]}),c&&f.length>0&&s.jsx("div",{style:{borderTop:"1px solid #eee",margin:"4px 0"}}),O.length===0?s.jsx("div",{style:{padding:"16px",fontSize:"13px",color:"#6b7280",textAlign:"center"},children:"No matching fields"}):O.map(({category:u,fields:b},R)=>{const T=!!Q[u],j=`${Math.max(b.length*40,0)}px`;return s.jsxs("div",{style:{borderTop:R===0&&c?void 0:"1px solid #f0f0f0"},children:[s.jsxs("button",{type:"button",onClick:()=>Y(u),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",background:"transparent",border:"none",cursor:"pointer",fontWeight:500,textAlign:"left"},children:[s.jsxs("span",{children:[u," (",b.length,")"]}),s.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:"8px",height:"8px",borderRight:"2px solid #666",borderBottom:"2px solid #666",transform:T?"rotate(45deg)":"rotate(-45deg)",transition:"transform 0.2s ease",marginLeft:"12px"}})]}),s.jsx("div",{"data-category":u,"aria-hidden":!T,style:{overflow:"hidden",maxHeight:T?j:"0px",opacity:T?1:0,transition:"max-height 0.2s ease, opacity 0.2s ease",pointerEvents:T?"auto":"none"},children:s.jsx("div",{style:{padding:T?"4px 0":0},children:b.map(W=>s.jsx("div",{className:"field-menu-item",onClick:()=>F(W),style:{padding:"8px 16px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},children:s.jsx("span",{style:{fontWeight:500},children:W.label})},W.id))})})]},u)}),s.jsx("div",{style:{borderTop:"1px solid #eee",marginTop:"4px"},children:s.jsx("button",{onClick:D,style:{width:"100%",padding:"6px 16px",background:"#f3f4f6",border:"none",borderRadius:"0 0 4px 4px",cursor:"pointer"},children:"Close"})})]})},Te=({fields:o,onSelect:d,onDelete:f,selectedFieldId:l})=>s.jsxs("div",{className:"superdoc-field-list",style:{width:"250px",background:"white",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px"},children:[s.jsxs("h3",{style:{margin:"0 0 16px 0",fontSize:"16px",fontWeight:"600"},children:["Template Fields (",o.length,")"]}),o.length===0?s.jsxs("div",{style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",padding:"20px 0"},children:["No fields yet. Type ","{{"," to add a field."]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.map(n=>s.jsxs("div",{onClick:()=>d(n),style:{position:"relative",padding:"12px",background:l===n.id?"#eff6ff":"#f9fafb",border:l===n.id?"1px solid #3b82f6":"1px solid #e5e7eb",borderRadius:"6px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:c=>{l!==n.id&&(c.currentTarget.style.background="#f3f4f6")},onMouseLeave:c=>{l!==n.id&&(c.currentTarget.style.background="#f9fafb")},title:n.alias,children:[s.jsx("button",{onClick:c=>{c.stopPropagation(),f(n.id)},style:{position:"absolute",top:"8px",right:"8px",padding:"4px",background:"transparent",border:"none",cursor:"pointer",color:"#9ca3af",transition:"color 0.2s",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:c=>{c.currentTarget.style.color="#ef4444"},onMouseLeave:c=>{c.currentTarget.style.color="#9ca3af"},title:"Delete field",children:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.jsx("path",{d:"M6 2V1.5C6 1.22386 6.22386 1 6.5 1H9.5C9.77614 1 10 1.22386 10 1.5V2M2 4H14M12.6667 4L12.1991 11.0129C12.129 12.065 12.0939 12.5911 11.8667 12.99C11.6666 13.3412 11.3648 13.6235 11.0011 13.7998C10.588 14 10.0607 14 9.00623 14H6.99377C5.93927 14 5.41202 14 4.99889 13.7998C4.63517 13.6235 4.33339 13.3412 4.13332 12.99C3.90607 12.5911 3.871 12.065 3.80086 11.0129L3.33333 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),s.jsxs("div",{style:{paddingRight:"24px"},children:[s.jsx("div",{style:{fontWeight:"500",fontSize:"14px",marginBottom:n.alias&&n.alias!==n.id?"4px":"0"},children:n.id}),n.alias&&n.alias!==n.id&&s.jsx("div",{style:{fontSize:"12px",color:"#4b5563"},children:n.alias})]})]},n.id))})]}),ve=o=>{const d=o.helpers?.structuredContentCommands;return d?.getStructuredContentTags?(d.getStructuredContentTags(o.state)||[]).map(l=>{const c=(l?.node??l)?.attrs??{};return{id:c.id,alias:c.alias||c.label||"",tag:c.tag}}).filter(l=>!!l.id):[]},Ee=(o,d)=>{if(o===d)return!0;if(o.length!==d.length)return!1;for(let f=0;f<o.length;f+=1){const l=o[f],n=d[f];if(!n||l.id!==n.id||l.alias!==n.alias||l.tag!==n.tag||l.position!==n.position)return!1}return!0},ze=o=>{if(!o)return null;if(o===!0)return{selector:"#superdoc-toolbar",config:{},renderDefaultContainer:!0};if(typeof o=="string")return{selector:o,config:{},renderDefaultContainer:!1};const{selector:d,...f}=o;return{selector:d||"#superdoc-toolbar",config:f,renderDefaultContainer:d===void 0}},le=10,He=250,Ue=300,Re=o=>{const d=window.innerWidth-He-le,f=window.innerHeight-Ue-le,l=Math.min(o.left,d),n=Math.min(o.top,f);return new DOMRect(Math.max(l,le),Math.max(n,le),o.width,o.height)},ke=i.forwardRef((o,d)=>{const{document:f,fields:l={},menu:n={},list:c={},toolbar:F,onReady:D,onTrigger:z,onFieldInsert:H,onFieldUpdate:P,onFieldDelete:N,onFieldsChange:C,onFieldSelect:V,onFieldCreate:L,className:U,style:O,documentHeight:Q="600px"}=o,[E,Y]=i.useState(l.initial||[]),[A,u]=i.useState(null),[b,R]=i.useState(!1),[T,j]=i.useState(),[W,ce]=i.useState(""),[Z,se]=i.useState(()=>l.available||[]),K=i.useRef(null),k=i.useRef(null),M=i.useRef(null),ee=i.useRef(l);ee.current=l;const I=i.useRef(null),te=i.useRef(b);i.useEffect(()=>{te.current=b},[b]);const q=n.trigger||"{{",e=ee.current.available||[],a=i.useCallback(t=>{const r=t.trim().toLowerCase();return r?e.filter(y=>{const v=y.label.toLowerCase(),S=y.category?.toLowerCase()||"";return v.includes(r)||S.includes(r)}):e},[e]),x=i.useCallback(t=>{ce(t),se(a(t))},[a]),p=i.useCallback(()=>{x("")},[x]),B=i.useCallback((t,r)=>{if(!k.current?.activeEditor)return!1;const y=k.current.activeEditor,v=`field_${Date.now()}`,S=t==="inline"?y.commands.insertStructuredContentInline?.({attrs:{id:v,alias:r.alias,tag:r.metadata?JSON.stringify(r.metadata):r.category},text:r.defaultValue||r.alias}):y.commands.insertStructuredContentBlock?.({attrs:{id:v,alias:r.alias,tag:r.metadata?JSON.stringify(r.metadata):r.category},text:r.defaultValue||r.alias});if(S){const _={id:v,alias:r.alias,tag:r.category};Y(g=>{const m=[...g,_];return C?.(m),m}),H?.(_)}return S},[H,C]),re=i.useCallback((t,r)=>{if(!k.current?.activeEditor)return!1;const v=k.current.activeEditor.commands.updateStructuredContentById?.(t,{attrs:r});return v&&Y(S=>{const _=S.map(m=>m.id===t?{...m,...r}:m);C?.(_);const g=_.find(m=>m.id===t);return g&&P?.(g),_}),v},[P,C]),h=i.useCallback(t=>{const r=k.current?.activeEditor;if(!r){console.warn("[SuperDocTemplateBuilder] deleteField called without active editor");let g=!1;return Y(m=>{if(!m.some($=>$.id===t))return m;const X=m.filter($=>$.id!==t);return g=!0,C?.(X),X}),g&&(N?.(t),u(m=>m===t?null:m)),g}let y=!1;try{y=r.commands.deleteStructuredContentById?.(t)??!1}catch(g){console.error("[SuperDocTemplateBuilder] Delete command failed:",g)}let v=ve(r);const S=v.some(g=>g.id===t);!y&&S&&(v=v.filter(g=>g.id!==t));let _=!1;return Y(g=>{if(Ee(g,v))return g;const m=g.some($=>$.id===t),X=v.some($=>$.id===t);return m&&!X&&(_=!0),C?.(v),v}),_&&(N?.(t),u(g=>g===t?null:g)),y||_},[N,C]),w=i.useCallback(t=>{if(!k.current?.activeEditor)return;k.current.activeEditor.commands.selectStructuredContentById?.(t),u(t);const y=E.find(v=>v.id===t);y&&V?.(y)},[E,V]),G=i.useCallback(t=>{if(!t)return;const r=ve(t);Y(y=>Ee(y,r)?y:(C?.(r),r))},[C]);i.useEffect(()=>K.current?((async()=>{const{SuperDoc:r}=await import("superdoc"),y={selector:K.current,document:f?.source,documentMode:f?.mode||"editing",onReady:()=>{if(v.activeEditor){const S=v.activeEditor;S.on("update",({editor:_})=>{const{state:g}=_,{from:m}=g.selection;if(m>=q.length){const de=m-q.length;if(g.doc.textBetween(de,m)===q){const pe=_.view.coordsAtPos(m),me=Re(new DOMRect(pe.left,pe.top,0,0)),xe=()=>{const ae=k.current?.activeEditor;if(!ae)return;const Oe=ae.state.selection.from,Pe=ae.state.tr.delete(de,Oe);ae.view.dispatch(Pe)};M.current=xe,I.current=m,j(me),R(!0),p(),z?.({position:{from:de,to:m},bounds:me,cleanup:xe});return}}if(!te.current)return;if(I.current==null){R(!1),p();return}if(m<I.current){R(!1),I.current=null,p();return}const X=g.doc.textBetween(I.current,m);x(X);const $=_.view.coordsAtPos(m),Ne=Re(new DOMRect($.left,$.top,0,0));j(Ne)}),S.on("update",()=>{G(S)}),G(S)}D?.()}},v=new r({...y,...J&&{toolbar:J.selector,modules:{toolbar:{selector:J.selector,toolbarGroups:J.config.toolbarGroups||["center"],excludeItems:J.config.excludeItems||[],...J.config}}}});k.current=v})(),()=>{M.current=null,I.current=null;const r=k.current;r&&typeof r.destroy=="function"&&r.destroy(),k.current=null}):void 0,[f?.source,f?.mode,q,G,D,z,F]);const ue=i.useCallback(async t=>{if(M.current&&(M.current(),M.current=null),I.current=null,p(),t.id.startsWith("custom_")&&L)try{const r=await L(t);if(r){B("inline",{alias:r.label,category:r.category,metadata:r.metadata,defaultValue:r.defaultValue}),R(!1);return}}catch(r){console.error("Field creation failed:",r)}B("inline",{alias:t.label,category:t.category,metadata:t.metadata,defaultValue:t.defaultValue}),R(!1)},[B,L,p]),we=i.useCallback(()=>{R(!1),I.current=null,p(),M.current&&(M.current(),M.current=null)},[p]),_e=i.useCallback(()=>{if(!k.current?.activeEditor||E.length===0)return;const t=E.findIndex(y=>y.id===A),r=t>=0?(t+1)%E.length:0;w(E[r].id)},[E,A,w]),je=i.useCallback(()=>{if(!k.current?.activeEditor||E.length===0)return;const t=E.findIndex(y=>y.id===A),r=t>0?t-1:E.length-1;w(E[r].id)},[E,A,w]),Se=i.useCallback(async t=>{try{await k.current?.export({exportType:["docx"],exportedName:t?.fileName?t?.fileName:"document"})}catch(r){throw console.error("Failed to export DOCX",r),r}},[]);i.useImperativeHandle(d,()=>({insertField:t=>B("inline",t),insertBlockField:t=>B("block",t),updateField:re,deleteField:h,selectField:w,nextField:_e,previousField:je,getFields:()=>E,exportTemplate:Se}));const Fe=n.component||Ce,fe=c.component||Te,J=ze(F);return s.jsxs("div",{className:`superdoc-template-builder ${U||""}`,style:O,children:[s.jsxs("div",{style:{display:"flex",gap:"20px"},children:[c.position==="left"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(fe,{fields:E,onSelect:t=>w(t.id),onDelete:h,selectedFieldId:A||void 0})}),s.jsxs("div",{className:"superdoc-template-builder-document",style:{flex:1},children:[J?.renderDefaultContainer&&s.jsx("div",{id:"superdoc-toolbar",className:"superdoc-template-builder-toolbar","data-testid":"template-builder-toolbar"}),s.jsx("div",{ref:K,className:"superdoc-template-builder-editor",style:{height:Q},"data-testid":"template-builder-editor"})]}),c.position==="right"&&s.jsx("div",{className:"superdoc-template-builder-sidebar",children:s.jsx(fe,{fields:E,onSelect:t=>w(t.id),onDelete:h,selectedFieldId:A||void 0})})]}),s.jsx(Fe,{isVisible:b,position:T,availableFields:l.available||[],filteredFields:Z,filterQuery:W,allowCreate:l.allowCreate||!1,onSelect:ue,onClose:we,onCreateField:L})]})});ke.displayName="SuperDocTemplateBuilder";exports.FieldList=Te;exports.FieldMenu=Ce;exports.default=ke;
|
package/dist/index.mjs
CHANGED
|
@@ -18,8 +18,8 @@ function De() {
|
|
|
18
18
|
var F = null;
|
|
19
19
|
if (i !== void 0 && (F = "" + i), n.key !== void 0 && (F = "" + n.key), "key" in n) {
|
|
20
20
|
i = {};
|
|
21
|
-
for (var
|
|
22
|
-
|
|
21
|
+
for (var D in n)
|
|
22
|
+
D !== "key" && (i[D] = n[D]);
|
|
23
23
|
} else i = n;
|
|
24
24
|
return n = i.ref, {
|
|
25
25
|
$$typeof: a,
|
|
@@ -60,7 +60,7 @@ function Le() {
|
|
|
60
60
|
return "Suspense";
|
|
61
61
|
case E:
|
|
62
62
|
return "SuspenseList";
|
|
63
|
-
case
|
|
63
|
+
case W:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof e == "object")
|
|
@@ -76,7 +76,7 @@ function Le() {
|
|
|
76
76
|
case l:
|
|
77
77
|
var s = e.render;
|
|
78
78
|
return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case
|
|
79
|
+
case T:
|
|
80
80
|
return s = e.displayName || null, s !== null ? s : a(e.type) || "Memo";
|
|
81
81
|
case k:
|
|
82
82
|
s = e._payload, e = e._init;
|
|
@@ -132,9 +132,9 @@ function Le() {
|
|
|
132
132
|
}
|
|
133
133
|
return e.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function D(e, s) {
|
|
136
136
|
function f() {
|
|
137
|
-
|
|
137
|
+
I || (I = !0, console.error(
|
|
138
138
|
"%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://react.dev/link/special-props)",
|
|
139
139
|
s
|
|
140
140
|
));
|
|
@@ -153,7 +153,7 @@ function Le() {
|
|
|
153
153
|
function U(e, s, f, d, B, oe) {
|
|
154
154
|
var h = f.ref;
|
|
155
155
|
return e = {
|
|
156
|
-
$$typeof:
|
|
156
|
+
$$typeof: L,
|
|
157
157
|
type: e,
|
|
158
158
|
key: s,
|
|
159
159
|
props: f,
|
|
@@ -219,7 +219,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
219
219
|
for (var q in s)
|
|
220
220
|
q !== "key" && (f[q] = s[q]);
|
|
221
221
|
} else f = s;
|
|
222
|
-
return h &&
|
|
222
|
+
return h && D(
|
|
223
223
|
f,
|
|
224
224
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
225
|
), U(
|
|
@@ -232,12 +232,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
function N(e) {
|
|
235
|
-
|
|
235
|
+
R(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === k && (e._payload.status === "fulfilled" ? R(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
237
|
+
function R(e) {
|
|
238
|
+
return typeof e == "object" && e !== null && e.$$typeof === L;
|
|
239
239
|
}
|
|
240
|
-
var V = Ae,
|
|
240
|
+
var V = Ae, L = Symbol.for("react.transitional.element"), G = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), K = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), A = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), W = Symbol.for("react.activity"), fe = Symbol.for("react.client.reference"), ee = V.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ie = Object.prototype.hasOwnProperty, te = Array.isArray, w = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
243
|
V = {
|
|
@@ -245,10 +245,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
245
245
|
return e();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
var
|
|
248
|
+
var I, re = {}, M = V.react_stack_bottom_frame.bind(
|
|
249
249
|
V,
|
|
250
250
|
i
|
|
251
|
-
)(), ne =
|
|
251
|
+
)(), ne = w(c(i)), J = {};
|
|
252
252
|
ae.Fragment = O, ae.jsx = function(e, s, f) {
|
|
253
253
|
var d = 1e4 > ee.recentlyCreatedOwnerStacks++;
|
|
254
254
|
return P(
|
|
@@ -256,8 +256,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
256
256
|
s,
|
|
257
257
|
f,
|
|
258
258
|
!1,
|
|
259
|
-
d ? Error("react-stack-top-frame") :
|
|
260
|
-
d ?
|
|
259
|
+
d ? Error("react-stack-top-frame") : M,
|
|
260
|
+
d ? w(c(e)) : ne
|
|
261
261
|
);
|
|
262
262
|
}, ae.jsxs = function(e, s, f) {
|
|
263
263
|
var d = 1e4 > ee.recentlyCreatedOwnerStacks++;
|
|
@@ -266,8 +266,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
266
266
|
s,
|
|
267
267
|
f,
|
|
268
268
|
!0,
|
|
269
|
-
d ? Error("react-stack-top-frame") :
|
|
270
|
-
d ?
|
|
269
|
+
d ? Error("react-stack-top-frame") : M,
|
|
270
|
+
d ? w(c(e)) : ne
|
|
271
271
|
);
|
|
272
272
|
};
|
|
273
273
|
})()), ae;
|
|
@@ -285,12 +285,12 @@ const Be = ({
|
|
|
285
285
|
filterQuery: n,
|
|
286
286
|
allowCreate: i,
|
|
287
287
|
onSelect: F,
|
|
288
|
-
onClose:
|
|
288
|
+
onClose: D,
|
|
289
289
|
onCreateField: H
|
|
290
290
|
}) => {
|
|
291
|
-
const [U, P] = z(!1), [N,
|
|
291
|
+
const [U, P] = z(!1), [N, R] = z("");
|
|
292
292
|
ue(() => {
|
|
293
|
-
a || (P(!1),
|
|
293
|
+
a || (P(!1), R(""));
|
|
294
294
|
}, [a]);
|
|
295
295
|
const V = ye(() => ({
|
|
296
296
|
position: "absolute",
|
|
@@ -303,26 +303,26 @@ const Be = ({
|
|
|
303
303
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
|
|
304
304
|
padding: "8px 0",
|
|
305
305
|
minWidth: "200px"
|
|
306
|
-
}), [x]),
|
|
306
|
+
}), [x]), L = c ?? p, G = !!n, O = ye(() => {
|
|
307
307
|
const l = [], g = /* @__PURE__ */ new Map();
|
|
308
|
-
return
|
|
309
|
-
const
|
|
308
|
+
return L.forEach((E) => {
|
|
309
|
+
const T = E.category?.trim() || "Uncategorized", k = g.get(T);
|
|
310
310
|
if (k !== void 0) {
|
|
311
311
|
l[k].fields.push(E);
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
-
g.set(
|
|
314
|
+
g.set(T, l.length), l.push({ category: T, fields: [E] });
|
|
315
315
|
}), l;
|
|
316
|
-
}, [
|
|
316
|
+
}, [L]), [K, v] = z({});
|
|
317
317
|
ue(() => {
|
|
318
318
|
v((l) => {
|
|
319
319
|
if (O.length === 0)
|
|
320
320
|
return Object.keys(l).length === 0 ? l : {};
|
|
321
321
|
const g = {};
|
|
322
322
|
let E = Object.keys(l).length !== O.length;
|
|
323
|
-
return O.forEach(({ category:
|
|
324
|
-
const
|
|
325
|
-
g[
|
|
323
|
+
return O.forEach(({ category: T }, k) => {
|
|
324
|
+
const W = G ? !0 : l[T] ?? k === 0;
|
|
325
|
+
g[T] = W, !E && l[T] !== W && (E = !0);
|
|
326
326
|
}), E ? g : l;
|
|
327
327
|
});
|
|
328
328
|
}, [O, G]);
|
|
@@ -348,7 +348,7 @@ const Be = ({
|
|
|
348
348
|
} else
|
|
349
349
|
F(g);
|
|
350
350
|
} finally {
|
|
351
|
-
P(!1),
|
|
351
|
+
P(!1), R("");
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
return /* @__PURE__ */ o.jsxs("div", { className: "superdoc-field-menu", style: V, children: [
|
|
@@ -393,9 +393,9 @@ const Be = ({
|
|
|
393
393
|
type: "text",
|
|
394
394
|
value: N,
|
|
395
395
|
placeholder: "Field name...",
|
|
396
|
-
onChange: (l) =>
|
|
396
|
+
onChange: (l) => R(l.target.value),
|
|
397
397
|
onKeyDown: (l) => {
|
|
398
|
-
l.key === "Enter" && A(), l.key === "Escape" && (P(!1),
|
|
398
|
+
l.key === "Enter" && A(), l.key === "Escape" && (P(!1), R(""));
|
|
399
399
|
},
|
|
400
400
|
autoFocus: !0,
|
|
401
401
|
style: {
|
|
@@ -435,7 +435,7 @@ const Be = ({
|
|
|
435
435
|
"button",
|
|
436
436
|
{
|
|
437
437
|
onClick: () => {
|
|
438
|
-
P(!1),
|
|
438
|
+
P(!1), R("");
|
|
439
439
|
},
|
|
440
440
|
style: {
|
|
441
441
|
padding: "4px 12px",
|
|
@@ -472,7 +472,7 @@ const Be = ({
|
|
|
472
472
|
children: "No matching fields"
|
|
473
473
|
}
|
|
474
474
|
) : O.map(({ category: l, fields: g }, E) => {
|
|
475
|
-
const
|
|
475
|
+
const T = !!K[l], k = `${Math.max(g.length * 40, 0)}px`;
|
|
476
476
|
return /* @__PURE__ */ o.jsxs(
|
|
477
477
|
"div",
|
|
478
478
|
{
|
|
@@ -514,7 +514,7 @@ const Be = ({
|
|
|
514
514
|
height: "8px",
|
|
515
515
|
borderRight: "2px solid #666",
|
|
516
516
|
borderBottom: "2px solid #666",
|
|
517
|
-
transform:
|
|
517
|
+
transform: T ? "rotate(45deg)" : "rotate(-45deg)",
|
|
518
518
|
transition: "transform 0.2s ease",
|
|
519
519
|
marginLeft: "12px"
|
|
520
520
|
}
|
|
@@ -527,19 +527,19 @@ const Be = ({
|
|
|
527
527
|
"div",
|
|
528
528
|
{
|
|
529
529
|
"data-category": l,
|
|
530
|
-
"aria-hidden": !
|
|
530
|
+
"aria-hidden": !T,
|
|
531
531
|
style: {
|
|
532
532
|
overflow: "hidden",
|
|
533
|
-
maxHeight:
|
|
534
|
-
opacity:
|
|
533
|
+
maxHeight: T ? k : "0px",
|
|
534
|
+
opacity: T ? 1 : 0,
|
|
535
535
|
transition: "max-height 0.2s ease, opacity 0.2s ease",
|
|
536
|
-
pointerEvents:
|
|
536
|
+
pointerEvents: T ? "auto" : "none"
|
|
537
537
|
},
|
|
538
|
-
children: /* @__PURE__ */ o.jsx("div", { style: { padding:
|
|
538
|
+
children: /* @__PURE__ */ o.jsx("div", { style: { padding: T ? "4px 0" : 0 }, children: g.map((W) => /* @__PURE__ */ o.jsx(
|
|
539
539
|
"div",
|
|
540
540
|
{
|
|
541
541
|
className: "field-menu-item",
|
|
542
|
-
onClick: () => F(
|
|
542
|
+
onClick: () => F(W),
|
|
543
543
|
style: {
|
|
544
544
|
padding: "8px 16px",
|
|
545
545
|
cursor: "pointer",
|
|
@@ -547,9 +547,9 @@ const Be = ({
|
|
|
547
547
|
alignItems: "center",
|
|
548
548
|
justifyContent: "space-between"
|
|
549
549
|
},
|
|
550
|
-
children: /* @__PURE__ */ o.jsx("span", { style: { fontWeight: 500 }, children:
|
|
550
|
+
children: /* @__PURE__ */ o.jsx("span", { style: { fontWeight: 500 }, children: W.label })
|
|
551
551
|
},
|
|
552
|
-
|
|
552
|
+
W.id
|
|
553
553
|
)) })
|
|
554
554
|
}
|
|
555
555
|
)
|
|
@@ -568,7 +568,7 @@ const Be = ({
|
|
|
568
568
|
children: /* @__PURE__ */ o.jsx(
|
|
569
569
|
"button",
|
|
570
570
|
{
|
|
571
|
-
onClick:
|
|
571
|
+
onClick: D,
|
|
572
572
|
style: {
|
|
573
573
|
width: "100%",
|
|
574
574
|
padding: "6px 16px",
|
|
@@ -773,22 +773,22 @@ const Be = ({
|
|
|
773
773
|
menu: n = {},
|
|
774
774
|
list: i = {},
|
|
775
775
|
toolbar: F,
|
|
776
|
-
onReady:
|
|
776
|
+
onReady: D,
|
|
777
777
|
onTrigger: H,
|
|
778
778
|
onFieldInsert: U,
|
|
779
779
|
onFieldUpdate: P,
|
|
780
780
|
onFieldDelete: N,
|
|
781
|
-
onFieldsChange:
|
|
781
|
+
onFieldsChange: R,
|
|
782
782
|
onFieldSelect: V,
|
|
783
|
-
onFieldCreate:
|
|
783
|
+
onFieldCreate: L,
|
|
784
784
|
className: G,
|
|
785
785
|
style: O,
|
|
786
786
|
documentHeight: K = "600px"
|
|
787
787
|
} = a, [v, Y] = z(
|
|
788
788
|
c.initial || []
|
|
789
|
-
), [A, l] = z(null), [g, E] = z(!1), [
|
|
789
|
+
), [A, l] = z(null), [g, E] = z(!1), [T, k] = z(), [W, fe] = z(""), [ee, ie] = z(() => c.available || []), te = Z(null), w = Z(null), I = Z(null), re = Z(c);
|
|
790
790
|
re.current = c;
|
|
791
|
-
const
|
|
791
|
+
const M = Z(null), ne = Z(g);
|
|
792
792
|
ue(() => {
|
|
793
793
|
ne.current = g;
|
|
794
794
|
}, [g]);
|
|
@@ -810,8 +810,8 @@ const Be = ({
|
|
|
810
810
|
f("");
|
|
811
811
|
}, [f]), B = C(
|
|
812
812
|
(t, r) => {
|
|
813
|
-
if (!
|
|
814
|
-
const b =
|
|
813
|
+
if (!w.current?.activeEditor) return !1;
|
|
814
|
+
const b = w.current.activeEditor, y = `field_${Date.now()}`, S = t === "inline" ? b.commands.insertStructuredContentInline?.({
|
|
815
815
|
attrs: {
|
|
816
816
|
id: y,
|
|
817
817
|
alias: r.alias,
|
|
@@ -834,31 +834,31 @@ const Be = ({
|
|
|
834
834
|
};
|
|
835
835
|
Y((m) => {
|
|
836
836
|
const u = [...m, j];
|
|
837
|
-
return
|
|
837
|
+
return R?.(u), u;
|
|
838
838
|
}), U?.(j);
|
|
839
839
|
}
|
|
840
840
|
return S;
|
|
841
841
|
},
|
|
842
|
-
[U,
|
|
842
|
+
[U, R]
|
|
843
843
|
), oe = C(
|
|
844
844
|
(t, r) => {
|
|
845
|
-
if (!
|
|
846
|
-
const y =
|
|
845
|
+
if (!w.current?.activeEditor) return !1;
|
|
846
|
+
const y = w.current.activeEditor.commands.updateStructuredContentById?.(t, {
|
|
847
847
|
attrs: r
|
|
848
848
|
});
|
|
849
849
|
return y && Y((S) => {
|
|
850
850
|
const j = S.map(
|
|
851
851
|
(u) => u.id === t ? { ...u, ...r } : u
|
|
852
852
|
);
|
|
853
|
-
|
|
853
|
+
R?.(j);
|
|
854
854
|
const m = j.find((u) => u.id === t);
|
|
855
855
|
return m && P?.(m), j;
|
|
856
856
|
}), y;
|
|
857
857
|
},
|
|
858
|
-
[P,
|
|
858
|
+
[P, R]
|
|
859
859
|
), h = C(
|
|
860
860
|
(t) => {
|
|
861
|
-
const r =
|
|
861
|
+
const r = w.current?.activeEditor;
|
|
862
862
|
if (!r) {
|
|
863
863
|
console.warn(
|
|
864
864
|
"[SuperDocTemplateBuilder] deleteField called without active editor"
|
|
@@ -867,7 +867,7 @@ const Be = ({
|
|
|
867
867
|
return Y((u) => {
|
|
868
868
|
if (!u.some(($) => $.id === t)) return u;
|
|
869
869
|
const Q = u.filter(($) => $.id !== t);
|
|
870
|
-
return m = !0,
|
|
870
|
+
return m = !0, R?.(Q), Q;
|
|
871
871
|
}), m && (N?.(t), l((u) => u === t ? null : u)), m;
|
|
872
872
|
}
|
|
873
873
|
let b = !1;
|
|
@@ -887,14 +887,14 @@ const Be = ({
|
|
|
887
887
|
if (we(m, y))
|
|
888
888
|
return m;
|
|
889
889
|
const u = m.some(($) => $.id === t), Q = y.some(($) => $.id === t);
|
|
890
|
-
return u && !Q && (j = !0),
|
|
890
|
+
return u && !Q && (j = !0), R?.(y), y;
|
|
891
891
|
}), j && (N?.(t), l((m) => m === t ? null : m)), b || j;
|
|
892
892
|
},
|
|
893
|
-
[N,
|
|
893
|
+
[N, R]
|
|
894
894
|
), _ = C(
|
|
895
895
|
(t) => {
|
|
896
|
-
if (!
|
|
897
|
-
|
|
896
|
+
if (!w.current?.activeEditor) return;
|
|
897
|
+
w.current.activeEditor.commands.selectStructuredContentById?.(t), l(t);
|
|
898
898
|
const b = v.find((y) => y.id === t);
|
|
899
899
|
b && V?.(b);
|
|
900
900
|
},
|
|
@@ -903,9 +903,9 @@ const Be = ({
|
|
|
903
903
|
(t) => {
|
|
904
904
|
if (!t) return;
|
|
905
905
|
const r = Te(t);
|
|
906
|
-
Y((b) => we(b, r) ? b : (
|
|
906
|
+
Y((b) => we(b, r) ? b : (R?.(r), r));
|
|
907
907
|
},
|
|
908
|
-
[
|
|
908
|
+
[R]
|
|
909
909
|
);
|
|
910
910
|
ue(() => te.current ? ((async () => {
|
|
911
911
|
const { SuperDoc: r } = await import("superdoc"), b = {
|
|
@@ -923,12 +923,12 @@ const Be = ({
|
|
|
923
923
|
const ge = j.view.coordsAtPos(u), he = _e(
|
|
924
924
|
new DOMRect(ge.left, ge.top, 0, 0)
|
|
925
925
|
), be = () => {
|
|
926
|
-
const le =
|
|
926
|
+
const le = w.current?.activeEditor;
|
|
927
927
|
if (!le) return;
|
|
928
928
|
const Oe = le.state.selection.from, Pe = le.state.tr.delete(me, Oe);
|
|
929
929
|
le.view.dispatch(Pe);
|
|
930
930
|
};
|
|
931
|
-
|
|
931
|
+
I.current = be, M.current = u, k(he), E(!0), d(), H?.({
|
|
932
932
|
position: { from: me, to: u },
|
|
933
933
|
bounds: he,
|
|
934
934
|
cleanup: be
|
|
@@ -938,16 +938,16 @@ const Be = ({
|
|
|
938
938
|
}
|
|
939
939
|
if (!ne.current)
|
|
940
940
|
return;
|
|
941
|
-
if (
|
|
941
|
+
if (M.current == null) {
|
|
942
942
|
E(!1), d();
|
|
943
943
|
return;
|
|
944
944
|
}
|
|
945
|
-
if (u <
|
|
946
|
-
E(!1),
|
|
945
|
+
if (u < M.current) {
|
|
946
|
+
E(!1), M.current = null, d();
|
|
947
947
|
return;
|
|
948
948
|
}
|
|
949
949
|
const Q = m.doc.textBetween(
|
|
950
|
-
|
|
950
|
+
M.current,
|
|
951
951
|
u
|
|
952
952
|
);
|
|
953
953
|
f(Q);
|
|
@@ -959,7 +959,7 @@ const Be = ({
|
|
|
959
959
|
q(S);
|
|
960
960
|
}), q(S);
|
|
961
961
|
}
|
|
962
|
-
|
|
962
|
+
D?.();
|
|
963
963
|
}
|
|
964
964
|
}, y = new r({
|
|
965
965
|
...b,
|
|
@@ -975,23 +975,25 @@ const Be = ({
|
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
977
|
});
|
|
978
|
-
|
|
978
|
+
w.current = y;
|
|
979
979
|
})(), () => {
|
|
980
|
-
|
|
980
|
+
I.current = null, M.current = null;
|
|
981
|
+
const r = w.current;
|
|
982
|
+
r && typeof r.destroy == "function" && r.destroy(), w.current = null;
|
|
981
983
|
}) : void 0, [
|
|
982
984
|
p?.source,
|
|
983
985
|
p?.mode,
|
|
984
986
|
J,
|
|
985
987
|
q,
|
|
986
|
-
|
|
988
|
+
D,
|
|
987
989
|
H,
|
|
988
990
|
F
|
|
989
991
|
]);
|
|
990
992
|
const pe = C(
|
|
991
993
|
async (t) => {
|
|
992
|
-
if (
|
|
994
|
+
if (I.current && (I.current(), I.current = null), M.current = null, d(), t.id.startsWith("custom_") && L)
|
|
993
995
|
try {
|
|
994
|
-
const r = await
|
|
996
|
+
const r = await L(t);
|
|
995
997
|
if (r) {
|
|
996
998
|
B("inline", {
|
|
997
999
|
alias: r.label,
|
|
@@ -1011,18 +1013,18 @@ const Be = ({
|
|
|
1011
1013
|
defaultValue: t.defaultValue
|
|
1012
1014
|
}), E(!1);
|
|
1013
1015
|
},
|
|
1014
|
-
[B,
|
|
1016
|
+
[B, L, d]
|
|
1015
1017
|
), je = C(() => {
|
|
1016
|
-
E(!1),
|
|
1018
|
+
E(!1), M.current = null, d(), I.current && (I.current(), I.current = null);
|
|
1017
1019
|
}, [d]), Ce = C(() => {
|
|
1018
|
-
if (!
|
|
1020
|
+
if (!w.current?.activeEditor || v.length === 0)
|
|
1019
1021
|
return;
|
|
1020
1022
|
const t = v.findIndex(
|
|
1021
1023
|
(b) => b.id === A
|
|
1022
1024
|
), r = t >= 0 ? (t + 1) % v.length : 0;
|
|
1023
1025
|
_(v[r].id);
|
|
1024
1026
|
}, [v, A, _]), ke = C(() => {
|
|
1025
|
-
if (!
|
|
1027
|
+
if (!w.current?.activeEditor || v.length === 0)
|
|
1026
1028
|
return;
|
|
1027
1029
|
const t = v.findIndex(
|
|
1028
1030
|
(b) => b.id === A
|
|
@@ -1031,7 +1033,7 @@ const Be = ({
|
|
|
1031
1033
|
}, [v, A, _]), Se = C(
|
|
1032
1034
|
async (t) => {
|
|
1033
1035
|
try {
|
|
1034
|
-
await
|
|
1036
|
+
await w.current?.export({
|
|
1035
1037
|
exportType: ["docx"],
|
|
1036
1038
|
exportedName: t?.fileName ? t?.fileName : "document"
|
|
1037
1039
|
});
|
|
@@ -1102,14 +1104,14 @@ const Be = ({
|
|
|
1102
1104
|
Fe,
|
|
1103
1105
|
{
|
|
1104
1106
|
isVisible: g,
|
|
1105
|
-
position:
|
|
1107
|
+
position: T,
|
|
1106
1108
|
availableFields: c.available || [],
|
|
1107
1109
|
filteredFields: ee,
|
|
1108
|
-
filterQuery:
|
|
1110
|
+
filterQuery: W,
|
|
1109
1111
|
allowCreate: c.allowCreate || !1,
|
|
1110
1112
|
onSelect: pe,
|
|
1111
1113
|
onClose: je,
|
|
1112
|
-
onCreateField:
|
|
1114
|
+
onCreateField: L
|
|
1113
1115
|
}
|
|
1114
1116
|
)
|
|
1115
1117
|
]
|