PromucFlow_constructor/app/client/src/utils/WidgetBlueprintUtils.ts
Preet Sidhu 6a8806f629
feat: Add widget responsiveness and conversion algorithm (#21386)
## Description

QA branch for mobile responsiveness

---------

Co-authored-by: Aswath K <aswath@appsmith.com>
Co-authored-by: Arsalan Yaldram <arsalanyaldram0211@outlook.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: rahulramesha <rahul@appsmith.com>
2023-04-07 09:51:35 -04:00

34 lines
835 B
TypeScript

import type { UpdatePropertyArgs } from "sagas/WidgetBlueprintSagas";
/**
* Util method that makes it easier
* and takes in readable updates and converts them to blueprint updates
* @param widgetUpdates
* @returns
*/
export function getWidgetBluePrintUpdates(widgetUpdates: {
[key: string]: any;
}): UpdatePropertyArgs[] {
const widgetIds = Object.keys(widgetUpdates);
const updates: UpdatePropertyArgs[] = [];
for (const widgetId of widgetIds) {
const updateProps = widgetUpdates[widgetId];
if (updateProps) {
const propertyNames = Object.keys(updateProps);
for (const propertyName of propertyNames) {
updates.push({
widgetId: widgetId,
propertyName: propertyName,
propertyValue: updateProps[propertyName],
});
}
}
}
return updates;
}