cozy-ui 82.1.2 → 82.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/package.json +1 -1
- package/react/Filename/index.jsx +23 -15
- package/react/MuiCozyTheme/ListItem/ExpandedAttributes/ExpandedAttribute.jsx +1 -1
- package/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers.js +41 -8
- package/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers.spec.js +39 -1
- package/react/MuiCozyTheme/ListItem/ListItemByDoc/index.jsx +20 -4
- package/react/MuiCozyTheme/ListItem/ListItemContact/index.jsx +3 -14
- package/react/MuiCozyTheme/ListItem/ListItemFile/index.jsx +2 -11
- package/react/MuiCozyTheme/ListItem/locales/en.json +9 -0
- package/react/MuiCozyTheme/ListItem/locales/fr.json +10 -1
- package/react/MuiCozyTheme/MuiBreadcrumbs/Readme.md +11 -0
- package/react/MuiCozyTheme/MuiBreadcrumbs/index.js +3 -0
- package/react/index.js +1 -0
- package/transpiled/react/Filename/index.js +3 -3
- package/transpiled/react/MuiCozyTheme/ListItem/ExpandedAttributes/ExpandedAttribute.js +1 -1
- package/transpiled/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers.js +30 -3
- package/transpiled/react/MuiCozyTheme/ListItem/ListItemByDoc/index.js +17 -4
- package/transpiled/react/MuiCozyTheme/ListItem/ListItemContact/index.js +3 -13
- package/transpiled/react/MuiCozyTheme/ListItem/ListItemFile/index.js +2 -9
- package/transpiled/react/MuiCozyTheme/ListItem/hoc/withListItemLocales.js +19 -1
- package/transpiled/react/MuiCozyTheme/MuiBreadcrumbs/index.js +2 -0
- package/transpiled/react/index.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [82.3.0](https://github.com/cozy/cozy-ui/compare/v82.2.0...v82.3.0) (2023-03-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **ExpandedAttributes:** Secondary font wasn't correct ([a9800df](https://github.com/cozy/cozy-ui/commit/a9800df))
|
|
7
|
+
* **Filename:** Props `filename` was required ([910ff05](https://github.com/cozy/cozy-ui/commit/910ff05))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **ExpandedAttributes:** Add some locales ([6fbcfe4](https://github.com/cozy/cozy-ui/commit/6fbcfe4))
|
|
13
|
+
* **ExpandedAttributes:** Change supported attributes and modify logic ([238e359](https://github.com/cozy/cozy-ui/commit/238e359))
|
|
14
|
+
|
|
15
|
+
# [82.2.0](https://github.com/cozy/cozy-ui/compare/v82.1.2...v82.2.0) (2023-03-27)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* Export Breadcrumbs from MUI ([3bf0588](https://github.com/cozy/cozy-ui/commit/3bf0588))
|
|
21
|
+
|
|
1
22
|
## [82.1.2](https://github.com/cozy/cozy-ui/compare/v82.1.1...v82.1.2) (2023-03-24)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
package/react/Filename/index.jsx
CHANGED
|
@@ -15,20 +15,28 @@ const Filename = ({ icon, filename, extension, variant }) => {
|
|
|
15
15
|
<Icon className={'u-mr-1'} icon={icon} width={30} height={30} />
|
|
16
16
|
</Img>
|
|
17
17
|
)}
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
{(filename || extension) && (
|
|
19
|
+
<Bd className={styles['c-filename-wrapper']}>
|
|
20
|
+
{filename && (
|
|
21
|
+
<Typography
|
|
22
|
+
variant={variant}
|
|
23
|
+
component="span"
|
|
24
|
+
className={cx(styles['c-filename-name'], 'u-ellipsis')}
|
|
25
|
+
>
|
|
26
|
+
{filename}
|
|
27
|
+
</Typography>
|
|
28
|
+
)}
|
|
29
|
+
{extension && (
|
|
30
|
+
<Typography
|
|
31
|
+
variant={variant}
|
|
32
|
+
component="span"
|
|
33
|
+
color="textSecondary"
|
|
34
|
+
>
|
|
35
|
+
{extension}
|
|
36
|
+
</Typography>
|
|
37
|
+
)}
|
|
38
|
+
</Bd>
|
|
39
|
+
)}
|
|
32
40
|
</Media>
|
|
33
41
|
)
|
|
34
42
|
}
|
|
@@ -41,7 +49,7 @@ Filename.propTypes = {
|
|
|
41
49
|
PropTypes.func
|
|
42
50
|
]),
|
|
43
51
|
/** folder or file name */
|
|
44
|
-
filename: PropTypes.string
|
|
52
|
+
filename: PropTypes.string,
|
|
45
53
|
/** If a file name, you can specify the extension */
|
|
46
54
|
extension: PropTypes.string,
|
|
47
55
|
variant: PropTypes.string
|
|
@@ -24,7 +24,7 @@ const ExpandedAttribute = ({ label, value, setAlertProps }) => {
|
|
|
24
24
|
</ListItemIcon>
|
|
25
25
|
<ListItemText
|
|
26
26
|
primary={<Typography variant="caption">{label}</Typography>}
|
|
27
|
-
secondary={<Typography variant="
|
|
27
|
+
secondary={<Typography variant="body2">{value}</Typography>}
|
|
28
28
|
/>
|
|
29
29
|
</ListItem>
|
|
30
30
|
)
|
|
@@ -2,7 +2,11 @@ import get from 'lodash/get'
|
|
|
2
2
|
|
|
3
3
|
import { formatDate } from '../../../Viewer/helpers'
|
|
4
4
|
|
|
5
|
-
export const normalizeExpandedAttribute = attr =>
|
|
5
|
+
export const normalizeExpandedAttribute = attr =>
|
|
6
|
+
attr
|
|
7
|
+
.split('[]')[0]
|
|
8
|
+
.replace(':', '.')
|
|
9
|
+
.replace('flexsearchProps.', '')
|
|
6
10
|
|
|
7
11
|
// attributes not considered as expanded attributes
|
|
8
12
|
export const notExpandedAttributes = {
|
|
@@ -26,10 +30,7 @@ export const defaultExpandedAttributes = {
|
|
|
26
30
|
'metadata.CObtentionDate',
|
|
27
31
|
'metadata.DObtentionDate',
|
|
28
32
|
'metadata.obtentionDate',
|
|
29
|
-
'metadata.referencedDate',
|
|
30
33
|
'metadata.issueDate',
|
|
31
|
-
'metadata.shootingDate',
|
|
32
|
-
'metadata.date',
|
|
33
34
|
'metadata.datetime',
|
|
34
35
|
'metadata.expirationDate',
|
|
35
36
|
'metadata.country',
|
|
@@ -79,6 +80,7 @@ export const copyToClipboard = ({ value, setAlertProps, t }) => () => {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
export const isDate = value => {
|
|
83
|
+
if (!isNaN(value)) return false
|
|
82
84
|
const dateTime = new Date(value).getTime()
|
|
83
85
|
const dateParsedValue = Date.parse(value)
|
|
84
86
|
|
|
@@ -106,6 +108,19 @@ export const formatAttrValue = ({ attribute, attrValue, f, lang }) => {
|
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
111
|
+
export const makeAttrKey = (doc, expandedAttribute) => {
|
|
112
|
+
switch (true) {
|
|
113
|
+
case expandedAttribute === 'metadata.number':
|
|
114
|
+
return `${expandedAttribute}.${doc.metadata.qualification.label}`
|
|
115
|
+
|
|
116
|
+
case expandedAttribute.match(/\[.+\]/g) !== null:
|
|
117
|
+
return expandedAttribute.split('[')[0]
|
|
118
|
+
|
|
119
|
+
default:
|
|
120
|
+
return expandedAttribute
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
109
124
|
export const makeAttrsKeyAndFormatedValue = ({
|
|
110
125
|
doc,
|
|
111
126
|
expandedAttributes,
|
|
@@ -125,10 +140,7 @@ export const makeAttrsKeyAndFormatedValue = ({
|
|
|
125
140
|
|
|
126
141
|
if (!attrFormatedValue) return undefined
|
|
127
142
|
|
|
128
|
-
const attrKey =
|
|
129
|
-
expandedAttribute === 'metadata.number'
|
|
130
|
-
? `${expandedAttribute}.${doc.metadata.qualification.label}`
|
|
131
|
-
: expandedAttribute
|
|
143
|
+
const attrKey = makeAttrKey(doc, expandedAttribute)
|
|
132
144
|
|
|
133
145
|
return { attrKey, attrFormatedValue }
|
|
134
146
|
})
|
|
@@ -137,3 +149,24 @@ export const makeAttrsKeyAndFormatedValue = ({
|
|
|
137
149
|
|
|
138
150
|
return attrsKeyAndFormatedValue
|
|
139
151
|
}
|
|
152
|
+
|
|
153
|
+
export const hasExpandedAttributesDisplayed = ({
|
|
154
|
+
doc,
|
|
155
|
+
expandedAttributes,
|
|
156
|
+
f,
|
|
157
|
+
lang
|
|
158
|
+
}) => {
|
|
159
|
+
const defaultExpandedAttributes = makeDefaultExpandedAttributes(
|
|
160
|
+
doc,
|
|
161
|
+
expandedAttributes
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
const attrsKeyAndFormatedValue = makeAttrsKeyAndFormatedValue({
|
|
165
|
+
doc,
|
|
166
|
+
expandedAttributes: defaultExpandedAttributes,
|
|
167
|
+
f,
|
|
168
|
+
lang
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
return attrsKeyAndFormatedValue?.length > 0 || false
|
|
172
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { formatAttrValue } from './helpers'
|
|
1
|
+
import { formatAttrValue, makeAttrKey } from './helpers'
|
|
2
2
|
|
|
3
3
|
const f = () => 'someMockedDate'
|
|
4
4
|
const lang = 'en'
|
|
5
|
+
const doc = { metadata: { qualification: { label: 'qualifLabel' } } }
|
|
5
6
|
|
|
6
7
|
describe('formatAttrValue', () => {
|
|
7
8
|
it('should return primary formattedAddress from addresses', () => {
|
|
@@ -84,6 +85,17 @@ describe('formatAttrValue', () => {
|
|
|
84
85
|
expect(res).toBe(12345)
|
|
85
86
|
})
|
|
86
87
|
|
|
88
|
+
it('should return a number for a number value', () => {
|
|
89
|
+
const res = formatAttrValue({
|
|
90
|
+
attribute: 'metadata.number',
|
|
91
|
+
attrValue: '12345',
|
|
92
|
+
f,
|
|
93
|
+
lang
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
expect(res).toBe('12345')
|
|
97
|
+
})
|
|
98
|
+
|
|
87
99
|
it('should return a date for an ISO string formated date', () => {
|
|
88
100
|
const res = formatAttrValue({
|
|
89
101
|
attribute: 'metadata.date',
|
|
@@ -95,3 +107,29 @@ describe('formatAttrValue', () => {
|
|
|
95
107
|
expect(res).toBe('someMockedDate')
|
|
96
108
|
})
|
|
97
109
|
})
|
|
110
|
+
|
|
111
|
+
describe('makeAttrKey', () => {
|
|
112
|
+
it('should return email', () => {
|
|
113
|
+
const res = makeAttrKey(doc, 'email[0].address')
|
|
114
|
+
|
|
115
|
+
expect(res).toBe('email')
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('should return phone', () => {
|
|
119
|
+
const res = makeAttrKey(doc, 'phone[1].number')
|
|
120
|
+
|
|
121
|
+
expect(res).toBe('phone')
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it('should return metadata.number.qualifLabel', () => {
|
|
125
|
+
const res = makeAttrKey(doc, 'metadata.number')
|
|
126
|
+
|
|
127
|
+
expect(res).toBe('metadata.number.qualifLabel')
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it('should return the attribute', () => {
|
|
131
|
+
const res = makeAttrKey(doc, 'civility')
|
|
132
|
+
|
|
133
|
+
expect(res).toBe('civility')
|
|
134
|
+
})
|
|
135
|
+
})
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
|
|
|
3
3
|
|
|
4
4
|
import ListItemFile from '../ListItemFile'
|
|
5
5
|
import ListItemContact from '../ListItemContact'
|
|
6
|
+
import { makeDefaultExpandedAttributes } from '../ExpandedAttributes/helpers'
|
|
6
7
|
|
|
7
8
|
const ListItemByDoc = ({
|
|
8
9
|
doc,
|
|
@@ -11,9 +12,15 @@ const ListItemByDoc = ({
|
|
|
11
12
|
icon,
|
|
12
13
|
actions,
|
|
13
14
|
selectProps,
|
|
14
|
-
expandedAttributesProps,
|
|
15
|
+
expandedAttributesProps: { isExpandedAttributesActive, expandedAttributes },
|
|
16
|
+
|
|
15
17
|
onClick
|
|
16
18
|
}) => {
|
|
19
|
+
const itemExpandedAttributes = makeDefaultExpandedAttributes(
|
|
20
|
+
doc,
|
|
21
|
+
expandedAttributes
|
|
22
|
+
)
|
|
23
|
+
|
|
17
24
|
switch (doc._type) {
|
|
18
25
|
case 'io.cozy.contacts':
|
|
19
26
|
return (
|
|
@@ -24,7 +31,10 @@ const ListItemByDoc = ({
|
|
|
24
31
|
icon={icon}
|
|
25
32
|
actions={actions}
|
|
26
33
|
selectProps={selectProps}
|
|
27
|
-
expandedAttributesProps={
|
|
34
|
+
expandedAttributesProps={{
|
|
35
|
+
isExpandedAttributesActive,
|
|
36
|
+
expandedAttributes: itemExpandedAttributes
|
|
37
|
+
}}
|
|
28
38
|
onClick={onClick}
|
|
29
39
|
/>
|
|
30
40
|
)
|
|
@@ -38,7 +48,10 @@ const ListItemByDoc = ({
|
|
|
38
48
|
icon={icon}
|
|
39
49
|
actions={actions}
|
|
40
50
|
selectProps={selectProps}
|
|
41
|
-
expandedAttributesProps={
|
|
51
|
+
expandedAttributesProps={{
|
|
52
|
+
isExpandedAttributesActive,
|
|
53
|
+
expandedAttributes: itemExpandedAttributes
|
|
54
|
+
}}
|
|
42
55
|
onClick={onClick}
|
|
43
56
|
/>
|
|
44
57
|
)
|
|
@@ -52,7 +65,10 @@ const ListItemByDoc = ({
|
|
|
52
65
|
icon={icon}
|
|
53
66
|
actions={actions}
|
|
54
67
|
selectProps={selectProps}
|
|
55
|
-
expandedAttributesProps={
|
|
68
|
+
expandedAttributesProps={{
|
|
69
|
+
isExpandedAttributesActive,
|
|
70
|
+
expandedAttributes: itemExpandedAttributes
|
|
71
|
+
}}
|
|
56
72
|
onClick={onClick}
|
|
57
73
|
/>
|
|
58
74
|
)
|
|
@@ -6,7 +6,6 @@ import Icon from '../../../Icon'
|
|
|
6
6
|
import ContactsIcon from '../../../Icons/Contacts'
|
|
7
7
|
import ListItemBase from '../ListItemBase'
|
|
8
8
|
|
|
9
|
-
import { makeDefaultExpandedAttributes } from '../ExpandedAttributes/helpers'
|
|
10
9
|
import useActions from './useActions'
|
|
11
10
|
|
|
12
11
|
const ListItemContact = ({
|
|
@@ -16,7 +15,7 @@ const ListItemContact = ({
|
|
|
16
15
|
icon,
|
|
17
16
|
actions,
|
|
18
17
|
selectProps,
|
|
19
|
-
expandedAttributesProps
|
|
18
|
+
expandedAttributesProps,
|
|
20
19
|
onClick
|
|
21
20
|
}) => {
|
|
22
21
|
const defaultActions = useActions(contact)
|
|
@@ -24,10 +23,6 @@ const ListItemContact = ({
|
|
|
24
23
|
const secondaryText = secondary || contact.email?.[0]?.address
|
|
25
24
|
const itemIcon = icon || <Icon icon={ContactsIcon} width="32" height="32" />
|
|
26
25
|
|
|
27
|
-
const itemExpandedAttributes = makeDefaultExpandedAttributes(
|
|
28
|
-
contact,
|
|
29
|
-
expandedAttributes
|
|
30
|
-
)
|
|
31
26
|
const itemActions = defaultActions.concat(actions)
|
|
32
27
|
|
|
33
28
|
return (
|
|
@@ -41,20 +36,14 @@ const ListItemContact = ({
|
|
|
41
36
|
Header: <Filename icon={ContactsIcon} filename={primaryText} />
|
|
42
37
|
}}
|
|
43
38
|
selectProps={selectProps}
|
|
44
|
-
expandedAttributesProps={
|
|
45
|
-
isExpandedAttributesActive,
|
|
46
|
-
expandedAttributes: itemExpandedAttributes
|
|
47
|
-
}}
|
|
39
|
+
expandedAttributesProps={expandedAttributesProps}
|
|
48
40
|
onClick={onClick}
|
|
49
41
|
/>
|
|
50
42
|
)
|
|
51
43
|
}
|
|
52
44
|
|
|
53
45
|
ListItemContact.defaultProps = {
|
|
54
|
-
actions: []
|
|
55
|
-
expandedAttributesProps: {
|
|
56
|
-
isExpandedAttributesActive: false
|
|
57
|
-
}
|
|
46
|
+
actions: []
|
|
58
47
|
}
|
|
59
48
|
|
|
60
49
|
ListItemContact.propTypes = {
|
|
@@ -6,7 +6,6 @@ import { splitFilename } from 'cozy-client/dist/models/file'
|
|
|
6
6
|
import Filename from '../../../Filename'
|
|
7
7
|
import FiletypePdfIcon from '../../../Icons/FileTypePdf'
|
|
8
8
|
import ListItemBase from '../ListItemBase'
|
|
9
|
-
import { makeDefaultExpandedAttributes } from '../ExpandedAttributes/helpers'
|
|
10
9
|
import ItemIcon from './ItemIcon'
|
|
11
10
|
import PrimaryText from './PrimaryText'
|
|
12
11
|
import SecondaryText from './SecondaryText'
|
|
@@ -18,7 +17,7 @@ const ListItemFile = ({
|
|
|
18
17
|
icon,
|
|
19
18
|
actions,
|
|
20
19
|
selectProps,
|
|
21
|
-
expandedAttributesProps
|
|
20
|
+
expandedAttributesProps,
|
|
22
21
|
onClick
|
|
23
22
|
}) => {
|
|
24
23
|
const { filename, extension } = splitFilename({
|
|
@@ -26,11 +25,6 @@ const ListItemFile = ({
|
|
|
26
25
|
type: 'file'
|
|
27
26
|
})
|
|
28
27
|
|
|
29
|
-
const itemExpandedAttributes = makeDefaultExpandedAttributes(
|
|
30
|
-
file,
|
|
31
|
-
expandedAttributes
|
|
32
|
-
)
|
|
33
|
-
|
|
34
28
|
return (
|
|
35
29
|
<ListItemBase
|
|
36
30
|
doc={file}
|
|
@@ -48,10 +42,7 @@ const ListItemFile = ({
|
|
|
48
42
|
)
|
|
49
43
|
}}
|
|
50
44
|
selectProps={selectProps}
|
|
51
|
-
expandedAttributesProps={
|
|
52
|
-
isExpandedAttributesActive,
|
|
53
|
-
expandedAttributes: itemExpandedAttributes
|
|
54
|
-
}}
|
|
45
|
+
expandedAttributesProps={expandedAttributesProps}
|
|
55
46
|
onClick={onClick}
|
|
56
47
|
/>
|
|
57
48
|
)
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
"ListItem": {
|
|
3
3
|
"attributes": {
|
|
4
4
|
"birthday": "Birthday",
|
|
5
|
+
"birthcity": "Birth city",
|
|
5
6
|
"address": "Address",
|
|
6
7
|
"email": "Email address",
|
|
7
8
|
"phone": "Phone number",
|
|
9
|
+
"company": "Company",
|
|
10
|
+
"jobTitle": "Job title",
|
|
8
11
|
"metadata": {
|
|
9
12
|
"datetime": "Added on",
|
|
10
13
|
"AObtentionDate": "License A, delivered on",
|
|
@@ -21,9 +24,15 @@
|
|
|
21
24
|
"refTaxIncome": "Reference tax income",
|
|
22
25
|
"contractType": "Contract type",
|
|
23
26
|
"noticePeriod": "Expiration alert",
|
|
27
|
+
"cafFileNumber": "CAF file number",
|
|
28
|
+
"vinNumber": "Vehicle registration number (VIN)",
|
|
29
|
+
"cardNumber": "National ID card number",
|
|
30
|
+
"ibanNumber": "IBAN number",
|
|
31
|
+
"passportNumber": "Passport number",
|
|
24
32
|
"number": {
|
|
25
33
|
"driver_license": "License number",
|
|
26
34
|
"caf": "CAF file number",
|
|
35
|
+
"payment_proof_family_allowance": "CAF file number",
|
|
27
36
|
"vehicle_registration": "Vehicle registration number (VIN)",
|
|
28
37
|
"national_id_card": "National ID card number",
|
|
29
38
|
"bank_details": "IBAN number",
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
"ListItem": {
|
|
3
3
|
"attributes": {
|
|
4
4
|
"birthday": "Date de naissance",
|
|
5
|
+
"birthcity": "Lieu de naissance",
|
|
5
6
|
"address": "Adresse",
|
|
6
7
|
"email": "Adresse e-mail",
|
|
7
8
|
"phone": "Numéro de téléphone",
|
|
9
|
+
"company": "Entreprise",
|
|
10
|
+
"jobTitle": "Fonction",
|
|
8
11
|
"metadata": {
|
|
9
12
|
"datetime": "Ajouté le",
|
|
10
13
|
"AObtentionDate": "Permis A, délivré le",
|
|
@@ -19,11 +22,17 @@
|
|
|
19
22
|
"date": "Date du document",
|
|
20
23
|
"country": "Pays de délivrance",
|
|
21
24
|
"refTaxIncome": "Revenu fiscal de référence",
|
|
22
|
-
"contractType": "Type de
|
|
25
|
+
"contractType": "Type de contrat",
|
|
23
26
|
"noticePeriod": "Alerte d’expiration",
|
|
27
|
+
"cafFileNumber": "Numéro de dossier CAF",
|
|
28
|
+
"vinNumber": "Numéro de la carte grise (VIN)",
|
|
29
|
+
"cardNumber": "Numéro de la carte d'identité",
|
|
30
|
+
"ibanNumber": "Numéro d'IBAN",
|
|
31
|
+
"passportNumber": "Numéro du passeport",
|
|
24
32
|
"number": {
|
|
25
33
|
"driver_license": "Numéro du permis",
|
|
26
34
|
"caf": "Numéro de dossier CAF",
|
|
35
|
+
"payment_proof_family_allowance": "Numéro de dossier CAF",
|
|
27
36
|
"vehicle_registration": "Numéro de la carte grise (VIN)",
|
|
28
37
|
"national_id_card": "Numéro de la carte d'identité",
|
|
29
38
|
"bank_details": "Numéro d'IBAN",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
See [Material UI documentation](https://v4.mui.com/components/breadcrumbs/#breadcrumbs) to learn more about Breadcrumbs.
|
|
2
|
+
|
|
3
|
+
```jsx
|
|
4
|
+
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
5
|
+
import MuiBreadcrumbs from 'cozy-ui/transpiled/react/MuiCozyTheme/MuiBreadcrumbs';
|
|
6
|
+
|
|
7
|
+
<MuiBreadcrumbs aria-label="breadcrumb">
|
|
8
|
+
<Typography color="textPrimary">A</Typography>
|
|
9
|
+
<Typography color="textPrimary">B</Typography>
|
|
10
|
+
</MuiBreadcrumbs>
|
|
11
|
+
```
|
package/react/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export { default as Spinner } from './Spinner'
|
|
|
26
26
|
export { default as Accordion } from './MuiCozyTheme/Accordion'
|
|
27
27
|
export { default as AccordionSummary } from './MuiCozyTheme/AccordionSummary'
|
|
28
28
|
export { default as AccordionDetails } from './MuiCozyTheme/AccordionDetails'
|
|
29
|
+
export { default as MuiBreadcrumbs } from './MuiCozyTheme/MuiBreadcrumbs'
|
|
29
30
|
export { default as Toggle } from './Toggle'
|
|
30
31
|
export { default as withBreakpoints } from './helpers/withBreakpoints'
|
|
31
32
|
export { default as useBreakpoints } from './hooks/useBreakpoints'
|
|
@@ -19,9 +19,9 @@ var Filename = function Filename(_ref) {
|
|
|
19
19
|
icon: icon,
|
|
20
20
|
width: 30,
|
|
21
21
|
height: 30
|
|
22
|
-
})), /*#__PURE__*/React.createElement(Bd, {
|
|
22
|
+
})), (filename || extension) && /*#__PURE__*/React.createElement(Bd, {
|
|
23
23
|
className: styles['c-filename-wrapper']
|
|
24
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
24
|
+
}, filename && /*#__PURE__*/React.createElement(Typography, {
|
|
25
25
|
variant: variant,
|
|
26
26
|
component: "span",
|
|
27
27
|
className: cx(styles['c-filename-name'], 'u-ellipsis')
|
|
@@ -37,7 +37,7 @@ Filename.propTypes = {
|
|
|
37
37
|
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]),
|
|
38
38
|
|
|
39
39
|
/** folder or file name */
|
|
40
|
-
filename: PropTypes.string
|
|
40
|
+
filename: PropTypes.string,
|
|
41
41
|
|
|
42
42
|
/** If a file name, you can specify the extension */
|
|
43
43
|
extension: PropTypes.string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import { formatDate } from "cozy-ui/transpiled/react/Viewer/helpers";
|
|
3
3
|
export var normalizeExpandedAttribute = function normalizeExpandedAttribute(attr) {
|
|
4
|
-
return attr.split('[]')[0];
|
|
4
|
+
return attr.split('[]')[0].replace(':', '.').replace('flexsearchProps.', '');
|
|
5
5
|
}; // attributes not considered as expanded attributes
|
|
6
6
|
|
|
7
7
|
export var notExpandedAttributes = {
|
|
@@ -11,7 +11,7 @@ export var notExpandedAttributes = {
|
|
|
11
11
|
|
|
12
12
|
export var defaultExpandedAttributes = {
|
|
13
13
|
'io.cozy.contacts': ['email', 'phone', 'address', 'birthday'],
|
|
14
|
-
'io.cozy.files': ['metadata.number', 'metadata.cafFileNumber', 'metadata.cardNumber', 'metadata.vinNumber', 'metadata.ibanNumber', 'metadata.passportNumber', 'metadata.noticePeriod', 'metadata.AObtentionDate', 'metadata.BObtentionDate', 'metadata.CObtentionDate', 'metadata.DObtentionDate', 'metadata.obtentionDate', 'metadata.
|
|
14
|
+
'io.cozy.files': ['metadata.number', 'metadata.cafFileNumber', 'metadata.cardNumber', 'metadata.vinNumber', 'metadata.ibanNumber', 'metadata.passportNumber', 'metadata.noticePeriod', 'metadata.AObtentionDate', 'metadata.BObtentionDate', 'metadata.CObtentionDate', 'metadata.DObtentionDate', 'metadata.obtentionDate', 'metadata.issueDate', 'metadata.datetime', 'metadata.expirationDate', 'metadata.country', 'metadata.refTaxIncome', 'metadata.contractType']
|
|
15
15
|
};
|
|
16
16
|
export var hasAllElement = function hasAllElement(arr1, arr2) {
|
|
17
17
|
return arr1.every(function (x) {
|
|
@@ -57,6 +57,7 @@ export var copyToClipboard = function copyToClipboard(_ref) {
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
export var isDate = function isDate(value) {
|
|
60
|
+
if (!isNaN(value)) return false;
|
|
60
61
|
var dateTime = new Date(value).getTime();
|
|
61
62
|
var dateParsedValue = Date.parse(value);
|
|
62
63
|
return dateTime === dateParsedValue;
|
|
@@ -97,6 +98,18 @@ export var formatAttrValue = function formatAttrValue(_ref2) {
|
|
|
97
98
|
return attrValue;
|
|
98
99
|
}
|
|
99
100
|
};
|
|
101
|
+
export var makeAttrKey = function makeAttrKey(doc, expandedAttribute) {
|
|
102
|
+
switch (true) {
|
|
103
|
+
case expandedAttribute === 'metadata.number':
|
|
104
|
+
return "".concat(expandedAttribute, ".").concat(doc.metadata.qualification.label);
|
|
105
|
+
|
|
106
|
+
case expandedAttribute.match(/\[.+\]/g) !== null:
|
|
107
|
+
return expandedAttribute.split('[')[0];
|
|
108
|
+
|
|
109
|
+
default:
|
|
110
|
+
return expandedAttribute;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
100
113
|
export var makeAttrsKeyAndFormatedValue = function makeAttrsKeyAndFormatedValue(_ref3) {
|
|
101
114
|
var doc = _ref3.doc,
|
|
102
115
|
expandedAttributes = _ref3.expandedAttributes,
|
|
@@ -111,7 +124,7 @@ export var makeAttrsKeyAndFormatedValue = function makeAttrsKeyAndFormatedValue(
|
|
|
111
124
|
lang: lang
|
|
112
125
|
});
|
|
113
126
|
if (!attrFormatedValue) return undefined;
|
|
114
|
-
var attrKey =
|
|
127
|
+
var attrKey = makeAttrKey(doc, expandedAttribute);
|
|
115
128
|
return {
|
|
116
129
|
attrKey: attrKey,
|
|
117
130
|
attrFormatedValue: attrFormatedValue
|
|
@@ -120,4 +133,18 @@ export var makeAttrsKeyAndFormatedValue = function makeAttrsKeyAndFormatedValue(
|
|
|
120
133
|
return x;
|
|
121
134
|
}).slice(0, 3);
|
|
122
135
|
return attrsKeyAndFormatedValue;
|
|
136
|
+
};
|
|
137
|
+
export var hasExpandedAttributesDisplayed = function hasExpandedAttributesDisplayed(_ref4) {
|
|
138
|
+
var doc = _ref4.doc,
|
|
139
|
+
expandedAttributes = _ref4.expandedAttributes,
|
|
140
|
+
f = _ref4.f,
|
|
141
|
+
lang = _ref4.lang;
|
|
142
|
+
var defaultExpandedAttributes = makeDefaultExpandedAttributes(doc, expandedAttributes);
|
|
143
|
+
var attrsKeyAndFormatedValue = makeAttrsKeyAndFormatedValue({
|
|
144
|
+
doc: doc,
|
|
145
|
+
expandedAttributes: defaultExpandedAttributes,
|
|
146
|
+
f: f,
|
|
147
|
+
lang: lang
|
|
148
|
+
});
|
|
149
|
+
return (attrsKeyAndFormatedValue === null || attrsKeyAndFormatedValue === void 0 ? void 0 : attrsKeyAndFormatedValue.length) > 0 || false;
|
|
123
150
|
};
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ListItemFile from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemFile";
|
|
4
4
|
import ListItemContact from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemContact";
|
|
5
|
+
import { makeDefaultExpandedAttributes } from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers";
|
|
5
6
|
|
|
6
7
|
var ListItemByDoc = function ListItemByDoc(_ref) {
|
|
7
8
|
var doc = _ref.doc,
|
|
@@ -10,8 +11,11 @@ var ListItemByDoc = function ListItemByDoc(_ref) {
|
|
|
10
11
|
icon = _ref.icon,
|
|
11
12
|
actions = _ref.actions,
|
|
12
13
|
selectProps = _ref.selectProps,
|
|
13
|
-
|
|
14
|
+
_ref$expandedAttribut = _ref.expandedAttributesProps,
|
|
15
|
+
isExpandedAttributesActive = _ref$expandedAttribut.isExpandedAttributesActive,
|
|
16
|
+
expandedAttributes = _ref$expandedAttribut.expandedAttributes,
|
|
14
17
|
onClick = _ref.onClick;
|
|
18
|
+
var itemExpandedAttributes = makeDefaultExpandedAttributes(doc, expandedAttributes);
|
|
15
19
|
|
|
16
20
|
switch (doc._type) {
|
|
17
21
|
case 'io.cozy.contacts':
|
|
@@ -22,7 +26,10 @@ var ListItemByDoc = function ListItemByDoc(_ref) {
|
|
|
22
26
|
icon: icon,
|
|
23
27
|
actions: actions,
|
|
24
28
|
selectProps: selectProps,
|
|
25
|
-
expandedAttributesProps:
|
|
29
|
+
expandedAttributesProps: {
|
|
30
|
+
isExpandedAttributesActive: isExpandedAttributesActive,
|
|
31
|
+
expandedAttributes: itemExpandedAttributes
|
|
32
|
+
},
|
|
26
33
|
onClick: onClick
|
|
27
34
|
});
|
|
28
35
|
|
|
@@ -34,7 +41,10 @@ var ListItemByDoc = function ListItemByDoc(_ref) {
|
|
|
34
41
|
icon: icon,
|
|
35
42
|
actions: actions,
|
|
36
43
|
selectProps: selectProps,
|
|
37
|
-
expandedAttributesProps:
|
|
44
|
+
expandedAttributesProps: {
|
|
45
|
+
isExpandedAttributesActive: isExpandedAttributesActive,
|
|
46
|
+
expandedAttributes: itemExpandedAttributes
|
|
47
|
+
},
|
|
38
48
|
onClick: onClick
|
|
39
49
|
});
|
|
40
50
|
|
|
@@ -46,7 +56,10 @@ var ListItemByDoc = function ListItemByDoc(_ref) {
|
|
|
46
56
|
icon: icon,
|
|
47
57
|
actions: actions,
|
|
48
58
|
selectProps: selectProps,
|
|
49
|
-
expandedAttributesProps:
|
|
59
|
+
expandedAttributesProps: {
|
|
60
|
+
isExpandedAttributesActive: isExpandedAttributesActive,
|
|
61
|
+
expandedAttributes: itemExpandedAttributes
|
|
62
|
+
},
|
|
50
63
|
onClick: onClick
|
|
51
64
|
});
|
|
52
65
|
}
|
|
@@ -4,7 +4,6 @@ import Filename from "cozy-ui/transpiled/react/Filename";
|
|
|
4
4
|
import Icon from "cozy-ui/transpiled/react/Icon";
|
|
5
5
|
import ContactsIcon from "cozy-ui/transpiled/react/Icons/Contacts";
|
|
6
6
|
import ListItemBase from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemBase";
|
|
7
|
-
import { makeDefaultExpandedAttributes } from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers";
|
|
8
7
|
import useActions from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemContact/useActions";
|
|
9
8
|
|
|
10
9
|
var ListItemContact = function ListItemContact(_ref) {
|
|
@@ -16,9 +15,7 @@ var ListItemContact = function ListItemContact(_ref) {
|
|
|
16
15
|
icon = _ref.icon,
|
|
17
16
|
actions = _ref.actions,
|
|
18
17
|
selectProps = _ref.selectProps,
|
|
19
|
-
|
|
20
|
-
isExpandedAttributesActive = _ref$expandedAttribut.isExpandedAttributesActive,
|
|
21
|
-
expandedAttributes = _ref$expandedAttribut.expandedAttributes,
|
|
18
|
+
expandedAttributesProps = _ref.expandedAttributesProps,
|
|
22
19
|
onClick = _ref.onClick;
|
|
23
20
|
var defaultActions = useActions(contact);
|
|
24
21
|
var primaryText = primary || contact.displayName;
|
|
@@ -28,7 +25,6 @@ var ListItemContact = function ListItemContact(_ref) {
|
|
|
28
25
|
width: "32",
|
|
29
26
|
height: "32"
|
|
30
27
|
});
|
|
31
|
-
var itemExpandedAttributes = makeDefaultExpandedAttributes(contact, expandedAttributes);
|
|
32
28
|
var itemActions = defaultActions.concat(actions);
|
|
33
29
|
return /*#__PURE__*/React.createElement(ListItemBase, {
|
|
34
30
|
doc: contact,
|
|
@@ -43,19 +39,13 @@ var ListItemContact = function ListItemContact(_ref) {
|
|
|
43
39
|
})
|
|
44
40
|
},
|
|
45
41
|
selectProps: selectProps,
|
|
46
|
-
expandedAttributesProps:
|
|
47
|
-
isExpandedAttributesActive: isExpandedAttributesActive,
|
|
48
|
-
expandedAttributes: itemExpandedAttributes
|
|
49
|
-
},
|
|
42
|
+
expandedAttributesProps: expandedAttributesProps,
|
|
50
43
|
onClick: onClick
|
|
51
44
|
});
|
|
52
45
|
};
|
|
53
46
|
|
|
54
47
|
ListItemContact.defaultProps = {
|
|
55
|
-
actions: []
|
|
56
|
-
expandedAttributesProps: {
|
|
57
|
-
isExpandedAttributesActive: false
|
|
58
|
-
}
|
|
48
|
+
actions: []
|
|
59
49
|
};
|
|
60
50
|
ListItemContact.propTypes = {
|
|
61
51
|
contact: PropTypes.object,
|
|
@@ -4,7 +4,6 @@ import { splitFilename } from 'cozy-client/dist/models/file';
|
|
|
4
4
|
import Filename from "cozy-ui/transpiled/react/Filename";
|
|
5
5
|
import FiletypePdfIcon from "cozy-ui/transpiled/react/Icons/FileTypePdf";
|
|
6
6
|
import ListItemBase from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemBase";
|
|
7
|
-
import { makeDefaultExpandedAttributes } from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ExpandedAttributes/helpers";
|
|
8
7
|
import ItemIcon from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemFile/ItemIcon";
|
|
9
8
|
import PrimaryText from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemFile/PrimaryText";
|
|
10
9
|
import SecondaryText from "cozy-ui/transpiled/react/MuiCozyTheme/ListItem/ListItemFile/SecondaryText";
|
|
@@ -16,9 +15,7 @@ var ListItemFile = function ListItemFile(_ref) {
|
|
|
16
15
|
icon = _ref.icon,
|
|
17
16
|
actions = _ref.actions,
|
|
18
17
|
selectProps = _ref.selectProps,
|
|
19
|
-
|
|
20
|
-
isExpandedAttributesActive = _ref$expandedAttribut.isExpandedAttributesActive,
|
|
21
|
-
expandedAttributes = _ref$expandedAttribut.expandedAttributes,
|
|
18
|
+
expandedAttributesProps = _ref.expandedAttributesProps,
|
|
22
19
|
onClick = _ref.onClick;
|
|
23
20
|
|
|
24
21
|
var _splitFilename = splitFilename({
|
|
@@ -28,7 +25,6 @@ var ListItemFile = function ListItemFile(_ref) {
|
|
|
28
25
|
filename = _splitFilename.filename,
|
|
29
26
|
extension = _splitFilename.extension;
|
|
30
27
|
|
|
31
|
-
var itemExpandedAttributes = makeDefaultExpandedAttributes(file, expandedAttributes);
|
|
32
28
|
return /*#__PURE__*/React.createElement(ListItemBase, {
|
|
33
29
|
doc: file,
|
|
34
30
|
primary: /*#__PURE__*/React.createElement(PrimaryText, {
|
|
@@ -52,10 +48,7 @@ var ListItemFile = function ListItemFile(_ref) {
|
|
|
52
48
|
})
|
|
53
49
|
},
|
|
54
50
|
selectProps: selectProps,
|
|
55
|
-
expandedAttributesProps:
|
|
56
|
-
isExpandedAttributesActive: isExpandedAttributesActive,
|
|
57
|
-
expandedAttributes: itemExpandedAttributes
|
|
58
|
-
},
|
|
51
|
+
expandedAttributesProps: expandedAttributesProps,
|
|
59
52
|
onClick: onClick
|
|
60
53
|
});
|
|
61
54
|
};
|
|
@@ -3,9 +3,12 @@ var en = {
|
|
|
3
3
|
ListItem: {
|
|
4
4
|
attributes: {
|
|
5
5
|
birthday: "Birthday",
|
|
6
|
+
birthcity: "Birth city",
|
|
6
7
|
address: "Address",
|
|
7
8
|
email: "Email address",
|
|
8
9
|
phone: "Phone number",
|
|
10
|
+
company: "Company",
|
|
11
|
+
jobTitle: "Job title",
|
|
9
12
|
metadata: {
|
|
10
13
|
datetime: "Added on",
|
|
11
14
|
AObtentionDate: "License A, delivered on",
|
|
@@ -22,9 +25,15 @@ var en = {
|
|
|
22
25
|
refTaxIncome: "Reference tax income",
|
|
23
26
|
contractType: "Contract type",
|
|
24
27
|
noticePeriod: "Expiration alert",
|
|
28
|
+
cafFileNumber: "CAF file number",
|
|
29
|
+
vinNumber: "Vehicle registration number (VIN)",
|
|
30
|
+
cardNumber: "National ID card number",
|
|
31
|
+
ibanNumber: "IBAN number",
|
|
32
|
+
passportNumber: "Passport number",
|
|
25
33
|
number: {
|
|
26
34
|
driver_license: "License number",
|
|
27
35
|
caf: "CAF file number",
|
|
36
|
+
payment_proof_family_allowance: "CAF file number",
|
|
28
37
|
vehicle_registration: "Vehicle registration number (VIN)",
|
|
29
38
|
national_id_card: "National ID card number",
|
|
30
39
|
bank_details: "IBAN number",
|
|
@@ -58,9 +67,12 @@ var fr = {
|
|
|
58
67
|
ListItem: {
|
|
59
68
|
attributes: {
|
|
60
69
|
birthday: "Date de naissance",
|
|
70
|
+
birthcity: "Lieu de naissance",
|
|
61
71
|
address: "Adresse",
|
|
62
72
|
email: "Adresse e-mail",
|
|
63
73
|
phone: "Num\xE9ro de t\xE9l\xE9phone",
|
|
74
|
+
company: "Entreprise",
|
|
75
|
+
jobTitle: "Fonction",
|
|
64
76
|
metadata: {
|
|
65
77
|
datetime: "Ajout\xE9 le",
|
|
66
78
|
AObtentionDate: "Permis A, d\xE9livr\xE9 le",
|
|
@@ -75,11 +87,17 @@ var fr = {
|
|
|
75
87
|
date: "Date du document",
|
|
76
88
|
country: "Pays de d\xE9livrance",
|
|
77
89
|
refTaxIncome: "Revenu fiscal de r\xE9f\xE9rence",
|
|
78
|
-
contractType: "Type de
|
|
90
|
+
contractType: "Type de contrat",
|
|
79
91
|
noticePeriod: "Alerte d\u2019expiration",
|
|
92
|
+
cafFileNumber: "Num\xE9ro de dossier CAF",
|
|
93
|
+
vinNumber: "Num\xE9ro de la carte grise (VIN)",
|
|
94
|
+
cardNumber: "Num\xE9ro de la carte d'identit\xE9",
|
|
95
|
+
ibanNumber: "Num\xE9ro d'IBAN",
|
|
96
|
+
passportNumber: "Num\xE9ro du passeport",
|
|
80
97
|
number: {
|
|
81
98
|
driver_license: "Num\xE9ro du permis",
|
|
82
99
|
caf: "Num\xE9ro de dossier CAF",
|
|
100
|
+
payment_proof_family_allowance: "Num\xE9ro de dossier CAF",
|
|
83
101
|
vehicle_registration: "Num\xE9ro de la carte grise (VIN)",
|
|
84
102
|
national_id_card: "Num\xE9ro de la carte d'identit\xE9",
|
|
85
103
|
bank_details: "Num\xE9ro d'IBAN",
|
|
@@ -19,6 +19,7 @@ export { default as Spinner } from './Spinner';
|
|
|
19
19
|
export { default as Accordion } from './MuiCozyTheme/Accordion';
|
|
20
20
|
export { default as AccordionSummary } from './MuiCozyTheme/AccordionSummary';
|
|
21
21
|
export { default as AccordionDetails } from './MuiCozyTheme/AccordionDetails';
|
|
22
|
+
export { default as MuiBreadcrumbs } from './MuiCozyTheme/MuiBreadcrumbs';
|
|
22
23
|
export { default as Toggle } from './Toggle';
|
|
23
24
|
export { default as withBreakpoints } from './helpers/withBreakpoints';
|
|
24
25
|
export { default as useBreakpoints } from './hooks/useBreakpoints';
|