hippo-fw 0.9.6 → 0.9.7
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.
- checksums.yaml +4 -4
- data/client/hippo/components/asset.jsx +22 -2
- data/client/hippo/components/asset.scss +1 -1
- data/client/hippo/components/data-list.jsx +38 -27
- data/client/hippo/components/data-list/data-list.scss +2 -0
- data/client/hippo/components/data-table.jsx +4 -2
- data/client/hippo/components/data-table/formatters.js +7 -0
- data/client/hippo/components/data-table/table-styles.scss +10 -0
- data/client/hippo/components/date-time.jsx +93 -133
- data/client/hippo/components/date-time.scss +1 -36
- data/client/hippo/components/form/api.js +4 -3
- data/client/hippo/components/form/fields.jsx +7 -1
- data/client/hippo/components/form/fields/date-wrapper.jsx +4 -4
- data/client/hippo/components/icon.jsx +10 -1
- data/client/hippo/components/query-builder.jsx +6 -1
- data/client/hippo/components/record-finder/query-layer.jsx +1 -1
- data/client/hippo/components/save-button.jsx +55 -0
- data/client/hippo/components/text-editor.jsx +10 -9
- data/client/hippo/components/text-editor/text-editor.scss +0 -1
- data/client/hippo/components/time-zone-select.jsx +60 -0
- data/client/hippo/models/asset.js +10 -5
- data/client/hippo/models/base.js +1 -1
- data/client/hippo/models/pub_sub.js +22 -67
- data/client/hippo/models/pub_sub/channel.js +28 -8
- data/client/hippo/models/pub_sub/map.js +57 -0
- data/client/hippo/models/query/array-result.js +5 -4
- data/client/hippo/models/query/field.js +19 -3
- data/client/hippo/models/system-setting.js +16 -1
- data/client/hippo/models/tenant.js +8 -7
- data/client/hippo/screens/system-settings.jsx +10 -12
- data/client/hippo/screens/user-management/edit-form.jsx +10 -11
- data/client/hippo/workspace/index.jsx +6 -3
- data/client/hippo/workspace/menu-option.jsx +2 -5
- data/client/hippo/workspace/menu.jsx +13 -1
- data/client/hippo/workspace/styles.scss +11 -26
- data/command-reference-files/initial/Gemfile +1 -1
- data/command-reference-files/model/client/appy-app/models/test_test.js +1 -1
- data/command-reference-files/model/spec/server/models/test_test_spec.rb +10 -0
- data/lib/hippo/api/cable.rb +0 -2
- data/lib/hippo/command/generate_model.rb +2 -3
- data/lib/hippo/spec_helper.rb +4 -2
- data/lib/hippo/tenant.rb +7 -1
- data/lib/hippo/version.rb +1 -1
- data/package-lock.json +60 -46
- data/package.json +5 -2
- data/spec/client/components/__snapshots__/record-finder.spec.jsx.snap +1 -0
- data/spec/client/components/__snapshots__/time-zone-select.spec.jsx.snap +48 -0
- data/spec/client/components/form.spec.jsx +7 -0
- data/spec/client/components/time-zone-select.spec.jsx +11 -0
- data/spec/client/models/pub_sub.spec.js +1 -3
- data/spec/client/models/pub_sub/channel.spec.js +45 -0
- data/spec/client/models/system-setting.spec.js +14 -0
- data/spec/client/workspace/__snapshots__/menu.spec.jsx.snap +9 -9
- data/spec/server/api/tenant_change_spec.rb +1 -1
- data/templates/client/models/model.js +1 -1
- data/templates/spec/factories/model.rb +6 -0
- data/templates/spec/server/model_spec.rb +4 -4
- data/views/hippo_root_view.erb +4 -0
- metadata +11 -10
- data/client/hippo/components/date-time/calendar.jsx +0 -113
- data/client/hippo/components/date-time/date-time-drop.jsx +0 -75
- data/client/hippo/components/date-time/date-time.scss +0 -157
- data/client/hippo/components/date-time/time.jsx +0 -119
- data/client/hippo/workspace/foo.js +0 -0
- data/command-reference-files/model/spec/fixtures/appy-app/test_test.yml +0 -11
- data/command-reference-files/model/spec/server/test_test_spec.rb +0 -10
- data/spec/client/components/date-time.spec.jsx +0 -20
@@ -1,119 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import cn from 'classnames';
|
4
|
-
import { inRange, get, isString } from 'lodash';
|
5
|
-
import { action, observable } from 'mobx';
|
6
|
-
import { observer } from 'mobx-react';
|
7
|
-
import InputSlider from 'react-input-slider';
|
8
|
-
import CheckBox from 'grommet/components/CheckBox';
|
9
|
-
import Box from 'grommet/components/Box';
|
10
|
-
|
11
|
-
const NON_DIGIT = /\D/;
|
12
|
-
|
13
|
-
function getDigits(ev) {
|
14
|
-
const val = get(ev, 'target.value', ev.x);
|
15
|
-
if (isString(val) && (!val || NON_DIGIT.test(val))) { return null; }
|
16
|
-
return parseInt(val, 10);
|
17
|
-
}
|
18
|
-
|
19
|
-
@observer
|
20
|
-
export default class TimeSelector extends React.PureComponent {
|
21
|
-
static propTypes = {
|
22
|
-
moment: PropTypes.object.isRequired,
|
23
|
-
onChange: PropTypes.func.isRequired,
|
24
|
-
minuteStep: PropTypes.number,
|
25
|
-
}
|
26
|
-
|
27
|
-
@observable isPM;
|
28
|
-
@observable hour;
|
29
|
-
@observable minutes;
|
30
|
-
|
31
|
-
componentWillMount() {
|
32
|
-
this.set(this.props);
|
33
|
-
}
|
34
|
-
|
35
|
-
componentWillReceiveProps(nextProps) {
|
36
|
-
this.set(nextProps);
|
37
|
-
}
|
38
|
-
|
39
|
-
set(props) {
|
40
|
-
this.isPM = !!(12 <= props.moment.hour());
|
41
|
-
this.hour = (12 <= props.moment.hour()) ? props.moment.hour() - 12 : props.moment.hour();
|
42
|
-
this.minutes = props.moment.minute();
|
43
|
-
}
|
44
|
-
|
45
|
-
@action.bound
|
46
|
-
onHourChange(ev) {
|
47
|
-
const d = getDigits(ev);
|
48
|
-
const m = this.props.moment;
|
49
|
-
if (inRange(d, 1, 13)) {
|
50
|
-
m.hours(this.isPM ? d + 12 : d);
|
51
|
-
this.hour = d;
|
52
|
-
} else {
|
53
|
-
this.hour = 0;
|
54
|
-
m.hours(0);
|
55
|
-
}
|
56
|
-
this.props.onChange(m);
|
57
|
-
}
|
58
|
-
|
59
|
-
@action.bound
|
60
|
-
onMinuteChange(ev) {
|
61
|
-
const d = getDigits(ev);
|
62
|
-
if (inRange(d, 0, 60)) {
|
63
|
-
const m = this.props.moment;
|
64
|
-
m.minutes(d);
|
65
|
-
this.props.onChange(m);
|
66
|
-
this.minutes = d;
|
67
|
-
} else {
|
68
|
-
this.minutes = 0;
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
@action.bound
|
73
|
-
toggleAMPM(ev) {
|
74
|
-
this.isPM = ev.target.checked;
|
75
|
-
this.props.moment.hours(this.isPM ? this.hour + 12 : this.hour);
|
76
|
-
this.props.onChange(this.props.moment);
|
77
|
-
}
|
78
|
-
|
79
|
-
render() {
|
80
|
-
const { hour, minutes } = this;
|
81
|
-
|
82
|
-
return (
|
83
|
-
<div className={cn('time-picker', this.props.className)}>
|
84
|
-
<Box direction='row' className="showtime" justify="center" align="center">
|
85
|
-
<input className="hour" value={hour} onChange={this.onHourChange} />
|
86
|
-
<span className="separater">:</span>
|
87
|
-
<input className="minutes" value={minutes} onChange={this.onMinuteChange} />
|
88
|
-
<CheckBox
|
89
|
-
toggle
|
90
|
-
className="am-pm"
|
91
|
-
label='AM / PM'
|
92
|
-
checked={this.isPM}
|
93
|
-
onChange={this.toggleAMPM}
|
94
|
-
/>
|
95
|
-
</Box>
|
96
|
-
|
97
|
-
<div className="sliders">
|
98
|
-
<div className="time-text">Hours:</div>
|
99
|
-
<InputSlider
|
100
|
-
className="u-slider-time"
|
101
|
-
xmin={1}
|
102
|
-
xmax={12}
|
103
|
-
step={this.props.minuteStep}
|
104
|
-
x={hour}
|
105
|
-
onChange={this.onHourChange}
|
106
|
-
/>
|
107
|
-
<div className="time-text">Minutes:</div>
|
108
|
-
<InputSlider
|
109
|
-
className="u-slider-time"
|
110
|
-
xmin={0}
|
111
|
-
xmax={59}
|
112
|
-
x={minutes || 0}
|
113
|
-
onChange={this.onMinuteChange}
|
114
|
-
/>
|
115
|
-
</div>
|
116
|
-
</div>
|
117
|
-
);
|
118
|
-
}
|
119
|
-
}
|
File without changes
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import React from 'react'; // eslint-disable-line no-unused-vars
|
2
|
-
import DateTime from 'hippo/components/date-time/date-time-drop';
|
3
|
-
import moment from 'moment';
|
4
|
-
|
5
|
-
describe('DateTime Component', () => {
|
6
|
-
let props;
|
7
|
-
beforeEach(() => {
|
8
|
-
props = {
|
9
|
-
value: moment('2017-06-26T21:33:13Z'),
|
10
|
-
onChange: jest.fn(),
|
11
|
-
};
|
12
|
-
});
|
13
|
-
|
14
|
-
it('sets time', () => {
|
15
|
-
const dt = mount(<DateTime {...props} />);
|
16
|
-
dt.find('.minutes').simulate('change', { target: { value: '42' } });
|
17
|
-
expect(props.onChange).toHaveBeenCalledWith(props.value);
|
18
|
-
expect(props.value.minute()).toEqual(42);
|
19
|
-
});
|
20
|
-
});
|