diff --git a/packages/builder/src/helpers/data/utils.js b/packages/builder/src/helpers/data/utils.js index 23aeb314a0..647c2be33e 100644 --- a/packages/builder/src/helpers/data/utils.js +++ b/packages/builder/src/helpers/data/utils.js @@ -150,12 +150,31 @@ export function flipHeaderState(headersActivity) { return enabled } +export const parseToCsv = (headers, rows) => { + let csv = headers?.map(key => `"${key}"`)?.join(",") || "" + + for (let row of rows) { + csv = `${csv}\n${headers + .map(header => { + let val = row[header] + val = + typeof val === "object" && !(val instanceof Date) + ? `"${JSON.stringify(val).replace(/"/g, "'")}"` + : `"${val}"` + return val.trim() + }) + .join(",")}` + } + return csv +} + export default { breakQueryString, buildQueryString, fieldsToSchema, flipHeaderState, keyValueToQueryParameters, + parseToCsv, queryParametersToKeyValue, schemaToFields, } diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte index 26318d3dcf..e2995d8a02 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/PasswordModal.svelte @@ -1,6 +1,7 @@ -
+