superdesk-ui-framework 3.1.12 → 3.1.13
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/_helpers.scss +17 -0
- package/app/styles/_toggle-box.scss +45 -28
- package/app/styles/form-elements/_inputs.scss +14 -0
- package/app/styles/grids/_grid-layout.scss +3 -0
- package/app-typescript/components/DatePicker.tsx +6 -0
- package/app-typescript/components/Layouts/LayoutContainer.tsx +7 -1
- package/app-typescript/components/Layouts/PageLayout.tsx +2 -1
- package/app-typescript/components/TimePickerV2.tsx +222 -0
- package/app-typescript/components/ToggleBox/CustomHeaderToggleBox.tsx +6 -1
- package/app-typescript/components/ToggleBox/SimpleToggleBox.tsx +10 -20
- package/app-typescript/components/ToggleBox/index.tsx +3 -1
- package/app-typescript/components/TreeMenu.tsx +8 -5
- package/app-typescript/components/TreeSelect/TreeSelect.tsx +13 -12
- package/app-typescript/components/TreeSelect/TreeSelectItem.tsx +11 -1
- package/app-typescript/index.ts +1 -0
- package/dist/components/TimePicker.tsx +43 -1
- package/dist/components/Togglebox.tsx +19 -4
- package/dist/components/TreeMenu.tsx +2 -0
- package/dist/components/utilities/TextUtilities.tsx +39 -0
- package/dist/design-patterns/ThreePaneLayoutPattern.tsx +1 -1
- package/dist/examples.bundle.js +2184 -1924
- package/dist/superdesk-ui.bundle.css +72 -20
- package/dist/superdesk-ui.bundle.js +1815 -1604
- package/dist/vendor.bundle.js +16 -16
- package/examples/pages/components/TimePicker.tsx +43 -1
- package/examples/pages/components/Togglebox.tsx +19 -4
- package/examples/pages/components/TreeMenu.tsx +2 -0
- package/examples/pages/components/utilities/TextUtilities.tsx +39 -0
- package/examples/pages/design-patterns/ThreePaneLayoutPattern.tsx +1 -1
- package/package.json +1 -1
- package/react/components/DatePicker.d.ts +3 -0
- package/react/components/DatePicker.js +2 -2
- package/react/components/Layouts/LayoutContainer.d.ts +1 -0
- package/react/components/Layouts/LayoutContainer.js +8 -1
- package/react/components/Layouts/PageLayout.d.ts +1 -0
- package/react/components/Layouts/PageLayout.js +1 -1
- package/react/components/TimePickerV2.d.ts +28 -0
- package/react/components/TimePickerV2.js +189 -0
- package/react/components/ToggleBox/CustomHeaderToggleBox.d.ts +1 -0
- package/react/components/ToggleBox/CustomHeaderToggleBox.js +6 -3
- package/react/components/ToggleBox/SimpleToggleBox.js +8 -6
- package/react/components/ToggleBox/index.d.ts +2 -1
- package/react/components/TreeMenu.js +7 -7
- package/react/components/TreeSelect/TreeSelect.js +9 -11
- package/react/components/TreeSelect/TreeSelectItem.d.ts +1 -0
- package/react/components/TreeSelect/TreeSelectItem.js +7 -4
- package/react/index.d.ts +1 -0
- package/react/index.js +5 -3
package/dist/vendor.bundle.js
CHANGED
@@ -70,7 +70,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
70
70
|
/******/ __webpack_require__.p = "";
|
71
71
|
/******/
|
72
72
|
/******/ // Load entry module and return exports
|
73
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
73
|
+
/******/ return __webpack_require__(__webpack_require__.s = 801);
|
74
74
|
/******/ })
|
75
75
|
/************************************************************************/
|
76
76
|
/******/ ({
|
@@ -82,7 +82,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
|
|
82
82
|
|
83
83
|
/***/ }),
|
84
84
|
|
85
|
-
/***/
|
85
|
+
/***/ 21:
|
86
86
|
/***/ (function(module, exports, __webpack_require__) {
|
87
87
|
|
88
88
|
/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
|
@@ -28246,21 +28246,21 @@ return jQuery;
|
|
28246
28246
|
|
28247
28247
|
/***/ }),
|
28248
28248
|
|
28249
|
-
/***/
|
28249
|
+
/***/ 801:
|
28250
28250
|
/***/ (function(module, exports, __webpack_require__) {
|
28251
28251
|
|
28252
28252
|
"use strict";
|
28253
28253
|
|
28254
28254
|
|
28255
|
-
__webpack_require__(
|
28255
|
+
__webpack_require__(21);
|
28256
28256
|
|
28257
28257
|
__webpack_require__(57);
|
28258
28258
|
|
28259
|
-
__webpack_require__(
|
28259
|
+
__webpack_require__(802);
|
28260
28260
|
|
28261
|
-
__webpack_require__(
|
28261
|
+
__webpack_require__(804);
|
28262
28262
|
|
28263
|
-
__webpack_require__(
|
28263
|
+
__webpack_require__(806);
|
28264
28264
|
|
28265
28265
|
__webpack_require__(0);
|
28266
28266
|
|
@@ -28268,7 +28268,7 @@ __webpack_require__(9);
|
|
28268
28268
|
|
28269
28269
|
/***/ }),
|
28270
28270
|
|
28271
|
-
/***/
|
28271
|
+
/***/ 802:
|
28272
28272
|
/***/ (function(module, exports, __webpack_require__) {
|
28273
28273
|
|
28274
28274
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
@@ -28292,7 +28292,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
28292
28292
|
if ( true ) {
|
28293
28293
|
|
28294
28294
|
// AMD. Register as an anonymous module.
|
28295
|
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(57), __webpack_require__(
|
28295
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(57), __webpack_require__(803) ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
28296
28296
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
28297
28297
|
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
28298
28298
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
@@ -29030,7 +29030,7 @@ return $.widget;
|
|
29030
29030
|
|
29031
29031
|
/***/ }),
|
29032
29032
|
|
29033
|
-
/***/
|
29033
|
+
/***/ 803:
|
29034
29034
|
/***/ (function(module, exports, __webpack_require__) {
|
29035
29035
|
|
29036
29036
|
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {
|
@@ -29060,16 +29060,16 @@ return $.ui.version = "1.13.0";
|
|
29060
29060
|
|
29061
29061
|
/***/ }),
|
29062
29062
|
|
29063
|
-
/***/
|
29063
|
+
/***/ 804:
|
29064
29064
|
/***/ (function(module, exports, __webpack_require__) {
|
29065
29065
|
|
29066
|
-
__webpack_require__(
|
29066
|
+
__webpack_require__(805);
|
29067
29067
|
module.exports = angular;
|
29068
29068
|
|
29069
29069
|
|
29070
29070
|
/***/ }),
|
29071
29071
|
|
29072
|
-
/***/
|
29072
|
+
/***/ 805:
|
29073
29073
|
/***/ (function(module, exports, __webpack_require__) {
|
29074
29074
|
|
29075
29075
|
/* WEBPACK VAR INJECTION */(function(__webpack_provided_window_dot_jQuery) {/**
|
@@ -65676,16 +65676,16 @@ $provide.value("$locale", {
|
|
65676
65676
|
|
65677
65677
|
/***/ }),
|
65678
65678
|
|
65679
|
-
/***/
|
65679
|
+
/***/ 806:
|
65680
65680
|
/***/ (function(module, exports, __webpack_require__) {
|
65681
65681
|
|
65682
|
-
__webpack_require__(
|
65682
|
+
__webpack_require__(807);
|
65683
65683
|
module.exports = 'ngAnimate';
|
65684
65684
|
|
65685
65685
|
|
65686
65686
|
/***/ }),
|
65687
65687
|
|
65688
|
-
/***/
|
65688
|
+
/***/ 807:
|
65689
65689
|
/***/ (function(module, exports) {
|
65690
65690
|
|
65691
65691
|
/**
|
@@ -2,6 +2,10 @@ import * as React from 'react';
|
|
2
2
|
import * as Markup from '../../js/react';
|
3
3
|
import {PropsList, Prop} from '../../../app-typescript';
|
4
4
|
import {TimePicker} from '../../../app-typescript/components/TimePicker';
|
5
|
+
import {TimePickerV2} from '../../../app-typescript/components/TimePickerV2';
|
6
|
+
|
7
|
+
let minutes = Array.from(Array(60).keys());
|
8
|
+
let changedMinutes = minutes.filter((num) => num % 15 !== 0)
|
5
9
|
|
6
10
|
class TimePickerExample extends React.PureComponent<{}, {time: string}> {
|
7
11
|
constructor(props) {
|
@@ -27,7 +31,15 @@ class TimePickerExample extends React.PureComponent<{}, {time: string}> {
|
|
27
31
|
}
|
28
32
|
}
|
29
33
|
|
30
|
-
export default class TimePickerDoc extends React.Component {
|
34
|
+
export default class TimePickerDoc extends React.Component<{}, {time: string}> {
|
35
|
+
constructor(props) {
|
36
|
+
super(props);
|
37
|
+
|
38
|
+
this.state = {
|
39
|
+
time: '14:00',
|
40
|
+
};
|
41
|
+
}
|
42
|
+
|
31
43
|
render() {
|
32
44
|
return (
|
33
45
|
<section className="docs-page__container">
|
@@ -59,6 +71,36 @@ export default class TimePickerDoc extends React.Component {
|
|
59
71
|
`}</Markup.ReactMarkupCode>
|
60
72
|
</Markup.ReactMarkup>
|
61
73
|
|
74
|
+
<p className='docs-page__paragraph'>TimePickerV2:</p>
|
75
|
+
<Markup.ReactMarkup>
|
76
|
+
<Markup.ReactMarkupPreview>
|
77
|
+
<div className='docs-page__content-row'>
|
78
|
+
<TimePickerV2
|
79
|
+
value={this.state.time}
|
80
|
+
label='This is Label'
|
81
|
+
disabledOptions={{
|
82
|
+
minutes: changedMinutes,
|
83
|
+
}}
|
84
|
+
onChange={(time) => {
|
85
|
+
this.setState({time});
|
86
|
+
}}
|
87
|
+
/>
|
88
|
+
</div>
|
89
|
+
</Markup.ReactMarkupPreview>
|
90
|
+
<Markup.ReactMarkupCode>{`
|
91
|
+
<TimePickerV2
|
92
|
+
value={this.state.time}
|
93
|
+
label='This is Label'
|
94
|
+
disableOptions={{
|
95
|
+
minutes: changedMinutes,
|
96
|
+
}}
|
97
|
+
onChange={(time) => {
|
98
|
+
this.setState({time})
|
99
|
+
}}
|
100
|
+
/>
|
101
|
+
`}</Markup.ReactMarkupCode>
|
102
|
+
</Markup.ReactMarkup>
|
103
|
+
|
62
104
|
<h3 className='docs-page__h3'>Props</h3>
|
63
105
|
<PropsList>
|
64
106
|
<Prop name='value' isRequired={true} type='string' default='/' description='Item value.' />
|
@@ -37,16 +37,30 @@ const ToggleboxDocs = () => {
|
|
37
37
|
<section className="docs-page__container">
|
38
38
|
<h2 className="docs-page__h2">Togglebox</h2>
|
39
39
|
<Markup.ReactMarkupCodePreview>{`
|
40
|
-
<ToggleBox title="togglebox title">togglebox content</ToggleBox>
|
40
|
+
<ToggleBox variant="simple" title="togglebox title">togglebox content</ToggleBox>
|
41
41
|
`}
|
42
42
|
</Markup.ReactMarkupCodePreview>
|
43
43
|
<p className="docs-page__paragraph">Simple ToggleBox:</p>
|
44
44
|
<Markup.ReactMarkup>
|
45
45
|
<Markup.ReactMarkupPreview>
|
46
46
|
<div style={{ marginTop: "2em" }}>
|
47
|
-
<ToggleBox variant=
|
47
|
+
<ToggleBox variant="simple" title="Simple togglebox">Togglebox content</ToggleBox>
|
48
48
|
<ToggleBox variant='simple' title="With badge" badge={<Badge text='2' type='primary' />}>Togglebox content</ToggleBox>
|
49
|
-
<ToggleBox variant='simple' title="Togglebox - circled chevron"
|
49
|
+
<ToggleBox variant='simple' title="Togglebox - circled chevron" circledChevron={true}>Togglebox content</ToggleBox>
|
50
|
+
<ToggleBox variant='simple' title="Large title" largeTitle={true} circledChevron={true}>
|
51
|
+
<div className="px-4 text-sm line-height-lg">
|
52
|
+
<p className="mb-2">Maecenas sed diam eget risus varius blandit sit amet non magna. Nulla vitae elit libero, a pharetra augue.
|
53
|
+
Donec id elit non mi porta gravida at eget metus. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
|
54
|
+
Curabitur blandit tempus porttitor.</p>
|
55
|
+
|
56
|
+
<p className="mb-2">Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Nullam quis risus eget urna mollis ornare vel eu leo.
|
57
|
+
Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere
|
58
|
+
erat a ante venenatis dapibus posuere velit aliquet.</p>
|
59
|
+
|
60
|
+
<p className="">Aenean lacinia bibendum nulla sed consectetur. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Vestibulum id
|
61
|
+
ligula porta felis euismod semper. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
|
62
|
+
</div>
|
63
|
+
</ToggleBox>
|
50
64
|
</div>
|
51
65
|
</Markup.ReactMarkupPreview>
|
52
66
|
<Markup.ReactMarkupCode>{`
|
@@ -168,12 +182,13 @@ const ToggleboxDocs = () => {
|
|
168
182
|
<PropsList>
|
169
183
|
<Prop name='title' isRequired={true} type='string' default='null' description='Togglebox title' />
|
170
184
|
<Prop name='badge' isRequired={false} type='JSX.Element' default='null' description='Badge' />
|
171
|
-
<Prop name='hideUsingCSS' isRequired={false} type='boolean' default='false' description='Usefull when working with forms. Content of togglebox will be hidden but remain rendered.' />
|
172
185
|
<Prop name='initiallyOpen' isRequired={false} type='boolean' default='false' description='Opens togglebox on initial render' />
|
173
186
|
<Prop name='className' isRequired={false} type='string' default='null' description='Style class of the component' />
|
174
187
|
<Prop name='margin' isRequired={false} type='none | small | normal | large' default='normal' description='Defines the bottom margin of the toggle box.' />
|
175
188
|
<Prop name='onOpen' isRequired={false} type='function' default='null' description='Callback on open event' />
|
176
189
|
<Prop name='onClose' isRequired={false} type='function' default='null' description='Callback on close event' />
|
190
|
+
<Prop name='circledChevron' isRequired={false} type='boolean' default='false' description='Adds a light, circle-shaped background around the chevron.' />
|
191
|
+
<Prop name='largeTitle' isRequired={false} type='boolean' default='false' description='This option will increase the size of the title. Always use a circled chevron (circledChevron) in combination with this option.' />
|
177
192
|
</PropsList>
|
178
193
|
|
179
194
|
<h3 className="docs-page__h3">Props: variant: 'custom-header'</h3>
|
@@ -176,6 +176,7 @@ export class TreeMenuDocs extends React.Component<{}, {}> {
|
|
176
176
|
<Markup.ReactMarkupPreview>
|
177
177
|
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
178
178
|
<TreeMenu
|
179
|
+
searchPlaceholder='Search...'
|
179
180
|
getOptions={() => options}
|
180
181
|
getId={(item) => item.name}
|
181
182
|
getLabel={(item) => item.name}
|
@@ -208,6 +209,7 @@ export class TreeMenuDocs extends React.Component<{}, {}> {
|
|
208
209
|
<Markup.ReactMarkupPreview>
|
209
210
|
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
210
211
|
<TreeMenu
|
212
|
+
searchPlaceholder='Search...'
|
211
213
|
getOptions={() => options2}
|
212
214
|
getId={(item) => item.name}
|
213
215
|
getLabel={(item) => item.name}
|
@@ -203,6 +203,45 @@ class TextUtilitiesDoc extends React.Component {
|
|
203
203
|
</div>
|
204
204
|
</div>
|
205
205
|
|
206
|
+
<div className='docs-page__container-block--line-height'>
|
207
|
+
<h3 className="docs-page__h3">Line Height</h3>
|
208
|
+
<p className="docs-page__paragraph">
|
209
|
+
Utilities for managing the line height of an element.
|
210
|
+
</p>
|
211
|
+
<div className="utilities-table__container">
|
212
|
+
<table className="table utilities-table">
|
213
|
+
<thead>
|
214
|
+
<tr>
|
215
|
+
<th>Class</th>
|
216
|
+
<th>Properties</th>
|
217
|
+
</tr>
|
218
|
+
</thead>
|
219
|
+
<tbody>
|
220
|
+
<tr>
|
221
|
+
<td>line-height-1</td>
|
222
|
+
<td>{'line-height: 1;'}</td>
|
223
|
+
</tr>
|
224
|
+
<tr>
|
225
|
+
<td>line-height-xs</td>
|
226
|
+
<td>{'line-height: 1.1;'}</td>
|
227
|
+
</tr>
|
228
|
+
<tr>
|
229
|
+
<td>line-height-sm</td>
|
230
|
+
<td>{'line-height: 1.2;'}</td>
|
231
|
+
</tr>
|
232
|
+
<tr>
|
233
|
+
<td>line-height-md</td>
|
234
|
+
<td>{'line-height: 1.4;'}</td>
|
235
|
+
</tr>
|
236
|
+
<tr>
|
237
|
+
<td>line-height-lg</td>
|
238
|
+
<td>{'line-height: 1.5;'}</td>
|
239
|
+
</tr>
|
240
|
+
</tbody>
|
241
|
+
</table>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
206
245
|
<div className='docs-page__container-block--font-style'>
|
207
246
|
<h3 className="docs-page__h3">Text Align</h3>
|
208
247
|
<div className="utilities-table__container">
|
@@ -75,7 +75,7 @@ class ThreePaneLayoutPattern extends React.Component<IProps, IState> {
|
|
75
75
|
<Markup.ReactMarkup>
|
76
76
|
<Markup.ReactMarkupPreview>
|
77
77
|
<div style={{height: 600,}} className='sd-border--light'>
|
78
|
-
<Layout.PageLayout
|
78
|
+
<Layout.PageLayout fullHeight={true}
|
79
79
|
header={(
|
80
80
|
<SubNav zIndex={2}>
|
81
81
|
<ButtonGroup align="inline">
|
package/package.json
CHANGED
@@ -13,6 +13,9 @@ interface IDatePickerBase extends IInputWrapper {
|
|
13
13
|
interface IDatePicker extends IDatePickerBase {
|
14
14
|
value: Date | null;
|
15
15
|
onChange(valueNext: Date | null): void;
|
16
|
+
maxDate?: Date;
|
17
|
+
minDate?: Date;
|
18
|
+
showButtonBar?: boolean;
|
16
19
|
'data-test-id'?: string;
|
17
20
|
}
|
18
21
|
interface IState {
|
@@ -137,7 +137,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
137
137
|
React.createElement("span", null, (0, moment_1.default)(this.state.value).format(this.props.dateFormat))));
|
138
138
|
}
|
139
139
|
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, invalid: this.props.error != null, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
140
|
-
React.createElement(calendar_1.Calendar, { inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', ref: function (ref) {
|
140
|
+
React.createElement(calendar_1.Calendar, { showButtonBar: this.props.showButtonBar, inputId: this.htmlId, ariaLabelledBy: this.htmlId + 'label', ref: function (ref) {
|
141
141
|
_this.instance = ref;
|
142
142
|
var refAny = ref;
|
143
143
|
if (_this.props['data-test-id'] != null && (refAny === null || refAny === void 0 ? void 0 : refAny.inputElement) != null) {
|
@@ -162,7 +162,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
162
162
|
_this.instance.hideOverlay();
|
163
163
|
}
|
164
164
|
} }, label));
|
165
|
-
}))); }, appendTo: document.body, disabled: this.props.disabled, onBlur: function (event) {
|
165
|
+
}))); }, appendTo: document.body, disabled: this.props.disabled, minDate: this.props.minDate, maxDate: this.props.maxDate, onBlur: function (event) {
|
166
166
|
// @ts-ignore: Object is possibly 'null'.
|
167
167
|
if (!(event === null || event === void 0 ? void 0 : event.target.value)) {
|
168
168
|
// @ts-ignore: Object is possibly 'null'.
|
@@ -37,16 +37,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
37
37
|
__setModuleDefault(result, mod);
|
38
38
|
return result;
|
39
39
|
};
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
42
|
+
};
|
40
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
41
44
|
exports.LayoutContainer = void 0;
|
42
45
|
var React = __importStar(require("react"));
|
46
|
+
var classnames_1 = __importDefault(require("classnames"));
|
43
47
|
var LayoutContainer = /** @class */ (function (_super) {
|
44
48
|
__extends(LayoutContainer, _super);
|
45
49
|
function LayoutContainer() {
|
46
50
|
return _super !== null && _super.apply(this, arguments) || this;
|
47
51
|
}
|
48
52
|
LayoutContainer.prototype.render = function () {
|
49
|
-
|
53
|
+
var classes = (0, classnames_1.default)('sd-content-wrapper__main-content-area sd-main-content-grid comfort', {
|
54
|
+
'sd-main-content-grid--full-height': this.props.fullHeight,
|
55
|
+
});
|
56
|
+
return (React.createElement("div", { className: classes }, this.props.children));
|
50
57
|
};
|
51
58
|
return LayoutContainer;
|
52
59
|
}(React.PureComponent));
|
@@ -59,7 +59,7 @@ var PageLayout = /** @class */ (function (_super) {
|
|
59
59
|
return _super !== null && _super.apply(this, arguments) || this;
|
60
60
|
}
|
61
61
|
PageLayout.prototype.render = function () {
|
62
|
-
return (React.createElement(Layouts_1.LayoutContainer,
|
62
|
+
return (React.createElement(Layouts_1.LayoutContainer, { fullHeight: this.props.fullHeight },
|
63
63
|
this.props.header && (React.createElement(Layouts_1.HeaderPanel, null, this.props.header)),
|
64
64
|
this.props.leftPanel && (React.createElement(Layouts_1.LeftPanel, { open: this.props.leftPanelOpen }, this.props.leftPanel)),
|
65
65
|
this.props.main && (React.createElement(Layouts_1.MainPanel, __assign({ className: this.props.mainClassName }, this.props.mainProps), this.props.main)),
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { IInputWrapper } from './Form/InputWrapper';
|
3
|
+
interface IProps extends IInputWrapper {
|
4
|
+
value: string;
|
5
|
+
allowSeconds?: boolean;
|
6
|
+
disabledOptions: {
|
7
|
+
hours?: Array<number>;
|
8
|
+
minutes?: Array<number>;
|
9
|
+
seconds?: Array<number>;
|
10
|
+
};
|
11
|
+
'data-test-id'?: string;
|
12
|
+
onChange(valueNext: string): void;
|
13
|
+
}
|
14
|
+
export declare class TimePickerV2 extends React.PureComponent<IProps> {
|
15
|
+
private is12HourFormat;
|
16
|
+
constructor(props: IProps);
|
17
|
+
/**
|
18
|
+
* in case initial time is not valid according to disabled options, we return first valid option
|
19
|
+
*/
|
20
|
+
private getCorrectedTime;
|
21
|
+
private getOptionsForTimeUnit;
|
22
|
+
private handleTimeChange;
|
23
|
+
componentDidMount(): void;
|
24
|
+
padValue(value: number): string;
|
25
|
+
updatedTimeUnit(): string[];
|
26
|
+
render(): JSX.Element;
|
27
|
+
}
|
28
|
+
export {};
|
@@ -0,0 +1,189 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
18
|
+
if (k2 === undefined) k2 = k;
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
22
|
+
}
|
23
|
+
Object.defineProperty(o, k2, desc);
|
24
|
+
}) : (function(o, m, k, k2) {
|
25
|
+
if (k2 === undefined) k2 = k;
|
26
|
+
o[k2] = m[k];
|
27
|
+
}));
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
30
|
+
}) : function(o, v) {
|
31
|
+
o["default"] = v;
|
32
|
+
});
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
34
|
+
if (mod && mod.__esModule) return mod;
|
35
|
+
var result = {};
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
37
|
+
__setModuleDefault(result, mod);
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
41
|
+
exports.TimePickerV2 = void 0;
|
42
|
+
var React = __importStar(require("react"));
|
43
|
+
var Form_1 = require("./Form");
|
44
|
+
var lodash_1 = require("lodash");
|
45
|
+
var TimePickerV2 = /** @class */ (function (_super) {
|
46
|
+
__extends(TimePickerV2, _super);
|
47
|
+
function TimePickerV2(props) {
|
48
|
+
var _this = _super.call(this, props) || this;
|
49
|
+
_this.handleTimeChange = _this.handleTimeChange.bind(_this);
|
50
|
+
_this.getCorrectedTime = _this.getCorrectedTime.bind(_this);
|
51
|
+
_this.getOptionsForTimeUnit = _this.getOptionsForTimeUnit.bind(_this);
|
52
|
+
_this.padValue = _this.padValue.bind(_this);
|
53
|
+
var hour = new Date().toLocaleTimeString([], { hour: 'numeric' });
|
54
|
+
_this.is12HourFormat = hour.includes('AM') || hour.includes('PM');
|
55
|
+
return _this;
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* in case initial time is not valid according to disabled options, we return first valid option
|
59
|
+
*/
|
60
|
+
TimePickerV2.prototype.getCorrectedTime = function (timeUnit, timeStringArray) {
|
61
|
+
var _a;
|
62
|
+
var dividedValue = this.props.value.split(':');
|
63
|
+
var value = (function () {
|
64
|
+
if (timeUnit === 'hours') {
|
65
|
+
return dividedValue[0];
|
66
|
+
}
|
67
|
+
else if (timeUnit === 'minutes') {
|
68
|
+
return dividedValue[1];
|
69
|
+
}
|
70
|
+
return dividedValue[2];
|
71
|
+
})();
|
72
|
+
if (!((_a = this.props.disabledOptions[timeUnit]) !== null && _a !== void 0 ? _a : []).includes(parseInt(value, 10)) && value != null) {
|
73
|
+
return value;
|
74
|
+
}
|
75
|
+
return timeStringArray[0];
|
76
|
+
};
|
77
|
+
TimePickerV2.prototype.getOptionsForTimeUnit = function (timeUnit) {
|
78
|
+
var _this = this;
|
79
|
+
var format12HourArr = (0, lodash_1.range)(1, 13);
|
80
|
+
format12HourArr.unshift(format12HourArr.pop());
|
81
|
+
var timeUnitArray = (function () {
|
82
|
+
if (timeUnit === 'hours') {
|
83
|
+
if (_this.is12HourFormat) {
|
84
|
+
return format12HourArr;
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
return (0, lodash_1.range)(24);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
return (0, lodash_1.range)(60);
|
92
|
+
}
|
93
|
+
})();
|
94
|
+
return timeUnitArray
|
95
|
+
.filter(function (item) { var _a; return !((_a = _this.props.disabledOptions[timeUnit]) !== null && _a !== void 0 ? _a : []).includes(item); })
|
96
|
+
.map(function (value) { return (0, lodash_1.padStart)(value.toString(), 2, '0'); });
|
97
|
+
};
|
98
|
+
TimePickerV2.prototype.handleTimeChange = function (index, newValue) {
|
99
|
+
var current = this.props.value.split(':');
|
100
|
+
var updated12HourValue = (function () {
|
101
|
+
if (parseInt(current[0], 10) >= 12) {
|
102
|
+
if (newValue === '12') {
|
103
|
+
return newValue;
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
return (parseInt(newValue, 10) + 12).toString();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
else {
|
110
|
+
if (newValue === '12') {
|
111
|
+
return '00';
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
return newValue;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
})();
|
118
|
+
current[index] = this.is12HourFormat ? updated12HourValue : newValue;
|
119
|
+
this.props.onChange(current.join(':'));
|
120
|
+
};
|
121
|
+
TimePickerV2.prototype.componentDidMount = function () {
|
122
|
+
var correctedTime = [
|
123
|
+
this.getCorrectedTime('hours', this.getOptionsForTimeUnit('hours')),
|
124
|
+
':',
|
125
|
+
this.getCorrectedTime('minutes', this.getOptionsForTimeUnit('minutes')),
|
126
|
+
this.props.allowSeconds
|
127
|
+
? ":".concat(this.getCorrectedTime('seconds', this.getOptionsForTimeUnit('seconds')))
|
128
|
+
: '',
|
129
|
+
].join('');
|
130
|
+
if (this.props.value !== correctedTime) {
|
131
|
+
this.props.onChange(correctedTime);
|
132
|
+
}
|
133
|
+
};
|
134
|
+
TimePickerV2.prototype.padValue = function (value) {
|
135
|
+
return (0, lodash_1.padStart)((value).toString(), 2, '0');
|
136
|
+
};
|
137
|
+
TimePickerV2.prototype.updatedTimeUnit = function () {
|
138
|
+
var timeUnitValuesArray = this.props.value.split(':');
|
139
|
+
/**
|
140
|
+
* updating the initial value from props
|
141
|
+
*/
|
142
|
+
if (this.is12HourFormat) {
|
143
|
+
if (parseInt(timeUnitValuesArray[0], 10) > 12) {
|
144
|
+
timeUnitValuesArray[0] = this.padValue(parseInt(timeUnitValuesArray[0], 10) - 12);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
return timeUnitValuesArray;
|
148
|
+
};
|
149
|
+
TimePickerV2.prototype.render = function () {
|
150
|
+
var _this = this;
|
151
|
+
var timeUnitValuesArray = this.updatedTimeUnit();
|
152
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, invalid: this.props.error != null, required: this.props.required, disabled: this.props.disabled, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, tabindex: this.props.tabindex },
|
153
|
+
React.createElement("div", { className: 'sd__input__time-picker-v2', "data-test-id": this.props['data-test-id'] },
|
154
|
+
React.createElement("div", { className: 'input-wrapper__time-picker-v2' },
|
155
|
+
React.createElement("select", { className: 'sd-input__select', value: timeUnitValuesArray[0], onChange: function (_a) {
|
156
|
+
var target = _a.target;
|
157
|
+
_this.handleTimeChange(0, target.value);
|
158
|
+
} }, this.getOptionsForTimeUnit('hours').map(function (hour) { return (React.createElement("option", { value: hour, label: hour, key: hour })); })),
|
159
|
+
React.createElement("span", { className: 'time-picker-v2-suffix' }, ":")),
|
160
|
+
React.createElement("div", { className: 'input-wrapper__time-picker-v2' },
|
161
|
+
React.createElement("select", { className: 'sd-input__select', value: timeUnitValuesArray[1], onChange: function (_a) {
|
162
|
+
var target = _a.target;
|
163
|
+
_this.handleTimeChange(1, target.value);
|
164
|
+
} }, this.getOptionsForTimeUnit('minutes').map(function (minute) { return (React.createElement("option", { value: minute, label: minute, key: minute })); })),
|
165
|
+
this.props.allowSeconds && (React.createElement("span", { className: 'time-picker-v2-suffix' }, ":"))),
|
166
|
+
this.props.allowSeconds && (React.createElement("div", { className: 'input-wrapper__time-picker-v2' },
|
167
|
+
React.createElement("select", { className: 'sd-input__select', value: timeUnitValuesArray[2], onChange: function (_a) {
|
168
|
+
var target = _a.target;
|
169
|
+
_this.handleTimeChange(2, target.value);
|
170
|
+
} }, this.getOptionsForTimeUnit('seconds').map(function (second) { return (React.createElement("option", { value: second, label: second, key: second })); })))),
|
171
|
+
this.is12HourFormat && (React.createElement("div", { className: 'input-wrapper__time-picker-v2' },
|
172
|
+
React.createElement("span", { className: 'time-picker-v2-suffix' }),
|
173
|
+
React.createElement("select", { className: 'sd-input__select', value: (parseInt(this.props.value.split(':')[0], 10) >= 12) ? 'PM' : 'AM', onChange: function (_a) {
|
174
|
+
var target = _a.target;
|
175
|
+
var splitValue = _this.props.value.split(':');
|
176
|
+
if (target.value === 'PM') {
|
177
|
+
splitValue[0] = _this.padValue(parseInt(splitValue[0], 10) + 12);
|
178
|
+
}
|
179
|
+
else {
|
180
|
+
splitValue[0] = _this.padValue(parseInt(splitValue[0], 10) - 12);
|
181
|
+
}
|
182
|
+
_this.props.onChange(splitValue.join(':'));
|
183
|
+
} },
|
184
|
+
React.createElement("option", { value: 'AM', label: 'AM' }),
|
185
|
+
React.createElement("option", { value: 'PM', label: 'PM' })))))));
|
186
|
+
};
|
187
|
+
return TimePickerV2;
|
188
|
+
}(React.PureComponent));
|
189
|
+
exports.TimePickerV2 = TimePickerV2;
|