superdesk-ui-framework 3.0.1-beta.5 → 3.0.1-beta.6
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/app/styles/form-elements/_inputs.scss +2 -0
- package/app-typescript/components/DurationInput.tsx +15 -1
- package/app-typescript/components/Input.tsx +1 -1
- package/app-typescript/index.ts +1 -0
- package/dist/examples.bundle.js +413 -397
- package/dist/superdesk-ui.bundle.css +3 -1
- package/dist/superdesk-ui.bundle.js +394 -378
- package/package.json +1 -1
- package/react/components/DurationInput.js +15 -1
- package/react/components/Input.js +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.js +4 -2
@@ -324,5 +324,19 @@ export class DurationInput extends React.PureComponent<IProps, IState> {
|
|
324
324
|
}
|
325
325
|
|
326
326
|
export function getDurationString(seconds: number) {
|
327
|
-
|
327
|
+
function zeroPad(value: number | string) {
|
328
|
+
if (value.toString().length === 1 || value === 0) {
|
329
|
+
return `0${value}`;
|
330
|
+
} else if (!value) {
|
331
|
+
return '00';
|
332
|
+
} else {
|
333
|
+
return value;
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
let hour = zeroPad(Math.floor(seconds / 3600));
|
338
|
+
let minute = zeroPad(Math.floor((seconds % 3600) / 60));
|
339
|
+
let second = zeroPad(Math.floor(seconds % 60));
|
340
|
+
|
341
|
+
return `${hour}h ${minute}m ${second}s`;
|
328
342
|
}
|
@@ -88,7 +88,7 @@ export class Input extends React.Component<IProps, IState> {
|
|
88
88
|
required={this.props.required}
|
89
89
|
disabled={this.props.disabled}
|
90
90
|
value={this.state.value}
|
91
|
-
invalid={this.
|
91
|
+
invalid={this.props.invalid}
|
92
92
|
info={this.props.info}
|
93
93
|
maxLength={this.props.maxLength}
|
94
94
|
inlineLabel={this.props.inlineLabel}
|
package/app-typescript/index.ts
CHANGED
@@ -18,6 +18,7 @@ export { IconButton } from './components/IconButton';
|
|
18
18
|
export { IconLabel } from './components/IconLabel';
|
19
19
|
export { Tooltip } from './components/Tooltip';
|
20
20
|
export { DurationInput } from './components/DurationInput';
|
21
|
+
export { getDurationString } from './components/DurationInput';
|
21
22
|
export { DatePicker } from './components/DatePicker';
|
22
23
|
export { DatePickerISO } from './components/DatePicker';
|
23
24
|
export { DatePickerLocaleSettings } from './components/DatePicker';
|