dinocollab-core 2.2.42 → 2.2.44
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/bin/codegen.js +2 -1
- package/dist/form/index.js +1 -1
- package/dist/src/api-context/alert-global.js +1 -1
- package/dist/src/api-context/alert-global.js.map +1 -1
- package/dist/src/components/text-editor.js +1 -1
- package/dist/src/components/text-editor.js.map +1 -1
- package/dist/src/data-surface/view-list/styled.js +1 -1
- package/dist/src/data-surface/view-list/styled.js.map +1 -1
- package/dist/src/filter-bar/components/filter-summary.js +1 -1
- package/dist/src/filter-bar/components/filter-summary.js.map +1 -1
- package/dist/src/filter-bar/hooks.js +1 -1
- package/dist/src/filter-bar/hooks.js.map +1 -1
- package/dist/src/filter-bar/index.create.js +1 -1
- package/dist/src/filter-bar/index.create.js.map +1 -1
- package/dist/src/filter-bar/menu/create-form-field-select-multiple.js +1 -1
- package/dist/src/filter-bar/menu/create-form-field-select-multiple.js.map +1 -1
- package/dist/src/filter-bar/menu/create-form-field-select.js +1 -1
- package/dist/src/filter-bar/menu/create-form-field-select.js.map +1 -1
- package/dist/src/form/create.input-file.csv-local-parser.js +1 -1
- package/dist/src/form/create.input-file.csv-local-parser.js.map +1 -1
- package/dist/src/form/create.text-editor.js +1 -1
- package/dist/src/form/create.text-editor.js.map +1 -1
- package/dist/src/form/decorator.form.js +1 -1
- package/dist/src/form/decorator.form.js.map +1 -1
- package/dist/src/form/decorator.js +1 -1
- package/dist/src/form/decorator.js.map +1 -1
- package/dist/src/form/decorator.units.js +2 -0
- package/dist/src/form/decorator.units.js.map +1 -0
- package/dist/src/form/dino-form.js +1 -1
- package/dist/src/form/dino-form.js.map +1 -1
- package/dist/src/form/helpers.js +1 -1
- package/dist/src/form/helpers.js.map +1 -1
- package/dist/src/table/dino.js +1 -1
- package/dist/src/table/dino.js.map +1 -1
- package/dist/src/table/toolbar-pannel.js +1 -1
- package/dist/src/table/toolbar-pannel.js.map +1 -1
- package/dist/src/table/ui.units.js +1 -1
- package/dist/src/table/ui.units.js.map +1 -1
- package/dist/src/table-grid/toolbar-pannel.js +1 -1
- package/dist/src/table-grid/toolbar-pannel.js.map +1 -1
- package/dist/src/utils/query-param.js +1 -1
- package/dist/src/utils/query-param.js.map +1 -1
- package/dist/types/api-context/alert-global.d.ts +1 -1
- package/dist/types/components/text-editor.d.ts +0 -1
- package/dist/types/filter-bar/menu/create-form-field-select-multiple.d.ts +1 -1
- package/dist/types/filter-bar/menu/create-form-field-select.d.ts +1 -1
- package/dist/types/form/create.input-file.csv-local-parser.d.ts +15 -0
- package/dist/types/form/decorator.d.ts +9 -8
- package/dist/types/form/decorator.form.d.ts +11 -17
- package/dist/types/form/decorator.units.d.ts +17 -0
- package/dist/types/form/dino-form.d.ts +1 -2
- package/dist/types/form/helpers.d.ts +4 -1
- package/dist/types/form/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{objectWithoutProperties as
|
|
1
|
+
import{objectWithoutProperties as e,objectSpread2 as r,slicedToArray as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as i,Fragment as n,jsxs as a}from"react/jsx-runtime";import{useState as o,useEffect as l}from"react";import{styled as c,Typography as p,Box as m,Chip as s,Tooltip as u,IconButton as d,Divider as f}from"@mui/material";import v from"@mui/icons-material/OpenInNew";import{mergeObjects as g}from"../utils/helpers.js";import"../utils/dayjs-config.js";import"../utils/query-param.js";import"../components/breadcrumbs.js";import"../components/buttons.js";import{CopyToClipboard as h}from"../components/copy-to-clipboard.js";import"../components/create.multi-select-dropdown.js";import{HelpTooltipWrap as x}from"../components/help-tooltip.js";import"../components/rich-tooltip.js";import"../components/text-editor.js";import b from"dayjs";var y=["children"],j=function(e,t){return function(a){var o,l,c,p,m;return a.value?i(k,r(r({onClick:a.onClick},null===(o=a.slots)||void 0===o?void 0:o.typographyProps),{},{sx:(c=a.value,p=a.sx,m=a.slots,Object.assign({},c?e[c]:{},null==t?void 0:t.sx,p,null==m||null===(l=m.typographyProps)||void 0===l?void 0:l.sx)),children:a.title||a.value})):i(n,{})}},k=c(p)({borderRadius:"4px",fontSize:"0.8rem",padding:"4px 9px",fontWeight:600,minWidth:"70px",textAlign:"center",color:"#ffffff",display:"inline-block"}),w=function(e){var r,n=o(null!==(r=e.imageUri)&&void 0!==r?r:e.fallbackSrc),c=t(n,2),s=c[0],u=c[1];return l(function(){var r;u(null!==(r=e.imageUri)&&void 0!==r?r:e.fallbackSrc)},[e.imageUri,e.fallbackSrc]),a(m,{sx:{display:"flex",alignItems:"center",height:"100%",gap:"10px"},children:[i(F,{src:s,onError:function(){return u(e.fallbackSrc)}}),i(p,{variant:"body1",children:e.value})]})},S=function(e){var r,n=o(null!==(r=e.imageUri)&&void 0!==r?r:e.imageFallback),a=t(n,2),c=a[0],p=a[1];return l(function(){var r;p(null!==(r=e.imageUri)&&void 0!==r?r:e.imageFallback)},[e.imageUri,e.imageFallback]),i(F,{src:c,onError:function(){return p(e.imageFallback)},sx:e.sx})},F=c("img")({backgroundRepeat:"no-repeat",height:"50px",width:"50px",backgroundSize:"contain",borderRadius:"8px",boxShadow:"rgba(0, 0, 0, 0.16) 0px 1px 4px"}),U=function(e){var t,n=null!==(t=e.valueFormatted)&&void 0!==t?t:e.value,o=!!e.copyToClipboard&&!!n;return a(W,r(r({title:n},e.wrapProps),{},{children:[!!e.imageUrl&&i(S,{imageUri:e.imageUrl,sx:{mr:"10px"},imageFallback:e.imageFallbackSrc}),!!e.icon&&e.icon,i(p,r(r({variant:"body2",component:"span",noWrap:!0,sx:{flex:1}},e.typographyProps),{},{children:n})),n&&!0===e.openInNewTab&&i(u,{arrow:!0,title:"Open new tab",children:i(d,{component:"a",href:n,target:"_blank",children:i(v,{fontSize:"small",sx:{color:"#1A75E2"}})})}),o&&i(h,{value:n}),n&&!0===e.beforeLine&&i(f,{flexItem:!0,variant:"middle",orientation:"vertical"})]}))},W=c(function(t){var n=t.children,a=e(t,y);return i(m,r(r({},a),{},{children:i("div",{children:n})}))})({flex:1,width:"100%",height:"100%",position:"relative",top:0,left:0,"& > div":{display:"flex",alignItems:"center",width:"100%",height:"100%",position:"absolute",top:0,left:0}}),I=function(e){var r,t;if("string"!=typeof e.value)return null!==(r=e.value)&&void 0!==r?r:i(n,{});var o=e.value.split(null!==(t=null==e?void 0:e.separator)&&void 0!==t?t:"|").filter(function(e){return!!e}),l=null!=e&&e.maximum?o.slice(0,e.maximum):o,c=null!=e&&e.maximum&&o.length>e.maximum?o.length-e.maximum:0;return a(m,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px",height:"100%"},children:[l.map(function(r,t){return i(P,{label:e.valueFormatter?e.valueFormatter(r):r,size:"small"},"key"+t)}),c>0&&i(x,{title:"Artists",content:i(m,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"4px"},children:o.map(function(e,r){return i(P,{label:e,size:"small"},"key"+r)})}),children:i(P,{label:"+".concat(c),size:"small"},"remaining")})]})},P=c(s)({lineHeight:1}),z=function(e){try{var t,n,a=null!==(t=null==e?void 0:e.showRelative)&&void 0!==t&&t,o=b(e.value),l=o.format(e.formatString),c=a?"".concat(l," (").concat(b().to(o),")"):l,m=e.styledGetter?e.styledGetter(e.value):{flex:1},s=g({},null!==(n=e.typographyProps)&&void 0!==n?n:{},{sx:m});return i(p,r(r({variant:"body2",component:"span",noWrap:!0,title:"".concat(c," formatted with ").concat(e.formatString)},s),{},{children:c}))}catch(e){return i(p,{variant:"body2",component:"span",noWrap:!0,children:"format invalid"})}};export{U as CellBase,I as CellChips,z as CellDate,w as CellImageSmall,j as CreateStatusCell,S as ImageSmallFallback};
|
|
2
2
|
//# sourceMappingURL=ui.units.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.units.js","sources":["../../../src/table/ui.units.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\r\nimport { Box, BoxProps, Chip, Divider, IconButton, styled, SxProps, Theme, Tooltip, Typography, TypographyProps } from '@mui/material'\r\nimport type { ComponentType, FC, PropsWithChildren, ReactNode } from 'react'\r\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew'\r\nimport { dayjsCustom, mergeObjects } from '../utils'\r\nimport { CopyToClipboard, HelpTooltipWrap } from '../components'\r\n\r\n//#region CellImageSmall\r\nexport type IStatusCellConfig<T extends string> = { [key in T]: SxProps<Theme> }\r\n\r\nexport interface IStatusCellOptions {\r\n sx?: SxProps<Theme>\r\n}\r\n\r\nexport interface IStatusCellProps<T extends string> extends PropsWithChildren {\r\n value?: T\r\n title?: string\r\n sx?: SxProps<Theme>\r\n onClick?: TypographyProps['onClick']\r\n slots?: {\r\n typographyProps?: TypographyProps\r\n }\r\n}\r\n\r\nexport const CreateStatusCell = function <T extends string>(\r\n config: IStatusCellConfig<T>,\r\n options?: IStatusCellOptions\r\n): ComponentType<IStatusCellProps<T>> {\r\n const StatusCell: FC<IStatusCellProps<T>> = (props) => {\r\n const getSxProps = (): SxProps<Theme> => {\r\n const { value: data, sx, slots } = props\r\n return Object.assign({}, data ? config[data] : {}, options?.sx, sx, slots?.typographyProps?.sx)\r\n }\r\n\r\n if (!props.value) return <></>\r\n return (\r\n <CustomTypography onClick={props.onClick} {...props.slots?.typographyProps} sx={getSxProps()}>\r\n {props.title || props.value}\r\n </CustomTypography>\r\n )\r\n }\r\n return StatusCell\r\n}\r\n\r\nconst CustomTypography = styled(Typography)({\r\n borderRadius: '4px',\r\n fontSize: '0.8rem',\r\n padding: '4px 9px',\r\n fontWeight: 600,\r\n minWidth: '70px',\r\n textAlign: 'center',\r\n color: '#ffffff',\r\n display: 'inline-block'\r\n})\r\n\r\n//#region CellImageSmall\r\ninterface CellImageSmallProps {\r\n value: string\r\n imageUri?: string\r\n fallbackSrc?: string\r\n}\r\n\r\nexport const CellImageSmall: FC<CellImageSmallProps> = (props) => {\r\n const [imgSrc, setImgSrc] = useState(props.imageUri ?? props.fallbackSrc)\r\n useEffect(() => {\r\n setImgSrc(props.imageUri ?? props.fallbackSrc)\r\n }, [props.imageUri, props.fallbackSrc])\r\n return (\r\n <Box sx={{ display: 'flex', alignItems: 'center', height: '100%', gap: '10px' }}>\r\n <ImageSmall src={imgSrc} onError={() => setImgSrc(props.fallbackSrc)} />\r\n <Typography variant='body1'>{props.value}</Typography>\r\n </Box>\r\n )\r\n}\r\n\r\ninterface ImageSmallFallbackProps {\r\n imageUri?: string\r\n imageFallback?: string\r\n sx?: SxProps<Theme>\r\n}\r\n\r\nexport const ImageSmallFallback: FC<ImageSmallFallbackProps> = (props) => {\r\n const [imgSrc, setImgSrc] = useState(props.imageUri ?? props.imageFallback)\r\n useEffect(() => {\r\n setImgSrc(props.imageUri ?? props.imageFallback)\r\n }, [props.imageUri, props.imageFallback])\r\n return <ImageSmall src={imgSrc} onError={() => setImgSrc(props.imageFallback)} sx={props.sx} />\r\n}\r\n\r\nconst ImageSmall = styled('img')({\r\n backgroundRepeat: 'no-repeat',\r\n height: '50px',\r\n width: '50px',\r\n backgroundSize: 'contain',\r\n borderRadius: '8px',\r\n boxShadow: 'rgba(0, 0, 0, 0.16) 0px 1px 4px'\r\n})\r\n//#endregion\r\n\r\n//#region CellBase\r\n\r\nexport interface CellBaseOptions {\r\n openInNewTab?: boolean\r\n beforeLine?: boolean\r\n copyToClipboard?: boolean\r\n icon?: ReactNode\r\n imageUrl?: string\r\n imageFallbackSrc?: string\r\n valueFormatter?: (value?: string) => string\r\n wrapProps?: BoxProps & { [key: string]: any }\r\n typographyProps?: TypographyProps & { [key: string]: any }\r\n}\r\n\r\ninterface CellBaseProps extends CellBaseOptions {\r\n value?: string\r\n valueFormatted?: string\r\n}\r\n\r\nexport const CellBase: FC<CellBaseProps> = (props) => {\r\n const value = props.valueFormatted ?? props.value\r\n const isCopyToClipboard = !!props.copyToClipboard && !!value\r\n return (\r\n <CellBaseWrap title={value} {...props.wrapProps}>\r\n {!!props.imageUrl && <ImageSmallFallback imageUri={props.imageUrl} sx={{ mr: '10px' }} imageFallback={props.imageFallbackSrc} />}\r\n {!!props.icon && props.icon}\r\n <Typography variant='body2' component='span' noWrap sx={{ flex: 1 }} {...props.typographyProps}>\r\n {value}\r\n </Typography>\r\n {value && props.openInNewTab === true && (\r\n <Tooltip arrow title='Open new tab'>\r\n <IconButton component='a' href={value} target='_blank'>\r\n <OpenInNewIcon fontSize='small' sx={{ color: '#1A75E2' }} />\r\n </IconButton>\r\n </Tooltip>\r\n )}\r\n {isCopyToClipboard && <CopyToClipboard value={value} />}\r\n {value && props.beforeLine === true && <Divider flexItem variant='middle' orientation='vertical' />}\r\n </CellBaseWrap>\r\n )\r\n}\r\n\r\nconst CellBaseWrap = styled(({ children, ...props }: BoxProps) => (\r\n <Box {...props}>\r\n <div>{children}</div>\r\n </Box>\r\n))({\r\n flex: 1,\r\n width: '100%',\r\n height: '100%',\r\n position: 'relative',\r\n top: 0,\r\n left: 0,\r\n '& > div': {\r\n display: 'flex',\r\n alignItems: 'center',\r\n width: '100%',\r\n height: '100%',\r\n position: 'absolute',\r\n top: 0,\r\n left: 0\r\n }\r\n})\r\n//#endregion\r\n\r\n//#region Chips\r\nexport interface CellChipsProps {\r\n value?: string\r\n valueFormatter?: (value: string) => string\r\n separator?: string\r\n maximum?: number\r\n}\r\n\r\nexport const CellChips: FC<CellChipsProps> = (props) => {\r\n if (typeof props.value !== 'string') return props.value ?? <></>\r\n\r\n const list = props.value.split(props?.separator ?? '|').filter((x) => !!x)\r\n const displayList = props?.maximum ? list.slice(0, props.maximum) : list\r\n const remainingCount = props?.maximum && list.length > props.maximum ? list.length - props.maximum : 0\r\n\r\n return (\r\n <Box sx={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '4px', height: '100%' }}>\r\n {displayList.map((x, i) => (\r\n <CustomChip key={'key' + i} label={props.valueFormatter ? props.valueFormatter(x) : x} size='small' />\r\n ))}\r\n {remainingCount > 0 && (\r\n <HelpTooltipWrap\r\n title='Artists'\r\n content={\r\n <Box sx={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '4px' }}>\r\n {list.map((x, i) => (\r\n <CustomChip key={'key' + i} label={x} size='small' />\r\n ))}\r\n </Box>\r\n }\r\n >\r\n <CustomChip key='remaining' label={`+${remainingCount}`} size='small' />\r\n </HelpTooltipWrap>\r\n )}\r\n </Box>\r\n )\r\n}\r\n\r\nconst CustomChip = styled(Chip)({\r\n lineHeight: 1\r\n})\r\n//#endregion\r\n\r\n//#region Date\r\nexport interface CellDatePropsOwner {\r\n formatString?: string\r\n showRelative?: boolean\r\n typographyProps?: TypographyProps\r\n styledGetter?: (value: any) => SxProps<Theme>\r\n}\r\nexport interface CellDateProps extends CellDatePropsOwner {\r\n value: any\r\n}\r\n\r\nexport const CellDate: FC<CellDateProps> = (props) => {\r\n try {\r\n const showRelative = props?.showRelative ?? false\r\n const date = dayjsCustom(props.value)\r\n const formatted = date.format(props.formatString)\r\n const value = showRelative ? `${formatted} (${dayjsCustom().to(date)})` : formatted\r\n const sx = props.styledGetter ? props.styledGetter(props.value) : { flex: 1 }\r\n const mergeTypographyProps = mergeObjects<TypographyProps>({}, props.typographyProps ?? {}, { sx })\r\n return (\r\n <Typography variant='body2' component='span' noWrap title={`${value} formatted with ${props.formatString}`} {...mergeTypographyProps}>\r\n {value}\r\n </Typography>\r\n )\r\n } catch {\r\n return (\r\n <Typography variant='body2' component='span' noWrap>\r\n format invalid\r\n </Typography>\r\n )\r\n }\r\n}\r\n//#endregion\r\n"],"names":["CreateStatusCell","config","options","props","_props$slots","_slots$typographyProp","data","sx","slots","value","_jsx","CustomTypography","_objectSpread","onClick","typographyProps","Object","assign","children","title","styled","Typography","borderRadius","fontSize","padding","fontWeight","minWidth","textAlign","color","display","CellImageSmall","_props$imageUri","_useState","useState","imageUri","fallbackSrc","_useState2","_slicedToArray","imgSrc","setImgSrc","useEffect","_props$imageUri2","_jsxs","Box","alignItems","height","gap","ImageSmall","src","onError","variant","ImageSmallFallback","_props$imageUri3","_useState3","imageFallback","_useState4","_props$imageUri4","backgroundRepeat","width","backgroundSize","boxShadow","CellBase","_props$valueFormatted","valueFormatted","isCopyToClipboard","copyToClipboard","CellBaseWrap","wrapProps","imageUrl","mr","imageFallbackSrc","icon","component","noWrap","flex","openInNewTab","Tooltip","arrow","IconButton","href","target","OpenInNewIcon","CopyToClipboard","beforeLine","Divider","flexItem","orientation","_ref","_objectWithoutProperties","_excluded","position","top","left","CellChips","_props$value","_props$separator","list","split","separator","filter","x","displayList","maximum","slice","remainingCount","length","flexWrap","map","i","CustomChip","label","valueFormatter","size","HelpTooltipWrap","content","concat","Chip","lineHeight","CellDate","_props$showRelative","_props$typographyProp","showRelative","date","dayjsCustom","formatted","format","formatString","to","styledGetter","mergeTypographyProps","mergeObjects","_unused"],"mappings":"8qBAwBaA,EAAmB,SAC9BC,EACAC,GAeA,OAb4C,SAACC,GAAS,IAAAC,EACZC,EACvBC,EAAMC,EAAIC,EAI3B,OAAKL,EAAMM,MAETC,EAACC,EAAgBC,EAAAA,EAAA,CAACC,QAASV,EAAMU,iBAAOT,EAAMD,EAAMK,aAAK,IAAAJ,OAAA,EAAXA,EAAaU,iBAAe,CAAA,EAAA,CAAEP,IAN7DD,EAAoBH,EAA3BM,MAAaF,EAAcJ,EAAdI,GAAIC,EAAUL,EAAVK,MAClBO,OAAOC,OAAO,CAAE,EAAEV,EAAOL,EAAOK,GAAQ,CAAA,EAAIJ,aAAO,EAAPA,EAASK,GAAIA,EAAIC,SAAsBH,QAAjBA,EAALG,EAAOM,2BAAeT,SAAtBA,EAAwBE,KAKAU,SACzFd,EAAMe,OAASf,EAAMM,SAHDC,OAM1B,CAEH,EAEMC,EAAmBQ,EAAOC,EAAPD,CAAmB,CAC1CE,aAAc,MACdC,SAAU,SACVC,QAAS,UACTC,WAAY,IACZC,SAAU,OACVC,UAAW,SACXC,MAAO,UACPC,QAAS,iBAUEC,EAA0C,SAAC1B,GAAS,IAAA2B,EAC/DC,EAA4BC,EAAuB,QAAfF,EAAC3B,EAAM8B,gBAAQH,I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H,EAAMM,OACzBkH,EAAYF,EAAKG,OAAOzH,EAAM0H,cAC9BpH,EAAQ+G,KAAYN,OAAMS,EAAST,MAAAA,OAAKQ,IAAcI,GAAGL,QAAWE,EACpEpH,EAAKJ,EAAM4H,aAAe5H,EAAM4H,aAAa5H,EAAMM,OAAS,CAAEgE,KAAM,GACpEuD,EAAuBC,EAA8B,WAAEV,EAAEpH,EAAMW,uBAAe,IAAAyG,EAAAA,EAAI,CAAA,EAAI,CAAEhH,GAAAA,IAC9F,OACEG,EAACU,EAAUR,EAAAA,EAAA,CAACqC,QAAQ,QAAQsB,UAAU,OAAOC,QAAM,EAACtD,MAAK,GAAAgG,OAAKzG,sBAAKyG,OAAmB/G,EAAM0H,eAAoBG,GAAoB,GAAA,CAAA/G,SACjIR,IAGN,CAAC,MAAAyH,GACA,OACExH,EAACU,EAAU,CAAC6B,QAAQ,QAAQsB,UAAU,OAAOC,QAAM,EAAAvD,SAAA,kBAItD,CACH"}
|
|
1
|
+
{"version":3,"file":"ui.units.js","sources":["../../../src/table/ui.units.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\r\nimport { Box, BoxProps, Chip, Divider, IconButton, styled, SxProps, Theme, Tooltip, Typography, TypographyProps } from '@mui/material'\r\nimport type { ComponentType, FC, PropsWithChildren, ReactNode } from 'react'\r\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew'\r\nimport { dayjsCustom, mergeObjects } from '../utils'\r\nimport { CopyToClipboard, HelpTooltipWrap } from '../components'\r\n\r\n//#region CellImageSmall\r\nexport type IStatusCellConfig<T extends string> = { [key in T]: SxProps<Theme> }\r\n\r\nexport interface IStatusCellOptions {\r\n sx?: SxProps<Theme>\r\n}\r\n\r\nexport interface IStatusCellProps<T extends string> extends PropsWithChildren {\r\n value?: T\r\n title?: string\r\n sx?: SxProps<Theme>\r\n onClick?: TypographyProps['onClick']\r\n slots?: {\r\n typographyProps?: TypographyProps\r\n }\r\n}\r\n\r\nexport const CreateStatusCell = function <T extends string>(\r\n config: IStatusCellConfig<T>,\r\n options?: IStatusCellOptions\r\n): ComponentType<IStatusCellProps<T>> {\r\n const StatusCell: FC<IStatusCellProps<T>> = (props) => {\r\n const getSxProps = (): SxProps<Theme> => {\r\n const { value: data, sx, slots } = props\r\n return Object.assign({}, data ? config[data] : {}, options?.sx, sx, slots?.typographyProps?.sx)\r\n }\r\n\r\n if (!props.value) return <></>\r\n return (\r\n <CustomTypography onClick={props.onClick} {...props.slots?.typographyProps} sx={getSxProps()}>\r\n {props.title || props.value}\r\n </CustomTypography>\r\n )\r\n }\r\n return StatusCell\r\n}\r\n\r\nconst CustomTypography = styled(Typography)({\r\n borderRadius: '4px',\r\n fontSize: '0.8rem',\r\n padding: '4px 9px',\r\n fontWeight: 600,\r\n minWidth: '70px',\r\n textAlign: 'center',\r\n color: '#ffffff',\r\n display: 'inline-block'\r\n})\r\n\r\n//#region CellImageSmall\r\ninterface CellImageSmallProps {\r\n value: string\r\n imageUri?: string\r\n fallbackSrc?: string\r\n}\r\n\r\nexport const CellImageSmall: FC<CellImageSmallProps> = (props) => {\r\n const [imgSrc, setImgSrc] = useState(props.imageUri ?? props.fallbackSrc)\r\n useEffect(() => {\r\n setImgSrc(props.imageUri ?? props.fallbackSrc)\r\n }, [props.imageUri, props.fallbackSrc])\r\n return (\r\n <Box sx={{ display: 'flex', alignItems: 'center', height: '100%', gap: '10px' }}>\r\n <ImageSmall src={imgSrc} onError={() => setImgSrc(props.fallbackSrc)} />\r\n <Typography variant='body1'>{props.value}</Typography>\r\n </Box>\r\n )\r\n}\r\n\r\ninterface ImageSmallFallbackProps {\r\n imageUri?: string\r\n imageFallback?: string\r\n sx?: SxProps<Theme>\r\n}\r\n\r\nexport const ImageSmallFallback: FC<ImageSmallFallbackProps> = (props) => {\r\n const [imgSrc, setImgSrc] = useState(props.imageUri ?? props.imageFallback)\r\n useEffect(() => {\r\n setImgSrc(props.imageUri ?? props.imageFallback)\r\n }, [props.imageUri, props.imageFallback])\r\n return <ImageSmall src={imgSrc} onError={() => setImgSrc(props.imageFallback)} sx={props.sx} />\r\n}\r\n\r\nconst ImageSmall = styled('img')({\r\n backgroundRepeat: 'no-repeat',\r\n height: '50px',\r\n width: '50px',\r\n backgroundSize: 'contain',\r\n borderRadius: '8px',\r\n boxShadow: 'rgba(0, 0, 0, 0.16) 0px 1px 4px'\r\n})\r\n//#endregion\r\n\r\n//#region CellBase\r\n\r\nexport interface CellBaseOptions {\r\n openInNewTab?: boolean\r\n beforeLine?: boolean\r\n copyToClipboard?: boolean\r\n icon?: ReactNode\r\n imageUrl?: string\r\n imageFallbackSrc?: string\r\n valueFormatter?: (value?: string) => string\r\n wrapProps?: BoxProps & { [key: string]: any }\r\n typographyProps?: TypographyProps & { [key: string]: any }\r\n}\r\n\r\ninterface CellBaseProps extends CellBaseOptions {\r\n value?: string\r\n valueFormatted?: string\r\n}\r\n\r\nexport const CellBase: FC<CellBaseProps> = (props) => {\r\n const value = props.valueFormatted ?? props.value\r\n const isCopyToClipboard = !!props.copyToClipboard && !!value\r\n return (\r\n <CellBaseWrap title={value} {...props.wrapProps}>\r\n {!!props.imageUrl && <ImageSmallFallback imageUri={props.imageUrl} sx={{ mr: '10px' }} imageFallback={props.imageFallbackSrc} />}\r\n {!!props.icon && props.icon}\r\n <Typography variant='body2' component='span' noWrap sx={{ flex: 1 }} {...props.typographyProps}>\r\n {value}\r\n </Typography>\r\n {value && props.openInNewTab === true && (\r\n <Tooltip arrow title='Open new tab'>\r\n <IconButton component='a' href={value} target='_blank'>\r\n <OpenInNewIcon fontSize='small' sx={{ color: '#1A75E2' }} />\r\n </IconButton>\r\n </Tooltip>\r\n )}\r\n {isCopyToClipboard && <CopyToClipboard value={value} />}\r\n {value && props.beforeLine === true && <Divider flexItem variant='middle' orientation='vertical' />}\r\n </CellBaseWrap>\r\n )\r\n}\r\n\r\nconst CellBaseWrap = styled(({ children, ...props }: BoxProps) => (\r\n <Box {...props}>\r\n <div>{children}</div>\r\n </Box>\r\n))({\r\n flex: 1,\r\n width: '100%',\r\n height: '100%',\r\n position: 'relative',\r\n top: 0,\r\n left: 0,\r\n '& > div': {\r\n display: 'flex',\r\n alignItems: 'center',\r\n width: '100%',\r\n height: '100%',\r\n position: 'absolute',\r\n top: 0,\r\n left: 0\r\n }\r\n})\r\n//#endregion\r\n\r\n//#region Chips\r\nexport interface CellChipsProps {\r\n value?: string\r\n valueFormatter?: (value: string) => string\r\n separator?: string\r\n maximum?: number\r\n}\r\n\r\nexport const CellChips: FC<CellChipsProps> = (props) => {\r\n if (typeof props.value !== 'string') return props.value ?? <></>\r\n\r\n const list = props.value.split(props?.separator ?? '|').filter((x) => !!x)\r\n const displayList = props?.maximum ? list.slice(0, props.maximum) : list\r\n const remainingCount = props?.maximum && list.length > props.maximum ? list.length - props.maximum : 0\r\n\r\n return (\r\n <Box sx={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '4px', height: '100%' }}>\r\n {displayList.map((x, i) => (\r\n <CustomChip key={'key' + i} label={props.valueFormatter ? props.valueFormatter(x) : x} size='small' />\r\n ))}\r\n {remainingCount > 0 && (\r\n <HelpTooltipWrap\r\n title='Artists'\r\n content={\r\n <Box sx={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '4px' }}>\r\n {list.map((x, i) => (\r\n <CustomChip key={'key' + i} label={x} size='small' />\r\n ))}\r\n </Box>\r\n }\r\n >\r\n <CustomChip key='remaining' label={`+${remainingCount}`} size='small' />\r\n </HelpTooltipWrap>\r\n )}\r\n </Box>\r\n )\r\n}\r\n\r\nconst CustomChip = styled(Chip)({\r\n lineHeight: 1\r\n})\r\n//#endregion\r\n\r\n//#region Date\r\nexport interface CellDatePropsOwner {\r\n formatString?: string\r\n showRelative?: boolean\r\n typographyProps?: TypographyProps\r\n styledGetter?: (value: any) => SxProps<Theme>\r\n}\r\nexport interface CellDateProps extends CellDatePropsOwner {\r\n value: any\r\n}\r\n\r\nexport const CellDate: FC<CellDateProps> = (props) => {\r\n try {\r\n const showRelative = props?.showRelative ?? false\r\n const date = dayjsCustom(props.value)\r\n const formatted = date.format(props.formatString)\r\n const value = showRelative ? `${formatted} (${dayjsCustom().to(date)})` : formatted\r\n const sx = props.styledGetter ? props.styledGetter(props.value) : { flex: 1 }\r\n const mergeTypographyProps = mergeObjects<TypographyProps>({}, props.typographyProps ?? {}, { sx })\r\n return (\r\n <Typography variant='body2' component='span' noWrap title={`${value} formatted with ${props.formatString}`} {...mergeTypographyProps}>\r\n {value}\r\n </Typography>\r\n )\r\n } catch {\r\n return (\r\n <Typography variant='body2' component='span' noWrap>\r\n format invalid\r\n </Typography>\r\n )\r\n }\r\n}\r\n//#endregion\r\n"],"names":["CreateStatusCell","config","options","props","_props$slots","_slots$typographyProp","data","sx","slots","value","_jsx","CustomTypography","_objectSpread","onClick","typographyProps","Object","assign","children","title","styled","Typography","borderRadius","fontSize","padding","fontWeight","minWidth","textAlign","color","display","CellImageSmall","_props$imageUri","_useState","useState","imageUri","fallbackSrc","_useState2","_slicedToArray","imgSrc","setImgSrc","useEffect","_props$imageUri2","_jsxs","Box","alignItems","height","gap","ImageSmall","src","onError","variant","ImageSmallFallback","_props$imageUri3","_useState3","imageFallback","_useState4","_props$imageUri4","backgroundRepeat","width","backgroundSize","boxShadow","CellBase","_props$valueFormatted","valueFormatted","isCopyToClipboard","copyToClipboard","CellBaseWrap","wrapProps","imageUrl","mr","imageFallbackSrc","icon","component","noWrap","flex","openInNewTab","Tooltip","arrow","IconButton","href","target","OpenInNewIcon","CopyToClipboard","beforeLine","Divider","flexItem","orientation","_ref","_objectWithoutProperties","_excluded","position","top","left","CellChips","_props$value","_props$separator","list","split","separator","filter","x","displayList","maximum","slice","remainingCount","length","flexWrap","map","i","CustomChip","label","valueFormatter","size","HelpTooltipWrap","content","concat","Chip","lineHeight","CellDate","_props$showRelative","_props$typographyProp","showRelative","date","dayjsCustom","formatted","format","formatString","to","styledGetter","mergeTypographyProps","mergeObjects","_unused"],"mappings":"q3BAwBaA,EAAmB,SAC9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AGN,CAAC,MAAAyH,GACA,OACExH,EAACU,EAAU,CAAC6B,QAAQ,QAAQsB,UAAU,OAAOC,QAAM,EAAAvD,SAAA,kBAItD,CACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{objectSpread2 as t,defineProperty as r,inherits as
|
|
1
|
+
import{objectSpread2 as t,defineProperty as r,inherits as o,createClass as e,classCallCheck as i,callSuper as n}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as s,jsxs as a,Fragment as l}from"react/jsx-runtime";import{Component as p}from"react";import{styled as m,Typography as u,Box as c,Tooltip as d,Button as f}from"@mui/material";import h from"@mui/icons-material/AddCircleOutline";import{Breadcrumbs as v}from"../components/breadcrumbs.js";import"../components/buttons.js";import"clipboard-copy";import"@mui/icons-material/Done";import"@mui/icons-material/ContentCopy";import"../components/create.multi-select-dropdown.js";import"../components/help-tooltip.js";import"../components/rich-tooltip.js";import"../components/text-editor.js";import{mapGlobalModalContext as x}from"../api-context/global-modal.js";var b=function(){function m(){var o;i(this,m);for(var e=arguments.length,a=new Array(e),p=0;p<e;p++)a[p]=arguments[p];return o=n(this,m,[].concat(a)),r(o,"renderButtonCreate",function(){return o.props.formCreate?x(function(r){var e;return s(d,{title:"Create new",children:s(f,t(t({size:"small",onClick:function(){return r.show({renderContent:function(){return o.props.formCreate}})},startIcon:s(h,{fontSize:"small"}),sx:{fontWeight:600},variant:"contained"},null===(e=o.props.slots)||void 0===e?void 0:e.buttonCreateProps),{},{children:"Create"}))})}):s(l,{})}),r(o,"renderTitle",function(){var t,r=null!==(t=o.props)&&void 0!==t?t:{},e=r.title,i=r.breadcrumbs;return i?s(v,{value:i}):s("string"==typeof e?C:l,{children:e})}),o}return o(m,p),e(m,[{key:"render",value:function(){var r,o,e,i,n;if(!1!==this.props.visible)return a(g,t(t({},null===(r=this.props.slots)||void 0===r?void 0:r.rootProps),{},{children:[null===(o=this.props.titleSlots)||void 0===o?void 0:o.before,this.renderTitle(),null===(e=this.props.titleSlots)||void 0===e?void 0:e.after,s(c,{sx:{flex:{xs:"0 0 auto",md:1},width:{xs:"100%",md:"auto"}}}),null===(i=this.props.actionSlots)||void 0===i?void 0:i.before,this.renderButtonCreate(),null===(n=this.props.actionSlots)||void 0===n?void 0:n.after]}))}}])}(),C=m(function(r){return s(u,t({noWrap:!0,variant:"subtitle1"},r))})({fontWeight:700,flex:1}),g=m(c)(function(t){var o=t.theme;return r({height:"var(--height-toolbar, 56px)",display:"flex",alignItems:"center",gap:"8px",padding:"0 6px",flexWrap:"wrap"},o.breakpoints.down("sm"),{height:"auto",padding:"12px 0",alignItems:"flex-start"})});export{b as default};
|
|
2
2
|
//# sourceMappingURL=toolbar-pannel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar-pannel.js","sources":["../../../src/table-grid/toolbar-pannel.tsx"],"sourcesContent":["import React, { Component } from 'react'\r\nimport { Box, BoxProps, Button, ButtonProps, styled, Tooltip, Typography, TypographyProps } from '@mui/material'\r\nimport AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'\r\nimport { mapGlobalModalContext } from '../api-context'\r\nimport { Breadcrumbs, IBreadcrumbConfig } from '../components'\r\n\r\nexport interface ISectionSlots {\r\n before?: React.ReactNode\r\n after?: React.ReactNode\r\n}\r\n\r\nexport interface IToolbarPannelProps {\r\n /** @default true */\r\n visible?: boolean\r\n searchInclude?: string[]\r\n breadcrumbs?: IBreadcrumbConfig[]\r\n title?: React.ReactNode\r\n titleSlots?: ISectionSlots\r\n formCreate?: React.ReactNode\r\n actionSlots?: ISectionSlots\r\n slots?: {\r\n rootProps?: BoxProps\r\n buttonCreateProps?: ButtonProps\r\n }\r\n}\r\n\r\nclass ToolbarPannel extends Component<IToolbarPannelProps> {\r\n render() {\r\n if (this.props.visible === false) return\r\n return (\r\n <Wrap {...this.props.slots?.rootProps}>\r\n {this.props.titleSlots?.before}\r\n {this.renderTitle()}\r\n {this.props.titleSlots?.after}\r\n <Box sx={{ flex: { xs: '0 0 auto', md: 1 }, width: { xs: '100%', md: 'auto' } }} />\r\n {this.props.actionSlots?.before}\r\n {this.renderButtonCreate()}\r\n {this.props.actionSlots?.after}\r\n </Wrap>\r\n )\r\n }\r\n\r\n renderButtonCreate = () => {\r\n if (!this.props.formCreate) return <></>\r\n return mapGlobalModalContext((context) => (\r\n <Tooltip title='Create new'>\r\n <Button\r\n size='small'\r\n onClick={() => context.show({ renderContent: () => this.props.formCreate })}\r\n startIcon={<AddCircleOutlineIcon fontSize='small' />}\r\n sx={{ fontWeight: 600 }}\r\n variant='contained'\r\n {...this.props.slots?.buttonCreateProps}\r\n >\r\n Create\r\n </Button>\r\n </Tooltip>\r\n ))\r\n }\r\n\r\n renderTitle = () => {\r\n const { title, breadcrumbs } = this.props ?? {}\r\n if (breadcrumbs) return <Breadcrumbs value={breadcrumbs} />\r\n if (typeof title === 'string') return <Title>{title}</Title>\r\n return <>{title}</>\r\n }\r\n}\r\n\r\nexport default ToolbarPannel\r\n\r\n// const SearchHelp = styled('ul')({\r\n// margin: '0 0 0 18px',\r\n// padding: 0,\r\n// li: {\r\n// position: 'relative'\r\n// },\r\n// 'li::after': {\r\n// content: '\"►\"',\r\n// display: 'inline-block',\r\n// top: '50%',\r\n// transform: 'translateY(-50%)',\r\n// position: 'absolute',\r\n// left: '-18px'\r\n// }\r\n// })\r\n\r\nconst Title = styled((props: TypographyProps) => <Typography noWrap variant='subtitle1' {...props} />)({\r\n fontWeight: 700,\r\n flex: 1\r\n})\r\n\r\nconst Wrap = styled(Box)(({ theme }) => ({\r\n height: 'var(--height-toolbar, 56px)',\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: '8px',\r\n padding: '0 6px',\r\n flexWrap: 'wrap',\r\n [theme.breakpoints.down('sm')]: {\r\n height: 'auto',\r\n padding: '12px 0',\r\n alignItems: 'flex-start'\r\n }\r\n}))\r\n"],"names":["ToolbarPannel","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","this","concat","_defineProperty","props","formCreate","mapGlobalModalContext","context","_this$props$slots","_jsx","Tooltip","title","children","Button","_objectSpread","size","onClick","show","renderContent","startIcon","AddCircleOutlineIcon","fontSize","sx","fontWeight","variant","slots","buttonCreateProps","_this$props","_ref","breadcrumbs","Breadcrumbs","value","Title","_Fragment","_inherits","Component","_createClass","key","_this$props$slots2","_this$props$titleSlot","_this$props$titleSlot2","_this$props$actionSlo","_this$props$actionSlo2","visible","_jsxs","Wrap","rootProps","titleSlots","before","renderTitle","after","Box","flex","xs","md","width","actionSlots","renderButtonCreate","styled","Typography","noWrap","_ref2","theme","height","display","alignItems","gap","padding","flexWrap","breakpoints","down"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toolbar-pannel.js","sources":["../../../src/table-grid/toolbar-pannel.tsx"],"sourcesContent":["import React, { Component } from 'react'\r\nimport { Box, BoxProps, Button, ButtonProps, styled, Tooltip, Typography, TypographyProps } from '@mui/material'\r\nimport AddCircleOutlineIcon from '@mui/icons-material/AddCircleOutline'\r\nimport { mapGlobalModalContext } from '../api-context'\r\nimport { Breadcrumbs, IBreadcrumbConfig } from '../components'\r\n\r\nexport interface ISectionSlots {\r\n before?: React.ReactNode\r\n after?: React.ReactNode\r\n}\r\n\r\nexport interface IToolbarPannelProps {\r\n /** @default true */\r\n visible?: boolean\r\n searchInclude?: string[]\r\n breadcrumbs?: IBreadcrumbConfig[]\r\n title?: React.ReactNode\r\n titleSlots?: ISectionSlots\r\n formCreate?: React.ReactNode\r\n actionSlots?: ISectionSlots\r\n slots?: {\r\n rootProps?: BoxProps\r\n buttonCreateProps?: ButtonProps\r\n }\r\n}\r\n\r\nclass ToolbarPannel extends Component<IToolbarPannelProps> {\r\n render() {\r\n if (this.props.visible === false) return\r\n return (\r\n <Wrap {...this.props.slots?.rootProps}>\r\n {this.props.titleSlots?.before}\r\n {this.renderTitle()}\r\n {this.props.titleSlots?.after}\r\n <Box sx={{ flex: { xs: '0 0 auto', md: 1 }, width: { xs: '100%', md: 'auto' } }} />\r\n {this.props.actionSlots?.before}\r\n {this.renderButtonCreate()}\r\n {this.props.actionSlots?.after}\r\n </Wrap>\r\n )\r\n }\r\n\r\n renderButtonCreate = () => {\r\n if (!this.props.formCreate) return <></>\r\n return mapGlobalModalContext((context) => (\r\n <Tooltip title='Create new'>\r\n <Button\r\n size='small'\r\n onClick={() => context.show({ renderContent: () => this.props.formCreate })}\r\n startIcon={<AddCircleOutlineIcon fontSize='small' />}\r\n sx={{ fontWeight: 600 }}\r\n variant='contained'\r\n {...this.props.slots?.buttonCreateProps}\r\n >\r\n Create\r\n </Button>\r\n </Tooltip>\r\n ))\r\n }\r\n\r\n renderTitle = () => {\r\n const { title, breadcrumbs } = this.props ?? {}\r\n if (breadcrumbs) return <Breadcrumbs value={breadcrumbs} />\r\n if (typeof title === 'string') return <Title>{title}</Title>\r\n return <>{title}</>\r\n }\r\n}\r\n\r\nexport default ToolbarPannel\r\n\r\n// const SearchHelp = styled('ul')({\r\n// margin: '0 0 0 18px',\r\n// padding: 0,\r\n// li: {\r\n// position: 'relative'\r\n// },\r\n// 'li::after': {\r\n// content: '\"►\"',\r\n// display: 'inline-block',\r\n// top: '50%',\r\n// transform: 'translateY(-50%)',\r\n// position: 'absolute',\r\n// left: '-18px'\r\n// }\r\n// })\r\n\r\nconst Title = styled((props: TypographyProps) => <Typography noWrap variant='subtitle1' {...props} />)({\r\n fontWeight: 700,\r\n flex: 1\r\n})\r\n\r\nconst Wrap = styled(Box)(({ theme }) => ({\r\n height: 'var(--height-toolbar, 56px)',\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: '8px',\r\n padding: '0 6px',\r\n flexWrap: 'wrap',\r\n [theme.breakpoints.down('sm')]: {\r\n height: 'auto',\r\n padding: '12px 0',\r\n alignItems: 'flex-start'\r\n }\r\n}))\r\n"],"names":["ToolbarPannel","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","this","concat","_defineProperty","props","formCreate","mapGlobalModalContext","context","_this$props$slots","_jsx","Tooltip","title","children","Button","_objectSpread","size","onClick","show","renderContent","startIcon","AddCircleOutlineIcon","fontSize","sx","fontWeight","variant","slots","buttonCreateProps","_this$props","_ref","breadcrumbs","Breadcrumbs","value","Title","_Fragment","_inherits","Component","_createClass","key","_this$props$slots2","_this$props$titleSlot","_this$props$titleSlot2","_this$props$actionSlo","_this$props$actionSlo2","visible","_jsxs","Wrap","rootProps","titleSlots","before","renderTitle","after","Box","flex","xs","md","width","actionSlots","renderButtonCreate","styled","Typography","noWrap","_ref2","theme","height","display","alignItems","gap","padding","flexWrap","breakpoints","down"],"mappings":"2zBA0BMA,IAAAA,aAAc,SAAAA,IAAA,IAAAC,EAAAC,OAAAF,GAAA,IAAA,IAAAG,EAAAC,UAAAC,OAAAC,EAAAC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAAF,EAAAE,GAAAJ,UAAAI,GAuCjB,OAvCiBP,EAAAQ,EAAAC,KAAAV,EAAAW,GAAAA,OAAAL,IAAAM,EAAAX,EAAA,qBAgBG,WACnB,OAAKA,EAAKY,MAAMC,WACTC,EAAsB,SAACC,GAAO,IAAAC,EAAA,OACnCC,EAACC,GAAQC,MAAM,aAAYC,SACzBH,EAACI,EAAMC,EAAAA,EAAA,CACLC,KAAK,QACLC,QAAS,WAAF,OAAQT,EAAQU,KAAK,CAAEC,cAAe,WAAF,OAAQ1B,EAAKY,MAAMC,UAAU,GAAG,EAC3Ec,UAAWV,EAACW,EAAqB,CAAAC,SAAS,UAC1CC,GAAI,CAAEC,WAAY,KAClBC,QAAQ,aACY,QADDhB,EACfhB,EAAKY,MAAMqB,aAAK,IAAAjB,OAAA,EAAhBA,EAAkBkB,mBAAiB,CAAA,EAAA,uBAIjC,GAbuBjB,UAepCN,EAAAX,EAAA,cAEa,WAAK,IAAAmC,EACjBC,EAAyC,QAAzCD,EAA+BnC,EAAKY,aAAK,IAAAuB,EAAAA,EAAI,CAAE,EAAvChB,EAAKiB,EAALjB,MAAOkB,EAAWD,EAA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AQ,CAC9BP,OAAQ,OACRI,QAAS,SACTF,WAAY,cACb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createClass as
|
|
1
|
+
import{createClass as t,classCallCheck as e,defineProperty as n}from"../../_virtual/_rollupPluginBabelHelpers.js";import a from"query-string";var i=function(t){var e;return null!==(e=null==t?void 0:t.trim().toLowerCase())&&void 0!==e?e:""},r=new(function(){return t(function t(){var i=this;e(this,t),n(this,"getPath",function(){return"/"===window.location.pathname?"":window.location.pathname}),n(this,"stringify",function(t){var e=Object.keys(t).filter(function(e){return t[e]}).reduce(function(e,n){var a=encodeURIComponent(t[n]);return e[n]=a,e},{}),n=a.stringify(e,{skipNull:!0,skipEmptyString:!0});return n?"?".concat(n):""}),n(this,"getAll",function(){return i.getValues()})},[{key:"getValues",value:function(){return a.parse(decodeURIComponent(window.location.search))}},{key:"getValuesMap",value:function(){var t=this.getValues();return new Map(Object.keys(t).map(function(e){return[i(e),t[e]]}))}},{key:"getkeysMap",value:function(){var t=this.getValues();return new Map(Object.keys(t).map(function(t){return[i(t),t]}))}},{key:"replace",value:function(t,e){window.history.replaceState(null!=e?e:{},"","".concat(this.getPath()).concat(this.stringify(t))),window.dispatchEvent(new window.PopStateEvent("popstate"))}},{key:"patch",value:function(t,e){var n=this.getValues(),a=this.getkeysMap();Object.keys(t).forEach(function(e){var r,o=i(e);a.has(o)?n[null!==(r=a.get(o))&&void 0!==r?r:""]=t[e]:n[e]=t[e]}),this.put(n,e)}},{key:"replacePatch",value:function(t,e){var n=this.getValues(),a=this.getkeysMap();Object.keys(t).forEach(function(e){var r,o=i(e);a.has(o)?n[null!==(r=a.get(o))&&void 0!==r?r:""]=t[e]:n[e]=t[e]}),this.replace(n,e)}},{key:"put",value:function(t,e){window.history.pushState(null!=e?e:{},"","".concat(this.getPath()).concat(this.stringify(t))),window.dispatchEvent(new window.PopStateEvent("popstate"))}},{key:"deletes",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.deletesWithState(e)}},{key:"replaceDeletes",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.replaceDeletesWithState(e)}},{key:"replaceDeletesWithState",value:function(t,e){var n=this.getValues(),a=this.getkeysMap();t.forEach(function(t){var e,r=i(t.toString());a.has(r)&&delete n[null!==(e=a.get(r))&&void 0!==e?e:""]}),this.replace(n,e)}},{key:"deletesWithState",value:function(t,e){var n=this.getValues(),a=this.getkeysMap();t.forEach(function(t){var e,r=i(t.toString());a.has(r)&&delete n[null!==(e=a.get(r))&&void 0!==e?e:""]}),this.put(n,e)}},{key:"deleteAll",value:function(){window.history.replaceState({},"","".concat(this.getPath()))}},{key:"gets",value:function(){for(var t=this.getValuesMap(),e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return n.reduce(function(e,n){var a=i(n.toString());return t.has(a)&&(e[n]=t.get(a)),e},{})}}])}());export{r as QueryParam,r as default};
|
|
2
2
|
//# sourceMappingURL=query-param.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-param.js","sources":["../../../src/utils/query-param.ts"],"sourcesContent":["import queryString from 'query-string'\r\n\r\nconst stringStardize = (str: string) => str?.trim().toLowerCase() ?? ''\r\n\r\nclass QueryParamBase {\r\n private getValues() {\r\n // return queryString.parse(decodeURIComponent(window.location.search))\r\n return queryString.parse(decodeURIComponent(window.location.search))\r\n }\r\n\r\n private getValuesMap() {\r\n const query = this.getValues()\r\n return new Map(Object.keys(query).map((x) => [stringStardize(x), query[x] as string]))\r\n }\r\n\r\n private getkeysMap() {\r\n const query = this.getValues()\r\n return new Map(Object.keys(query).map((x) => [stringStardize(x), x]))\r\n }\r\n\r\n private getPath = () => (window.location.pathname === '/' ? '' : window.location.pathname)\r\n\r\n // stringify<TParam extends {} = any>(param: TParam) {\r\n // return `?${encodeURIComponent(queryString.stringify(param, { skipNull: true, skipEmptyString: true }))}`\r\n // }\r\n stringify = <TParam extends Record<string, any> = any>(param: TParam): string => {\r\n const entries = Object.keys(param)\r\n .filter((key) => param[key]) // skip null & empty string\r\n .reduce((a, key) => {\r\n const encodedValue = encodeURIComponent(param[key])\r\n a[key] = encodedValue\r\n return a\r\n }, {} as any)\r\n\r\n
|
|
1
|
+
{"version":3,"file":"query-param.js","sources":["../../../src/utils/query-param.ts"],"sourcesContent":["import queryString from 'query-string'\r\n\r\nconst stringStardize = (str: string) => str?.trim().toLowerCase() ?? ''\r\n\r\nclass QueryParamBase {\r\n private getValues() {\r\n // return queryString.parse(decodeURIComponent(window.location.search))\r\n return queryString.parse(decodeURIComponent(window.location.search))\r\n }\r\n\r\n private getValuesMap() {\r\n const query = this.getValues()\r\n return new Map(Object.keys(query).map((x) => [stringStardize(x), query[x] as string]))\r\n }\r\n\r\n private getkeysMap() {\r\n const query = this.getValues()\r\n return new Map(Object.keys(query).map((x) => [stringStardize(x), x]))\r\n }\r\n\r\n private getPath = () => (window.location.pathname === '/' ? '' : window.location.pathname)\r\n\r\n // stringify<TParam extends {} = any>(param: TParam) {\r\n // return `?${encodeURIComponent(queryString.stringify(param, { skipNull: true, skipEmptyString: true }))}`\r\n // }\r\n stringify = <TParam extends Record<string, any> = any>(param: TParam): string => {\r\n const entries = Object.keys(param)\r\n .filter((key) => param[key]) // skip null & empty string\r\n .reduce((a, key) => {\r\n const encodedValue = encodeURIComponent(param[key])\r\n a[key] = encodedValue\r\n return a\r\n }, {} as any)\r\n\r\n const qs = queryString.stringify(entries, { skipNull: true, skipEmptyString: true })\r\n return qs ? `?${qs}` : ''\r\n }\r\n\r\n replace<TParam extends {} = any, TState = any>(param: TParam, state?: TState) {\r\n window.history.replaceState(state ?? {}, '', `${this.getPath()}${this.stringify(param)}`)\r\n window.dispatchEvent(new window.PopStateEvent('popstate'))\r\n }\r\n\r\n patch<TParam extends { [key: string]: any } = any, TState = any>(param: TParam, state?: TState) {\r\n const query = this.getValues()\r\n const keyMap = this.getkeysMap()\r\n Object.keys(param).forEach((k) => {\r\n const key = stringStardize(k)\r\n if (keyMap.has(key)) {\r\n query[keyMap.get(key) ?? ''] = param[k]\r\n } else {\r\n query[k] = param[k]\r\n }\r\n })\r\n this.put(query, state)\r\n }\r\n\r\n replacePatch<TParam extends { [key: string]: any } = any, TState = any>(param: TParam, state?: TState) {\r\n const query = this.getValues()\r\n const keyMap = this.getkeysMap()\r\n Object.keys(param).forEach((k) => {\r\n const key = stringStardize(k)\r\n if (keyMap.has(key)) {\r\n query[keyMap.get(key) ?? ''] = param[k]\r\n } else {\r\n query[k] = param[k]\r\n }\r\n })\r\n this.replace(query, state)\r\n }\r\n\r\n put<TParam extends {} = any, TState = any>(param: TParam, state?: TState) {\r\n window.history.pushState(state ?? {}, '', `${this.getPath()}${this.stringify(param)}`)\r\n window.dispatchEvent(new window.PopStateEvent('popstate'))\r\n }\r\n\r\n deletes<TValue extends {} = any>(...keys: (keyof TValue)[]) {\r\n this.deletesWithState(keys)\r\n }\r\n\r\n replaceDeletes<TValue extends {} = any>(...keys: (keyof TValue)[]) {\r\n this.replaceDeletesWithState(keys)\r\n }\r\n\r\n replaceDeletesWithState<TValue extends {} = any, TState = any>(keys: (keyof TValue)[], state?: TState) {\r\n const query = this.getValues()\r\n const keyMap = this.getkeysMap()\r\n keys.forEach((k) => {\r\n const key = stringStardize(k.toString())\r\n if (keyMap.has(key)) {\r\n delete query[keyMap.get(key) ?? '']\r\n }\r\n })\r\n this.replace(query, state)\r\n }\r\n\r\n deletesWithState<TValue extends {} = any, TState = any>(keys: (keyof TValue)[], state?: TState) {\r\n const query = this.getValues()\r\n const keyMap = this.getkeysMap()\r\n keys.forEach((k) => {\r\n const key = stringStardize(k.toString())\r\n if (keyMap.has(key)) {\r\n delete query[keyMap.get(key) ?? '']\r\n }\r\n })\r\n this.put(query, state)\r\n }\r\n\r\n deleteAll() {\r\n window.history.replaceState({}, '', `${this.getPath()}`)\r\n }\r\n\r\n getAll = () => {\r\n return this.getValues()\r\n }\r\n\r\n gets<TValue extends {} = any>(...keys: (keyof TValue)[]) {\r\n const query = this.getValuesMap()\r\n return keys.reduce<Partial<TValue>>((a, k) => {\r\n const key = stringStardize(k.toString())\r\n if (query.has(key)) {\r\n a[k] = query.get(key) as any\r\n }\r\n return a\r\n }, {})\r\n }\r\n}\r\n\r\nexport const QueryParam = new QueryParamBase()\r\n// ;(window as any).QueryParam = QueryParam\r\nexport default QueryParam\r\n"],"names":["stringStardize","str","_str$trim$toLowerCase","trim","toLowerCase","QueryParam","_createClass","QueryParamBase","_this","this","_classCallCheck","_defineProperty","window","location","pathname","param","entries","Object","keys","filter","key","reduce","a","encodedValue","encodeURIComponent","qs","queryString","stringify","skipNull","skipEmptyString","concat","getValues","value","parse","decodeURIComponent","search","query","Map","map","x","state","history","replaceState","getPath","dispatchEvent","PopStateEvent","keyMap","getkeysMap","forEach","k","_keyMap$get","has","get","put","_keyMap$get2","replace","pushState","_len","arguments","length","Array","_key","deletesWithState","_len2","_key2","replaceDeletesWithState","_keyMap$get3","toString","_keyMap$get4","getValuesMap","_len3","_key3"],"mappings":"8IAEA,IAAMA,EAAiB,SAACC,GAAW,IAAAC,EAAA,OAA8B,QAA9BA,EAAKD,aAAAA,EAAAA,EAAKE,OAAOC,qBAAaF,IAAAA,EAAAA,EAAI,EAAE,EA8H1DG,EAAa,IA5HN,WA8GjB,OAAAC,EA9GiB,SAAAC,IAAA,IAAAC,EAAAC,KAAAC,OAAAH,GAAAI,EAgBAF,KAAA,UAAA,WAAA,MAAoC,MAA7BG,OAAOC,SAASC,SAAmB,GAAKF,OAAOC,SAASC,WAIjFH,EAAAF,KAAA,YACY,SAA2CM,GACrD,IAAMC,EAAUC,OAAOC,KAAKH,GACzBI,OAAO,SAACC,GAAG,OAAKL,EAAMK,EAAI,GAC1BC,OAAO,SAACC,EAAGF,GACV,IAAMG,EAAeC,mBAAmBT,EAAMK,IAE9C,OADAE,EAAEF,GAAOG,EACFD,CACR,EAAE,IAECG,EAAKC,EAAYC,UAAUX,EAAS,CAAEY,UA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ACtB,GAAC,CAAApB,IAAA,mBAAAY,MAED,SAAwDd,EAAwBsB,GAC9E,IAAMJ,EAAQ3B,KAAKsB,YACbe,EAASrC,KAAKsC,aACpB7B,EAAK8B,QAAQ,SAACC,GACZ,IACqBmB,EADfhD,EAAMpB,EAAeiD,EAAEkB,YACzBrB,EAAOK,IAAI/B,WACNgB,UAAKgC,EAACtB,EAAOM,IAAIhC,UAAI,IAAAgD,EAAAA,EAAI,GAEpC,GACA3D,KAAK4C,IAAIjB,EAAOI,EAClB,GAAC,CAAApB,IAAA,YAAAY,MAED,WACEpB,OAAO6B,QAAQC,aAAa,GAAI,GAAEZ,GAAAA,OAAKrB,KAAKkC,WAC9C,GAAC,CAAAvB,IAAA,OAAAY,MAMD,WACmC,IAAjC,IAAMI,EAAQ3B,KAAK4D,eAAcC,EAAAZ,UAAAC,OADFzC,EAAsB0C,IAAAA,MAAAU,GAAAC,EAAA,EAAAA,EAAAD,EAAAC,IAAtBrD,EAAsBqD,GAAAb,UAAAa,GAErD,OAAOrD,EAAKG,OAAwB,SAACC,EAAG2B,GACtC,IAAM7B,EAAMpB,EAAeiD,EAAEkB,YAI7B,OAHI/B,EAAMe,IAAI/B,KACZE,EAAE2B,GAAKb,EAAMgB,IAAIhC,IAEZE,CACR,EAAE,GACL,IAAC,CAzHiB"}
|
|
@@ -17,7 +17,7 @@ export interface IApiContext {
|
|
|
17
17
|
ApiAlert?: IApiAlert;
|
|
18
18
|
}
|
|
19
19
|
export declare const ApiAlertContext: IApiContext;
|
|
20
|
-
declare function AlertGlobal():
|
|
20
|
+
declare function AlertGlobal(): React.ReactPortal;
|
|
21
21
|
export default AlertGlobal;
|
|
22
22
|
interface AlertDialogProps {
|
|
23
23
|
IsOpen: boolean;
|
|
@@ -16,7 +16,7 @@ export interface IFormFieldSelectMultipleParam<T> {
|
|
|
16
16
|
/** List of options for the select field */
|
|
17
17
|
options?: IFieldSelectOption[];
|
|
18
18
|
/** Function to fetch options asynchronously */
|
|
19
|
-
fetchOptions?: (signal?: AbortSignal) => Promise<IFieldSelectOption[]
|
|
19
|
+
fetchOptions?: (signal?: AbortSignal) => Promise<IFieldSelectOption[]> | IFieldSelectOption[];
|
|
20
20
|
/** If true, disables the field after submission. @default false */
|
|
21
21
|
disabledAfterSubmit?: boolean;
|
|
22
22
|
/** Force a fixed logic value, hiding the logic toggle */
|
|
@@ -20,7 +20,7 @@ export interface IFormFieldSelectParam<T> {
|
|
|
20
20
|
/** List of options for the select field */
|
|
21
21
|
options?: IFieldSelectOption[];
|
|
22
22
|
/** Function to fetch options asynchronously based on user input */
|
|
23
|
-
fetchOptions?: (signal?: AbortSignal) => Promise<IFieldSelectOption[]
|
|
23
|
+
fetchOptions?: (signal?: AbortSignal) => Promise<IFieldSelectOption[]> | IFieldSelectOption[];
|
|
24
24
|
/** Force a specific logic (and/or) for this field, overriding the default or user-selected logic */
|
|
25
25
|
forceLogic?: TLogic;
|
|
26
26
|
/** Maximum number of values that can be selected for this field */
|
|
@@ -13,6 +13,14 @@ export interface IInputFileCsvLocalParserSlots {
|
|
|
13
13
|
* Useful for guiding users on how to use or fill out the CSV file.
|
|
14
14
|
*/
|
|
15
15
|
instructionalText?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The title text displayed at the top.
|
|
18
|
+
*/
|
|
19
|
+
titleText?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional sub text displayed below the title or above the download link.
|
|
22
|
+
*/
|
|
23
|
+
subText?: string;
|
|
16
24
|
/**
|
|
17
25
|
* Props to customize the TextField used for uploading the CSV file.
|
|
18
26
|
* Allows customization of appearance and behavior (e.g., placeholder, onChange, disabled).
|
|
@@ -31,6 +39,13 @@ export interface IInputFileCsvLocalParserSlots {
|
|
|
31
39
|
labelShrink?: boolean;
|
|
32
40
|
}
|
|
33
41
|
export interface IInputFileCsvLocalParserParams extends IInputFileCsvLocalParserSlots {
|
|
42
|
+
/** Optional sub name for the input field. */
|
|
43
|
+
subName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional suffix name for the input field. When `subName` is provided, `suffixName` will be not used.
|
|
46
|
+
* @default '_file'
|
|
47
|
+
* */
|
|
48
|
+
suffixName?: string;
|
|
34
49
|
}
|
|
35
50
|
export interface IInputFileCsvLocalParserProps<T, C> extends IFormInputBase<T, IInputFileCsvLocalParserSlots> {
|
|
36
51
|
onChange?: (value: C[]) => void;
|
|
@@ -22,23 +22,24 @@ export declare function registerForm(name?: string): <T extends new (...args: an
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function isFormRegistered(target: any): boolean;
|
|
24
24
|
export interface IPreSubmitMetadata<T = any> {
|
|
25
|
-
handler: (data: T
|
|
25
|
+
handler: (data: Partial<T>, oldData?: T) => Promise<any> | any;
|
|
26
26
|
}
|
|
27
27
|
export declare function formPreSubmit<T = any>(handler: IPreSubmitMetadata<T>['handler']): <T_1 extends new (...args: any[]) => {}>(constructor: T_1) => T_1;
|
|
28
|
-
export declare function getFormPreSubmit(targetClass: any): IPreSubmitMetadata | undefined;
|
|
28
|
+
export declare function getFormPreSubmit<T = any>(targetClass: any): IPreSubmitMetadata<T> | undefined;
|
|
29
|
+
export type ISizes = Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', number>>;
|
|
29
30
|
export interface IFieldMetadata<T = any, O = {}> {
|
|
30
|
-
name: keyof T
|
|
31
|
+
name: keyof T;
|
|
31
32
|
label?: string;
|
|
32
33
|
placeholder?: string;
|
|
33
34
|
defaultValue?: any;
|
|
34
35
|
type?: any;
|
|
35
|
-
|
|
36
|
-
visible?: boolean | ((data?: T) => boolean);
|
|
37
|
-
disabled?: boolean | ((data?: T) => boolean);
|
|
36
|
+
sizes?: ISizes | ((data?: T, formState?: Partial<T>) => ISizes);
|
|
37
|
+
visible?: boolean | ((data?: T, formState?: Partial<T>) => boolean);
|
|
38
|
+
disabled?: boolean | ((data?: T, formState?: Partial<T>) => boolean);
|
|
38
39
|
renderInput?: ComponentType<IFormInputBase<T>>;
|
|
39
40
|
}
|
|
40
|
-
export declare function formField(options: Omit<IFieldMetadata
|
|
41
|
-
export declare
|
|
41
|
+
export declare function formField<T = any>(options: Omit<IFieldMetadata<T>, 'name'>): (target: any, propertyKey: string) => void;
|
|
42
|
+
export declare function getFormFields<T = any>(targetClass: any): IFieldMetadata<T>[];
|
|
42
43
|
export interface IValidationMetadata extends IConfigValue {
|
|
43
44
|
name: string;
|
|
44
45
|
}
|
|
@@ -1,40 +1,34 @@
|
|
|
1
|
-
import { ComponentType
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
2
|
import { BoxProps, GridProps } from '@mui/material';
|
|
3
3
|
import { IFormInputBase } from './types';
|
|
4
4
|
import { IPartialError } from './validator';
|
|
5
5
|
import { IFormBaseSlots } from './create.form-base';
|
|
6
|
+
import { IFormFooterProps, IFormFooterSlots } from './decorator.units';
|
|
6
7
|
export interface IDecoratorFieldProps<T = any> extends IFormInputBase<T> {
|
|
7
8
|
type?: any;
|
|
8
9
|
visible?: boolean | ((data: T) => boolean);
|
|
9
10
|
renderInput?: ComponentType<IFormInputBase<T>>;
|
|
10
11
|
}
|
|
11
|
-
export
|
|
12
|
-
export interface IDecoratorFormSlots {
|
|
12
|
+
export interface IDecoratorFormSlots<T> {
|
|
13
13
|
top?: React.ReactNode;
|
|
14
14
|
bottom?: React.ReactNode;
|
|
15
15
|
isFooter?: React.ReactNode | boolean;
|
|
16
16
|
contentProps?: GridProps;
|
|
17
17
|
formBase?: IFormBaseSlots;
|
|
18
|
-
footer?: ComponentType<
|
|
19
|
-
footerProps?: BoxProps
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
footerSlots?: {
|
|
23
|
-
after?: React.ReactNode;
|
|
24
|
-
before?: React.ReactNode;
|
|
25
|
-
};
|
|
18
|
+
footer?: ComponentType<IFormFooterProps<T>>;
|
|
19
|
+
footerProps?: Omit<BoxProps, 'slots'>;
|
|
20
|
+
footerSlots?: IFormFooterSlots;
|
|
26
21
|
}
|
|
27
22
|
export interface IDecoratorFormProps<T = any> {
|
|
28
23
|
configClass?: any;
|
|
29
|
-
data?:
|
|
24
|
+
data?: T;
|
|
30
25
|
onSubmit?: (data: Partial<T>, signal?: AbortSignal) => Promise<void>;
|
|
31
26
|
onError?: (error: any) => void;
|
|
32
27
|
onSubmitError?: (error: IPartialError<T>) => void;
|
|
33
28
|
onSuccess?: (data: Partial<T>) => void;
|
|
34
29
|
enableStickyFooter?: boolean;
|
|
35
|
-
slots?: IDecoratorFormSlots
|
|
30
|
+
slots?: IDecoratorFormSlots<T>;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
export declare const createDecoratorForm: <T>(configClass: any, params?: Partial<Omit<IDecoratorFormProps<T>, "configClass">> | undefined) => ComponentType<IDecoratorFormProps<T>>;
|
|
32
|
+
type IDecoratorFormParam<T> = Partial<Omit<IDecoratorFormProps<T>, 'configClass'>>;
|
|
33
|
+
export declare const createDecoratorForm: <T>(configClass: any, param?: Partial<Omit<IDecoratorFormProps<T>, "configClass">> | undefined) => ComponentType<IDecoratorFormProps<T>>;
|
|
34
|
+
export default createDecoratorForm;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { IFormBaseContext } from './types';
|
|
4
|
+
export interface IFormFooterSlots {
|
|
5
|
+
after?: React.ReactNode;
|
|
6
|
+
before?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface IFormFooterProps<T = any> extends Omit<BoxProps, 'slots'> {
|
|
9
|
+
formContext?: IFormBaseContext<T>;
|
|
10
|
+
}
|
|
11
|
+
interface IInternalFormFooterProps<T = any> extends IFormFooterProps<T> {
|
|
12
|
+
isSticky?: boolean;
|
|
13
|
+
slots?: IFormFooterSlots;
|
|
14
|
+
errorMessage?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const FormFooter: FC<IInternalFormFooterProps<any>>;
|
|
17
|
+
export {};
|
|
@@ -19,8 +19,7 @@ declare class DinoFormBase {
|
|
|
19
19
|
createFormBase: <T>(params?: import("./create.form-base").IFormBaseParams<T> | undefined) => import("./create.form-base").IFormBaseResult<T>;
|
|
20
20
|
createFormComfirm: <T = any>(param?: import("./create.form-comfirm").IFormComfirmParam<T> | undefined) => import("react").ComponentType<import("react").PropsWithChildren<import("./create.form-comfirm").IFormComfirmProps<T>>>;
|
|
21
21
|
createFormGridLayout: <T>(params: import("./create.form-grid-layout").IFormGridLayoutParams<T>) => import("react").ComponentType<import("./create.form-grid-layout").IFormGridLayoutProps<T>>;
|
|
22
|
-
|
|
23
|
-
createDecoratorForm: <T>(configClass: any, params?: Partial<Omit<import("./decorator.form").IDecoratorFormProps<T>, "configClass">> | undefined) => import("react").ComponentType<import("./decorator.form").IDecoratorFormProps<T>>;
|
|
22
|
+
createDecoratorForm: <T>(configClass: any, param?: Partial<Omit<import("./decorator.form").IDecoratorFormProps<T>, "configClass">> | undefined) => import("react").ComponentType<import("./decorator.form").IDecoratorFormProps<T>>;
|
|
24
23
|
createColorPicker: typeof createColorPicker;
|
|
25
24
|
createDateExpired: typeof CreateDateExpired;
|
|
26
25
|
createDatePicker: <T extends Object>(params?: import("./create.date-picker").IDatePickerSlots | undefined) => import("react").ComponentType<import("./create.date-picker").IDatePickerProps<T>>;
|
|
@@ -22,6 +22,9 @@ export interface IValidateCsv {
|
|
|
22
22
|
/** Optional message providing error details if validation fails */
|
|
23
23
|
message?: string;
|
|
24
24
|
}
|
|
25
|
+
interface IValidateCsvOptions {
|
|
26
|
+
maxRows?: number;
|
|
27
|
+
}
|
|
25
28
|
/**
|
|
26
29
|
* Validates a parsed CSV data array against a list of required column keys.
|
|
27
30
|
*
|
|
@@ -29,5 +32,5 @@ export interface IValidateCsv {
|
|
|
29
32
|
* @param requiredKeys - An array of keys that must exist in the CSV headers and each row.
|
|
30
33
|
* @returns An object indicating whether the data is valid and an optional error message.
|
|
31
34
|
*/
|
|
32
|
-
export declare const validateCsvModel: <T extends Record<string, any>>(data: T[], requiredKeys: (keyof T)[]) => IValidateCsv;
|
|
35
|
+
export declare const validateCsvModel: <T extends Record<string, any>>(data: T[], requiredKeys: (keyof T)[], options?: IValidateCsvOptions) => IValidateCsv;
|
|
33
36
|
export {};
|
|
@@ -8,7 +8,7 @@ export interface IFormBaseContext<T> {
|
|
|
8
8
|
onBlur: (keyName: keyof T) => void;
|
|
9
9
|
setError: (keyName: keyof T, message: string) => void;
|
|
10
10
|
removeError: (keyNames: keyof T | (keyof T)[]) => void;
|
|
11
|
-
clearErrorAll: (
|
|
11
|
+
clearErrorAll: () => void;
|
|
12
12
|
}
|
|
13
13
|
export interface IFormBase<T> {
|
|
14
14
|
data?: Partial<T>;
|