cozy-ui 128.0.0 → 128.2.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 +1 -1
- package/react/ActionsMenu/Actions/viewInDrive.js +2 -1
- package/react/AppTitle/Readme.md +0 -1
- package/react/Contacts/Header/Readme.md +1 -1
- package/react/DatePicker/Readme.md +85 -76
- package/react/Popup/index.jsx +1 -25
- package/react/Popup/index.spec.jsx +0 -75
- package/react/SelectBox/SelectBox.jsx +1 -11
- package/transpiled/react/ActionsMenu/Actions/viewInDrive.js +2 -1
- package/transpiled/react/Popup/index.d.ts +0 -2
- package/transpiled/react/Popup/index.js +1 -26
- package/transpiled/react/SelectBox/SelectBox.js +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [128.2.0](https://github.com/cozy/cozy-ui/compare/v128.1.0...v128.2.0) (2025-09-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Adjust view in drive to adapt shared drive :sparkles: ([dcf0204](https://github.com/cozy/cozy-ui/commit/dcf0204))
|
|
7
|
+
|
|
8
|
+
# [128.1.0](https://github.com/cozy/cozy-ui/compare/v128.0.0...v128.1.0) (2025-09-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Remove useless Cordova behavior ([ff7490f](https://github.com/cozy/cozy-ui/commit/ff7490f))
|
|
14
|
+
|
|
1
15
|
# [128.0.0](https://github.com/cozy/cozy-ui/compare/v127.17.0...v128.0.0) (2025-09-02)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -38,12 +38,13 @@ export const viewInDrive = () => {
|
|
|
38
38
|
Component: makeComponent(label, icon),
|
|
39
39
|
action: (docs, { client }) => {
|
|
40
40
|
const dirId = docs[0].dir_id
|
|
41
|
+
const driveId = docs[0].driveId
|
|
41
42
|
const webLink = generateWebLink({
|
|
42
43
|
slug: 'drive',
|
|
43
44
|
cozyUrl: client.getStackClient().uri,
|
|
44
45
|
subDomainType: client.getInstanceOptions().subdomain,
|
|
45
46
|
pathname: '/',
|
|
46
|
-
hash: `folder/${dirId}`
|
|
47
|
+
hash: driveId ? `shareddrive/${driveId}/${dirId}` : `folder/${dirId}`
|
|
47
48
|
})
|
|
48
49
|
|
|
49
50
|
window.open(webLink, '_blank')
|
package/react/AppTitle/Readme.md
CHANGED
|
@@ -109,99 +109,108 @@ Any prop not recognized by the pickers and their sub-components are passed down
|
|
|
109
109
|
|
|
110
110
|
#### **Date Picker**
|
|
111
111
|
|
|
112
|
-
|name|type|default|description|
|
|
113
|
-
|
|
114
|
-
|onChange|(date: DateIOType) => void
|
|
115
|
-
|value|Date
|
|
116
|
-
|allowKeyboardControl|Boolean|true|Enables keyboard listener for moving between days in calendar|
|
|
117
|
-
|autoOk|Boolean|false|Auto accept date on selection|
|
|
118
|
-
|disabled|Boolean
|
|
119
|
-
|disableFuture|Boolean|false|Disable future dates|
|
|
120
|
-
|disablePast|boolean|false|Disable past dates|
|
|
121
|
-
|disableToolbar|boolean|false|Hide toolbar and show only date/time views|
|
|
122
|
-
|emptyLabel|string|""|Message displaying in text field, if null passed (doesn't work in keyboard mode)|
|
|
123
|
-
|format|string
|
|
124
|
-
|initialFocusedDate|Date
|
|
125
|
-
|inputVariant|"standard" \| "outlined" \| "filled"
|
|
126
|
-
|invalidDateMessage|ReactNode|"Invalid Date Format"|Message, appearing when date cannot be parsed|
|
|
127
|
-
|invalidLabel|string|"unknown"|Message displaying in text field if date is invalid (doesn't work in keyboard mode)|
|
|
128
|
-
|labelFunc|(date: DateIOType, invalidLabel: string) => string
|
|
129
|
-
|leftArrowButtonProps|Partial<IconButtonProps
|
|
130
|
-
|leftArrowIcon|ReactNode
|
|
131
|
-
|loadingIndicator|Element
|
|
132
|
-
|maxDate|Date|Date(2100-01-01)|Max selectable date|
|
|
133
|
-
|maxDateMessage|ReactNode|"Date should not be after maximal date"|Error message, shown if date is more then maximal date|
|
|
134
|
-
|minDate|Date|Date(1900-01-01)|Min selectable date|
|
|
135
|
-
|minDateMessage|ReactNode|"Date should not be before minimal date"|Error message, shown if date is less then minimal date|
|
|
136
|
-
|onAccept|(date: DateIOType) => void
|
|
137
|
-
|onClose|() => void
|
|
138
|
-
|onError|(error: ReactNode, value: DateIOType) => void
|
|
139
|
-
|onMonthChange|(date: DateIOType) => void \| Promise<void
|
|
140
|
-
|onOpen|Date
|
|
141
|
-
|onYearChange|Date
|
|
142
|
-
|open|boolean
|
|
143
|
-
|openTo|"date" \| "year" \| "month"
|
|
144
|
-
|orientation|"portrait" \| "landscape"|"portrait"|Force rendering in particular orientation|
|
|
145
|
-
|PopoverProps|Partial<PopoverProps
|
|
146
|
-
|readOnly|boolean
|
|
147
|
-
|renderDay|(day: DateIOType, selectedDate: DateIOType, dayInCurrentMonth: boolean, dayComponent: Element) => Element
|
|
148
|
-
|rightArrowButtonProps|Partial<IconButtonProps
|
|
149
|
-
|rightArrowIcon|ReactNode
|
|
150
|
-
|shouldDisableDate|(day: DateIOType) => boolean
|
|
151
|
-
|strictCompareDates|boolean|false|Compare dates by the exact timestamp, instead of start/end of date|
|
|
152
|
-
|TextFieldComponent|FunctionComponent<TextFieldProps
|
|
153
|
-
|ToolbarComponent|FunctionComponent<ToolbarComponentProps
|
|
154
|
-
|variant|"dialog" \| "inline" \| "static"|'dialog'|Picker container option|
|
|
155
|
-
|views|Array
|
|
156
|
-
|
|
112
|
+
| name | type | default | description |
|
|
113
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
114
|
+
| onChange | (date: DateIOType) => void | | onChange callback |
|
|
115
|
+
| value | Date | | Picker value |
|
|
116
|
+
| allowKeyboardControl | Boolean | true | Enables keyboard listener for moving between days in calendar |
|
|
117
|
+
| autoOk | Boolean | false | Auto accept date on selection |
|
|
118
|
+
| disabled | Boolean | | Disable picker and text field |
|
|
119
|
+
| disableFuture | Boolean | false | Disable future dates |
|
|
120
|
+
| disablePast | boolean | false | Disable past dates |
|
|
121
|
+
| disableToolbar | boolean | false | Hide toolbar and show only date/time views |
|
|
122
|
+
| emptyLabel | string | "" | Message displaying in text field, if null passed (doesn't work in keyboard mode) |
|
|
123
|
+
| format | string | | Format string |
|
|
124
|
+
| initialFocusedDate | Date | | Date that will be initially highlighted if null was passed |
|
|
125
|
+
| inputVariant | "standard" \| "outlined" \| "filled" | | Pass material-ui text field variant down, bypass internal variant prop |
|
|
126
|
+
| invalidDateMessage | ReactNode | "Invalid Date Format" | Message, appearing when date cannot be parsed |
|
|
127
|
+
| invalidLabel | string | "unknown" | Message displaying in text field if date is invalid (doesn't work in keyboard mode) |
|
|
128
|
+
| labelFunc | (date: DateIOType, invalidLabel: string) => string | | Dynamic formatter of text field value |
|
|
129
|
+
| leftArrowButtonProps | Partial<IconButtonProps> | | Props to pass to left arrow button |
|
|
130
|
+
| leftArrowIcon | ReactNode | | Left arrow icon |
|
|
131
|
+
| loadingIndicator | Element | | Custom loading indicator |
|
|
132
|
+
| maxDate | Date | Date(2100-01-01) | Max selectable date |
|
|
133
|
+
| maxDateMessage | ReactNode | "Date should not be after maximal date" | Error message, shown if date is more then maximal date |
|
|
134
|
+
| minDate | Date | Date(1900-01-01) | Min selectable date |
|
|
135
|
+
| minDateMessage | ReactNode | "Date should not be before minimal date" | Error message, shown if date is less then minimal date |
|
|
136
|
+
| onAccept | (date: DateIOType) => void | | Callback fired when date is accepted |
|
|
137
|
+
| onClose | () => void | | On close callback |
|
|
138
|
+
| onError | (error: ReactNode, value: DateIOType) => void | | Callback fired when new error should be displayed (!! This is a side effect. Be careful if you want to rerender the component) |
|
|
139
|
+
| onMonthChange | (date: DateIOType) => void \| Promise<void> | | Callback firing on month change. Return promise to render spinner till it will not be resolved |
|
|
140
|
+
| onOpen | Date | | On open callback |
|
|
141
|
+
| onYearChange | Date | | Callback firing on year change |
|
|
142
|
+
| open | boolean | | Controlled picker open state |
|
|
143
|
+
| openTo | "date" \| "year" \| "month" | | First view to show in DatePicker |
|
|
144
|
+
| orientation | "portrait" \| "landscape" | "portrait" | Force rendering in particular orientation |
|
|
145
|
+
| PopoverProps | Partial<PopoverProps> | | Popover props passed to material-ui Popover (with variant="inline") |
|
|
146
|
+
| readOnly | boolean | | Make picker read only |
|
|
147
|
+
| renderDay | (day: DateIOType, selectedDate: DateIOType, dayInCurrentMonth: boolean, dayComponent: Element) => Element | | Custom renderer for day |
|
|
148
|
+
| rightArrowButtonProps | Partial<IconButtonProps> | | Props to pass to right arrow button |
|
|
149
|
+
| rightArrowIcon | ReactNode | | Right arrow icon |
|
|
150
|
+
| shouldDisableDate | (day: DateIOType) => boolean | | Disable specific date |
|
|
151
|
+
| strictCompareDates | boolean | false | Compare dates by the exact timestamp, instead of start/end of date |
|
|
152
|
+
| TextFieldComponent | FunctionComponent<TextFieldProps> | | Override input component |
|
|
153
|
+
| ToolbarComponent | FunctionComponent<ToolbarComponentProps> | | Component that will replace default toolbar renderer |
|
|
154
|
+
| variant | "dialog" \| "inline" \| "static" | 'dialog' | Picker container option |
|
|
155
|
+
| views | Array<"year" \| "date" \| "month"> | | Array of views to show |
|
|
156
|
+
|
|
157
|
+
* * *
|
|
158
|
+
|
|
157
159
|
<br>
|
|
158
160
|
|
|
159
161
|
#### **Keyboard Date Picker**
|
|
160
162
|
|
|
161
163
|
Additional props for keyboard date picker
|
|
162
164
|
|
|
163
|
-
|name|type|default|description|
|
|
164
|
-
|
|
165
|
-
|onChange|(date: DateIOType, isValid: boolean) => void
|
|
166
|
-
|InputAdornmentProps|Partial<InputAdornmentProps
|
|
167
|
-
|inputValue|string
|
|
168
|
-
|KeyboardButtonProps|Partial<IconButtonProps
|
|
169
|
-
|keyboardIcon|ReactNode
|
|
170
|
-
|mask|string
|
|
171
|
-
|maskChar|string|"_"|Char string that will be replaced with number (for "_" mask will be "
|
|
172
|
-
|refuse|RegExp
|
|
173
|
-
|rifmFormatter|(str: string) => string
|
|
174
|
-
|
|
165
|
+
| name | type | default | description |
|
|
166
|
+
| ------------------- | -------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
|
|
167
|
+
| onChange | (date: DateIOType, isValid: boolean) => void | | Keyboard onChange callback, that returns the value of the input when it changes and if it is a valid Date |
|
|
168
|
+
| InputAdornmentProps | Partial<InputAdornmentProps> | | Props to pass to keyboard input adornment |
|
|
169
|
+
| inputValue | string | | String value for controlling value with pure input string. Overrides value prop |
|
|
170
|
+
| KeyboardButtonProps | Partial<IconButtonProps> | | Props to pass to keyboard adornment button |
|
|
171
|
+
| keyboardIcon | ReactNode | | Icon displaying for open picker button |
|
|
172
|
+
| mask | string | | Custom mask. Can be used to override generate from format. (e.g. **/**/\_**\_ **:\_\_) |
|
|
173
|
+
| maskChar | string | "\_" | Char string that will be replaced with number (for "\_" mask will be "**/**/\_\_\_\_") |
|
|
174
|
+
| refuse | RegExp | /\[^\\d]+/gi | Refuse values regexp |
|
|
175
|
+
| rifmFormatter | (str: string) => string | | Custom formatter to be passed into Rifm component |
|
|
176
|
+
|
|
177
|
+
* * *
|
|
178
|
+
|
|
175
179
|
<br>
|
|
176
180
|
|
|
177
181
|
#### **DateTime & Time Picker**
|
|
178
182
|
|
|
179
183
|
Additional props for time date picker
|
|
180
184
|
|
|
181
|
-
|name|type|default|description|
|
|
182
|
-
|
|
183
|
-
|ampm|boolean
|
|
184
|
-
|
|
185
|
+
| name | type | default | description |
|
|
186
|
+
| ---- | ------- | ------- | ------------------------------------- |
|
|
187
|
+
| ampm | boolean | | 12h/24h view for hour selection clock |
|
|
188
|
+
|
|
189
|
+
* * *
|
|
190
|
+
|
|
185
191
|
<br>
|
|
186
192
|
|
|
187
193
|
### Modal Wrapper
|
|
188
194
|
|
|
189
|
-
|name|type|default|description|
|
|
190
|
-
|
|
191
|
-
|cancelLabel|ReactNode|"Cancel"|"CANCEL" label message|
|
|
192
|
-
|clearable|boolean
|
|
193
|
-
|clearLabel|ReactNode|"Clear"|"Clear" label message|
|
|
194
|
-
|DialogProps|Partial<MuiDialogProps
|
|
195
|
-
|okLabel|ReactNode|"OK"|"OK" label message|
|
|
196
|
-
|showTodayButton|boolean
|
|
197
|
-
|todayLabel|ReactNode|"TODAY"|"TODAY" label message|
|
|
198
|
-
|
|
195
|
+
| name | type | default | description |
|
|
196
|
+
| --------------- | ----------------------- | -------- | --------------------------------------------------------------------------------------- |
|
|
197
|
+
| cancelLabel | ReactNode | "Cancel" | "CANCEL" label message |
|
|
198
|
+
| clearable | boolean | | Show clear action in picker dialog |
|
|
199
|
+
| clearLabel | ReactNode | "Clear" | "Clear" label message |
|
|
200
|
+
| DialogProps | Partial<MuiDialogProps> | | Props to be passed directly to material-ui Dialog |
|
|
201
|
+
| okLabel | ReactNode | "OK" | "OK" label message |
|
|
202
|
+
| showTodayButton | boolean | | If true today button will be displayed. **Note:** that clear button has higher priority |
|
|
203
|
+
| todayLabel | ReactNode | "TODAY" | "TODAY" label message |
|
|
204
|
+
|
|
205
|
+
* * *
|
|
206
|
+
|
|
199
207
|
<br>
|
|
200
208
|
|
|
201
209
|
### Additional props
|
|
202
210
|
|
|
203
|
-
|name|type|default|description|
|
|
204
|
-
|
|
205
|
-
|enableKeyboard|boolean
|
|
206
|
-
|mode|"date" \| "time" \| "dateTime"|"date"|Picker mode|
|
|
207
|
-
|
|
211
|
+
| name | type | default | description |
|
|
212
|
+
| -------------- | ------------------------------ | ------- | ------------------------------- |
|
|
213
|
+
| enableKeyboard | boolean | | Enable the keyboard date picker |
|
|
214
|
+
| mode | "date" \| "time" \| "dateTime" | "date" | Picker mode |
|
|
215
|
+
|
|
216
|
+
* * *
|
package/react/Popup/index.jsx
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
import { PureComponent } from 'react'
|
|
3
3
|
|
|
4
|
-
import { isMobileApp } from 'cozy-device-helper'
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
5
|
* Customized function to get dimensions and position for a centered
|
|
8
6
|
* popup window
|
|
@@ -43,7 +41,6 @@ export class Popup extends PureComponent {
|
|
|
43
41
|
|
|
44
42
|
this.handleClose = this.handleClose.bind(this)
|
|
45
43
|
this.handleMessage = this.handleMessage.bind(this)
|
|
46
|
-
this.handleLoadStart = this.handleLoadStart.bind(this)
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
componentDidMount() {
|
|
@@ -57,11 +54,6 @@ export class Popup extends PureComponent {
|
|
|
57
54
|
addListeners() {
|
|
58
55
|
// Listen here for message FROM popup
|
|
59
56
|
window.addEventListener('message', this.handleMessage)
|
|
60
|
-
|
|
61
|
-
if (isMobileApp()) {
|
|
62
|
-
this.popup.addEventListener('loadstart', this.handleLoadStart)
|
|
63
|
-
this.popup.addEventListener('exit', this.handleClose)
|
|
64
|
-
}
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
removeListeners() {
|
|
@@ -69,11 +61,6 @@ export class Popup extends PureComponent {
|
|
|
69
61
|
|
|
70
62
|
// rest of instructions only if popup is still opened
|
|
71
63
|
if (this.popup.closed) return
|
|
72
|
-
|
|
73
|
-
if (isMobileApp()) {
|
|
74
|
-
this.popup.removeEventListener('loadstart', this.handleLoadStart)
|
|
75
|
-
this.popup.removeEventListener('exit', this.handleClose)
|
|
76
|
-
}
|
|
77
64
|
}
|
|
78
65
|
|
|
79
66
|
handleMessage(messageEvent) {
|
|
@@ -137,12 +124,6 @@ export class Popup extends PureComponent {
|
|
|
137
124
|
clearInterval(this.checkClosedInterval)
|
|
138
125
|
}
|
|
139
126
|
|
|
140
|
-
handleLoadStart(event) {
|
|
141
|
-
const { url } = event
|
|
142
|
-
const { onMobileUrlChange } = this.props
|
|
143
|
-
if (typeof onMobileUrlChange === 'function') onMobileUrlChange(new URL(url))
|
|
144
|
-
}
|
|
145
|
-
|
|
146
127
|
render() {
|
|
147
128
|
return null
|
|
148
129
|
}
|
|
@@ -163,12 +144,7 @@ Popup.propTypes = {
|
|
|
163
144
|
* Handler called when a message is received from `postMessage` interface.
|
|
164
145
|
* @param {MessageEvent} messageEvent Received MessageEvent object.
|
|
165
146
|
*/
|
|
166
|
-
onMessage: PropTypes.func
|
|
167
|
-
/**
|
|
168
|
-
* Handler used on mobile device to detect url changes
|
|
169
|
-
* @param {URL} url URL object.
|
|
170
|
-
*/
|
|
171
|
-
onMobileUrlChange: PropTypes.func
|
|
147
|
+
onMessage: PropTypes.func
|
|
172
148
|
}
|
|
173
149
|
|
|
174
150
|
Popup.defaultProps = {
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { render, fireEvent } from '@testing-library/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
-
import { isMobileApp } from 'cozy-device-helper'
|
|
5
|
-
|
|
6
4
|
import { Popup } from '.'
|
|
7
5
|
|
|
8
|
-
jest.mock('cozy-device-helper', () => ({
|
|
9
|
-
...jest.requireActual('cozy-device-helper'),
|
|
10
|
-
isMobileApp: jest.fn()
|
|
11
|
-
}))
|
|
12
|
-
|
|
13
6
|
const props = {
|
|
14
7
|
initialUrl: 'http://example.org',
|
|
15
8
|
title: 'Test title',
|
|
@@ -24,25 +17,10 @@ class MessageEventMock extends Event {
|
|
|
24
17
|
}
|
|
25
18
|
}
|
|
26
19
|
|
|
27
|
-
class LoadStartEventMock extends Event {
|
|
28
|
-
constructor(url) {
|
|
29
|
-
super('loadstart')
|
|
30
|
-
this.url = url
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
class ExitEventMock extends Event {
|
|
35
|
-
constructor() {
|
|
36
|
-
super('exit')
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
20
|
describe('Popup', () => {
|
|
41
21
|
const setup = ({ mockAddEventListener = true }) => {
|
|
42
22
|
const popupMock = new EventTarget()
|
|
43
23
|
|
|
44
|
-
isMobileApp.mockReturnValue(false)
|
|
45
|
-
|
|
46
24
|
jest.spyOn(global, 'open').mockReturnValue(popupMock)
|
|
47
25
|
jest.spyOn(global, 'addEventListener')
|
|
48
26
|
|
|
@@ -71,7 +49,6 @@ describe('Popup', () => {
|
|
|
71
49
|
|
|
72
50
|
afterEach(() => {
|
|
73
51
|
jest.clearAllMocks()
|
|
74
|
-
isMobileApp.mockRestore()
|
|
75
52
|
})
|
|
76
53
|
|
|
77
54
|
it('should open new window', () => {
|
|
@@ -98,44 +75,11 @@ describe('Popup', () => {
|
|
|
98
75
|
)
|
|
99
76
|
})
|
|
100
77
|
|
|
101
|
-
it('should subcribe to mobile events', () => {
|
|
102
|
-
const popupMock = setup({})
|
|
103
|
-
isMobileApp.mockReturnValue(true)
|
|
104
|
-
|
|
105
|
-
render(<Popup {...props} />)
|
|
106
|
-
|
|
107
|
-
expect(popupMock.addEventListener).toHaveBeenCalledWith(
|
|
108
|
-
'loadstart',
|
|
109
|
-
expect.any(Function)
|
|
110
|
-
)
|
|
111
|
-
expect(popupMock.addEventListener).toHaveBeenCalledWith(
|
|
112
|
-
'exit',
|
|
113
|
-
expect.any(Function)
|
|
114
|
-
)
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
describe('handleClose', () => {
|
|
118
|
-
it('should call onClose', () => {
|
|
119
|
-
const popupMock = setup({
|
|
120
|
-
mockAddEventListener: false
|
|
121
|
-
})
|
|
122
|
-
isMobileApp.mockReturnValue(true)
|
|
123
|
-
|
|
124
|
-
render(<Popup {...props} />)
|
|
125
|
-
|
|
126
|
-
const messageEvent = new ExitEventMock()
|
|
127
|
-
fireEvent(popupMock, messageEvent)
|
|
128
|
-
|
|
129
|
-
expect(props.onClose).toHaveBeenCalled()
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
|
|
133
78
|
describe('handleMessage', () => {
|
|
134
79
|
it('should call onMessage', () => {
|
|
135
80
|
const popupMock = setup({
|
|
136
81
|
mockAddEventListener: false
|
|
137
82
|
})
|
|
138
|
-
isMobileApp.mockReturnValue(true)
|
|
139
83
|
|
|
140
84
|
render(<Popup {...props} />)
|
|
141
85
|
|
|
@@ -149,7 +93,6 @@ describe('Popup', () => {
|
|
|
149
93
|
setup({
|
|
150
94
|
mockAddEventListener: false
|
|
151
95
|
})
|
|
152
|
-
isMobileApp.mockReturnValue(true)
|
|
153
96
|
|
|
154
97
|
render(<Popup {...props} />)
|
|
155
98
|
|
|
@@ -159,22 +102,4 @@ describe('Popup', () => {
|
|
|
159
102
|
expect(props.onMessage).not.toHaveBeenCalled()
|
|
160
103
|
})
|
|
161
104
|
})
|
|
162
|
-
|
|
163
|
-
describe('handleLoadStart', () => {
|
|
164
|
-
it('should call onMobileUrlChange', () => {
|
|
165
|
-
const popupMock = setup({
|
|
166
|
-
mockAddEventListener: false
|
|
167
|
-
})
|
|
168
|
-
isMobileApp.mockReturnValue(true)
|
|
169
|
-
|
|
170
|
-
render(<Popup {...props} />)
|
|
171
|
-
|
|
172
|
-
const url = 'https://cozy.io'
|
|
173
|
-
const messageEvent = new LoadStartEventMock(url)
|
|
174
|
-
fireEvent(popupMock, messageEvent)
|
|
175
|
-
|
|
176
|
-
expect(props.onMobileUrlChange).toHaveBeenCalledWith(expect.any(URL))
|
|
177
|
-
expect(props.onMobileUrlChange).toHaveBeenCalledWith(new URL(url))
|
|
178
|
-
})
|
|
179
|
-
})
|
|
180
105
|
})
|
|
@@ -3,8 +3,6 @@ import PropTypes from 'prop-types'
|
|
|
3
3
|
import React, { Component } from 'react'
|
|
4
4
|
import ReactSelect, { components } from 'react-select'
|
|
5
5
|
|
|
6
|
-
import { isIOSApp } from 'cozy-device-helper'
|
|
7
|
-
|
|
8
6
|
import ControlDefault from './ControlDefault'
|
|
9
7
|
import styles from './styles.styl'
|
|
10
8
|
import Icon from '../Icon'
|
|
@@ -332,15 +330,7 @@ class SelectBox extends Component {
|
|
|
332
330
|
// react-select temporarily adds className to its innerComponents
|
|
333
331
|
// but this behavior will soon be removed. For the moment, we
|
|
334
332
|
// cancel it by setting it to empty string
|
|
335
|
-
|
|
336
|
-
// the click and catch the event.
|
|
337
|
-
classNamePrefix={
|
|
338
|
-
isIOSApp()
|
|
339
|
-
? `needsclick ${classNamePrefix ? classNamePrefix : ''}`
|
|
340
|
-
: classNamePrefix
|
|
341
|
-
? classNamePrefix
|
|
342
|
-
: ''
|
|
343
|
-
}
|
|
333
|
+
classNamePrefix={classNamePrefix ? classNamePrefix : ''}
|
|
344
334
|
selectProps={{ name }}
|
|
345
335
|
/>
|
|
346
336
|
)
|
|
@@ -36,12 +36,13 @@ export var viewInDrive = function viewInDrive() {
|
|
|
36
36
|
action: function action(docs, _ref) {
|
|
37
37
|
var client = _ref.client;
|
|
38
38
|
var dirId = docs[0].dir_id;
|
|
39
|
+
var driveId = docs[0].driveId;
|
|
39
40
|
var webLink = generateWebLink({
|
|
40
41
|
slug: 'drive',
|
|
41
42
|
cozyUrl: client.getStackClient().uri,
|
|
42
43
|
subDomainType: client.getInstanceOptions().subdomain,
|
|
43
44
|
pathname: '/',
|
|
44
|
-
hash: "folder/".concat(dirId)
|
|
45
|
+
hash: driveId ? "shareddrive/".concat(driveId, "/").concat(dirId) : "folder/".concat(dirId)
|
|
45
46
|
});
|
|
46
47
|
window.open(webLink, '_blank');
|
|
47
48
|
}
|
|
@@ -18,7 +18,6 @@ export class Popup extends PureComponent<any, any, any> {
|
|
|
18
18
|
constructor(props: any, context: any);
|
|
19
19
|
handleClose(): void;
|
|
20
20
|
handleMessage(messageEvent: any): void;
|
|
21
|
-
handleLoadStart(event: any): void;
|
|
22
21
|
componentDidMount(): void;
|
|
23
22
|
componentWillUnmount(): void;
|
|
24
23
|
addListeners(): void;
|
|
@@ -50,7 +49,6 @@ export namespace Popup {
|
|
|
50
49
|
const initialUrl: PropTypes.Validator<string>;
|
|
51
50
|
const onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
51
|
const onMessage: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
-
const onMobileUrlChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
52
|
}
|
|
55
53
|
namespace defaultProps {
|
|
56
54
|
const title_1: string;
|
|
@@ -11,7 +11,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
11
|
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
import { PureComponent } from 'react';
|
|
14
|
-
import { isMobileApp } from 'cozy-device-helper';
|
|
15
14
|
/**
|
|
16
15
|
* Customized function to get dimensions and position for a centered
|
|
17
16
|
* popup window
|
|
@@ -57,7 +56,6 @@ export var Popup = /*#__PURE__*/function (_PureComponent) {
|
|
|
57
56
|
_this = _super.call(this, props, context);
|
|
58
57
|
_this.handleClose = _this.handleClose.bind(_assertThisInitialized(_this));
|
|
59
58
|
_this.handleMessage = _this.handleMessage.bind(_assertThisInitialized(_this));
|
|
60
|
-
_this.handleLoadStart = _this.handleLoadStart.bind(_assertThisInitialized(_this));
|
|
61
59
|
return _this;
|
|
62
60
|
}
|
|
63
61
|
|
|
@@ -76,11 +74,6 @@ export var Popup = /*#__PURE__*/function (_PureComponent) {
|
|
|
76
74
|
value: function addListeners() {
|
|
77
75
|
// Listen here for message FROM popup
|
|
78
76
|
window.addEventListener('message', this.handleMessage);
|
|
79
|
-
|
|
80
|
-
if (isMobileApp()) {
|
|
81
|
-
this.popup.addEventListener('loadstart', this.handleLoadStart);
|
|
82
|
-
this.popup.addEventListener('exit', this.handleClose);
|
|
83
|
-
}
|
|
84
77
|
}
|
|
85
78
|
}, {
|
|
86
79
|
key: "removeListeners",
|
|
@@ -88,11 +81,6 @@ export var Popup = /*#__PURE__*/function (_PureComponent) {
|
|
|
88
81
|
window.removeEventListener('message', this.handleMessage); // rest of instructions only if popup is still opened
|
|
89
82
|
|
|
90
83
|
if (this.popup.closed) return;
|
|
91
|
-
|
|
92
|
-
if (isMobileApp()) {
|
|
93
|
-
this.popup.removeEventListener('loadstart', this.handleLoadStart);
|
|
94
|
-
this.popup.removeEventListener('exit', this.handleClose);
|
|
95
|
-
}
|
|
96
84
|
}
|
|
97
85
|
}, {
|
|
98
86
|
key: "handleMessage",
|
|
@@ -173,13 +161,6 @@ export var Popup = /*#__PURE__*/function (_PureComponent) {
|
|
|
173
161
|
value: function stopMonitoringClosing() {
|
|
174
162
|
clearInterval(this.checkClosedInterval);
|
|
175
163
|
}
|
|
176
|
-
}, {
|
|
177
|
-
key: "handleLoadStart",
|
|
178
|
-
value: function handleLoadStart(event) {
|
|
179
|
-
var url = event.url;
|
|
180
|
-
var onMobileUrlChange = this.props.onMobileUrlChange;
|
|
181
|
-
if (typeof onMobileUrlChange === 'function') onMobileUrlChange(new URL(url));
|
|
182
|
-
}
|
|
183
164
|
}, {
|
|
184
165
|
key: "render",
|
|
185
166
|
value: function render() {
|
|
@@ -206,13 +187,7 @@ Popup.propTypes = {
|
|
|
206
187
|
* Handler called when a message is received from `postMessage` interface.
|
|
207
188
|
* @param {MessageEvent} messageEvent Received MessageEvent object.
|
|
208
189
|
*/
|
|
209
|
-
onMessage: PropTypes.func
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Handler used on mobile device to detect url changes
|
|
213
|
-
* @param {URL} url URL object.
|
|
214
|
-
*/
|
|
215
|
-
onMobileUrlChange: PropTypes.func
|
|
190
|
+
onMessage: PropTypes.func
|
|
216
191
|
};
|
|
217
192
|
Popup.defaultProps = {
|
|
218
193
|
title: ''
|
|
@@ -22,7 +22,6 @@ import classNames from 'classnames';
|
|
|
22
22
|
import PropTypes from 'prop-types';
|
|
23
23
|
import React, { Component } from 'react';
|
|
24
24
|
import ReactSelect, { components } from 'react-select';
|
|
25
|
-
import { isIOSApp } from 'cozy-device-helper';
|
|
26
25
|
import ControlDefault from "cozy-ui/transpiled/react/SelectBox/ControlDefault";
|
|
27
26
|
var styles = {
|
|
28
27
|
"select--disabled": "styles__select--disabled___1W3en",
|
|
@@ -353,10 +352,8 @@ var SelectBox = /*#__PURE__*/function (_Component) {
|
|
|
353
352
|
className: classNames((_classNames2 = {}, _defineProperty(_classNames2, styles['select__overlay'], showOverlay), _defineProperty(_classNames2, styles['select--autowidth'], !fullwidth), _defineProperty(_classNames2, styles['select--disabled'], disabled), _defineProperty(_classNames2, styles['select--fullwidth'], fullwidth), _classNames2), className) // react-select temporarily adds className to its innerComponents
|
|
354
353
|
// but this behavior will soon be removed. For the moment, we
|
|
355
354
|
// cancel it by setting it to empty string
|
|
356
|
-
// needsclick is added only on iOS App since fastclik tries to handle
|
|
357
|
-
// the click and catch the event.
|
|
358
355
|
,
|
|
359
|
-
classNamePrefix:
|
|
356
|
+
classNamePrefix: classNamePrefix ? classNamePrefix : '',
|
|
360
357
|
selectProps: {
|
|
361
358
|
name: name
|
|
362
359
|
}
|