@entropic-bond/crud-panel 4.1.0 → 4.1.1

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.
@@ -43,3 +43,4 @@ Check the render method of \``+e+"`."}return""}function on(e){if(e!==void 0){var
43
43
  Check your code at `+r+":"+i+"."}return""}function sn(e){return e!=null?on(e.__source):""}var Nt={};function an(e){var r=It();if(!r){var i=typeof e=="string"?e:e.displayName||e.name;i&&(r=`
44
44
 
45
45
  Check the top-level render call using <`+i+">.")}return r}function Ft(e,r){if(!(!e._store||e._store.validated||e.key!=null)){e._store.validated=!0;var i=an(r);if(!Nt[i]){Nt[i]=!0;var a="";e&&e._owner&&e._owner!==L.current&&(a=" It was passed a child from "+Z(e._owner.type)+"."),pe(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,a),pe(null)}}}function $t(e,r){if(typeof e=="object"){if(Te(e))for(var i=0;i<e.length;i++){var a=e[i];de(a)&&Ft(a,r)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var u=ce(e);if(typeof u=="function"&&u!==e.entries)for(var p=u.call(e),d;!(d=p.next()).done;)de(d.value)&&Ft(d.value,r)}}}function Mt(e){{var r=e.type;if(r==null||typeof r=="string")return;var i;if(typeof r=="function")i=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===z||r.$$typeof===W))i=r.propTypes;else return;if(i){var a=Z(r);nn(i,e.props,"prop",a,e)}else if(r.PropTypes!==void 0&&!Xe){Xe=!0;var u=Z(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function un(e){{for(var r=Object.keys(e.props),i=0;i<r.length;i++){var a=r[i];if(a!=="children"&&a!=="key"){pe(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",a),pe(null);break}}e.ref!==null&&(pe(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),pe(null))}}function Lt(e,r,i){var a=Et(e);if(!a){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" 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 p=sn(r);p?u+=p:u+=It();var d;e===null?d="null":Te(e)?d="array":e!==void 0&&e.$$typeof===l?(d="<"+(Z(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,h("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,u)}var m=Er.apply(this,arguments);if(m==null)return m;if(a)for(var b=2;b<arguments.length;b++)$t(arguments[b],e);return e===y?un(m):Mt(m),m}var Ut=!1;function cn(e){var r=Lt.bind(null,e);return r.type=e,Ut||(Ut=!0,X("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(r,"type",{enumerable:!1,get:function(){return X("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),r}function ln(e,r,i){for(var a=wr.apply(this,arguments),u=2;u<arguments.length;u++)$t(arguments[u],a.type);return Mt(a),a}function fn(e,r){var i=G.transition;G.transition={};var a=G.transition;G.transition._updatedFibers=new Set;try{e()}finally{if(G.transition=i,i===null&&a._updatedFibers){var u=a._updatedFibers.size;u>10&&X("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),a._updatedFibers.clear()}}}var Vt=!1,Me=null;function dn(e){if(Me===null)try{var r=("require"+Math.random()).slice(0,7),i=n&&n[r];Me=i.call(n,"timers").setImmediate}catch{Me=function(u){Vt===!1&&(Vt=!0,typeof MessageChannel>"u"&&h("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var p=new MessageChannel;p.port1.onmessage=u,p.port2.postMessage(void 0)}}return Me(e)}var he=0,xt=!1;function pn(e){{var r=he;he++,A.current===null&&(A.current=[]);var i=A.isBatchingLegacy,a;try{if(A.isBatchingLegacy=!0,a=e(),!i&&A.didScheduleLegacyUpdate){var u=A.current;u!==null&&(A.didScheduleLegacyUpdate=!1,tt(u))}}catch(T){throw Le(r),T}finally{A.isBatchingLegacy=i}if(a!==null&&typeof a=="object"&&typeof a.then=="function"){var p=a,d=!1,m={then:function(T,j){d=!0,p.then(function(N){Le(r),he===0?Ze(N,T,j):T(N)},function(N){Le(r),j(N)})}};return!xt&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){d||(xt=!0,h("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),m}else{var b=a;if(Le(r),he===0){var C=A.current;C!==null&&(tt(C),A.current=null);var S={then:function(T,j){A.current===null?(A.current=[],Ze(b,T,j)):T(b)}};return S}else{var O={then:function(T,j){T(b)}};return O}}}}function Le(e){e!==he-1&&h("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),he=e}function Ze(e,r,i){{var a=A.current;if(a!==null)try{tt(a),dn(function(){a.length===0?(A.current=null,r(e)):Ze(e,r,i)})}catch(u){i(u)}else r(e)}}var et=!1;function tt(e){if(!et){et=!0;var r=0;try{for(;r<e.length;r++){var i=e[r];do i=i(!0);while(i!==null)}e.length=0}catch(a){throw e=e.slice(r+1),a}finally{et=!1}}}var hn=Lt,mn=ln,yn=cn,vn={map:Ae,forEach:Dr,count:Or,toArray:Tr,only:kr};t.Children=vn,t.Component=_,t.Fragment=y,t.Profiler=F,t.PureComponent=$,t.StrictMode=D,t.Suspense=H,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Y,t.cloneElement=mn,t.createContext=jr,t.createElement=hn,t.createFactory=yn,t.createRef=pr,t.forwardRef=Fr,t.isValidElement=de,t.lazy=Nr,t.memo=$r,t.startTransition=fn,t.unstable_act=pn,t.useCallback=Hr,t.useContext=Mr,t.useDebugValue=qr,t.useDeferredValue=Gr,t.useEffect=xr,t.useId=Jr,t.useImperativeHandle=zr,t.useInsertionEffect=Wr,t.useLayoutEffect=Yr,t.useMemo=Br,t.useReducer=Ur,t.useRef=Vr,t.useState=Lr,t.useSyncExternalStore=Qr,t.useTransition=Kr,t.version=s,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(ve,ve.exports)),ve.exports}process.env.NODE_ENV==="production"?We.exports=lr():We.exports=fr();var ue=We.exports;const V=cr(ue);class dr extends ue.Component{constructor(t){super(t),this.unfilteredDocuments=[],this.state={documents:[],mode:0}}async componentDidMount(){const{controller:t}=this.props;this.unsubscriber=t.onChange(s=>{s.documentCollection&&(this.unfilteredDocuments=s.documentCollection,this.setState({documents:t.filter(this.unfilteredDocuments)})),s.action==="filterChange"?this.setState({documents:t.filter(this.unfilteredDocuments)}):this.setState({})}),this.unfilteredDocuments=await t.documentCollection(),this.setState({documents:t.filter(this.unfilteredDocuments)})}componentWillUnmount(){var t;(t=this.unsubscriber)==null||t.call(this)}newDocument(){this.props.controller.newDocument(),this.setState({mode:1})}editDocument(t){this.props.controller.setDocument(t),this.setState({mode:2})}async storeDocument(t){const{controller:s,layout:l}=this.props;s.setDocument(t),await s.storeDocument(),l==="formAndItems"?this.newDocument():this.setState({mode:0})}invokeContentViewChild(t){const{children:s,layout:l,controller:c}=this.props,{mode:y}=this.state,D=l!=="formAndItems";if(!c.document)return;const F={controller:c,submitButtonCaption:y==2?t==null?void 0:t.updateButtonLabel:t==null?void 0:t.addButtonLabel,onSubmit:x=>this.storeDocument(x),onCancel:D?()=>this.setState({mode:0}):()=>this.newDocument()};return typeof s[0]=="function"?ue.cloneElement(s[0](F),{key:c.document.id}):ue.cloneElement(s[0],{key:c.document.id,...F})}invokeDetailViewChild(t){const{children:s,controller:l}=this.props,c={document:t,onSelect:y=>this.editDocument(y),onDelete:y=>l.setDocument(y).deleteDocument()};return typeof s[1]=="function"?ue.cloneElement(s[1](c),{key:t.id}):ue.cloneElement(s[1],{key:t.id,...c})}render(){var W;const{mode:t,documents:s}=this.state,{className:l,cardAddButton:c,controller:y}=this.props,D=ar((W=y.document)==null?void 0:W.className);let F=this.props.labels||{};const x=this.props.layout||"itemsAlways";typeof F=="function"&&(F=F(y));const{addNewDocumentLabel:B,singularDocumentInCollectionCaption:z,documentsInCollectionCaption:H,noDocumentsFoundLabel:ne}=F;return V.createElement("div",{className:`crud-panel ${D} ${l||""}`},t===0&&x!=="formAndItems"&&!c&&V.createElement("div",{className:"header"},this.props.header?typeof this.props.header=="function"?this.props.header(y,()=>this.newDocument(),F):this.props.header:V.createElement("button",{onClick:()=>this.newDocument()},B)),(x==="formAndItems"||t===1||t===2)&&V.createElement("div",{className:"content-panel"},this.invokeContentViewChild(F)),(x==="itemsAlways"||x==="formAndItems"||t===0)&&V.createElement("div",{className:"collection-panel"},(s==null?void 0:s.length)>0&&V.createElement("h3",null,s.length>1?H:z||H),V.createElement("div",{className:"documents"},c&&V.createElement("div",{className:"crud-card card-add-button clickable",onClick:()=>this.newDocument()},V.createElement("div",{className:"button-element"},c),V.createElement("div",{className:"add-label"},B)),s!=null&&s.length?s.map(q=>this.invokeDetailViewChild(q)):V.createElement("p",null,ne))),V.createElement("div",{className:"footer"},this.props.footer&&typeof this.props.footer=="function"?this.props.footer(y,()=>this.newDocument(),F):this.props.footer))}}ee.CrudController=xe,ee.CrudPanel=dr,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})});
46
+ //# sourceMappingURL=entropic-bond-crud-panel.umd.cjs.map