@dartech/arsenal-ui 0.1.4 → 0.2.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.
- package/index.js +1 -0
- package/package.json +15 -9
- package/src/interfaces/definition.d.ts +7 -7
- package/src/interfaces/ui.d.ts +5 -5
- package/src/lib/Alert/Alert.d.ts +1 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +1 -1
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +1 -1
- package/src/lib/Definition/DefinitionValueView/DefinitionValueView.d.ts +1 -1
- package/src/lib/Definition/DefinitionValueView/PropertyDataView.d.ts +1 -1
- package/src/lib/Forms/BackButton.d.ts +1 -1
- package/src/lib/Forms/ControlDate.d.ts +1 -1
- package/src/lib/Forms/ControlDateTime.d.ts +1 -1
- package/src/lib/Forms/ControlInput.d.ts +2 -2
- package/src/lib/Forms/ControlNumberInput.d.ts +2 -2
- package/src/lib/Forms/ControlSelect.d.ts +2 -2
- package/src/lib/Forms/ControlSwitch.d.ts +1 -1
- package/src/lib/Forms/ControlTime.d.ts +1 -1
- package/src/lib/InfoItem/InfoItem.d.ts +1 -1
- package/src/lib/InfoItem/styles.d.ts +1 -1
- package/src/lib/JsonPathPicker/JsonPathPicker.d.ts +1 -1
- package/src/lib/JsonPathPicker/PropertyStep.d.ts +1 -1
- package/src/lib/JsonView/JsonView.d.ts +1 -1
- package/src/lib/Loader/Loader.d.ts +1 -1
- package/src/lib/Modals/JsonModalView.d.ts +1 -1
- package/src/lib/Property/PropertyFiller/JsonEditor.d.ts +1 -1
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +1 -1
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +1 -1
- package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +1 -1
- package/src/lib/Property/PropertyFiller/usePropertyFiller.d.ts +1 -1
- package/src/lib/Property/PropertyFiller/useStyles.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/BooleanValueField.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/DateTimeValueField.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/DateValueField.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/JsonValueField.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/PropertyValue.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/PropertyValueField.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/StringValueField.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/TimeValueField.d.ts +1 -1
- package/src/lib/Property/PropertyValueField/ValueComponent.d.ts +1 -1
- package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/CustomPropertyField.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/BigDecimalPropertyFields.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/DateAdditionalFields.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityReferencePropertyFields.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +1 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/StringPropertyFields.d.ts +1 -1
- package/src/lib/Property/ViewPropertiesList/ViewPropertiesList.d.ts +1 -1
- package/src/lib/Property/ViewProperty/EntityPropertiesShortView.d.ts +2 -4
- package/src/lib/Property/ViewProperty/EntityPropertiesView.d.ts +1 -1
- package/src/lib/Property/ViewProperty/PropertyDataTable.d.ts +1 -1
- package/src/lib/Property/ViewProperty/PropertyItem.d.ts +1 -1
- package/src/lib/Property/ViewProperty/ViewProperty.d.ts +1 -1
- package/src/lib/Status/Status.d.ts +1 -1
- package/src/lib/Status/styles.d.ts +1 -1
- package/src/lib/StepperView/StepperView.d.ts +2 -2
- package/src/lib/Table/TableAction.d.ts +1 -1
- package/src/lib/Table/styles.d.ts +1 -1
- package/src/lib/TemplateContent/TemplateContentEditor.d.ts +1 -1
- package/src/utils/common.d.ts +1 -1
- package/index.esm.js +0 -1
- package/index.umd.js +0 -1
package/index.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import n from"@mui/material/Button";import i from"@mui/material/Dialog";import a from"@mui/material/DialogActions";import l from"@mui/material/DialogContent";import o from"@mui/material/DialogContentText";import s from"@mui/material/DialogTitle";import c from"@mui/material/Box";import d from"@mui/material/CircularProgress";import{__rest as p,__awaiter as u}from"tslib";import{useController as m,useWatch as h,useFormContext as g,Controller as b}from"react-hook-form";import f from"@mui/material/TextField";import y,{useRef as v,useEffect as O,useState as T,useMemo as E,useCallback as C,memo as x}from"react";import j from"@mui/material/MenuItem";import N from"@mui/material/Checkbox";import S from"@mui/material/FormControlLabel";import I from"@mui/material/Radio";import k from"@mui/material/RadioGroup";import w from"@mui/lab/Autocomplete";import P from"@mui/icons-material/FileCopyOutlined";import A from"@mui/material/Tooltip";import V from"@mui/material/IconButton";import q from"@mui/icons-material/ArrowBack";import{useHistory as L,useLocation as R,Link as M}from"react-router-dom";import $ from"react-ace";import D from"@mui/material/Typography";import F from"@mui/material/FormHelperText";import z from"@mui/material/Switch";import{DatePicker as B}from"@mui/x-date-pickers/DatePicker";import{format as J,isMatch as G,isValid as Y,parse as _}from"date-fns";import{DateTimePicker as W}from"@mui/x-date-pickers/DateTimePicker";import{TimePicker as H}from"@mui/x-date-pickers/TimePicker";import U from"@mui/lab/Pagination";import K from"@mui/material/TablePagination";import{useGridApiContext as X,useGridSelector as Z,gridPageSelector as Q,gridPageCountSelector as ee,gridRowCountSelector as re,gridPageSizeSelector as te,GridColumnMenuContainer as ne,GridFilterMenuItem as ie,DataGrid as ae,GridActionsCellItem as le}from"@mui/x-data-grid";import{makeStyles as oe}from"@mui/styles";import se from"@mui/material/Paper";import ce from"@mui/material/Tab";import de from"@mui/material/Tabs";import pe from"@mui/material/Unstable_Grid2";import ue from"@mui/material/Accordion";import me from"@mui/material/AccordionSummary";import he from"@mui/material/AccordionDetails";import ge from"@mui/material/AccordionActions";import be from"@mui/icons-material/ExpandMore";import fe from"@mui/material/Stepper";import ye from"@mui/material/Step";import ve from"@mui/material/StepLabel";import Oe from"@mui/material/StepContent";import Te from"@mui/material/StepConnector";import Ee from"@mui/material/Chip";import Ce from"@mui/icons-material/Add";import xe from"@mui/material/Select";import je from"@mui/material/FormControl";import Ne from"@mui/material/InputLabel";import Se from"@mui/icons-material/Close";import Ie from"@mui/material/Table";import ke from"@mui/material/TableBody";import we from"@mui/material/TableRow";import Pe from"@mui/material/TableCell";import Ae from"@mui/icons-material/CheckCircle";import Ve from"classnames";import{toast as qe}from"react-toastify";import Le from"mui-rte";import{createTheme as Re,ThemeProvider as Me}from"@mui/material/styles";import{convertToRaw as $e,EditorState as De,convertFromHTML as Fe,ContentState as ze,Modifier as Be}from"draft-js";import Je from"@mui/icons-material/Functions";import Ge from"@mui/icons-material/NotInterested";var Ye;!function(e){e.STRING="STRING",e.INTEGER="INTEGER",e.BIG_INTEGER="BIG_INTEGER",e.BIG_DECIMAL="BIG_DECIMAL",e.FLOAT="FLOAT",e.LONG="LONG",e.DOUBLE="DOUBLE",e.BOOLEAN="BOOLEAN",e.ENTITY_REFERENCE="ENTITY_REFERENCE",e.ENTITY="ENTITY",e.JSON="JSON",e.DATE="DATE",e.TIME="TIME",e.DATE_TIME="DATE_TIME"}(Ye||(Ye={}));const _e="yyyy-MM-dd",We="HH:mm:ss",He="yyyy-MM-dd'T'HH:mm:ss.SSSXXX";var Ue;!function(e){e.UP="UP",e.DOWN="DOWN",e.CEILING="CEILING",e.FLOOR="FLOOR",e.HALF_UP="HALF_UP",e.HALF_DOWN="HALF_DOWN",e.HALF_EVEN="HALF_EVEN",e.UNNECESSARY="UNNECESSARY"}(Ue||(Ue={}));const Ke=({transparent:r,position:t})=>e(c,Object.assign({position:null!=t?t:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:r?"none":"rgba(255, 255, 255, .3)",zIndex:10},{children:e(d,{})})),Xe=({open:t,title:d,description:p,closeButtonTitle:u="Close",onClose:m,confirmButtonTitle:h="Confirm",confirmButtonDisabled:g=!1,onConfirm:b,children:f,dialogProps:y,loading:v,maxWidth:O="xs"})=>e("div",{children:r(i,Object.assign({open:t,onClose:m,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",fullWidth:!0,maxWidth:O},y,{children:[v&&e(Ke,{}),e(s,Object.assign({id:"alert-dialog-title"},{children:d})),r(l,{children:[p&&e(o,Object.assign({id:"alert-dialog-description"},{children:p})),e(c,Object.assign({maxWidth:"100%",overflow:"hidden"},{children:f}))]}),r(a,{children:[e(n,Object.assign({onClick:m,color:"primary",variant:"contained"},{children:u})),h&&b?e(n,Object.assign({onClick:b,color:"secondary",variant:"contained",autoFocus:!0,disabled:g},{children:h})):null]})]}))}),Ze=({inputProps:r,name:t,control:n,required:i,validate:a,label:l="",variant:o="outlined",type:s="text",defaultValue:c="",disabled:d,InputLabelProps:u,textarea:g,hideErrorMessage:b=!1})=>{const y=m({name:t,control:n,defaultValue:c,rules:{required:i&&"Please, fill this field",validate:a}}),v=y.field,{ref:O}=v,T=p(v,["ref"]),{fieldState:{error:E}}=y,C=h({control:n,name:t});return e(f,Object.assign({fullWidth:!0,size:"small",inputRef:O,type:s,label:l,error:!!E,helperText:!b&&(null==E?void 0:E.message),disabled:d,variant:o,InputLabelProps:u,inputProps:r,multiline:g,minRows:g?3:1,value:C||""},T))};function Qe(e,r){const t=v();O((()=>()=>{t.current&&clearTimeout(t.current)}),[]);return(...n)=>{clearTimeout(t.current),t.current=setTimeout((()=>{e(...n)}),r)}}const er=()=>{const[e,r]=T(!1);return{open:e,toggle:()=>{r((e=>!e))},onClose:()=>{r(!1)},onOpen:()=>{r(!0)}}},rr=({inputProps:r,name:t,required:n,validate:i,label:a="",variant:l="outlined",type:o="text",defaultValue:s="",disabled:c,InputLabelProps:d,textarea:u})=>{const{setValue:m,control:h,getValues:y}=g(),[v,O]=T(""),x=Qe((e=>{m(t,e.target.value)}),350);E((()=>{const e=y(t);O(e)}),[y,t]);const j=C((e=>{O(e.target.value),x(e)}),[x]);return e(b,{name:t,control:h,defaultValue:s,rules:{required:n&&"Required field",validate:i},render:t=>{var n=t.field,{ref:i,value:s}=n,m=p(n,["ref","value"]),{fieldState:{error:h}}=t;return e(f,Object.assign({fullWidth:!0,size:"small",inputRef:i,type:o,label:a,error:!!h,helperText:null==h?void 0:h.message,disabled:c,variant:l,InputLabelProps:d,inputProps:r,multiline:u,minRows:u?3:1},m,{onChange:j,value:v}))}})},tr=({inputProps:r,selectProps:t,name:n,control:i,required:a,defaultValue:l,options:o,variant:s="outlined",validate:c,labelKey:d,valueKey:u,label:h="",disabled:g=!1})=>{const b=m({name:n,defaultValue:l,control:i,rules:{required:a&&"Required field",validate:c}}),y=b.field,{ref:v,value:O}=y,T=p(y,["ref","value"]),{fieldState:{error:E}}=b,x=C((e=>"string"==typeof e?e:u?e[u]:e.value),[u]),N=C((e=>"string"==typeof e?e:d?e[d]:e.label),[d]);return e(f,Object.assign({size:"small",select:!0,fullWidth:!0,error:!!E,inputRef:v,ref:v,helperText:null==E?void 0:E.message,SelectProps:t,variant:s,label:h,disabled:g,inputProps:Object.assign({},r),value:O||""},T,{children:null==o?void 0:o.map((r=>e(j,Object.assign({value:x(r)},{children:N(r)}),x(r))))}))},nr=({name:r,control:t,label:n,disabled:i,onChange:a})=>e(S,{label:n,control:e(b,{control:t,name:r,render:({field:r})=>e(N,Object.assign({color:"primary",size:"small"},r,{onChange:(e,t)=>a?a(r.name,t):r.onChange(e),checked:r.value,disabled:i}))})}),ir=({name:r,values:t,control:n})=>e(b,{control:n,name:r,render:({field:r})=>e(k,Object.assign({row:!0},r,{children:t.map((r=>e(S,{value:r,control:e(I,{}),label:r})))}))}),ar=({control:r,name:t,options:n,label:i,placeholder:a,multiple:l,required:o,disableCloseOnSelect:s=!1,labelKey:c,valueKey:d,loading:p,onChange:u,getOptionDisabled:m})=>{C(((e,r)=>{if(e&&r){if("string"==typeof e)return e===r;if(d)return e[d]===r[d]||e[d]===r;if(e.value)return e.value===r.value||e.value===r}return!1}),[]);const h=C((e=>e?"string"==typeof e?e:c&&e[c]?e[c]:e.label||e.name||e.value||e.code||"":""),[n]);return e(b,{name:t,control:r,rules:{required:o&&"Required field"},render:({field:r,fieldState:t})=>e(w,Object.assign({},r,{multiple:l,size:"small",disableCloseOnSelect:s||l,filterSelectedOptions:l,disablePortal:!0,loading:p,options:n,getOptionLabel:h,getOptionDisabled:m||null,value:r.value||null,onChange:(e,t)=>u?u(r.name,t):r.onChange(t),renderInput:r=>{var n;return e(f,Object.assign({},r,{label:i,variant:"outlined",helperText:null===(n=t.error)||void 0===n?void 0:n.message,placeholder:a,error:!!t.error}))}}))})},lr=({name:t,label:n,placeholder:i,queryFunction:a})=>{const{control:l,setValue:o}=g(),[s,c]=T(!1),[p,u]=T(""),[m,h]=T(""),[v,E]=T(null),[x,j]=T([]),[N,S]=T(0),[I,k]=T(1),P=Qe((e=>{u(e),k(1),j([])}),500),A=C(((e,r)=>{h(r),P(r)}),[P]),V=C(((e,r)=>{E(r),o(t,r)}),[t,o]),q=e=>{const r=e.currentTarget;r.scrollTop+r.clientHeight===r.scrollHeight&&x.length<N&&k(I+1)};return O((()=>{a(p,I).then((({options:e,totalItems:r})=>{j((r=>[...r,...e])),S(r)})).catch((e=>console.log(e))).finally((()=>c(!1)))}),[I,a,p]),e(b,{control:l,name:t,render:({field:t})=>e(w,{style:{width:300,margin:"auto"},size:"small",options:x,inputValue:m,filterOptions:e=>e,loading:s,value:v,onChange:V,clearOnBlur:!1,onInputChange:A,ListboxProps:{onScroll:q},renderInput:t=>e(f,Object.assign({},t,{label:n,variant:"outlined",placeholder:i,InputProps:Object.assign(Object.assign({},t.InputProps),{endAdornment:r(y.Fragment,{children:[s?e(d,{color:"inherit",size:20}):null,t.InputProps.endAdornment]})})}))})})},or=({copyText:r,helpText:t="Copy"})=>{const[n,i]=T(t);return n?e(A,Object.assign({title:n,placement:"top"},{children:e(V,Object.assign({onClick:()=>{navigator.clipboard.writeText(r),i("Copied!"),setTimeout((()=>{i(t)}),1e3)}},{children:e(P,{fontSize:"small"})}))})):null},sr=({text:r,buttonProps:t={}})=>{const i=L(),{state:a}=R(),l=E((()=>null==a?void 0:a.from),[a]),o=C((()=>{l?i.push(l):i.goBack()}),[i,l]);return e(c,Object.assign({mr:2},{children:r?e(n,Object.assign({color:"inherit",onClick:l?null:o,component:M,to:null!=l?l:""},t,{children:r})):e(V,Object.assign({onClick:o},{children:e(q,{})}))}))},cr=({control:n,name:i,mode:a="json",label:l,width:o="100%",height:s="200px",theme:d="monokai",readOnly:p,required:u=!1,validateJson:b=!1,fontSize:f=16,validate:y=!0})=>{const{setError:v,clearErrors:O}=g(),{field:{onChange:T},fieldState:{error:E}}=m({control:n,name:i}),C=h({control:n,name:i});return r(c,Object.assign({display:"flex",flexDirection:"column",width:"100%"},{children:[e(c,{children:l&&e(D,Object.assign({variant:"subtitle1",display:"inline",style:{marginRight:10}},{children:l}))}),r(t,{children:[e($,{focus:!0,wrapEnabled:!0,width:o,height:s,showPrintMargin:!1,theme:d,fontSize:f,setOptions:{enableLiveAutocompletion:!0,enableBasicAutocompletion:!0,showLineNumbers:!0,tabSize:2},style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},readOnly:p,value:"json"===a&&"string"!=typeof C?null===C?"":JSON.stringify(C):C,onChange:e=>{if(!e&&u?v(i,{message:"Required field"}):O(i),b)try{JSON.parse(e),O(i)}catch(e){return void v(i,{message:"Invalid JSON"})}T(e)},mode:a,onLoad:e=>{y&&b||e.getSession().setUseWorker(!1)}}),E&&e(F,Object.assign({error:!0},{children:E.message}))]})]}))},dr=(e,r)=>{const t=[...e];return t.splice(r,1),t},pr=e=>{try{JSON.parse(e)}catch(e){return!1}return!0};function ur(e){return e.replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))}const mr=(e,r,t,n="asc")=>{const i=e[t],a=r[t];return i<a?"asc"===n?-1:1:i>a?"asc"===n?1:-1:0},hr=e=>{if(!e)return"";if("string"!=typeof e)try{return JSON.stringify(e,null,"\t")}catch(e){return"Failed to stringify JSON"}return e},gr=e=>{try{return JSON.parse(e)}catch(e){return null}},br=e=>{try{const r=JSON.parse(e);return Object.keys(r).forEach((e=>{r[e]=br(r[e])})),r}catch(r){return e}},fr=({value:t,type:n,copyText:i,status:a})=>{switch(n){case"JSON_copy":return r(c,Object.assign({width:"100%"},{children:[e(c,Object.assign({display:"flex",alignItems:"center",justifyContent:"flex-end",pt:1,mb:2},{children:e(or,{copyText:hr(t)})})),e(Nt,{value:t})]}));case"JSON":return e(Nt,{value:t});case"JSON_text":return e(c,Object.assign({width:"100%"},{children:e(c,Object.assign({overflow:"hidden",whiteSpace:"nowrap"},{children:"object"==typeof t?JSON.stringify(t):t}))}));case"copy":return r(c,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[e(c,Object.assign({mr:"auto"},{children:t})),e(or,{copyText:i||t})]}));case"boolean":return t?e(Ae,{color:"primary",fontSize:"small"}):e(Ge,{fontSize:"small"});case"date":return t?r("div",{children:[e("div",{children:J(new Date(t),"dd.MM.yyyy")}),e("div",{children:J(new Date(t),"HH:mm:ss")})]}):"";case"status":return e(Dt,{text:t,status:a});case"array":return e(c,{children:t.map(((r,t)=>e(c,{children:r},t)))});default:return e("div",{children:t})}},yr=new RegExp("^[-+]?[0-9]+$"),vr=new RegExp(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/),Or=e=>"string"==typeof e&&e.includes("$("),Tr=e=>e===Ye.DATE||e===Ye.DATE_TIME||e===Ye.TIME,Er=e=>!e&&0!==e&&!1!==e,Cr=(e,r,t)=>{if(null==r&&e!==Ye.BOOLEAN)return null;let n=r;switch(e){case Ye.BOOLEAN:n=!!r;break;case Ye.INTEGER:case Ye.BIG_INTEGER:case Ye.BIG_DECIMAL:case Ye.FLOAT:case Ye.LONG:case Ye.DOUBLE:n=Number(r);break;case Ye.DATE:case Ye.DATE_TIME:case Ye.TIME:n=J(new Date(r.toString()),t.formatText);break;case Ye.JSON:case"ANY":try{"string"!=typeof r&&(n=JSON.stringify(r)),n=JSON.parse(n)}catch(e){console.log(e),n=null}break;case Ye.ENTITY:n=xr(t.properties,r)}return n},xr=(e,r)=>{if(r){const t={};return e.forEach((e=>{const{key:n,propertyType:i}=e,a=r[n];Array.isArray(a)?t[n]=a.map((r=>Cr(i,r,{formatText:e.format,properties:e.properties}))):t[n]=Cr(i,a,{formatText:e.format,properties:e.properties})})),t}return null},jr=(e,r)=>{const t={};return e.forEach((e=>{const{key:n,name:i,isRequired:a,isMultiple:l,sortOrder:o,isEnabled:s,uiSettings:c,validationNode:d}=e,p="string"==typeof e.propertyType?e.propertyType:e.propertyType.value,u=Object.assign({name:i,propertyType:p,isRequired:a,isMultiple:l,sortOrder:o,isEnabled:s,validationNode:d,uiSettings:c},((e,r)=>{const t={};let n,i="";return r?e.isMultiple?(i="values",n=e.value):(i="value",n=e.value):e.isMultiple?(i="defaultValues",n=e.defaultValue):(i="defaultValue",n=e.defaultValue),t[i]=Cr(e.propertyType,n,{formatText:e.format,properties:e.properties}),t})(Object.assign(Object.assign({},e),{propertyType:p}),r));if("isViewableInList"in e&&(u.isViewableInList=e.isViewableInList),c)try{u.uiSettings=JSON.parse(c)}catch(e){console.log(e)}else u.uiSettings=null;p===Ye.BIG_DECIMAL&&(u.precisionScale=e.precisionScale,u.roundingMode=e.roundingMode),p!==Ye.DATE&&p!==Ye.TIME&&p!==Ye.DATE_TIME||(u.format=e.format),p===Ye.STRING&&(u.restrictedValues=e.restrictedValues),p===Ye.ENTITY_REFERENCE&&(u.definitionCode=e.definitionCode,u.definitionVersion=e.definitionVersion,u.labelPropertyCode=e.labelPropertyCode,u.valuePropertyCode=e.valuePropertyCode),p===Ye.ENTITY&&(u.properties=jr(e.properties,r)),t[n]=u})),t};function Nr(e,r){return Object.keys(e).map((t=>{const n=Object.assign(Object.assign({key:t},e[t]),r||{});if(n.propertyType===Ye.ENTITY&&(n.properties=Nr(n.properties,r)),n.propertyType===Ye.JSON)try{null==n.defaultValue?n.defaultValue="":n.defaultValue=JSON.stringify(n.defaultValue)}catch(e){n.defaultValue=""}if(n.uiSettings)try{n.uiSettings=JSON.stringify(n.uiSettings)}catch(e){n.uiSettings=""}return n.isMultiple&&("defaultValues"in n&&(n.defaultValue=n.defaultValues),"values"in n&&(n.value=n.values)),n})).sort(((e,r)=>mr(e,r,"sortOrder")))}const Sr=(e,r)=>{if(r)try{const e=r.replace(/Z/g,"XXX");return J(new Date,e),e}catch(r){return console.error("Incorrect format",r),e}return e},Ir=e=>{let r=[];return r=Array.isArray(e.properties)?e.properties:Nr(e.properties),r.reduce(((e,r)=>{const t=JSON.parse(JSON.stringify(e));return r.propertyType===Ye.ENTITY?t[r.key]=Ir(r):t[r.key]=r.propertyType,t}),{})},kr=({propertyType:e,useExpression:r,required:t})=>{let n=[{value:"widget",label:"Fill array (widget)",sortOrder:1}];return t||n.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Ye.JSON||e===Ye.ENTITY||"ANY"===e?n.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):n.push({value:"expression",label:"Expression",sortOrder:3})),e!==Ye.JSON&&"ANY"!==e&&e!==Ye.ENTITY||n.push({value:"json_valid",label:"JSON editor",sortOrder:2}),n=n.sort(((e,r)=>mr(e,r,"sortOrder"))),n},wr=({propertyType:e,useExpression:r,required:t})=>{let n=[{value:"widget",label:"Widget",sortOrder:1}];switch(t||n.push({value:"null",label:"NULL",sortOrder:0}),r&&(e===Ye.JSON||e===Ye.ENTITY||"ANY"===e?n.push({value:"expression",label:"Expression (JSON editor)",sortOrder:3}):n.push({value:"expression",label:"Expression",sortOrder:3})),e){case Ye.STRING:n[0].label="Text input";break;case Ye.INTEGER:case Ye.BIG_INTEGER:case Ye.BIG_DECIMAL:case Ye.FLOAT:case Ye.LONG:case Ye.DOUBLE:n[0].label="Number input";break;case Ye.BOOLEAN:n[0].label="Switch";break;case Ye.ENTITY_REFERENCE:n[0].label="Entity reference fields";break;case Ye.JSON:n[0].label="JSON editor";break;case Ye.DATE:n[0].label="Date picker",n.push({value:"string",label:"Text input",sortOrder:2});break;case Ye.DATE_TIME:n[0].label="Date & Time picker",n.push({value:"string",label:"Text input",sortOrder:2});break;case Ye.TIME:n[0].label="Time picker",n.push({value:"string",label:"Text input",sortOrder:2});break;case"ANY":n[0].label="Textarea"}return n=n.sort(((e,r)=>mr(e,r,"sortOrder"))),n},Pr=({inputProps:r,name:t,label:n="",control:i,required:a,defaultValue:l,disabled:o,variant:s="outlined",InputLabelProps:c,decimal:d=!1,hideErrorMessage:u=!1})=>{const g=m({name:t,control:i,defaultValue:l,rules:{required:a&&"Please, fill this field",validate:e=>d&&!vr.test(e)?"Not valid number":!(!d&&!yr.test(e))||"Not valid integer"}}),b=g.field,{ref:y,onChange:v}=b,O=p(b,["ref","onChange"]),{fieldState:{error:T}}=g,E=h({control:i,name:t});return e(f,Object.assign({fullWidth:!0,size:"small",inputRef:y,label:n,error:!!T,helperText:!u&&(null==T?void 0:T.message),disabled:o,variant:s,InputLabelProps:c,inputProps:r,onChange:v,value:null!=E?E:""},O))},Ar=({control:n,name:i,label:a})=>{const{field:{onChange:l}}=m({control:n,name:i}),o=h({control:n,name:i});O((()=>{null===o&&l(!1)}),[o]);return r(t,{children:[a&&e(D,{children:a}),e(S,{label:(!!o+"").toUpperCase(),name:i,control:e(z,{color:"primary",size:"small",onChange:e=>{const{checked:r}=e.target;l(r)},checked:!!o+""=="true"})})]})},Vr=({control:r,name:t,required:n,label:i,format:a=_e,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=m({control:r,name:t,rules:{required:n&&"Please, fill this field",validate:e=>!!G(e,a)||"Incorrect date format"}}),d=h({control:r,name:t});return e(B,{mask:"",label:i,inputRef:s,inputFormat:a,value:d||null,onChange:e=>{o(Y(e)?J(e,a):e)},renderInput:r=>e(f,Object.assign({},r,{fullWidth:!0,size:"small",variant:"outlined",name:t,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},qr=({control:r,name:t,required:n,label:i,format:a=He,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=m({control:r,name:t,rules:{required:n&&"Please, fill this field",validate:e=>!!G(e,a)||"Incorrect date format"}}),d=h({control:r,name:t});return e(W,{mask:"",ampm:!1,inputRef:s,label:i,value:d||null,inputFormat:a,onChange:e=>{o(Y(e)?J(e,a):e)},renderInput:r=>e(f,Object.assign({},r,{fullWidth:!0,size:"small",variant:"outlined",name:t,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})},Lr=({control:r,name:t,required:n,label:i,format:a=We,hideErrorMessage:l=!1})=>{const{field:{onChange:o,ref:s},fieldState:{error:c}}=m({control:r,name:t,rules:{required:n&&"Please, fill this field",validate:e=>!!G(e,a)||"Incorrect date format"}}),d=h({control:r,name:t}),[p,u]=T(null);return O((()=>{if(d&&a){let e=_(d,a,new Date);Y(e)||(e=_(d,"HH:mm:ss.SSS",new Date)),u(e)}}),[d,a]),e(H,{mask:"",inputRef:s,label:i,ampm:!1,value:p,inputFormat:a,onChange:e=>{u(e),o(Y(e)?J(e,a):e)},renderInput:r=>e(f,Object.assign({},r,{fullWidth:!0,size:"small",variant:"outlined",name:t,error:!!c,helperText:!l&&(null==c?void 0:c.message)}))})};var Rr=()=>{const n=X(),i=Z(n,Q),a=Z(n,ee),l=Z(n,re),o=Z(n,te),s=e=>n.current.setPage(e);return r(c,Object.assign({px:2,display:"flex",alignItems:"center"},{children:[e(K,{component:"div",page:i,count:l,rowsPerPage:o,rowsPerPageOptions:[10,20,50,100],onPageChange:(e,r)=>s(r),onRowsPerPageChange:e=>n.current.setPageSize(parseInt(e.target.value,10)),ActionsComponent:()=>e(t,{})}),e(U,{count:a,page:i+1,onChange:(e,r)=>s(r-1)})]}))};var Mr=r=>{var{hideMenu:t,currentColumn:n,onUnsort:i}=r,a=p(r,["hideMenu","currentColumn","onUnsort"]);return e(ne,Object.assign({hideMenu:t,currentColumn:n},a,{children:e(ie,{onClick:t,column:n})}))};var $r=({mode:e})=>{const r=L(),{search:t,state:n}=R(),i=E((()=>new URLSearchParams(t)),[t]),a=+i.get("page")||0,l=+i.get("size")||10;return O((()=>{"server"===e&&(i.has("page")||i.set("page","0"),i.has("size")||i.set("size","10"),r.replace({pathname:r.location.pathname,search:i.toString()},n))}),[t,e]),{page:a,size:l,onPageChange:e=>{i.set("page",`${e}`),r.replace({pathname:r.location.pathname,search:i.toString()})},onSizeChange:e=>{i.set("size",`${e}`),r.replace({pathname:r.location.pathname,search:i.toString()})}}};var Dr=()=>{const e=L(),{search:r,state:t}=R(),n=E((()=>new URLSearchParams(r)),[r]),i=n.getAll("sort").map((e=>e.split(",")));return{onColumnHeaderClick:({field:r})=>{let i=!1;const a=n.getAll("sort");n.delete("sort"),a.forEach((e=>{const[t,a]=e.split(",");t===r?(i=!0,"asc"===a&&n.append("sort",`${t},desc`)):n.append("sort",`${t},${a}`)})),i||n.append("sort",`${r},asc`),e.replace({pathname:e.location.pathname,search:n.toString()},t)},getSortedColumns:e=>e.map((e=>{const r=i.find((r=>r[0]===e.field));return e.headerClassName=r?`Sorted --${r[1]} `:"",e}))}};var Fr=e=>{const[r,t]=T(10);O((()=>{t(e)}),[e]);return{pageSize:r,handlePageSizeChange:e=>t(e)}},zr=oe({root:{width:"100%","& .MuiDataGrid-virtualScrollerContent":{height:"auto !important",minHeight:"56px !important"},"& .MuiDataGrid-virtualScrollerRenderZone":{position:"static"},"& .MuiDataGrid-renderingZone":{maxHeight:"none !important"},"& .MuiDataGrid-cell":{maxHeight:"none !important",lineHeight:"unset !important",whiteSpace:"normal !important",textOverflow:"ellipsis",wordBreak:"break-all","& .MuiDataGrid-actionsCell":{width:"100%",gridGap:"4px",flexWrap:"wrap",'& > button[aria-label="more"]':{marginLeft:"auto"}}},"& .MuiDataGrid-row":{maxHeight:"none !important"},"& .Sorted":{"& .MuiDataGrid-iconButtonContainer":{visibility:"visible",width:"auto","& svg":{opacity:"1 !important"}},"&.--desc":{"& svg":{transform:"rotate(180deg)"}}}}});const Br=({columns:r,rows:t,rowCount:n,loading:i,disableMargin:a,mode:l="server",initialPageSize:o=10,pagination:s=!0,onCellClick:d})=>{const p=zr(),{page:u,size:m,onPageChange:h,onSizeChange:g}=$r({mode:l}),{onColumnHeaderClick:b,getSortedColumns:f}=Dr(),{pageSize:y,handlePageSizeChange:v}=Fr(o),O={sortingMode:l,paginationMode:l,pageSize:"server"===l?m:s?y:n,onPageSizeChange:"server"===l?g:v,components:{Pagination:Rr}};return"server"===l&&(O.sortModel=[],O.onColumnHeaderClick=b,O.page=u,O.onPageChange=h,O.components.ColumnMenu=Mr),e(c,Object.assign({mt:a?0:2},{children:e(ae,Object.assign({autoHeight:!0,hideFooterPagination:!s,hideFooter:!s,disableSelectionOnClick:!0,showColumnRightBorder:!0,showCellRightBorder:!0,className:p.root,loading:i,rows:t,columns:f(r),rowCount:n,rowsPerPageOptions:[10,20,50,100],onCellClick:d},O))}))},Jr=({icon:r,label:t,showInMenu:n,onClick:i,location:a})=>a?e(V,Object.assign({component:M,to:a,size:"small"},{children:e(A,Object.assign({title:t,arrow:!0},{children:y.cloneElement(r,{fontSize:"small"})}))})):e(le,{nonce:!1,onResize:!1,onResizeCapture:!1,icon:e(A,Object.assign({title:t,arrow:!0},{children:r})),onClick:i,label:t,showInMenu:n}),Gr=r=>{const{children:t,value:n,index:i}=r,a=p(r,["children","value","index"]);return e("div",Object.assign({role:"tabpanel",hidden:n!==i,id:`simple-tabpanel-${i}`,"aria-labelledby":`simple-tab-${i}`},a,{children:n===i?t:null}))},Yr=t=>{var n;const{tabs:i}=t,a=L(),l=R(),o=E((()=>new URLSearchParams(l.search)),[l.search]),s=o.get("tab");return r(c,{children:[e(se,{children:e(de,Object.assign({value:s||(null===(n=i[0])||void 0===n?void 0:n.name),indicatorColor:"primary",textColor:"primary",onChange:(e,r)=>{o.set("tab",r),a.replace({pathname:a.location.pathname,search:o.toString()})}},{children:i.map((r=>e(ce,{value:r.name,label:r.label},r.name)))}))}),e(c,Object.assign({mt:2},{children:i.map((r=>{var t;return e(Gr,Object.assign({value:s||(null===(t=i[0])||void 0===t?void 0:t.name),index:r.name},{children:r.component}),r.name)}))}))]})},_r=({open:t,onClose:o,value:s})=>r(i,Object.assign({disableEscapeKeyDown:!0,open:t,onClose:o,fullWidth:!0,maxWidth:"md",style:{width:800,left:"30%"}},{children:[e(l,{children:e($,{readOnly:!0,value:s,mode:"json",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})}),r(a,{children:[e(or,{copyText:s}),e(n,Object.assign({onClick:o,variant:"contained",color:"secondary"},{children:"Close"}))]})]}));var Wr=oe((()=>({container:{borderBottom:"1px solid #ccc",paddingBottom:"8px"},title:{fontSize:"14px",fontWeight:600,color:"#536DFE"},text:{fontSize:"18px",wordWrap:"break-word"}})));const Hr=({title:t,text:n,json:i})=>{const a=Wr();return r("div",Object.assign({className:a.container},{children:[e("div",Object.assign({className:a.title},{children:t})),n&&e("div",Object.assign({className:a.text},{children:n})),i&&e($,{readOnly:!0,value:i,mode:"json",height:"300px",width:"100%",fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})]}))},Ur=Object.values(Ue).sort(((e,r)=>e.localeCompare(r)));var Kr=({propertyFieldName:n})=>{const{control:i}=g();return r(t,{children:[e(pe,{children:e(Pr,{required:!0,control:i,defaultValue:2,name:`${n}.precisionScale`,label:"Precision Scale"})}),e(pe,{children:e(tr,{required:!0,control:i,name:`${n}.roundingMode`,label:"Rounding Mode",defaultValue:Ue.HALF_UP,options:Ur})})]})};var Xr=({propertyFieldName:r,defaultValue:t=""})=>{const{control:n}=g();return e(pe,{children:e(Ze,{required:!0,control:n,defaultValue:t,name:`${r}.format`,label:"Format"})})};const Zr=oe((()=>({content:{marginLeft:"4px"},connector:{marginLeft:"4px"},stepper:{padding:"12px"},label:{display:"flex",alignItems:"flex-start"}}))),Qr=()=>e("div",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",backgroundColor:"#536DFE",marginTop:"5px"}}),et=({data:t})=>{const n=Zr();return r(fe,Object.assign({nonLinear:!0,orientation:"vertical",className:n.stepper,connector:e(Te,{className:n.connector})},{children:[t.map(((t,i)=>r(ye,Object.assign({expanded:!0},{children:[e(ve,Object.assign({className:n.label,StepIconComponent:Qr,StepIconProps:{icon:"",completed:!1,active:!0}},{children:t.label})),e(Oe,Object.assign({className:n.content},{children:t.content}))]}),i))),e(ye,{})]}))},rt=({properties:t=[]})=>{const n=E((()=>t?t.map((t=>{const n="string"==typeof t.propertyType?t.propertyType:t.propertyType.value;return{label:r(c,Object.assign({display:"flex",flexDirection:"column"},{children:[r("b",{children:[t.name,t.isRequired?"*":""]}),r("span",{children:[t.key," | ",t.isMultiple?"multiple":"single"," | ",n]})]})),content:"ENTITY"===t.propertyType&&e(rt,{properties:t.properties})}})):[]),[t]);return e(et,{data:n})};var tt=rt;const nt={key:"",propertyType:"",name:"",defaultValue:"",isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0};var it=({parentPropertyFieldName:o,entityDefinition:c=!1,globalParameter:d=!1})=>{const{control:p,setValue:m,getValues:b,trigger:f}=g(),y=h({control:p,name:`${o}.properties`,defaultValue:b(`${o}.properties`)||[]}),v=h({control:p,name:`${o}.name`}),O=er(),[E,x]=T(0),j=C((()=>{if(y){const e=y.length;m(`${o}.properties.${e}`,nt),x(e)}else m(`${o}.properties`,[nt])}),[y,o,m]),N=()=>u(void 0,void 0,void 0,(function*(){(yield f(`${o}.properties`))&&O.onClose()}));return r(t,{children:[e(pe,{children:e(D,Object.assign({variant:"h6"},{children:"Properties"}))}),e(pe,{children:e(tt,{properties:y})}),e(pe,{children:e(n,Object.assign({variant:"contained",color:"primary",onClick:O.onOpen},{children:"Edit properties"}))}),r(i,Object.assign({disableEscapeKeyDown:!0,open:O.open,onClose:N,fullWidth:!0,maxWidth:"md"},{children:[r(s,{children:[v||"Entity"," Properties"]}),e(l,Object.assign({style:{height:"500px",overflow:"hidden"}},{children:r(pe,Object.assign({container:!0,direction:"row",spacing:2,style:{height:"100%"}},{children:[r(pe,Object.assign({xs:3,style:{backgroundColor:"#f9f9f9"}},{children:[e(fe,Object.assign({nonLinear:!0,activeStep:E,orientation:"vertical",style:{paddingLeft:"4px"}},{children:y.map(((t,n)=>r(ye,Object.assign({onClick:()=>(e=>x(e))(n),style:{cursor:"pointer"}},{children:[e(ve,Object.assign({StepIconProps:{icon:""},style:{wordBreak:"break-word"}},{children:t.name||"(no name)"})),e(Oe,{})]}),n)))})),e(n,Object.assign({variant:"contained",size:"small",color:"primary",onClick:j},{children:"Add property"}))]})),e(pe,Object.assign({container:!0,wrap:"nowrap",direction:"column",xs:9,spacing:2,style:{height:"100%",overflowY:"auto"}},{children:e(xt,{hideAddButton:!0,parentFieldName:o,focusOnIndex:E,entityDefinition:c,globalParameter:d})}))]}))})),e(a,{children:e(n,Object.assign({variant:"contained",color:"primary",onClick:N},{children:"Ok"}))})]}))]})};var at=({propertyFieldName:n})=>{const{control:i}=g();return r(t,{children:[e(pe,{children:e(Ze,{required:!0,control:i,name:`${n}.definitionCode`,label:"Definition Code"})}),e(pe,{children:e(Ze,{required:!0,control:i,name:`${n}.definitionVersion`,label:"Definition Version"})}),e(pe,{children:e(Ze,{required:!0,control:i,name:`${n}.labelPropertyCode`,label:"Label Property Code"})}),e(pe,{children:e(Ze,{required:!0,control:i,name:`${n}.valuePropertyCode`,label:"Value Property Code"})})]})};var lt=({propertyFieldName:n})=>{const i=E((()=>`${n}.restrictedValues`),[n]),{control:a,setValue:l,getValues:o}=g(),s=h({control:a,name:i,defaultValue:o(`${n}.restrictedValues`)||[]}),[d,p]=T(""),[u,m]=T(""),b=C((e=>{l(i,dr(s,e))}),[s,i,l]),y=()=>{d&&(l(i,[...s,d]),p(""))};return r(t,{children:[e(pe,{children:e(D,Object.assign({variant:"h6"},{children:"Restricted Values"}))}),e(pe,{children:e(c,Object.assign({display:"flex",flexWrap:"wrap"},{children:null==s?void 0:s.map(((r,t)=>e(Ee,{variant:"outlined",label:r,onDelete:()=>b(t)},t)))}))}),e(pe,{children:e(f,{fullWidth:!0,variant:"outlined",size:"small",label:"Add restricted value",value:d,onChange:e=>{const{value:r}=e.target;p(r),s.includes(r)?m("This value already exists"):m("")},error:!!u,helperText:u,name:"restrictedValues",inputProps:{onKeyDown:e=>{"Enter"===e.key&&y()}},InputProps:{endAdornment:e(V,Object.assign({size:"small",onClick:y,disabled:!!u},{children:e(Ce,{})}))}})})]})};const ot=({propertyType:r,propertyFieldName:t,entityDefinition:n=!1,globalParameter:i=!1})=>{switch(r){case Ye.STRING:return e(lt,{propertyFieldName:t});case Ye.BIG_DECIMAL:return e(Kr,{propertyFieldName:t});case Ye.DATE:return e(Xr,{propertyFieldName:t,defaultValue:_e});case Ye.TIME:return e(Xr,{propertyFieldName:t,defaultValue:We});case Ye.DATE_TIME:return e(Xr,{propertyFieldName:t,defaultValue:He});case Ye.ENTITY_REFERENCE:return e(at,{propertyFieldName:t});case Ye.ENTITY:return e(it,{parentPropertyFieldName:t,globalParameter:i,entityDefinition:n});default:return null}};var st=({validate:r=!1,name:t,inputRef:n})=>{const{control:i,setValue:a,setError:l,clearErrors:o}=g(),s=h({control:i,name:t});return e($,{wrapEnabled:!0,width:"100%",height:"200px",theme:"monokai",fontSize:14,showPrintMargin:!1,style:{lineHeight:1.4,zIndex:0,isolation:"isolate"},setOptions:{enableLiveAutocompletion:!0,enableBasicAutocompletion:!0,showLineNumbers:!0,tabSize:2},ref:n,name:t,value:"string"!=typeof s?null===s?"":JSON.stringify(s):s,onChange:e=>{if(a(t,e),r)try{JSON.parse(e),o(t)}catch(e){l(t,{message:"Invalid JSON"})}},mode:"json",onLoad:e=>{r||e.getSession().setUseWorker(!1)}})};var ct=({name:t,label:n,required:i,restrictedValues:a})=>{const{control:l}=g(),{field:{onChange:o,ref:s},fieldState:{error:c}}=m({control:l,name:t,rules:{required:i&&(Array.isArray(a)&&a.length?"Please, select a value":"Please, fill this field")}}),d=h({control:l,name:t});return Array.isArray(a)&&a.length?r(je,Object.assign({fullWidth:!0,size:"small",variant:"outlined",error:!!c},{children:[e(Ne,Object.assign({htmlFor:"type-select"},{children:n})),e(xe,Object.assign({labelId:"type-select",label:n,value:d||"",onChange:o,ref:s},{children:a.map((r=>e(j,Object.assign({value:r},{children:r}),r)))}))]})):e(Ze,{hideErrorMessage:!0,required:i,control:l,name:t,label:n})};const dt=({property:r,name:t,label:n,useExpression:i,inputRef:a})=>{const{control:l}=g();switch(E((()=>"string"==typeof r.propertyType?r.propertyType:r.propertyType.value),[r])){case Ye.BIG_DECIMAL:case Ye.FLOAT:case Ye.DOUBLE:return e(Pr,{decimal:!0,required:!0,hideErrorMessage:!0,control:l,name:t,label:n});case Ye.INTEGER:case Ye.BIG_INTEGER:case Ye.LONG:return e(Pr,{required:!0,hideErrorMessage:!0,control:l,name:t,label:n});case Ye.BOOLEAN:return e(Ar,{control:l,name:t});case Ye.DATE:return e(Vr,{required:!0,hideErrorMessage:!0,control:l,name:t,label:n,format:r.format});case Ye.TIME:return e(Lr,{required:!0,hideErrorMessage:!0,control:l,name:t,label:n,format:r.format});case Ye.DATE_TIME:return e(qr,{required:!0,hideErrorMessage:!0,control:l,name:t,label:n,format:r.format});case Ye.JSON:return e(st,{validate:!0,name:t,inputRef:a});case Ye.STRING:return e(ct,{required:!0,name:t,label:n,restrictedValues:r.restrictedValues});case Ye.ENTITY_REFERENCE:return e(Ze,{required:!0,hideErrorMessage:!0,name:t,label:n,control:l});case"ANY":return e(st,{name:t,inputRef:a});case Ye.ENTITY:return e(qt,{properties:r.properties,dataFieldName:t,useExpression:i});default:return e("div",{children:"No widget"})}};var pt=({property:e,name:r,label:t,isDirty:n,required:i=!1,useExpression:a=!1,multipleOptions:l=!1})=>{const{control:o}=g(),s=h({control:o,name:r}),c=E((()=>t?`${t} (value)`:`${e.name} (value)`),[t,e]),d=E((()=>t?`${t} (widget)`:`${e.name} (widget)`),[t,e]),p=E((()=>"string"==typeof e.propertyType?e.propertyType:e.propertyType.value),[e]),[u,m]=T(null),b=E((()=>l?kr({propertyType:p,required:i,useExpression:a}):wr({propertyType:p,required:i,useExpression:a})),[a,i,p,l]);return O((()=>{u?n||(Or(s)&&"expression"!==u?m("expression"):null===s||Or(s)||"widget"===u||m("widget")):Er(s)&&(null==b?void 0:b.length)?m(b[0].value):a&&Or(s)?m("expression"):m("widget")}),[s,u,b,a,n]),{propertyType:p,valueLabel:c,fillOptionLabel:d,fillOption:u,fillOptions:b,setFillOption:m}};var ut=oe((()=>({inputLabel:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"}})));const mt=({property:t,name:n,useExpression:i,label:a,required:l,title:o})=>{const{control:s,clearErrors:d}=g(),{field:{ref:p,onChange:u},fieldState:{error:b,isDirty:f}}=m({name:n,rules:{validate:{required:e=>!l||!Er(e)||"Please, fill this field"}}}),y=h({control:s,name:n}),{propertyType:v,valueLabel:T,fillOptionLabel:E,fillOption:C,fillOptions:x,setFillOption:N}=pt({property:t,name:n,isDirty:f,label:a,required:l,useExpression:i});O((()=>{void 0===y&&u(null)}),[y,u]);const S=ut();return r(pe,Object.assign({xs:12},{children:[o&&e(c,Object.assign({mb:2},{children:e(D,Object.assign({variant:"h6"},{children:o}))})),x?e(c,Object.assign({mb:2},{children:r(je,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[e(Ne,Object.assign({htmlFor:"type-select",className:S.inputLabel},{children:E})),e(xe,Object.assign({labelId:"type-select",label:E,value:C||"",onChange:e=>{const r=e.target.value;"null"===r||"widget"===r?u(null):"expression"!==r&&"string"!==r||u(""),N(r),d(n)}},{children:x.map((r=>e(j,Object.assign({value:r.value},{children:r.label}),r.value)))}))]}))})):null,"expression"===C&&(v===Ye.JSON||v===Ye.ENTITY||"ANY"===v?e(st,{name:n,inputRef:p}):e(Ze,{control:s,name:n,label:T,required:!0,hideErrorMessage:!0})),"string"===C&&e(Ze,{control:s,name:n,label:T,required:!0,hideErrorMessage:!0}),"json_notvalid"===C&&e(st,{name:n,inputRef:p}),"widget"===C&&e(dt,{property:t,name:n,useExpression:i,label:T,inputRef:p,required:l}),b&&e(D,Object.assign({color:"secondary"},{children:b.message}))]}))};var ht=({name:t,property:i,useExpression:a,required:l,label:o})=>{const{control:s,setValue:d,clearErrors:p}=g();m({control:s,name:t,rules:{validate:e=>!(!e||Array.isArray(e)&&!e.length)||"Please, fill array"}});const u=h({control:s,name:t}),b=C((()=>{u&&Array.isArray(u)?d(`${t}.${u.length}`,null):d(t,[null]),p(t)}),[t,u,d]),f=C((e=>{d(t,dr(u,e))}),[t,u,d]);return r(pe,Object.assign({container:!0,spacing:2,direction:"column",xs:12},{children:[u&&Array.isArray(u)?u.map(((n,s)=>e(pe,Object.assign({xs:12},{children:r(c,Object.assign({display:"flex",alignItems:"flex-start",width:"100%",p:2,style:{backgroundColor:"#f1f1f1"}},{children:[e(mt,{required:l,property:i,useExpression:a,name:`${t}.${s}`,label:`${o||i.name} (${s+1})`}),e(c,Object.assign({mt:"8px",ml:"4px"},{children:e(V,Object.assign({size:"small",onClick:()=>f(s)},{children:e(Se,{fontSize:"small"})}))}))]}))}),s))):null,e(pe,{children:e(n,Object.assign({variant:"contained",size:"small",color:"primary",onClick:b},{children:"Add value"}))})]}))};const gt=({property:t,name:n,useExpression:i,required:a,label:l,title:o})=>{const{control:s,clearErrors:d}=g(),{field:{ref:p,onChange:u},fieldState:{error:b,isDirty:f}}=m({control:s,name:n,rules:{validate:e=>!(a&&!e)||"Please, fill this field"}}),y=h({control:s,name:n}),{propertyType:v,valueLabel:T,fillOptionLabel:E,fillOption:C,fillOptions:x,setFillOption:N}=pt({property:t,name:n,isDirty:f,label:l,required:a,useExpression:i,multipleOptions:!0});O((()=>{void 0===y&&u(null)}),[y,u]);const S=ut();return r(pe,{children:[o&&e(c,Object.assign({mb:2},{children:e(D,Object.assign({variant:"h6"},{children:o}))})),x?e(c,Object.assign({mb:2},{children:r(je,Object.assign({fullWidth:!0,size:"small",variant:"outlined"},{children:[e(Ne,Object.assign({htmlFor:"type-select",className:S.inputLabel},{children:E})),e(xe,Object.assign({labelId:"type-select",label:E,value:C||"",onChange:e=>{const r=e.target.value;"null"===r?u(null):"expression"===r||"json_valid"===r||"json_notvalid"===r?u(""):"widget"===r&&u([]),N(r),d(n)}},{children:x.map((r=>e(j,Object.assign({value:r.value},{children:r.label}),r.value)))}))]}))})):null,"expression"===C&&(v===Ye.JSON||v===Ye.ENTITY||"ANY"===v?e(st,{name:n,inputRef:p}):e(Ze,{required:!0,hideErrorMessage:!0,control:s,name:n,label:T})),"json_valid"===C&&e(st,{validate:!0,name:n,inputRef:p}),"widget"===C&&e(ht,{property:t,name:n,useExpression:i,required:a,label:l}),b&&e(D,Object.assign({color:"secondary"},{children:b.message}))]})},bt=({propertyFieldName:r,name:t,label:n="",required:i})=>{const{control:a}=g(),l=h({control:a,name:`${r}.propertyType`}),o=h({control:a,name:`${r}.isMultiple`}),s=h({control:a,name:`${r}.format`}),c=h({control:a,name:`${r}.restrictedValues`}),d=h({control:a,name:`${r}.properties`}),p=h({control:a,name:`${r}.isRequired`}),u=E((()=>{const e="string"==typeof l?l:l.value;return{name:n,isRequired:p,isMultiple:o,format:s,restrictedValues:c,properties:d,propertyType:e,defaultValue:null,defaultValues:[],sortOrder:0,isEnabled:!0,uiSettings:null,validationNode:null}}),[l,s,c,o,n,p,d]);return e(o?gt:mt,{name:t,property:u,title:n,required:i})};var ft=({propertyType:e,control:r,name:t,label:n,required:i,format:a,restrictedValues:l,properties:o})=>null;const yt=({property:i,name:a,label:l,required:o="byProperty"})=>{const{control:s,setValue:d}=g(),p=h({control:s,name:a}),u=C((e=>{d(a,dr(p,e))}),[a,p,d]),m=C((()=>{p&&Array.isArray(p)?d(`${a}.${p.length}`,null):d(a,[null])}),[a,p,d]),b=E((()=>({control:s,name:a,label:l,required:"byProperty"===o?i.isRequired:o,propertyType:"string"==typeof i.propertyType?i.propertyType:i.propertyType.value,format:i.format,restrictedValues:i.restrictedValues,properties:i.properties})),[a,l,o,i,s]);return i.isMultiple?r(pe,Object.assign({container:!0,spacing:2,direction:"column"},{children:[p&&Array.isArray(p)?e(t,{children:p.map(((t,n)=>e(pe,{children:r(c,Object.assign({display:"flex",alignItems:"center",width:"100%"},{children:[e(ft,Object.assign({},b,{label:`${i.name} (${n+1})`,name:`${a}.${n}`})),e(V,Object.assign({size:"small",onClick:()=>u(n)},{children:e(Se,{fontSize:"small"})}))]}))},n)))}):null,e(pe,{children:e(n,Object.assign({variant:"contained",size:"small",color:"primary",onClick:m},{children:"Add value"}))})]})):e(ft,Object.assign({},b))};var vt=({name:r,label:t="",propertyFieldName:n,type:i,decimal:a=!1,options:l=[],required:o=!1})=>{const{control:s}=g(),c=E((()=>`${n}.${r}`),[r,n]);switch(i){case"text":return e(Ze,{control:s,name:c,label:t,required:o});case"number":return e(Pr,{control:s,name:c,label:t,decimal:a,required:o});case"select":return e(tr,{control:s,name:c,label:t,options:l,required:o});case"autocomplete":return e(ar,{control:s,name:c,label:t,options:l,required:o});case"json":return e(cr,{control:s,name:c,label:t,mode:"json",required:o});default:return null}};var Ot=e=>({customCheckboxes:E((()=>e.length?e.filter((e=>"checkbox"===e.type)):[]),[e]),customFields:E((()=>e.length?e.filter((e=>"checkbox"!==e.type)):[]),[e])});const Tt=Object.values(Ye).sort(((e,r)=>e.localeCompare(r))).map((e=>({value:e,label:e.replace("_"," ").toLowerCase().replace(/(^\w)|([-\s]\w)/g,(e=>e.toUpperCase()))})));var Et=({propertyFieldName:n,entityDefinition:i=!1,globalParameter:a=!1,customPropertyFields:l=[],hasAny:o=!1})=>{const{control:s,setValue:c}=g();h({control:s,name:n});const d=h({control:s,name:`${n}.propertyType`}),p=h({control:s,name:`${n}.isMultiple`}),u=h({control:s,name:`${n}.isRequired`}),{customCheckboxes:m,customFields:b}=Ot(l),f=E((()=>o?[{value:"ANY",label:"Any"},...Tt]:Tt),[o]),y=E((()=>{let e=a?"Value":"Default Value";return p&&(e+="s"),e}),[a,p]);return r(pe,Object.assign({container:!0,direction:"column",spacing:2},{children:[e(pe,{children:e(rr,{required:!0,control:s,name:`${n}.key`,label:"Key"})}),e(pe,{children:e(rr,{required:!0,control:s,name:`${n}.name`,label:"Name"})}),e(pe,{children:e(ar,{required:!0,control:s,name:`${n}.propertyType`,label:"Type",options:f,onChange:(e,r)=>{const t=`${n}.${a?"value":"defaultValue"}`;c(t,p?[]:null),c(e,r)}})}),e(pe,{children:e(Pr,{required:!0,control:s,name:`${n}.sortOrder`,label:"Sort Order"})}),e(pe,{children:e(cr,{control:s,name:`${n}.uiSettings`,label:"UI Settings",validateJson:!0})}),r(pe,{children:[e(nr,{control:s,name:`${n}.isMultiple`,label:"Multiple"}),e(nr,{control:s,name:`${n}.isEnabled`,label:"Enabled"}),e(nr,{control:s,name:`${n}.isRequired`,label:"Required"}),i&&e(nr,{control:s,name:`${n}.isViewableInList`,label:"Is viewable in list"}),m.length?e(t,{children:m.map(((r,t)=>e(nr,{control:s,name:`${n}.${r.name}`,label:r.label},t)))}):null]}),d&&r(t,{children:[e(ot,{propertyType:"string"==typeof d?d:d.value,propertyFieldName:n,globalParameter:a,entityDefinition:i}),e(pe,{children:e(bt,{propertyFieldName:n,name:`${n}.${a?"value":"defaultValue"}`,label:y,required:!!a&&u})})]}),b.length?e(t,{children:b.map(((r,t)=>e(pe,{children:e(vt,Object.assign({},r,{propertyFieldName:n}))},t)))}):null]}))};const Ct={key:"",propertyType:"",name:"",defaultValue:"",defaultValues:[],isRequired:!0,isMultiple:!1,sortOrder:0,isEnabled:!0,executeValue:"",uiSettings:""},xt=({parentFieldName:i,hideAddButton:a,focusOnIndex:l,required:o,entityDefinition:s=!1,globalParameter:c=!1,customPropertyFields:d=[],hasAny:p})=>{const u=E((()=>i?`${i}.properties`:"properties"),[i]),{setValue:b,clearErrors:f,control:y}=g(),{fieldState:{error:T}}=m({control:y,name:u,rules:{required:o&&"Please, add properties"}}),x=h({control:y,name:u}),j=v([]);O((()=>{"number"==typeof l&&j.current[l]&&j.current[l].scrollIntoView({behavior:"smooth",block:"start"})}),[l,j]);const N=C((()=>{x?b(`${u}.${x.length}`,Ct):b(u,[Ct]),f(u)}),[x,u,f,b]),S=C((e=>{b(`${u}`,dr(x,e))}),[x,u,b]);return r(t,{children:[T&&T.message&&e(pe,Object.assign({sm:12,md:8,lg:6},{children:e(D,Object.assign({color:"secondary"},{children:T.message}))})),x&&x.map(((t,i)=>e(pe,Object.assign({sm:12,md:8,lg:6,ref:e=>j.current[i]=e},{children:r(ue,Object.assign({defaultExpanded:!0,elevation:3},{children:[e(me,Object.assign({expandIcon:e(be,{})},{children:e(D,Object.assign({color:T&&T[i]?"secondary":"initial",style:{wordBreak:"break-word"}},{children:t.name||`Property ${i+1}`}))})),e(he,{children:e(Et,{propertyFieldName:`${u}.${i}`,entityDefinition:s,globalParameter:c,customPropertyFields:d,hasAny:p})}),e(ge,{children:e(n,Object.assign({variant:"contained",size:"small",color:"secondary",onClick:()=>S(i)},{children:"Remove"}))})]}))}),i))),!a&&e(pe,Object.assign({xs:12},{children:e(n,Object.assign({variant:"contained",size:"small",color:"primary",onClick:N},{children:"Add property"}))}))]})},jt=({definitionFieldName:t,title:n,hideCodeField:i,hideVersionField:a,hideNameField:l,required:o=!1,hasAny:s})=>{const{control:d}=g();return r(pe,Object.assign({container:!0,direction:"column",spacing:2},{children:[n&&e(pe,Object.assign({sm:12,md:8,lg:6},{children:e(c,Object.assign({my:2},{children:e(D,Object.assign({variant:"h4"},{children:n}))}))})),!l&&e(pe,Object.assign({sm:12,md:8,lg:6},{children:e(Ze,{required:!0,control:d,name:t?`${t}.name`:"name",label:"Name"})})),!i&&e(pe,Object.assign({sm:12,md:8,lg:6},{children:e(Ze,{required:!0,control:d,name:t?`${t}.code`:"code",label:"Code"})})),!a&&e(pe,Object.assign({sm:12,md:8,lg:6},{children:e(Pr,{required:!0,control:d,decimal:!1,name:t?`${t}.version`:"version",label:"Version"})})),e(xt,{required:o,parentFieldName:t,hasAny:s})]}))},Nt=({value:r,height:t="200px"})=>{const n=E((()=>{if("string"==typeof r)return r;if("object"==typeof r)try{return JSON.stringify(r,null,"\t")}catch(e){return"Failed to parse JSON"}return null}),[r]);return e($,{readOnly:!0,value:n,mode:"json",width:"100%",height:t,fontSize:"16",setOptions:{enableSnippets:!1,copyWithEmptySelection:!0,showLineNumbers:!0,tabSize:2}})},St={name:"Name",key:"Key",propertyType:"Property Type",defaultValue:"Default Value",defaultValues:"Default Values",sortOrder:"Sort Order",isRequired:"Required",isMultiple:"Multiple",isEnabled:"Enabled",isViewableInList:"Is Viewable In List",precisionScale:"Precision Scale",roundingMode:"Rounding Mode",format:"Format",definitionCode:"Definition Code",definitionVersion:"Definition Version",labelPropertyCode:"Label Property Code",valuePropertyCode:"Value Property Code",restrictedValues:"Restricted Values",value:"Value",values:"Values",uiSettings:"UI Settings"},It=({value:r,type:t})=>t!==Ye.JSON&&t!==Ye.ENTITY&&"ANY"!==t||!r?e(D,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:null===r?"null":r.toString()})):e(Nt,{value:r}),kt=(r,t,n)=>{switch(t){case"isRequired":case"isMultiple":case"isEnabled":case"isViewableInList":return r?e(Ae,{color:"primary",fontSize:"small"}):null;case"restrictedValues":return r?e(c,Object.assign({display:"flex",flexWrap:"wrap"},{children:r.map((r=>e(Ee,{label:r,style:{wordBreak:"break-word",maxWidth:"500px"}},r)))})):null;case"defaultValue":case"value":return e(It,{value:r,type:n});case"values":case"defaultValues":return Array.isArray(r)&&n!==Ye.ENTITY&&n!==Ye.JSON&&"ANY"!==n?e("div",{children:null==r?void 0:r.map(((r,t)=>e("div",{children:e(It,{value:r,type:n})},t)))}):e(Nt,{value:r});case"uiSettings":return r?e(Nt,{value:r}):null;default:return e(D,Object.assign({variant:"subtitle1",display:"inline",style:{wordBreak:"break-word"}},{children:r}))}};var wt=({property:t})=>{const n=E((()=>(t&&(t.isMultiple?(delete t.defaultValue,delete t.value):(delete t.defaultValues,delete t.values)),t)),[t]);return e(Ie,Object.assign({size:"small"},{children:e(ke,{children:Object.keys(St).map((t=>t in n?r(we,{children:[e(Pe,Object.assign({width:"30%"},{children:e(D,{children:St[t]})})),e(Pe,{children:kt(n[t],t,n.propertyType)})]},t):null))})}))};var Pt=x((({properties:t,parentNames:n=[]})=>{const i=E((()=>{let e=!1;return t.every((r=>r.propertyType!==Ye.ENTITY||(e=!0,!1))),e}),[t]);return r(c,Object.assign({mt:4},{children:[e(D,Object.assign({variant:"h6"},{children:"Properties"})),r(fe,Object.assign({orientation:"vertical",style:{paddingLeft:"4px"}},{children:[t.map((t=>r(ye,Object.assign({expanded:!0},{children:[e(ve,{StepIconProps:{icon:"",completed:!1,active:!0}}),e(Oe,{children:e(At,{property:t,parentNames:[...n],defaultExpanded:!1})})]}),t.key))),i&&e(ye,{})]}))]}))}));const At=({property:t,parentNames:n=[],defaultExpanded:i=!0})=>{const[a,l]=T(!0);return O((()=>{l(i)}),[i]),r(ue,Object.assign({elevation:3,style:{backgroundColor:n.length%2==1?"#f1f1f1":"#fff"},expanded:a,onChange:()=>l((e=>!e))},{children:[e(me,Object.assign({expandIcon:e(be,{})},{children:e(D,Object.assign({style:{wordBreak:"break-word",fontWeight:"600"}},{children:t.name}))})),e(he,{children:r(c,Object.assign({width:"100%"},{children:[e(wt,{property:t}),t.propertyType===Ye.ENTITY&&e(Pt,{properties:Nr(t.properties),parentNames:[...n,t.name]})]}))})]}))},Vt=({properties:r,expandAll:t=!0})=>{const n=E((()=>Array.isArray(r)?r:r?Nr(r):[]),[r]);return e(c,Object.assign({display:"flex",flexDirection:"column"},{children:n.length?n.map((r=>e(At,{property:r,defaultExpanded:t},r.key))):e(D,{children:"No properties"})}))},qt=({properties:t,dataFieldName:n,useExpression:i=!1,title:a})=>{const l=E((()=>t?t.map((t=>{const a="string"==typeof t.propertyType?t.propertyType:t.propertyType.value;return{label:r(c,Object.assign({display:"flex",flexDirection:"column"},{children:[r("b",{children:[t.name,t.isRequired?"*":""]}),r("span",{children:[t.key," | ",t.isMultiple?"multiple":"single"," | ",a]})]})),content:t.isMultiple?e(gt,{property:t,name:`${n}.${t.key}`,useExpression:i,label:t.name,required:t.isRequired}):e(mt,{property:t,name:`${n}.${t.key}`,useExpression:i,label:t.name,required:t.isRequired})}})):[]),[t,n,i]);return r(pe,Object.assign({container:!0,direction:"column",spacing:2},{children:[a&&e(pe,Object.assign({xs:12},{children:e("div",Object.assign({style:{fontWeight:"600"}},{children:a}))})),e(et,{data:l})]}))},Lt=({property:r,data:t,properties:n})=>{if(Or(t))return e(c,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px"}},{children:null===t?"null":null==t?void 0:t.toString()}));switch(r.propertyType){case Ye.JSON:return e(Nt,{value:t});case Ye.ENTITY:return e(Mt,{properties:n,data:t});case"ANY":return e(Nt,{value:t});default:return e(c,Object.assign({style:{backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"4px"}},{children:null===t?"null":null==t?void 0:t.toString()}))}};var Rt=({property:r,data:t,hasBackground:n=!1})=>{const i=E((()=>r.propertyType===Ye.ENTITY?Array.isArray(r.properties)?r.properties:Nr(r.properties):[]),[r]);return e(c,Object.assign({style:{backgroundColor:n?"#f1f1f1":"none"}},{children:e(Lt,{property:r,data:t,properties:i})}))};const Mt=({properties:n,data:i})=>{const a=E((()=>n&&i?n.map((n=>{const{key:a,name:l,isMultiple:o,propertyType:s}=n,d=i[n.key];return{label:r(c,Object.assign({display:"flex",flexDirection:"column"},{children:[e("b",{children:l}),r("span",{children:[a," | ",o?"multiple":"single"," | ",s]})]})),content:o&&Array.isArray(d)?e(t,{children:d.map(((r,t)=>e(c,Object.assign({mb:2},{children:e(Rt,{property:n,data:r,hasBackground:!0})}),t)))}):e(Rt,{property:n,data:d})}})):[]),[n,i]);return e(pe,Object.assign({container:!0,direction:"column",spacing:2},{children:e(et,{data:a})}))};var $t=oe((e=>({root:{backgroundColor:"#eee",fontSize:"14px",padding:"0 8px",borderRadius:"10px","&.success":{backgroundColor:"#a9dfa9"},"&.error":{backgroundColor:"#ff7e7e"},"&.warning":{backgroundColor:e.palette.warning.main}}})));const Dt=({text:r,status:t="default"})=>{const n=$t();return e("div",Object.assign({className:Ve(n.root,{[t]:!0})},{children:r}))},Ft=oe((()=>({propertyStepLabel:{"&:hover":{fontWeight:"600",cursor:"pointer"}}}))),zt=({properties:t,parentKey:n="",activePath:i="",prefix:a="",onClick:l})=>{const o=Ft();return e(fe,Object.assign({orientation:"vertical",onClick:e=>e.stopPropagation()},{children:t&&t.map((t=>{var s;const c=n?`${n}.${t.key}`:t.key,d=null!==(s=t.propertyType.value)&&void 0!==s?s:t.propertyType;return r(ye,Object.assign({expanded:!0,onClick:()=>{return e=c,void l(a?`${a}.${e}`:e);var e}},{children:[e(ve,Object.assign({StepIconProps:{icon:"",completed:!1,active:i===c}},{children:r("div",Object.assign({className:o.propertyStepLabel},{children:[t.name," - ",t.key," - ",d]}))})),e(Oe,{children:e("div",{children:d===Ye.ENTITY&&e(zt,{onClick:l,activePath:i,properties:t.properties,parentKey:c},t.key)})})]}),t.key)}))}))};var Bt=zt;const Jt=({open:t=!1,onClose:o,onPaste:c,properties:d})=>{const[p,u]=T("");return r(i,Object.assign({open:t,onClose:o,fullWidth:!0,maxWidth:"md"},{children:[e(s,{children:"JSON path picker"}),r(l,{children:[r(D,Object.assign({variant:"h6",gutterBottom:!0},{children:["Path : $(",p,")"]})),(null==d?void 0:d.length)?d.map(((t,n)=>r("div",{children:[e(D,Object.assign({variant:"h6"},{children:t.title})),e(Bt,{properties:t.properties,prefix:t.pathPrefix,onClick:u,activePath:p})]},n))):e(D,{children:"Please, add properties"})]}),r(a,{children:[e(n,Object.assign({variant:"contained",color:"primary",onClick:()=>{navigator.clipboard.writeText(`$(${p})`),qe.success("Copied!")}},{children:"Copy"})),e(n,Object.assign({variant:"contained",color:"primary",onClick:()=>{qe.success("Pasted!"),c(`$(${p})`)}},{children:"Paste"})),e(n,Object.assign({variant:"contained",color:"secondary",onClick:o},{children:"Close"}))]})]}))};var Gt=({children:r})=>e("span",Object.assign({style:{backgroundColor:"#e4ecff"}},{children:r}));const Yt=Re();Object.assign(Yt,{overrides:{MUIRichTextEditor:{root:{marginTop:20,width:"100%",border:"1px solid gray",padding:"8px"},editor:{minHeight:"300px"},toolbar:{backgroundColor:"#eee"}}}});const _t=({fieldName:t,getProperties:n,initialText:i})=>{const{control:a,setValue:l,clearErrors:o}=g(),{fieldState:{error:s}}=m({control:a,name:t,rules:{required:"Please, fill content"}}),c=$e(De.createEmpty().getCurrentContent()),{open:d,onOpen:p,onClose:u}=er(),[h,b]=T(JSON.stringify(c)),[f,y]=T([]),[v,E]=T(null);O((()=>{if(i){const e=Fe(i),r=e&&ze.createFromBlockArray(e.contentBlocks,e.entityMap);b(JSON.stringify($e(r)))}}),[i]);return r(Me,Object.assign({theme:Yt},{children:[e(Le,{defaultValue:h,label:"Start here...",controls:["title","bold","italic","strikethrough","numberList","bulletList","code","jsonPathPicker"],onChange:e=>{const r=e.getCurrentContent(),n=e.getSelection();De.push(e,Be.replaceText(r,n,""),"remove-range");const i=!e.getCurrentContent().hasText(),a=r.getPlainText();l(t,i?"":a),o(t)},customControls:[{name:"jsonPathPicker",icon:e(Je,{}),type:"callback",onClick:e=>{E(e),y(n()),p()}}],decorators:[{component:Gt,regex:/\$\([^\s]*\)/g}]}),e(D,Object.assign({color:"secondary"},{children:null==s?void 0:s.message})),d&&e(Jt,{open:d,properties:f,onClose:u,onPaste:e=>{const r=v.getCurrentContent(),t=v.getSelection(),n=De.push(v,Be.insertText(r,t,e),"insert-characters").getCurrentContent();b(JSON.stringify($e(n))),u()}})]}))};export{Xe as AlertDialog,sr as BackButton,cr as ControlAceEditor,ar as ControlAutocomplete,nr as ControlCheckbox,Vr as ControlDate,qr as ControlDateTime,rr as ControlDebouncedInput,Ze as ControlInput,Pr as ControlNumberInput,lr as ControlQueryAutocomplete,ir as ControlRadioBtn,tr as ControlSelect,Ar as ControlSwitch,Lr as ControlTime,or as CopyButton,jt as CreateDefinition,xt as CreatePropertiesList,_e as DATE_DEFAULT_FORMAT,He as DATE_TIME_DEFAULT_FORMAT,qt as DefinitionFiller,Mt as DefinitionValueView,Hr as InfoItem,_r as JsonModalView,Jt as JsonPathPicker,Nt as JsonView,Ke as Loader,gt as MultiplePropertyFiller,mt as PropertyFiller,Ye as PropertyType,yt as PropertyValue,bt as PropertyValueField,Ue as RoundingMode,Yr as RouteTabs,Dt as Status,et as StepperView,We as TIME_DEFAULT_FORMAT,Gr as TabPanel,Br as Table,Jr as TableAction,_t as TemplateContentEditor,Vt as ViewPropertiesList,At as ViewProperty,ur as capitalize,br as deepParseJson,yr as digitsOnly,vr as floatsOnly,xr as formatDefinitionData,fr as formatTableRowValue,Sr as getDemPropertyDateFormat,Ir as getEntityStarterValue,hr as getJsonStringValue,kr as getMultiplePropertyFillOptions,wr as getSinglePropertyFillOptions,Tr as isDateType,Or as isExpression,Er as isPropertyValueEmpty,jr as propertiesArrayToObject,Nr as propertiesObjectToArray,dr as removeArrayItem,gr as safeParseJson,mr as sortArrayOfObjects,Qe as useDebounce,er as useToggle,pr as validateJson};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dartech/arsenal-ui",
|
3
|
-
"version": "0.1
|
3
|
+
"version": "0.2.1",
|
4
4
|
"author": "DAR",
|
5
5
|
"publishConfig": {
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
@@ -10,8 +10,11 @@
|
|
10
10
|
"react": "17.0.2",
|
11
11
|
"react-hook-form": "^7.5.2",
|
12
12
|
"@mui/x-date-pickers": "^5.0.0-alpha.0",
|
13
|
-
"@mui/x-data-grid": "^5.17.
|
14
|
-
"@mui/material": "^5.11.0",
|
13
|
+
"@mui/x-data-grid": "^5.17.18",
|
14
|
+
"@mui/icons-material": "^5.11.0",
|
15
|
+
"@mui/lab": "^5.0.0-alpha.114",
|
16
|
+
"@mui/material": "^5.11.3",
|
17
|
+
"@mui/styles": "^5.11.2",
|
15
18
|
"@emotion/react": "^11.10.5",
|
16
19
|
"@emotion/styled": "^11.10.5",
|
17
20
|
"date-fns": "^2.22.1",
|
@@ -20,11 +23,14 @@
|
|
20
23
|
"react-router-dom": "5.3.0",
|
21
24
|
"react-toastify": "^8.2.0",
|
22
25
|
"classnames": "^2.3.1",
|
23
|
-
"mui-rte": "^
|
24
|
-
"@material-ui/lab": "^4.0.0-alpha.61",
|
25
|
-
"@material-ui/core": "^4.12.4"
|
26
|
+
"mui-rte": "^2.0.1"
|
26
27
|
},
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
28
|
+
"module": "./index.js",
|
29
|
+
"main": "./index.js",
|
30
|
+
"type": "module",
|
31
|
+
"types": "./index.d.ts",
|
32
|
+
"peerDependencies": {
|
33
|
+
"@rollup/plugin-node-resolve": "13.3.0",
|
34
|
+
"draft-js": "0.11.7"
|
35
|
+
}
|
30
36
|
}
|
@@ -21,8 +21,8 @@ export interface Definition {
|
|
21
21
|
name: string;
|
22
22
|
properties: PropertiesObjectType;
|
23
23
|
}
|
24
|
-
export
|
25
|
-
export
|
24
|
+
export type PropertiesObjectType<T = unknown> = Record<string, PropertyUnion & T>;
|
25
|
+
export type PropertiesArrayType<T = unknown> = Array<PropertyUnion & T>;
|
26
26
|
export interface CreateDefinitionType extends Omit<Definition, 'properties'> {
|
27
27
|
properties: PropertiesArrayType;
|
28
28
|
}
|
@@ -100,21 +100,21 @@ export interface TimeProperty extends Property {
|
|
100
100
|
export interface AnyProperty extends Property {
|
101
101
|
propertyType: 'ANY';
|
102
102
|
}
|
103
|
-
export
|
103
|
+
export type PropertyUnion = BigDecimalProperty | BigIntegerProperty | BooleanProperty | DateProperty | DateTimeProperty | DoubleProperty | EntityTypeProperty | EntityReferenceProperty | FloatProperty | StringProperty | IntegerProperty | JsonProperty | LongProperty | TimeProperty | AnyProperty;
|
104
104
|
export declare const DATE_DEFAULT_FORMAT = "yyyy-MM-dd";
|
105
105
|
export declare const TIME_DEFAULT_FORMAT = "HH:mm:ss";
|
106
106
|
export declare const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
107
|
-
export
|
107
|
+
export type GPBPropertiesObjectType = PropertiesObjectType<{
|
108
108
|
value: unknown;
|
109
109
|
values: unknown[];
|
110
110
|
}>;
|
111
|
-
export
|
111
|
+
export type GPBPropertiesArrayType = PropertiesArrayType<{
|
112
112
|
value: unknown;
|
113
113
|
values: unknown[];
|
114
114
|
}>;
|
115
|
-
export
|
115
|
+
export type EntityDefinitionPropertyObjectType = PropertiesObjectType<{
|
116
116
|
isViewableInList: boolean;
|
117
117
|
}>;
|
118
|
-
export
|
118
|
+
export type EntityDefinitionPropertyArrayType = PropertiesArrayType<{
|
119
119
|
isViewableInList: boolean;
|
120
120
|
}>;
|
package/src/interfaces/ui.d.ts
CHANGED
@@ -14,13 +14,13 @@ export interface Option {
|
|
14
14
|
value: string;
|
15
15
|
label: string;
|
16
16
|
}
|
17
|
-
export
|
18
|
-
export
|
17
|
+
export type TableDataType = 'JSON' | 'JSON_text' | 'JSON_copy' | 'copy' | 'boolean' | 'date' | 'status' | 'array';
|
18
|
+
export type JsonPathPickerProperties = {
|
19
19
|
properties: PropertiesArrayType;
|
20
20
|
pathPrefix: string;
|
21
21
|
title: string;
|
22
22
|
}[];
|
23
|
-
export
|
23
|
+
export type CustomPropertyFieldProps = {
|
24
24
|
name: string;
|
25
25
|
label?: string;
|
26
26
|
type: 'text' | 'checkbox' | 'number' | 'select' | 'autocomplete' | 'json';
|
@@ -31,5 +31,5 @@ export declare type CustomPropertyFieldProps = {
|
|
31
31
|
}[];
|
32
32
|
required?: boolean;
|
33
33
|
};
|
34
|
-
export
|
35
|
-
export
|
34
|
+
export type PropertyFillType = 'expression' | 'widget' | 'null' | 'string' | 'json_valid' | 'json_notvalid';
|
35
|
+
export type StatusVariant = 'default' | 'success' | 'error' | 'warning';
|
package/src/lib/Alert/Alert.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { Control } from 'react-hook-form';
|
3
|
-
|
4
|
-
|
3
|
+
type ValidateFunc = (value: string) => boolean | string;
|
4
|
+
type onChangeCallback = (e: any) => void;
|
5
5
|
/**
|
6
6
|
* This interface is referencing the [[ControlInput]] component props.
|
7
7
|
* @category Forms
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { Control } from 'react-hook-form';
|
3
|
-
|
4
|
-
|
3
|
+
type ValidateFunc = (value: string) => boolean | string;
|
4
|
+
type onChangeCallback = (e: any) => void;
|
5
5
|
/**
|
6
6
|
* This interface is referencing the [[ControlSelect]] component props.
|
7
7
|
* @category Forms
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: (props?: any) => import("@
|
1
|
+
declare const _default: (props?: any) => import("@mui/styles").ClassNameMap<"container" | "text" | "title">;
|
2
2
|
export default _default;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const useStyles: (props?: any) => import("@
|
1
|
+
declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"inputLabel">;
|
2
2
|
export default useStyles;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { PropertiesArrayType, PropertyType } from '../../../interfaces';
|
2
2
|
import { Control } from 'react-hook-form';
|
3
|
-
export
|
3
|
+
export type ValueComponentProps = {
|
4
4
|
control: Control;
|
5
5
|
propertyType: PropertyType | 'ANY';
|
6
6
|
name: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { CustomPropertyFieldProps } from '../../../interfaces';
|
3
|
-
|
3
|
+
type Props = CustomPropertyFieldProps & {
|
4
4
|
propertyFieldName: string;
|
5
5
|
};
|
6
6
|
export declare const CustomPropertyField: ({ name, label, propertyFieldName, type, decimal, options, required, }: Props) => JSX.Element;
|