Skip to content

Commit

Permalink
Merge pull request #201 from wrappid/WRPD-enhancement-183
Browse files Browse the repository at this point in the history
feat(core): ✨ add defaulValidEvents props in sanatizeCompPro…
  • Loading branch information
irkfaisal authored Apr 8, 2024
2 parents beb9e98 + 2d9d9d9 commit 9fdcd17
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion package/utils/componentUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,19 @@ export const defaultValidProps = [
},
];

export const defaultValidEvents = [
{
name : "onClick",
types: [{ type: "function" }],
}
];

export const defaultInvalidProps = ["sx", "classes"];

export function sanitizeComponentProps(component, props) {
// eslint-disable-next-line etc/no-commented-out-code
// console.log(`----------------Props=${Object.keys(props)}`);
let validProps = [...defaultValidProps, ...(component?.validProps || [])];
let validProps = [...defaultValidProps, ...defaultValidEvents, ...(component?.validProps || [])];
let sanitizedProps = {};

let validPropKeys = validProps.map(prop => { return prop?.name; });
Expand Down

0 comments on commit 9fdcd17

Please sign in to comment.