Skip to content

Commit 4941c12

Browse files
Merge branch 'master' into feature/updateGallery
2 parents 5181bc5 + 99ad9ac commit 4941c12

File tree

13 files changed

+63
-39
lines changed

13 files changed

+63
-39
lines changed

examples/react-chayns-scrollview/Example.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ export default class Example extends Component {
4141
}}
4242
showScrollbar
4343
>
44-
{'Test'}
45-
<br />
4644
{'Not scrollable'}
45+
<br />
46+
{'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirm'}
4747
</ScrollView>
4848
</ExampleContainer>
4949
);

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chayns-components",
3-
"version": "2.8.1",
3+
"version": "2.9.0",
44
"description": "Some react components for chayns®",
55
"main": "dist/index.js",
66
"module": "dist/index.es.js",

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
}[env],
1818
format: env
1919
},
20-
external: ['react', 'classnames', 'prop-types', 'ract-dom', 'react-transition-group', 'emojione'],
20+
external: ['react', 'classnames', 'prop-types', 'react-dom', 'react-transition-group', 'emojione'],
2121
plugins: [
2222
external(),
2323
autoExternal(),

src/react-chayns-accordion/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ The following properties can be set
4343
| onOpen | onOpened-Event | Function | |
4444
| onClose | onClose-Event | Function | |
4545
| ellipsis | Cuts the accordion headline if it is too long | bool | |
46+
| open | The accordion is open | bool | |
4647
| defaultOpened| The accordion is default opened | bool | |
4748
| autogrow | The accordion will adjust its height when opened | bool | false |
4849
| reference | A reference for the accordion | Function | |

src/react-chayns-calendar/component/Calendar.jsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ import areDatesEqual from '../utils/areDatesEqual';
99

1010
const TODAY = new Date();
1111
const TRANSITION_TIME = 300;
12-
const MONTH_NAMES = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
12+
const MONTH_NAMES = {
13+
de: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
14+
en: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
15+
};
16+
17+
function getMonthNames(language = chayns.env.language) {
18+
return MONTH_NAMES[language] || MONTH_NAMES.de;
19+
}
1320

1421
export default class Calendar extends Component {
1522
static propTypes = {
@@ -68,29 +75,31 @@ export default class Calendar extends Component {
6875
const _rightShown = new Date(_focus.getFullYear(), _focus.getMonth() + 1, 1);
6976
const _rightHidden = new Date(_focus.getFullYear(), _focus.getMonth() + 2, 1);
7077

78+
const monthNames = getMonthNames();
79+
7180
this.setState({
7281
focus: _focus,
7382
months: [
7483
{
75-
title: MONTH_NAMES[_leftHidden.getMonth()],
84+
title: monthNames[_leftHidden.getMonth()],
7685
className: 'left__hidden month',
7786
startDate: _leftHidden,
7887
endDate: new Date(_leftHidden.getFullYear(), _leftHidden.getMonth() + 1, 0)
7988
},
8089
{
81-
title: MONTH_NAMES[_focus.getMonth()],
90+
title: monthNames[_focus.getMonth()],
8291
className: 'left__shown month',
8392
startDate: new Date(_focus.getFullYear(), _focus.getMonth(), 1),
8493
endDate: new Date(_focus.getFullYear(), _focus.getMonth() + 1, 0)
8594
},
8695
{
87-
title: MONTH_NAMES[_rightShown.getMonth()],
96+
title: monthNames[_rightShown.getMonth()],
8897
className: 'right__shown month',
8998
startDate: _rightShown,
9099
endDate: new Date(_rightShown.getFullYear(), _rightShown.getMonth() + 1, 0)
91100
},
92101
{
93-
title: MONTH_NAMES[_rightHidden.getMonth()],
102+
title: monthNames[_rightHidden.getMonth()],
94103
className: 'right__hidden month',
95104
startDate: _rightHidden,
96105
endDate: new Date(_rightHidden.getFullYear(), _rightHidden.getMonth() + 1, 0)

src/react-chayns-calendar/utils/areDatesEqual.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
* @param {Date} date2 - First date for comparison
55
*/
66
export default function areDatesEqual(date1, date2) {
7-
return date1.getUTCFullYear() === date2.getUTCFullYear() && date1.getUTCMonth() === date2.getUTCMonth() && date1.getUTCDate() === date2.getUTCDate();
7+
return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate(); // TODO: UTC-comparison
88
}

src/react-chayns-emoji_input/README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ Just use `event.target.pureInnerText` to save the text in your component and to
3636
## Props
3737
The following properties can be set on the EmojiInput-Component
3838

39-
| **Property** | **Description** | **Type** | **Default Value** | **Required** |
40-
| ------------ | --------------------------------------------------- | -------- | ----------------- | ------------ |
41-
| placeholder | Text that will be shown as placeholder | string | | true |
42-
| onInput | Function that will be called on input event | function | | true |
43-
| value | Text that will be shown in input | string | | true |
44-
| id | Id that is given to the component | string | | true |
45-
| hideBorder | Hides the border below the input | boolean | false | |
46-
| onKeyDown | Function that will be called on input event | function | *null* | |
47-
| disabled | Disables the input | boolean | false | |
48-
| onFocus | Function that will be called when input gets focus | function | *null* | |
49-
| onBlur | Function that will be called when input loses focus | function | *null* | |
39+
| **Property** | **Description** | **Type** | **Default Value** | **Required** |
40+
| -------------- | --------------------------------------------------- | -------- | ----------------- | ------------ |
41+
| onInput | Function that will be called on input event | function | | true |
42+
| placeholder | Text that will be shown as placeholder | string | | true |
43+
| value | Text that will be shown in input | string | | true |
44+
| id | Id that is given to the component | string | | true |
45+
| hideBorder | Hides the border below the input | boolean | false | |
46+
| disabled | Disables the input | boolean | false | |
47+
| style | Extra styles for input (e.g. max-height) | object | *null* | |
48+
| onKeyDown | Function that will be called on input event | function | *null* | |
49+
| onFocus | Function that will be called when input gets focus | function | *null* | |
50+
| onBlur | Function that will be called when input loses focus | function | *null* | |

src/react-chayns-emoji_input/component/EmojiInput.jsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ function requireEmojione(returnPromise) {
1212
}
1313

1414
export default class EmojiInput extends Component {
15-
lastKeyPressed = null;
16-
17-
firstRender = true;
18-
19-
activeNode = 0;
20-
21-
cursorPos = 0;
22-
2315
static propTypes = {
2416
placeholder: PropTypes.string.isRequired,
2517
onInput: PropTypes.func.isRequired,
@@ -28,6 +20,7 @@ export default class EmojiInput extends Component {
2820
hideBorder: PropTypes.bool,
2921
onKeyDown: PropTypes.func,
3022
disabled: PropTypes.bool,
23+
style: PropTypes.object,
3124
onFocus: PropTypes.func,
3225
onBlur: PropTypes.func
3326
};
@@ -37,9 +30,18 @@ export default class EmojiInput extends Component {
3730
onKeyDown: null,
3831
disabled: false,
3932
onFocus: null,
40-
onBlur: null
33+
onBlur: null,
34+
style: null
4135
};
4236

37+
lastKeyPressed = null;
38+
39+
firstRender = true;
40+
41+
activeNode = 0;
42+
43+
cursorPos = 0;
44+
4345
componentWillMount() {
4446
requireEmojione().then((emojione) => {
4547
emojione.ascii = true; // eslint-disable-line no-param-reassign
@@ -357,7 +359,12 @@ export default class EmojiInput extends Component {
357359
};
358360

359361
render() {
360-
const { id, hideBorder, disabled } = this.props;
362+
const {
363+
hideBorder,
364+
disabled,
365+
style,
366+
id,
367+
} = this.props;
361368

362369
const messageInputClasses = classNames('emoji-input__message-input', {
363370
'emoji-input__message-input--hide-border': hideBorder,
@@ -369,20 +376,25 @@ export default class EmojiInput extends Component {
369376
<div className="emoji-input">
370377
<div
371378
dangerouslySetInnerHTML={{ __html: '<br />' }}
372-
ref={(ref) => { this.input = ref; }}
379+
ref={(ref) => {
380+
this.input = ref;
381+
}}
373382
className={messageInputClasses}
374383
onKeyDown={this.handleKeyDown}
375384
contentEditable={!disabled}
376385
onKeyUp={this.handleKeyUp}
377386
onInput={this.handleInput}
378387
onFocus={this.handleFocus}
379388
onBlur={this.handleBlur}
389+
style={style}
380390
dir="auto"
381391
id={id}
382392
/>
383393
<div
384394
className="emoji-input__placeholder"
385-
ref={(ref) => { this.placeholder = ref; }}
395+
ref={(ref) => {
396+
this.placeholder = ref;
397+
}}
386398
/>
387399
</div>
388400
);

src/react-chayns-emoji_input/index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
&__message-input {
2727
font-weight: 400 !important;
2828
word-break: break-word;
29-
max-height: 104px;
3029
min-height: 36px;
3130
overflow-y: auto;
3231

src/react-chayns-gallery/component/ImageContainer.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ export default class ImageContainer extends PureComponent {
77
static propTypes = {
88
index: PropTypes.number,
99
url: PropTypes.string.isRequired,
10+
openImage: PropTypes.func.isRequired,
1011
moreImages: PropTypes.number,
1112
deleteMode: PropTypes.bool,
1213
onDelete: PropTypes.func,
13-
openImage: PropTypes.func
1414
};
1515

1616
static defaultProps = {
1717
index: 0,
1818
moreImages: 0,
1919
deleteMode: false,
20-
openImage: null,
21-
onDelete: null
20+
onDelete: null,
2221
};
2322

2423
constructor(props) {

src/react-chayns-scrollview/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
&--hidden {
5252
.cc__scroll-view__content {
5353
overflow: hidden !important;
54+
width: 100% !important;
5455
}
5556
}
5657

src/react-chayns-selectlist/component/SelectList.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ export default class SelectList extends Component {
3636
constructor(props) {
3737
super(props);
3838

39+
const preselectId = ((props.defaultValue || props.defaultValue === 0) ? props.defaultValue : props.value);
40+
3941
this.state = {
40-
selectedId: props.defaultValue || 0,
42+
selectedId: preselectId || 0,
4143
};
4244

4345
if(props.defaultValue && props.onChange) {

0 commit comments

Comments
 (0)