codicent-app-sdk 0.4.6 → 0.4.7
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
|
-
{"version":3,"file":"RecordModal.d.ts","sourceRoot":"","sources":["../../../src/components/RecordModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RecordModal.d.ts","sourceRoot":"","sources":["../../../src/components/RecordModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAoB9C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwHlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("@fluentui/react-components"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("@fluentui/react-components"),o=require("../hooks/useLocalization.js");const t=a.makeStyles({surface:{backgroundColor:a.tokens.colorNeutralBackground1},content:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"400px",maxHeight:"60vh",overflowY:"auto"},field:{display:"flex",flexDirection:"column"}}),l=({open:l,onClose:n,onSave:c,columns:i,initialData:s,title:d})=>{const u=t(),{t:x}=o.default(),[h,p]=r.useState({}),[f,y]=r.useState(!1);r.useEffect((()=>{l&&p(s||{})}),[l,s]);const g=e=>Array.isArray(e.key)?e.key[0]:e.key,k=e=>{if(Array.isArray(e.key))for(const r of e.key)if(void 0!==h[r])return r;return g(e)},j=(e,r)=>{const a=k(e);p((e=>({...e,[a]:r})))},m=i.filter((e=>!e.hidden&&"file"!==e.type&&"createdAt"!==g(e)));return e.jsx(a.Dialog,{open:l,onOpenChange:(e,r)=>!f&&!1===r.open&&n(),children:e.jsx(a.DialogSurface,{className:u.surface,backdrop:{style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}},children:e.jsxs(a.DialogBody,{children:[e.jsx(a.DialogTitle,{children:d||x(s?"Edit Record":"Add Record")}),e.jsx(a.DialogContent,{className:u.content,children:m.map(((r,o)=>{const t=g(r),l=(e=>{const r=k(e);return h[r]})(r),n=r.title||t;return"checkbox"===r.type?e.jsx(a.Field,{label:n,className:u.field,children:e.jsx(a.Checkbox,{checked:!0===l||"true"===l||"yes"===l||"1"===l,onChange:(e,a)=>j(r,a.checked)})},o):"textarea"===r.type?e.jsx(a.Field,{label:n,className:u.field,children:e.jsx(a.Textarea,{value:String(l??""),rows:r.rows??3,onChange:(e,a)=>j(r,a.value),placeholder:x("Enter")+" "+n.toLowerCase(),resize:"vertical"})},o):e.jsx(a.Field,{label:n,className:u.field,children:e.jsx(a.Input,{value:String(l??""),onChange:(e,a)=>j(r,a.value),placeholder:x("Enter")+" "+n.toLowerCase()})},o)}))}),e.jsxs(a.DialogActions,{children:[e.jsx(a.Button,{appearance:"secondary",onClick:n,disabled:f,children:x("Cancel")}),e.jsx(a.Button,{appearance:"primary",onClick:async()=>{y(!0);try{await c(h),n()}catch(e){console.error("Failed to save record:",e)}finally{y(!1)}},disabled:f,children:x(f?"Saving...":"Save")})]})]})})})};exports.RecordModal=l,exports.default=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordModal.d.ts","sourceRoot":"","sources":["../../../src/components/RecordModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RecordModal.d.ts","sourceRoot":"","sources":["../../../src/components/RecordModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAoB9C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwHlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as a,useEffect as
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as a,useEffect as o}from"react";import{makeStyles as n,tokens as l,Dialog as c,DialogSurface as t,DialogBody as i,DialogTitle as s,DialogContent as d,Field as p,Checkbox as h,Textarea as u,Input as f,DialogActions as m,Button as y}from"@fluentui/react-components";import k from"../hooks/useLocalization.js";const g=n({surface:{backgroundColor:l.colorNeutralBackground1},content:{display:"flex",flexDirection:"column",gap:"16px",minWidth:"400px",maxHeight:"60vh",overflowY:"auto"},field:{display:"flex",flexDirection:"column"}}),v=({open:n,onClose:l,onSave:v,columns:C,initialData:x,title:b})=>{const w=g(),{t:A}=k(),[N,S]=a({}),[D,E]=a(!1);o((()=>{n&&S(x||{})}),[n,x]);const L=e=>Array.isArray(e.key)?e.key[0]:e.key,j=e=>{if(Array.isArray(e.key))for(const r of e.key)if(void 0!==N[r])return r;return L(e)},z=(e,r)=>{const a=j(e);S((e=>({...e,[a]:r})))},R=C.filter((e=>!e.hidden&&"file"!==e.type&&"createdAt"!==L(e)));return e(c,{open:n,onOpenChange:(e,r)=>!D&&!1===r.open&&l(),children:e(t,{className:w.surface,backdrop:{style:{backgroundColor:"rgba(0, 0, 0, 0.4)"}},children:r(i,{children:[e(s,{children:b||A(x?"Edit Record":"Add Record")}),e(d,{className:w.content,children:R.map(((r,a)=>{const o=L(r),n=(e=>{const r=j(e);return N[r]})(r),l=r.title||o;return"checkbox"===r.type?e(p,{label:l,className:w.field,children:e(h,{checked:!0===n||"true"===n||"yes"===n||"1"===n,onChange:(e,a)=>z(r,a.checked)})},a):"textarea"===r.type?e(p,{label:l,className:w.field,children:e(u,{value:String(n??""),rows:r.rows??3,onChange:(e,a)=>z(r,a.value),placeholder:A("Enter")+" "+l.toLowerCase(),resize:"vertical"})},a):e(p,{label:l,className:w.field,children:e(f,{value:String(n??""),onChange:(e,a)=>z(r,a.value),placeholder:A("Enter")+" "+l.toLowerCase()})},a)}))}),r(m,{children:[e(y,{appearance:"secondary",onClick:l,disabled:D,children:A("Cancel")}),e(y,{appearance:"primary",onClick:async()=>{E(!0);try{await v(N),l()}catch(e){console.error("Failed to save record:",e)}finally{E(!1)}},disabled:D,children:A(D?"Saving...":"Save")})]})]})})})};export{v as RecordModal,v as default};
|