react-ui-basics 0.0.202 → 0.0.204
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/AutocompleteSelect.js +1 -1
- package/AutocompleteSelect.js.map +1 -1
- package/DatePicker.d.ts +1 -0
- package/DatePicker.js +8 -2
- package/DatePicker.js.map +1 -1
- package/HttpTools.d.ts +1 -0
- package/HttpTools.js +8 -6
- package/HttpTools.js.map +1 -1
- package/bundle.css +586 -586
- package/package.json +2 -2
- package/src/AutocompleteSelect.js +1 -1
- package/src/DatePicker.tsx +11 -2
- package/src/HttpTools.ts +9 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-ui-basics",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.204",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"_main": "index.cjs.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"build": "./build.sh",
|
|
34
34
|
"postinstall": "",
|
|
35
35
|
"clean": "rm -rf build && mkdir build",
|
|
36
|
-
"dist": "npm
|
|
36
|
+
"dist": "NODE_OPTIONS=--openssl-legacy-provider npm-run-all clean build build-storybook && cd build && npm publish",
|
|
37
37
|
"storybook": "start-storybook -p 9009 -s public",
|
|
38
38
|
"build-storybook": "build-storybook -c .storybook -o docs"
|
|
39
39
|
},
|
|
@@ -79,7 +79,7 @@ class AutocompleteSelect extends PureComponent {
|
|
|
79
79
|
|
|
80
80
|
static propTypes = {
|
|
81
81
|
mode: PropTypes.oneOf([MODE_DEFAULT, MODE_INLINE, MODE_MULTIPLE, MODE_MULTIPLE_AUTO, MODE_MULTIPLE_MINI, MODE_MULTIPLE_MINI_INLINE, MODE_INLINE_MULTIPLE, MODE_MINI]),
|
|
82
|
-
listPortalPosition: PropTypes.oneOf('left', 'right'),
|
|
82
|
+
listPortalPosition: PropTypes.oneOf(['left', 'right']),
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
constructor(props) {
|
package/src/DatePicker.tsx
CHANGED
|
@@ -33,6 +33,7 @@ const DayRenderer = ({day, selected, minDate, onClick}: {
|
|
|
33
33
|
export interface DatePickerProps {
|
|
34
34
|
id?: number | string
|
|
35
35
|
name?: string
|
|
36
|
+
className?: string
|
|
36
37
|
open?: boolean
|
|
37
38
|
onClose?: () => void
|
|
38
39
|
renderInput?: () => JSX.Element
|
|
@@ -139,6 +140,14 @@ class DatePicker extends React.Component<DatePickerProps, DatePickerState> {
|
|
|
139
140
|
return true;
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
if (this.props.className !== nextProps.className) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (this.props.renderInput !== nextProps.renderInput) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
|
|
142
151
|
if (this.state.text !== nextState.text) {
|
|
143
152
|
return true;
|
|
144
153
|
}
|
|
@@ -163,10 +172,10 @@ class DatePicker extends React.Component<DatePickerProps, DatePickerState> {
|
|
|
163
172
|
};
|
|
164
173
|
|
|
165
174
|
render() {
|
|
166
|
-
const {minDate, formatter, parser, dayOfWeekToString, monthToString, renderInput, portal} = this.props;
|
|
175
|
+
const {minDate, formatter, parser, dayOfWeekToString, monthToString, className, renderInput, portal} = this.props;
|
|
167
176
|
const {value, text, focused, selectedMonth, popupStyles} = this.state;
|
|
168
177
|
|
|
169
|
-
let popup = <div className={classNames('calendar', focused && 'focused', portal && 'portal')}
|
|
178
|
+
let popup = <div className={classNames('calendar', focused && 'focused', portal && 'portal', className)}
|
|
170
179
|
ref={ref('popup', this)}
|
|
171
180
|
style={popupStyles}>
|
|
172
181
|
<div className={'row monthSelect'}>
|
package/src/HttpTools.ts
CHANGED
|
@@ -22,6 +22,7 @@ export class FetchOptions {
|
|
|
22
22
|
async?: boolean = true
|
|
23
23
|
withCredentials?: boolean = true
|
|
24
24
|
timeout?: number
|
|
25
|
+
responseType?: "arraybuffer" | "text" | "json" | "blob" | "document" = "json"
|
|
25
26
|
onTimeout?: ((ev: ProgressEvent) => any)
|
|
26
27
|
onSuccess?: ((t: any) => void)
|
|
27
28
|
onError?: ((e: any, status: number) => void)
|
|
@@ -104,21 +105,23 @@ export const fetch = <T>(url, options: FetchOptions = DEFAULT_OPTIONS) => {
|
|
|
104
105
|
request.onprogress = onProgress;
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
request.responseType = options.responseType
|
|
109
|
+
|
|
107
110
|
request.onload = () => {
|
|
108
|
-
const
|
|
111
|
+
const response = request.response;
|
|
109
112
|
const status = request.status;
|
|
110
113
|
if (status >= 200 && status < 400) {
|
|
111
114
|
try {
|
|
112
|
-
orNoop(success)(
|
|
115
|
+
orNoop(success)(response);
|
|
113
116
|
} catch (e) {
|
|
114
|
-
const message = `Unexpected exception while processing response for ${method} ${url}, status: ${status}, response: '${
|
|
117
|
+
const message = `Unexpected exception while processing response for ${method} ${url}, status: ${status}, response: '${response}', exception:`;
|
|
115
118
|
console.log(message, e)
|
|
116
|
-
onError(new FetchError(message, status,
|
|
119
|
+
onError(new FetchError(message, status, response))
|
|
117
120
|
}
|
|
118
121
|
} else {
|
|
119
|
-
const message = `Not ok response for ${method} ${url}, status: ${status}, response: '${
|
|
122
|
+
const message = `Not ok response for ${method} ${url}, status: ${status}, response: '${response}'`;
|
|
120
123
|
console.log(message);
|
|
121
|
-
onError(new FetchError(message, status,
|
|
124
|
+
onError(new FetchError(message, status, response))
|
|
122
125
|
}
|
|
123
126
|
};
|
|
124
127
|
|