Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions assets/js/src/core/modules/element/export-api-slice.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export type ExportXlsxApiArg = {
| "string"
| "bool"
| "items_to_restore";
sheetName?: string;
};
elementType?: "data-object" | "object" | "asset" | "document";
classId?: string | null;
Expand Down Expand Up @@ -234,6 +235,7 @@ export type ExportXlsxFolderApiArg = {
| "string"
| "bool"
| "items_to_restore";
sheetName?: string;
};
elementType?: "data-object" | "object" | "asset" | "document";
classId?: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import React from 'react'
import { useTranslation } from 'react-i18next'
import { Form, type FormProps } from '@Pimcore/components/form/form'
import { Select } from '@Pimcore/components/select/select'
import { Input } from '@Pimcore/components/input/input'

export interface XLSXFormValues {
header: 'name' | 'title' | 'no_header'
sheetName: string
}

export interface CreateXLSXFormProps extends FormProps {}
Expand Down Expand Up @@ -42,6 +44,14 @@ export const CreateXLSXForm = ({ ...props }: CreateXLSXFormProps): React.JSX.Ele
}
/>
</Form.Item>

<Form.Item
label={ t('export-xlsx-form.form-field.sheet-name') }
name={ 'sheetName' }
rules={ [{ required: true, message: t('form.validation.required') }] }
>
<Input />
</Form.Item>
</Form>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export const XlsxModal = (props: XlsxModalProps): React.JSX.Element => {
const classDefinitionSelection = useClassDefinitionSelection(true)
const selectedClassDefinition = classDefinitionSelection?.selectedClassDefinition
const initialFormValues: XLSXFormValues = {
header: 'name'
header: 'name',
sheetName: 'Sheet1'
}
const { t } = useTranslation()

Expand Down Expand Up @@ -110,13 +111,13 @@ export const XlsxModal = (props: XlsxModalProps): React.JSX.Element => {

function onFinish (values: XLSXFormValues): void {
const isFolderExport = numberedSelectedRows.length === 0
const job = new XlsxDownloadJob({ action: async () => await getDownloadAction(values.header), isFolderExport })
const job = new XlsxDownloadJob({ action: async () => await getDownloadAction(values.header, values.sheetName), isFolderExport })
void executionEngine.runJob(job)

props.setOpen(false)
}

async function getDownloadAction (header: XLSXFormValues['header']): Promise<number> {
async function getDownloadAction (header: XLSXFormValues['header'], sheetName: XLSXFormValues['sheetName']): Promise<number> {
const extractedColumnsFromColumnArg: GridColumnRequest[] = []
const columns = getArgs()?.body?.columns ?? []

Expand Down Expand Up @@ -148,7 +149,8 @@ export const XlsxModal = (props: XlsxModalProps): React.JSX.Element => {
elementType,
columns: extractedColumnsFromColumnArg,
config: {
header
header,
sheetName
},
filters: {
...filters
Expand All @@ -167,7 +169,8 @@ export const XlsxModal = (props: XlsxModalProps): React.JSX.Element => {
elementType,
columns: extractedColumnsFromColumnArg,
config: {
header
header,
sheetName
},
...(!isNil(selectedClassDefinition?.id) && { classId: selectedClassDefinition.id })
}
Expand Down
15 changes: 8 additions & 7 deletions translations/studio.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ lazy-loading: Lazy Loading
disallow-add-remove: Disallow Add / Remove
disallow-reorder: Disallow Reorder
css-style: CSS Style
css-style-tooltip: "Inline CSS applied to the body, e.g. \"float: left; margin: 10px;\". Invalid declarations are ignored."
css-style-tooltip: 'Inline CSS applied to the body, e.g. "float: left; margin: 10px;". Invalid declarations are ignored.'
collapsible: Collapsible
collapsed: Initially Collapsed
border: Border
Expand Down Expand Up @@ -1099,6 +1099,7 @@ export-xlsx-form.form-field.header: Header
export-xlsx-form.form-field.header.option.name: System key
export-xlsx-form.form-field.header.option.title: Label
export-xlsx-form.form-field.header.option.no-header: No header
export-xlsx-form.form-field.sheet-name: Sheet name
form.validation.required: This field is required
form.validation.max-length: The maximum length for this field is {{max}} characters
form.validation.min: The minimum value is {{min}}
Expand Down Expand Up @@ -1908,18 +1909,18 @@ classification-store.tabs.groups: Groups
classification-store.tabs.keys: Keys
classification-store.add-store: Add store
classification-store.rename-store: Rename store
classification-store.delete-store: "Delete store \"{{storeName}}\"?"
classification-store.delete-store: 'Delete store "{{storeName}}"?'
classification-store.add-group: Add group
classification-store.rename-group: Rename group
classification-store.delete-group: "Delete group \"{{groupName}}\"?"
classification-store.delete-group: 'Delete group "{{groupName}}"?'
classification-store.add-collection: Add collection
classification-store.rename-collection: Rename collection
classification-store.delete-collection: "Delete collection \"{{collectionName}}\"?"
classification-store.delete-collection: 'Delete collection "{{collectionName}}"?'
classification-store.add-key: Add key
classification-store.rename-key: Rename key
classification-store.delete-key: "Delete key \"{{keyName}}\"?"
classification-store.delete-key-relation: "Remove key \"{{keyName}}\" from this group?"
classification-store.delete-group-relation: "Remove group \"{{groupName}}\" from this collection?"
classification-store.delete-key: 'Delete key "{{keyName}}"?'
classification-store.delete-key-relation: 'Remove key "{{keyName}}" from this group?'
classification-store.delete-group-relation: 'Remove group "{{groupName}}" from this collection?'
classification-store.edit-definition: Edit definition
classification-store.edit-key-definition: "Edit key definition: {{keyName}}"
classification-store.columns.id: ID
Expand Down
Loading