generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from eea/develop
Develop
- Loading branch information
Showing
11 changed files
with
498 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: \n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: \n" | ||
"Language: \n" | ||
"Language-Team: \n" | ||
"Content-Type: \n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: CSV file imported correctly | ||
msgid "CSV file imported correctly" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Export CSV file | ||
msgid "Export CSV file" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Import CSV file | ||
msgid "Import CSV file" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} new items imported | ||
msgid "Imported item count" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} items modified | ||
msgid "Modified item count" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo | ||
msgid "Undo" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo all modifications | ||
msgid "Undo all modifications" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo message | ||
msgid "Undo message" | ||
msgstr "All modifications has been undone" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: \n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: \n" | ||
"Language: \n" | ||
"Language-Team: \n" | ||
"Content-Type: \n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: CSV file imported correctly | ||
msgid "CSV file imported correctly" | ||
msgstr "Fichero CSV importado correctamente" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Export CSV file | ||
msgid "Export CSV file" | ||
msgstr "Exportar fichero CSV" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Import CSV file | ||
msgid "Import CSV file" | ||
msgstr "Importar fichero CSV" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} new items imported | ||
msgid "Imported item count" | ||
msgstr "{count} nuevos items importados" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} items modified | ||
msgid "Modified item count" | ||
msgstr "{count} items modificados" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo | ||
msgid "Undo" | ||
msgstr "Deshacer" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo all modifications | ||
msgid "Undo all modifications" | ||
msgstr "Deshacer todas las modificaciones" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo message | ||
msgid "Undo message" | ||
msgstr "Se han deshecho todas las modificaciones realizadas" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: \n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: \n" | ||
"Language: \n" | ||
"Language-Team: \n" | ||
"Content-Type: \n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: CSV file imported correctly | ||
msgid "CSV file imported correctly" | ||
msgstr "CSV fitxategia ongi inportatu da" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Export CSV file | ||
msgid "Export CSV file" | ||
msgstr "Exportatu CSV fitxategia" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Import CSV file | ||
msgid "Import CSV file" | ||
msgstr "Inportatu CSV fitxategia" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} new items imported | ||
msgid "Imported item count" | ||
msgstr "{count} elementu berri inportatu dira" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} items modified | ||
msgid "Modified item count" | ||
msgstr "{count} elementu aldatu dira" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo | ||
msgid "Undo" | ||
msgstr "Desegin" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo all modifications | ||
msgid "Undo all modifications" | ||
msgstr "Desegin aldaketa guztiak" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo message | ||
msgid "Undo message" | ||
msgstr "Aldaketa guztiak desegin dira" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Plone\n" | ||
"POT-Creation-Date: 2022-05-19T09:08:53.014Z\n" | ||
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n" | ||
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=1; plural=0;\n" | ||
"Language-Code: en\n" | ||
"Language-Name: English\n" | ||
"Preferred-Encodings: utf-8\n" | ||
"Domain: volto\n" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: CSV file imported correctly | ||
msgid "CSV file imported correctly" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Export CSV file | ||
msgid "Export CSV file" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Import CSV file | ||
msgid "Import CSV file" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} new items imported | ||
msgid "Imported item count" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: {count} items modified | ||
msgid "Modified item count" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo | ||
msgid "Undo" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo all modifications | ||
msgid "Undo all modifications" | ||
msgstr "" | ||
|
||
#: components/Widgets/ReactTableWidget | ||
# defaultMessage: Undo message | ||
msgid "Undo message" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { useSelector } from 'react-redux'; | ||
import React from 'react'; | ||
import { normalizeValue } from '@plone/volto/components/manage/Widgets/SelectUtils'; | ||
import { useIntl } from 'react-intl'; | ||
import moment from 'moment'; | ||
import { getFieldType, getOnChange, getValue, getValueToRender } from './utils'; | ||
|
||
export const EditableCell = ({ | ||
value: initialValue, | ||
row: { index }, | ||
column: { id }, | ||
updateCell, // This is a custom function that we supplied to our table instance | ||
selectedRow, | ||
setSelectedRow, | ||
schema, | ||
reactSelect, | ||
state: { pageIndex, pageSize }, | ||
}) => { | ||
const fieldSchema = { ...schema?.properties?.[id], id: id }; | ||
const locale = useSelector((state) => state.intl.locale); | ||
moment.locale(locale); | ||
|
||
const [value, setValue] = React.useState(initialValue); | ||
|
||
const onBlur = () => { | ||
updateCell(index, id, value); | ||
}; | ||
|
||
React.useEffect(() => { | ||
setValue(initialValue); | ||
}, [initialValue]); | ||
const { choices, defaultValue, isMulti } = fieldSchema; | ||
const intl = useIntl(); | ||
const fieldType = getFieldType(fieldSchema, reactSelect); | ||
const Field = fieldType.Field; | ||
const normalizedValue = normalizeValue(choices, value, intl); | ||
const onChangeFunction = getOnChange(fieldType.type, setValue); | ||
return selectedRow === index ? ( | ||
<Field | ||
{...fieldType.properties} | ||
value={getValue(fieldType.type, value, defaultValue, normalizedValue)} | ||
onChange={(...args) => onChangeFunction({ ...args, isMulti: isMulti })} | ||
onBlur={onBlur} | ||
/> | ||
) : ( | ||
<span | ||
role="button" | ||
className="editable-cell" | ||
tabIndex={0} | ||
onClick={() => { | ||
setSelectedRow(index); | ||
}} | ||
onKeyDown={() => { | ||
setSelectedRow(index); | ||
}} | ||
onFocus={() => { | ||
setSelectedRow(index); | ||
}} | ||
> | ||
{getValueToRender(fieldType, value, moment)} | ||
</span> | ||
); | ||
}; |
Oops, something went wrong.