cozy-ui 81.4.0 → 81.6.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 +14 -0
- package/package.json +5 -5
- package/react/ActionMenu/index.spec.jsx +1 -1
- package/react/Radio/index.spec.jsx +1 -1
- package/react/SquareAppIcon/Readme.md +58 -48
- package/react/SquareAppIcon/__snapshots__/SquareAppIcon.spec.js.snap +88 -0
- package/react/SquareAppIcon/index.jsx +10 -0
- package/react/SquareAppIcon/styles.styl +14 -0
- package/react/Viewer/Panel/Qualification.jsx +1 -3
- package/react/Viewer/Panel/QualificationListItemInformation.jsx +11 -9
- package/react/Viewer/Panel/QualificationListItemInformation.spec.jsx +3 -0
- package/react/Viewer/helpers.js +18 -12
- package/react/Viewer/helpers.spec.js +10 -16
- package/react/Viewer/locales/en.json +24 -5
- package/react/Viewer/locales/fr.json +24 -5
- package/react/__snapshots__/examples.spec.jsx.snap +189 -5664
- package/react/examples.spec.jsx +3 -3
- package/transpiled/react/SquareAppIcon/index.js +11 -3
- package/transpiled/react/Viewer/Panel/Qualification.js +1 -2
- package/transpiled/react/Viewer/Panel/QualificationListItemInformation.js +7 -3
- package/transpiled/react/Viewer/helpers.js +2 -1
- package/transpiled/react/Viewer/hoc/withViewerLocales.js +46 -10
- package/transpiled/react/stylesheet.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [81.6.0](https://github.com/cozy/cozy-ui/compare/v81.5.0...v81.6.0) (2023-03-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add a flag around the attribute migration feature... ([93790ce](https://github.com/cozy/cozy-ui/commit/93790ce))
|
|
7
|
+
|
|
8
|
+
# [81.5.0](https://github.com/cozy/cozy-ui/compare/v81.4.0...v81.5.0) (2023-03-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Add `loading` variant to SquareAppIcon ([f72b657](https://github.com/cozy/cozy-ui/commit/f72b657))
|
|
14
|
+
|
|
1
15
|
# [81.4.0](https://github.com/cozy/cozy-ui/compare/v81.3.0...v81.4.0) (2023-03-13)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-ui",
|
|
3
|
-
"version": "81.
|
|
3
|
+
"version": "81.6.0",
|
|
4
4
|
"description": "Cozy apps UI SDK",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"makeSpriteAndPalette": "npm-run-all --parallel sprite palette",
|
|
45
45
|
"semantic-release": "semantic-release",
|
|
46
46
|
"sprite": "scripts/make-icon-sprite.sh",
|
|
47
|
-
"jest": "yarn test:jest",
|
|
48
47
|
"screenshots": "node scripts/screenshots.js --screenshot-dir ./screenshots --styleguide-url file://$(pwd)/build/react --kss-dir ./build/styleguide",
|
|
49
|
-
"test": "
|
|
50
|
-
"test:
|
|
48
|
+
"test": "jest",
|
|
49
|
+
"test:noSnapshots": "jest --testPathIgnorePatterns 'react/examples.spec.jsx'",
|
|
50
|
+
"test:snapshots": "jest react/examples.spec.jsx",
|
|
51
|
+
"test:update:snapshots": "jest react/examples.spec.jsx -u",
|
|
51
52
|
"screenshots:server": "nodemon ./scripts/pixelmatch-server/server.js -e js,hbs",
|
|
52
|
-
"test:jest": "jest",
|
|
53
53
|
"postbuild": "postcss transpiled/react/stylesheet.css --replace",
|
|
54
54
|
"travis-deploy-once": "travis-deploy-once",
|
|
55
55
|
"start:css": "yarn build:css --watch",
|
|
@@ -12,7 +12,7 @@ import WarningIcon from '../Icons/Warning'
|
|
|
12
12
|
|
|
13
13
|
import ActionMenu, { ActionMenuItem, ActionMenuRadio } from '.'
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
xdescribe('ActionMenu', () => {
|
|
16
16
|
fixPopperTesting()
|
|
17
17
|
|
|
18
18
|
// The update-not-wrapping-in-act warning is disabled for ActionMenuWrapper since
|
|
@@ -8,66 +8,76 @@ import CozyIcon from 'cozy-ui/transpiled/react/Icons/Cozy'
|
|
|
8
8
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
9
9
|
import { useCozyTheme } from 'cozy-ui/transpiled/react/CozyTheme'
|
|
10
10
|
import cloudWallpaper from '../../docs/cloud-wallpaper.jpg'
|
|
11
|
+
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
11
12
|
|
|
12
13
|
const theme = useCozyTheme()
|
|
13
14
|
const app = { name: "Test App", slug: "testapp", type: "app" }
|
|
15
|
+
const [isLoading, setLoading] = React.useState(false)
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
;
|
|
16
19
|
|
|
20
|
+
<>
|
|
21
|
+
<Button className="u-mb-1" label="Toggle Loading" onClick={() => setLoading(!isLoading)} />
|
|
17
22
|
|
|
18
|
-
<Grid container spacing={1} style={{ background: `center / cover no-repeat url(${cloudWallpaper})` }}
|
|
19
|
-
>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<Grid item xs={6}>
|
|
61
|
-
<Icon icon={CozyIcon} />
|
|
62
|
-
</Grid>
|
|
23
|
+
<Grid container spacing={1} style={{ background: `center / cover no-repeat url(${cloudWallpaper})` }}
|
|
24
|
+
>
|
|
25
|
+
<Grid item>
|
|
26
|
+
<SquareAppIcon app={app} name="Normal" />
|
|
27
|
+
</Grid>
|
|
28
|
+
<Grid item>
|
|
29
|
+
<SquareAppIcon app={app} name="Maintenance" variant="maintenance" />
|
|
30
|
+
</Grid>
|
|
31
|
+
<Grid item>
|
|
32
|
+
<SquareAppIcon app={app} name="Error" variant="error" />
|
|
33
|
+
</Grid>
|
|
34
|
+
<Grid item>
|
|
35
|
+
<SquareAppIcon name="Add" variant="add" />
|
|
36
|
+
</Grid>
|
|
37
|
+
<Grid item>
|
|
38
|
+
<SquareAppIcon app="testapp" name="No Account long name very very very very long" variant="ghost" />
|
|
39
|
+
</Grid>
|
|
40
|
+
<Grid item>
|
|
41
|
+
<SquareAppIcon name="Shortcut" variant="shortcut" />
|
|
42
|
+
</Grid>
|
|
43
|
+
<Grid item>
|
|
44
|
+
<SquareAppIcon IconContent={<Icon icon={CozyIcon} size="48" />} name="Loading" variant={isLoading ? 'loading' : 'default'} />
|
|
45
|
+
</Grid>
|
|
46
|
+
<Grid item>
|
|
47
|
+
<SquareAppIcon name="Shortcut" variant="shortcut" IconContent={<img
|
|
48
|
+
src={`data:image/svg+xml;base64,${window.btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
49
|
+
<g fill="none" fill-rule="evenodd" transform="translate(0 2)">
|
|
50
|
+
<rect width="32" height="26" y="2" fill="#B2D3FF" rx="2"/>
|
|
51
|
+
<path fill="#197BFF" d="M0,0.990777969 C0,0.443586406 0.449948758,0 1.00684547,0 L12.9931545,0 C13.5492199,0 14.3125,0.3125 14.7107565,0.71075654 L15.2892435,1.28924346 C15.6817835,1.68178346 16.4446309,2 17.0008717,2 L30.0059397,2 C31.1072288,2 32,2.89470506 32,4 L32,4 L17.0008717,4 C16.4481055,4 15.6875,4.3125 15.2892435,4.71075654 L14.7107565,5.28924346 C14.3182165,5.68178346 13.5500512,6 12.9931545,6 L1.00684547,6 C0.450780073,6 0,5.54902482 0,5.00922203 L0,0.990777969 Z"/>
|
|
52
|
+
</g>
|
|
53
|
+
</svg>`)}`}
|
|
54
|
+
width={32}
|
|
55
|
+
height={32}
|
|
56
|
+
alt={"Shortcut"}
|
|
57
|
+
/>}/>
|
|
58
|
+
</Grid>
|
|
59
|
+
<Grid item>
|
|
60
|
+
<SquareAppIcon name="Custom Icon" IconContent={<Icon icon={CozyIcon} size="48" />} />
|
|
61
|
+
</Grid>
|
|
62
|
+
<Grid item>
|
|
63
|
+
<SquareAppIcon name="Icon Grid" IconContent={(
|
|
64
|
+
<Grid container spacing={0}>
|
|
63
65
|
<Grid item xs={6}>
|
|
64
66
|
<Icon icon={CozyIcon} />
|
|
65
67
|
</Grid>
|
|
66
68
|
<Grid item xs={6}>
|
|
67
69
|
<Icon icon={CozyIcon} />
|
|
68
70
|
</Grid>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
<Grid item xs={6}>
|
|
72
|
+
<Icon icon={CozyIcon} />
|
|
73
|
+
</Grid>
|
|
74
|
+
<Grid item xs={6}>
|
|
75
|
+
<Icon icon={CozyIcon} />
|
|
76
|
+
</Grid>
|
|
77
|
+
</Grid>
|
|
78
|
+
)} />
|
|
79
|
+
</Grid>
|
|
71
80
|
</Grid>
|
|
72
|
-
|
|
81
|
+
|
|
82
|
+
</>
|
|
73
83
|
```
|
|
@@ -8,6 +8,28 @@ exports[`SquareAppIcon component should render an app correctly with the app nam
|
|
|
8
8
|
<span
|
|
9
9
|
class="MuiBadge-root"
|
|
10
10
|
>
|
|
11
|
+
<div
|
|
12
|
+
class="styles__c-spinner___1snK7 styles__SquareAppIcon-spinner___o0LO1"
|
|
13
|
+
>
|
|
14
|
+
<svg
|
|
15
|
+
aria-busy="true"
|
|
16
|
+
class="styles__icon___23x3R styles__icon--spin___ybfC1"
|
|
17
|
+
height="16"
|
|
18
|
+
role="progressbar"
|
|
19
|
+
style="fill: var(--spinnerColor);"
|
|
20
|
+
viewBox="0 0 32 32"
|
|
21
|
+
width="16"
|
|
22
|
+
>
|
|
23
|
+
<path
|
|
24
|
+
d="M16 0a16 16 0 000 32 16 16 0 000-32m0 4a12 12 0 010 24 12 12 0 010-24"
|
|
25
|
+
opacity="0.25"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
d="M16 0a16 16 0 0116 16h-4A12 12 0 0016 4z"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
|
|
32
|
+
</div>
|
|
11
33
|
<span
|
|
12
34
|
class="MuiBadge-root styles__SquareAppIcon-wrapper___2SEuM makeStyles-shadow-9"
|
|
13
35
|
>
|
|
@@ -50,6 +72,28 @@ exports[`SquareAppIcon component should render an app correctly with the given n
|
|
|
50
72
|
<span
|
|
51
73
|
class="MuiBadge-root"
|
|
52
74
|
>
|
|
75
|
+
<div
|
|
76
|
+
class="styles__c-spinner___1snK7 styles__SquareAppIcon-spinner___o0LO1"
|
|
77
|
+
>
|
|
78
|
+
<svg
|
|
79
|
+
aria-busy="true"
|
|
80
|
+
class="styles__icon___23x3R styles__icon--spin___ybfC1"
|
|
81
|
+
height="16"
|
|
82
|
+
role="progressbar"
|
|
83
|
+
style="fill: var(--spinnerColor);"
|
|
84
|
+
viewBox="0 0 32 32"
|
|
85
|
+
width="16"
|
|
86
|
+
>
|
|
87
|
+
<path
|
|
88
|
+
d="M16 0a16 16 0 000 32 16 16 0 000-32m0 4a12 12 0 010 24 12 12 0 010-24"
|
|
89
|
+
opacity="0.25"
|
|
90
|
+
/>
|
|
91
|
+
<path
|
|
92
|
+
d="M16 0a16 16 0 0116 16h-4A12 12 0 0016 4z"
|
|
93
|
+
/>
|
|
94
|
+
</svg>
|
|
95
|
+
|
|
96
|
+
</div>
|
|
53
97
|
<span
|
|
54
98
|
class="MuiBadge-root styles__SquareAppIcon-wrapper___2SEuM makeStyles-shadow-3"
|
|
55
99
|
>
|
|
@@ -92,6 +136,28 @@ exports[`SquareAppIcon component should render an app with the app slug if no na
|
|
|
92
136
|
<span
|
|
93
137
|
class="MuiBadge-root"
|
|
94
138
|
>
|
|
139
|
+
<div
|
|
140
|
+
class="styles__c-spinner___1snK7 styles__SquareAppIcon-spinner___o0LO1"
|
|
141
|
+
>
|
|
142
|
+
<svg
|
|
143
|
+
aria-busy="true"
|
|
144
|
+
class="styles__icon___23x3R styles__icon--spin___ybfC1"
|
|
145
|
+
height="16"
|
|
146
|
+
role="progressbar"
|
|
147
|
+
style="fill: var(--spinnerColor);"
|
|
148
|
+
viewBox="0 0 32 32"
|
|
149
|
+
width="16"
|
|
150
|
+
>
|
|
151
|
+
<path
|
|
152
|
+
d="M16 0a16 16 0 000 32 16 16 0 000-32m0 4a12 12 0 010 24 12 12 0 010-24"
|
|
153
|
+
opacity="0.25"
|
|
154
|
+
/>
|
|
155
|
+
<path
|
|
156
|
+
d="M16 0a16 16 0 0116 16h-4A12 12 0 0016 4z"
|
|
157
|
+
/>
|
|
158
|
+
</svg>
|
|
159
|
+
|
|
160
|
+
</div>
|
|
95
161
|
<span
|
|
96
162
|
class="MuiBadge-root styles__SquareAppIcon-wrapper___2SEuM makeStyles-shadow-15"
|
|
97
163
|
>
|
|
@@ -364,6 +430,28 @@ exports[`SquareAppIcon component should render correctly an app with custom cont
|
|
|
364
430
|
<span
|
|
365
431
|
class="MuiBadge-root"
|
|
366
432
|
>
|
|
433
|
+
<div
|
|
434
|
+
class="styles__c-spinner___1snK7 styles__SquareAppIcon-spinner___o0LO1"
|
|
435
|
+
>
|
|
436
|
+
<svg
|
|
437
|
+
aria-busy="true"
|
|
438
|
+
class="styles__icon___23x3R styles__icon--spin___ybfC1"
|
|
439
|
+
height="16"
|
|
440
|
+
role="progressbar"
|
|
441
|
+
style="fill: var(--spinnerColor);"
|
|
442
|
+
viewBox="0 0 32 32"
|
|
443
|
+
width="16"
|
|
444
|
+
>
|
|
445
|
+
<path
|
|
446
|
+
d="M16 0a16 16 0 000 32 16 16 0 000-32m0 4a12 12 0 010 24 12 12 0 010-24"
|
|
447
|
+
opacity="0.25"
|
|
448
|
+
/>
|
|
449
|
+
<path
|
|
450
|
+
d="M16 0a16 16 0 0116 16h-4A12 12 0 0016 4z"
|
|
451
|
+
/>
|
|
452
|
+
</svg>
|
|
453
|
+
|
|
454
|
+
</div>
|
|
367
455
|
<span
|
|
368
456
|
class="MuiBadge-root styles__SquareAppIcon-wrapper___2SEuM makeStyles-shadow-57"
|
|
369
457
|
>
|
|
@@ -8,6 +8,7 @@ import AppIcon from '../AppIcon'
|
|
|
8
8
|
import Badge from '../Badge'
|
|
9
9
|
import InfosBadge from '../InfosBadge'
|
|
10
10
|
import { nameToColor } from '../Avatar'
|
|
11
|
+
import Spinner from '../Spinner'
|
|
11
12
|
import Typography from '../Typography'
|
|
12
13
|
import Icon from '../Icon'
|
|
13
14
|
import iconPlus from '../Icons/Plus'
|
|
@@ -81,6 +82,9 @@ export const SquareAppIcon = ({
|
|
|
81
82
|
overlap="rectangular"
|
|
82
83
|
invisible={variant !== 'shortcut'}
|
|
83
84
|
>
|
|
85
|
+
{['default', 'loading'].includes(variant) && (
|
|
86
|
+
<Spinner className={styles['SquareAppIcon-spinner']} />
|
|
87
|
+
)}
|
|
84
88
|
<Badge
|
|
85
89
|
className={cx(
|
|
86
90
|
styles['SquareAppIcon-wrapper'],
|
|
@@ -145,6 +149,8 @@ export const SquareAppIcon = ({
|
|
|
145
149
|
SquareAppIcon.propTypes = {
|
|
146
150
|
name: PropTypes.string,
|
|
147
151
|
variant: PropTypes.oneOf([
|
|
152
|
+
'default',
|
|
153
|
+
'loading',
|
|
148
154
|
'ghost',
|
|
149
155
|
'maintenance',
|
|
150
156
|
'error',
|
|
@@ -154,4 +160,8 @@ SquareAppIcon.propTypes = {
|
|
|
154
160
|
IconContent: PropTypes.node
|
|
155
161
|
}
|
|
156
162
|
|
|
163
|
+
SquareAppIcon.defaultProps = {
|
|
164
|
+
variant: 'default'
|
|
165
|
+
}
|
|
166
|
+
|
|
157
167
|
export default SquareAppIcon
|
|
@@ -13,6 +13,8 @@ $color = constants['color'] // hard-coded color, because the component is curren
|
|
|
13
13
|
border-radius rem(12)
|
|
14
14
|
height $iconSize
|
|
15
15
|
width $iconSize
|
|
16
|
+
transition transform 300ms, border-radius 300ms
|
|
17
|
+
|
|
16
18
|
+small-screen()
|
|
17
19
|
height $mobileIconSize
|
|
18
20
|
width $mobileIconSize
|
|
@@ -45,3 +47,15 @@ $color = constants['color'] // hard-coded color, because the component is curren
|
|
|
45
47
|
mix-blend-mode luminosity
|
|
46
48
|
svg, img
|
|
47
49
|
opacity .5
|
|
50
|
+
|
|
51
|
+
.SquareAppIcon-wrapper-loading
|
|
52
|
+
border-radius 50%
|
|
53
|
+
transform scale(0.875)
|
|
54
|
+
+small-screen()
|
|
55
|
+
transform scale(0.8334)
|
|
56
|
+
|
|
57
|
+
.SquareAppIcon-spinner
|
|
58
|
+
svg
|
|
59
|
+
position absolute
|
|
60
|
+
height 100%
|
|
61
|
+
width 100%
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState, createRef, useMemo, useEffect } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { isExpiringSoon } from 'cozy-client/dist/models/paper'
|
|
5
5
|
|
|
6
6
|
import List from '../../MuiCozyTheme/List'
|
|
7
7
|
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
@@ -18,8 +18,6 @@ import QualificationListItemDate from './QualificationListItemDate'
|
|
|
18
18
|
import QualificationListItemInformation from './QualificationListItemInformation'
|
|
19
19
|
import QualificationListItemOther from './QualificationListItemOther'
|
|
20
20
|
|
|
21
|
-
const { isExpiringSoon } = models.paper
|
|
22
|
-
|
|
23
21
|
const makeQualificationListItemComp = metadataName => {
|
|
24
22
|
if (knownDateMetadataNames.includes(metadataName)) {
|
|
25
23
|
return QualificationListItemDate
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getBoundT } from 'cozy-client/dist/models/document/locales'
|
|
5
|
+
import flag from 'cozy-flags'
|
|
5
6
|
|
|
6
7
|
import ListItem from '../../MuiCozyTheme/ListItem'
|
|
7
8
|
import ListItemSecondaryAction from '../../MuiCozyTheme/ListItemSecondaryAction'
|
|
@@ -12,12 +13,6 @@ import QualificationListItemText from './QualificationListItemText'
|
|
|
12
13
|
import { useI18n } from '../../I18n'
|
|
13
14
|
import MidEllipsis from '../../MidEllipsis'
|
|
14
15
|
|
|
15
|
-
const {
|
|
16
|
-
document: {
|
|
17
|
-
locales: { getBoundT }
|
|
18
|
-
}
|
|
19
|
-
} = models
|
|
20
|
-
|
|
21
16
|
export const makeInformationValue = ({ name, value, t, scannerT }) => {
|
|
22
17
|
if (!value) {
|
|
23
18
|
return t('Viewer.panel.qualification.noInfo')
|
|
@@ -37,17 +32,24 @@ export const makeInformationValue = ({ name, value, t, scannerT }) => {
|
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
const QualificationListItemInformation = forwardRef(
|
|
40
|
-
({ formatedMetadataQualification, toggleActionsMenu }, ref) => {
|
|
35
|
+
({ formatedMetadataQualification, file, toggleActionsMenu }, ref) => {
|
|
41
36
|
const { t, lang } = useI18n()
|
|
42
37
|
const scannerT = getBoundT(lang)
|
|
43
38
|
const { name, value } = formatedMetadataQualification
|
|
39
|
+
const qualificationLabel = file.metadata.qualification.label
|
|
44
40
|
|
|
45
41
|
const currentValue = makeInformationValue({ name, value, t, scannerT })
|
|
42
|
+
const title =
|
|
43
|
+
name === 'number' && flag('mespapiers.migrated.metadata') // TODO Remove duplicate translations when remove this flag
|
|
44
|
+
? t(
|
|
45
|
+
`Viewer.panel.qualification.information.title.${qualificationLabel}.${name}`
|
|
46
|
+
)
|
|
47
|
+
: t(`Viewer.panel.qualification.information.title.${name}`)
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
50
|
<ListItem className={'u-pl-2 u-pr-3'}>
|
|
49
51
|
<QualificationListItemText
|
|
50
|
-
primary={
|
|
52
|
+
primary={title}
|
|
51
53
|
secondary={currentValue}
|
|
52
54
|
disabled={!value}
|
|
53
55
|
/>
|
|
@@ -16,6 +16,9 @@ const setup = ({
|
|
|
16
16
|
<QualificationListItemInformation
|
|
17
17
|
formatedMetadataQualification={formatedMetadataQualification}
|
|
18
18
|
toggleActionsMenu={toggleActionsMenu}
|
|
19
|
+
file={{
|
|
20
|
+
metadata: { qualification: { label: 'label_of_qualification' } }
|
|
21
|
+
}}
|
|
19
22
|
/>
|
|
20
23
|
</DemoProvider>
|
|
21
24
|
)
|
package/react/Viewer/helpers.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { models } from 'cozy-client'
|
|
2
|
+
import flag from 'cozy-flags'
|
|
3
|
+
|
|
2
4
|
const {
|
|
3
5
|
isEncrypted,
|
|
4
6
|
isFromKonnector,
|
|
@@ -19,18 +21,22 @@ export const knownDateMetadataNames = [
|
|
|
19
21
|
'date',
|
|
20
22
|
'datetime'
|
|
21
23
|
]
|
|
22
|
-
export const knownInformationMetadataNames =
|
|
23
|
-
'
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
export const knownInformationMetadataNames = flag(
|
|
25
|
+
'mespapiers.migrated.metadata'
|
|
26
|
+
)
|
|
27
|
+
? ['number', 'country', 'refTaxIncome', 'contractType', 'noticePeriod']
|
|
28
|
+
: [
|
|
29
|
+
'number',
|
|
30
|
+
'cafFileNumber',
|
|
31
|
+
'cardNumber',
|
|
32
|
+
'vinNumber',
|
|
33
|
+
'ibanNumber',
|
|
34
|
+
'country',
|
|
35
|
+
'passportNumber',
|
|
36
|
+
'refTaxIncome',
|
|
37
|
+
'contractType',
|
|
38
|
+
'noticePeriod'
|
|
39
|
+
]
|
|
34
40
|
export const knownOtherMetadataNames = ['contact', 'page', 'qualification']
|
|
35
41
|
|
|
36
42
|
export const getCurrentModel = metadataName => {
|
|
@@ -12,9 +12,6 @@ import {
|
|
|
12
12
|
|
|
13
13
|
const fakeMetadata = {
|
|
14
14
|
number: '111111',
|
|
15
|
-
cardNumber: '222222',
|
|
16
|
-
vinNumber: '333333',
|
|
17
|
-
ibanNumber: '444444',
|
|
18
15
|
AObtentionDate: '2029-12-01T23:00:00.000Z',
|
|
19
16
|
BObtentionDate: '2029-12-02T23:00:00.000Z',
|
|
20
17
|
CObtentionDate: '2029-12-03T23:00:00.000Z',
|
|
@@ -41,9 +38,6 @@ const computedMetadata = [
|
|
|
41
38
|
{ name: 'shootingDate', value: '2029-12-08T23:00:00.000Z' },
|
|
42
39
|
{ name: 'date', value: '2029-12-09T23:00:00.000Z' },
|
|
43
40
|
{ name: 'number', value: '111111' },
|
|
44
|
-
{ name: 'cardNumber', value: '222222' },
|
|
45
|
-
{ name: 'vinNumber', value: '333333' },
|
|
46
|
-
{ name: 'ibanNumber', value: '444444' },
|
|
47
41
|
{ name: 'contact', value: 'Alice Durand' },
|
|
48
42
|
{ name: 'page', value: 'front' },
|
|
49
43
|
{ name: 'qualification', value: 'fake_label' }
|
|
@@ -98,16 +92,16 @@ describe('helpers', () => {
|
|
|
98
92
|
const buildInformationPath = buildEditAttributePath(
|
|
99
93
|
editPathByModelProps,
|
|
100
94
|
'information',
|
|
101
|
-
'
|
|
95
|
+
'number'
|
|
102
96
|
)
|
|
103
97
|
const buildPagePath = buildEditAttributePath(
|
|
104
98
|
editPathByModelProps,
|
|
105
99
|
'page',
|
|
106
|
-
'
|
|
100
|
+
'number'
|
|
107
101
|
)
|
|
108
102
|
|
|
109
103
|
expect(buildInformationPath).toBe(
|
|
110
|
-
'#/paper/edit/information/01?metadata=
|
|
104
|
+
'#/paper/edit/information/01?metadata=number&backgroundPath=$/path'
|
|
111
105
|
)
|
|
112
106
|
expect(buildPagePath).toBe('#/paper/edit/page/01?backgroundPath=/path')
|
|
113
107
|
})
|
|
@@ -126,12 +120,12 @@ describe('helpers', () => {
|
|
|
126
120
|
)
|
|
127
121
|
expect(issueDate).toBe(false)
|
|
128
122
|
})
|
|
129
|
-
it('"
|
|
130
|
-
const
|
|
131
|
-
'
|
|
123
|
+
it('"number" should be an editable attribute', () => {
|
|
124
|
+
const number = isEditableAttribute(
|
|
125
|
+
'number',
|
|
132
126
|
makeFile({ fromConnector: true })
|
|
133
127
|
)
|
|
134
|
-
expect(
|
|
128
|
+
expect(number).toBe(true)
|
|
135
129
|
})
|
|
136
130
|
it('"datetime" should not be an editable attribute', () => {
|
|
137
131
|
const datetime = isEditableAttribute('datetime', makeFile())
|
|
@@ -147,9 +141,9 @@ describe('helpers', () => {
|
|
|
147
141
|
const issueDate = isEditableAttribute('issueDate', makeFile())
|
|
148
142
|
expect(issueDate).toBe(true)
|
|
149
143
|
})
|
|
150
|
-
it('"
|
|
151
|
-
const
|
|
152
|
-
expect(
|
|
144
|
+
it('"number" should be a editable attribute', () => {
|
|
145
|
+
const number = isEditableAttribute('number', makeFile())
|
|
146
|
+
expect(number).toBe(true)
|
|
153
147
|
})
|
|
154
148
|
it('"datetime" should not be an editable attribute', () => {
|
|
155
149
|
const datetime = isEditableAttribute('datetime', makeFile())
|
|
@@ -52,16 +52,35 @@
|
|
|
52
52
|
},
|
|
53
53
|
"information": {
|
|
54
54
|
"title": {
|
|
55
|
+
"caf": {
|
|
56
|
+
"number": "CAF file number"
|
|
57
|
+
},
|
|
58
|
+
"vehicle_registration": {
|
|
59
|
+
"number": "Vehicle registration number (VIN)"
|
|
60
|
+
},
|
|
61
|
+
"national_id_card": {
|
|
62
|
+
"number": "National ID card number"
|
|
63
|
+
},
|
|
64
|
+
"bank_details": {
|
|
65
|
+
"number": "IBAN number"
|
|
66
|
+
},
|
|
67
|
+
"passport": {
|
|
68
|
+
"number": "Passport number"
|
|
69
|
+
},
|
|
70
|
+
"driver_license": {
|
|
71
|
+
"number": "License number"
|
|
72
|
+
},
|
|
73
|
+
"country": "Country of delivery",
|
|
74
|
+
"refTaxIncome": "Reference tax income",
|
|
75
|
+
"contractType": "Contract type",
|
|
76
|
+
"noticePeriod": "Expiration alert",
|
|
77
|
+
|
|
55
78
|
"number": "License number",
|
|
56
79
|
"cafFileNumber": "CAF file number",
|
|
57
80
|
"cardNumber": "National ID card number",
|
|
58
81
|
"vinNumber": "Vehicle registration number (VIN)",
|
|
59
82
|
"ibanNumber": "IBAN number",
|
|
60
|
-
"
|
|
61
|
-
"passportNumber": "Passport number",
|
|
62
|
-
"refTaxIncome": "Reference tax income",
|
|
63
|
-
"contractType": "Contract type",
|
|
64
|
-
"noticePeriod": "Expiration alert"
|
|
83
|
+
"passportNumber": "Passport number"
|
|
65
84
|
},
|
|
66
85
|
"day": "day |||| days"
|
|
67
86
|
},
|
|
@@ -52,16 +52,35 @@
|
|
|
52
52
|
},
|
|
53
53
|
"information": {
|
|
54
54
|
"title": {
|
|
55
|
+
"caf": {
|
|
56
|
+
"number": "Numéro de dossier CAF"
|
|
57
|
+
},
|
|
58
|
+
"vehicle_registration": {
|
|
59
|
+
"number": "Numéro de la carte grise (VIN)"
|
|
60
|
+
},
|
|
61
|
+
"national_id_card": {
|
|
62
|
+
"number": "Numéro de la carte d'identité"
|
|
63
|
+
},
|
|
64
|
+
"bank_details": {
|
|
65
|
+
"number": "Numéro d'IBAN"
|
|
66
|
+
},
|
|
67
|
+
"passport": {
|
|
68
|
+
"number": "Numéro du passeport"
|
|
69
|
+
},
|
|
70
|
+
"driver_license": {
|
|
71
|
+
"number": "Numéro du permis"
|
|
72
|
+
},
|
|
73
|
+
"country": "Pays de délivrance",
|
|
74
|
+
"refTaxIncome": "Revenu fiscal de référence",
|
|
75
|
+
"contractType": "Type de contat",
|
|
76
|
+
"noticePeriod": "Alerte d’expiration",
|
|
77
|
+
|
|
55
78
|
"number": "Numéro du permis",
|
|
56
79
|
"cafFileNumber": "Numéro de dossier CAF",
|
|
57
80
|
"cardNumber": "Numéro de la carte d'identité",
|
|
58
81
|
"vinNumber": "Numéro de la carte grise (VIN)",
|
|
59
82
|
"ibanNumber": "Numéro d'IBAN",
|
|
60
|
-
"
|
|
61
|
-
"passportNumber": "Numéro du passeport",
|
|
62
|
-
"refTaxIncome": "Revenu fiscal de référence",
|
|
63
|
-
"contractType": "Type de contat",
|
|
64
|
-
"noticePeriod": "Alerte d’expiration"
|
|
83
|
+
"passportNumber": "Numéro du passeport"
|
|
65
84
|
},
|
|
66
85
|
"day": "jour |||| jours"
|
|
67
86
|
},
|