codicent-app-sdk 0.4.0 → 0.4.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),l=require("../hooks/useLocalization.js"),i=require("../node_modules/@griffel/react/makeStyles.esm.js"),n=require("../node_modules/@fluentui/react-dialog/lib/components/Dialog/Dialog.js"),t=require("../node_modules/@fluentui/react-dialog/lib/components/DialogSurface/DialogSurface.js"),a=require("../node_modules/@fluentui/react-dialog/lib/components/DialogBody/DialogBody.js"),r=require("../node_modules/@fluentui/react-dialog/lib/components/DialogTitle/DialogTitle.js"),s=require("../node_modules/@fluentui/react-dialog/lib/components/DialogContent/DialogContent.js"),c=require("../node_modules/@fluentui/react-field/lib/components/Field/Field.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),l=require("../hooks/useLocalization.js"),i=require("../node_modules/@griffel/react/makeStyles.esm.js"),n=require("../node_modules/@fluentui/react-dialog/lib/components/Dialog/Dialog.js"),t=require("../node_modules/@fluentui/react-dialog/lib/components/DialogSurface/DialogSurface.js"),a=require("../node_modules/@fluentui/react-dialog/lib/components/DialogBody/DialogBody.js"),r=require("../node_modules/@fluentui/react-dialog/lib/components/DialogTitle/DialogTitle.js"),s=require("../node_modules/@fluentui/react-dialog/lib/components/DialogContent/DialogContent.js"),c=require("../node_modules/@fluentui/react-field/lib/components/Field/Field.js"),d=require("../node_modules/@fluentui/react-checkbox/lib/components/Checkbox/Checkbox.js"),u=require("../node_modules/@fluentui/react-input/lib/components/Input/Input.js"),p=require("../node_modules/@fluentui/react-dialog/lib/components/DialogActions/DialogActions.js"),m=require("../node_modules/@fluentui/react-button/lib/components/Button/Button.js");const g=i.makeStyles({content:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"400px",maxHeight:"60vh",overflowY:"auto"},field:{display:"flex",flexDirection:"column"}}),f=({open:i,onClose:f,onSave:x,columns:h,initialData:j,title:b})=>{const y=g(),{t:D}=l.default(),[k,C]=o.useState({}),[q,_]=o.useState(!1);o.useEffect((()=>{i&&C(j||{})}),[i,j]);const S=e=>Array.isArray(e.key)?e.key[0]:e.key,v=(e,o)=>{const l=S(e);C((e=>({...e,[l]:o})))},A=h.filter((e=>!e.hidden&&"file"!==e.type&&"createdAt"!==S(e)));return e.jsx(n.Dialog,{open:i,onOpenChange:(e,o)=>!q&&!1===o.open&&f(),children:e.jsx(t.DialogSurface,{backdrop:{style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}},children:e.jsxs(a.DialogBody,{children:[e.jsx(r.DialogTitle,{children:b||D(j?"Edit Record":"Add Record")}),e.jsx(s.DialogContent,{className:y.content,children:A.map(((o,l)=>{const i=S(o),n=(e=>{const o=S(e);return k[o]})(o),t=o.title||i;return"checkbox"===o.type?e.jsx(c.Field,{label:t,className:y.field,children:e.jsx(d.Checkbox,{checked:!0===n||"true"===n||"yes"===n||"1"===n,onChange:(e,l)=>v(o,l.checked)})},l):e.jsx(c.Field,{label:t,className:y.field,children:e.jsx(u.Input,{value:String(n??""),onChange:(e,l)=>v(o,l.value),placeholder:D("Enter")+" "+t.toLowerCase()})},l)}))}),e.jsxs(p.DialogActions,{children:[e.jsx(m.Button,{appearance:"secondary",onClick:f,disabled:q,children:D("Cancel")}),e.jsx(m.Button,{appearance:"primary",onClick:async()=>{_(!0);try{await x(k),f()}catch(e){console.error("Failed to save record:",e)}finally{_(!1)}},disabled:q,children:D(q?"Saving...":"Save")})]})]})})})};exports.RecordModal=f,exports.default=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as n,useEffect as
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as n,useEffect as l}from"react";import t from"../hooks/useLocalization.js";import{makeStyles as i}from"../node_modules/@griffel/react/makeStyles.esm.js";import{Dialog as r}from"../node_modules/@fluentui/react-dialog/lib/components/Dialog/Dialog.js";import{DialogSurface as a}from"../node_modules/@fluentui/react-dialog/lib/components/DialogSurface/DialogSurface.js";import{DialogBody as c}from"../node_modules/@fluentui/react-dialog/lib/components/DialogBody/DialogBody.js";import{DialogTitle as d}from"../node_modules/@fluentui/react-dialog/lib/components/DialogTitle/DialogTitle.js";import{DialogContent as s}from"../node_modules/@fluentui/react-dialog/lib/components/DialogContent/DialogContent.js";import{Field as m}from"../node_modules/@fluentui/react-field/lib/components/Field/Field.js";import{Checkbox as u}from"../node_modules/@fluentui/react-checkbox/lib/components/Checkbox/Checkbox.js";import{Input as p}from"../node_modules/@fluentui/react-input/lib/components/Input/Input.js";import{DialogActions as f}from"../node_modules/@fluentui/react-dialog/lib/components/DialogActions/DialogActions.js";import{Button as g}from"../node_modules/@fluentui/react-button/lib/components/Button/Button.js";const h=i({content:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"400px",maxHeight:"60vh",overflowY:"auto"},field:{display:"flex",flexDirection:"column"}}),b=({open:i,onClose:b,onSave:y,columns:k,initialData:D,title:j})=>{const x=h(),{t:C}=t(),[_,v]=n({}),[S,A]=n(!1);l((()=>{i&&v(D||{})}),[i,D]);const B=e=>Array.isArray(e.key)?e.key[0]:e.key,w=(e,o)=>{const n=B(e);v((e=>({...e,[n]:o})))},F=k.filter((e=>!e.hidden&&"file"!==e.type&&"createdAt"!==B(e)));return e(r,{open:i,onOpenChange:(e,o)=>!S&&!1===o.open&&b(),children:e(a,{backdrop:{style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}},children:o(c,{children:[e(d,{children:j||C(D?"Edit Record":"Add Record")}),e(s,{className:x.content,children:F.map(((o,n)=>{const l=B(o),t=(e=>{const o=B(e);return _[o]})(o),i=o.title||l;return"checkbox"===o.type?e(m,{label:i,className:x.field,children:e(u,{checked:!0===t||"true"===t||"yes"===t||"1"===t,onChange:(e,n)=>w(o,n.checked)})},n):e(m,{label:i,className:x.field,children:e(p,{value:String(t??""),onChange:(e,n)=>w(o,n.value),placeholder:C("Enter")+" "+i.toLowerCase()})},n)}))}),o(f,{children:[e(g,{appearance:"secondary",onClick:b,disabled:S,children:C("Cancel")}),e(g,{appearance:"primary",onClick:async()=>{A(!0);try{await y(_),b()}catch(e){console.error("Failed to save record:",e)}finally{A(!1)}},disabled:S,children:C(S?"Saving...":"Save")})]})]})})})};export{b as RecordModal,b as default};
|