superdesk-ui-framework 4.0.10 → 4.0.11
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.
@@ -26,10 +26,9 @@ const MIN_WIDTH = 348;
|
|
26
26
|
export class DateTimePicker extends React.PureComponent<IProps> {
|
27
27
|
handleTimeChange = (time: string) => {
|
28
28
|
const [hours, minutes] = time.split(':').map((x) => defaultTo(parseInt(x, 10), 0)); // handle NaN value
|
29
|
-
const origDate = this.props.value
|
29
|
+
const origDate = this.props.value ? new Date(this.props.value) : new Date();
|
30
30
|
|
31
|
-
origDate.setHours(hours);
|
32
|
-
origDate.setMinutes(minutes);
|
31
|
+
origDate.setHours(hours, minutes);
|
33
32
|
|
34
33
|
this.props.onChange(origDate);
|
35
34
|
}
|
@@ -41,11 +40,10 @@ export class DateTimePicker extends React.PureComponent<IProps> {
|
|
41
40
|
return;
|
42
41
|
}
|
43
42
|
|
44
|
-
const selectedDate = new Date(date);
|
45
43
|
const origDate = this.props.value ?? new Date();
|
44
|
+
const selectedDate = new Date(date);
|
46
45
|
|
47
|
-
selectedDate.setHours(origDate.getHours());
|
48
|
-
selectedDate.setMinutes(origDate.getMinutes());
|
46
|
+
selectedDate.setHours(origDate.getHours(), origDate.getMinutes());
|
49
47
|
|
50
48
|
this.props.onChange(selectedDate);
|
51
49
|
}
|
@@ -55,9 +53,8 @@ export class DateTimePicker extends React.PureComponent<IProps> {
|
|
55
53
|
}
|
56
54
|
|
57
55
|
render() {
|
58
|
-
const
|
59
|
-
|
60
|
-
? `${this.prepareFormat(value.getHours())}:${this.prepareFormat(value.getMinutes())}`
|
56
|
+
const convertedTimeValue = this.props.value != null
|
57
|
+
? `${this.prepareFormat(this.props.value.getHours())}:${this.prepareFormat(this.props.value.getMinutes())}`
|
61
58
|
: '';
|
62
59
|
|
63
60
|
return (
|
@@ -68,7 +65,7 @@ export class DateTimePicker extends React.PureComponent<IProps> {
|
|
68
65
|
preview={this.props.preview}
|
69
66
|
required={this.props.required}
|
70
67
|
hideClearButton={true}
|
71
|
-
value={value}
|
68
|
+
value={this.props.value}
|
72
69
|
onChange={(val) => {
|
73
70
|
this.handleDateChange(val);
|
74
71
|
}}
|
package/dist/examples.bundle.js
CHANGED
@@ -124101,11 +124101,9 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
124101
124101
|
function DateTimePicker() {
|
124102
124102
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
124103
124103
|
_this.handleTimeChange = function (time) {
|
124104
|
-
var _a;
|
124105
|
-
var
|
124106
|
-
|
124107
|
-
origDate.setHours(hours);
|
124108
|
-
origDate.setMinutes(minutes);
|
124104
|
+
var _a = time.split(':').map(function (x) { return (0, lodash_1.defaultTo)(parseInt(x, 10), 0); }), hours = _a[0], minutes = _a[1]; // handle NaN value
|
124105
|
+
var origDate = _this.props.value ? new Date(_this.props.value) : new Date();
|
124106
|
+
origDate.setHours(hours, minutes);
|
124109
124107
|
_this.props.onChange(origDate);
|
124110
124108
|
};
|
124111
124109
|
_this.handleDateChange = function (date) {
|
@@ -124114,10 +124112,9 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
124114
124112
|
_this.props.onChange(null);
|
124115
124113
|
return;
|
124116
124114
|
}
|
124117
|
-
var selectedDate = new Date(date);
|
124118
124115
|
var origDate = (_a = _this.props.value) !== null && _a !== void 0 ? _a : new Date();
|
124119
|
-
selectedDate
|
124120
|
-
selectedDate.
|
124116
|
+
var selectedDate = new Date(date);
|
124117
|
+
selectedDate.setHours(origDate.getHours(), origDate.getMinutes());
|
124121
124118
|
_this.props.onChange(selectedDate);
|
124122
124119
|
};
|
124123
124120
|
return _this;
|
@@ -124128,13 +124125,12 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
124128
124125
|
DateTimePicker.prototype.render = function () {
|
124129
124126
|
var _this = this;
|
124130
124127
|
var _a, _b;
|
124131
|
-
var
|
124132
|
-
|
124133
|
-
? "".concat(this.prepareFormat(value.getHours()), ":").concat(this.prepareFormat(value.getMinutes()))
|
124128
|
+
var convertedTimeValue = this.props.value != null
|
124129
|
+
? "".concat(this.prepareFormat(this.props.value.getHours()), ":").concat(this.prepareFormat(this.props.value.getMinutes()))
|
124134
124130
|
: '';
|
124135
124131
|
return (React.createElement("div", { style: { width: Number(this.props.width) > MIN_WIDTH ? this.props.width : MIN_WIDTH } },
|
124136
124132
|
React.createElement(common_1.Spacer, { h: true, gap: "0", noGrow: true, alignItems: 'end' },
|
124137
|
-
React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: value, onChange: function (val) {
|
124133
|
+
React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: this.props.value, onChange: function (val) {
|
124138
124134
|
_this.handleDateChange(val);
|
124139
124135
|
}, dateFormat: this.props.dateFormat, label: this.props.label.text, inlineLabel: (_a = this.props.label.hidden) !== null && _a !== void 0 ? _a : false, labelHidden: (_b = this.props.label.hidden) !== null && _b !== void 0 ? _b : false, fullWidth: this.props.fullWidth }),
|
124140
124136
|
React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled, preview: this.props.preview, value: convertedTimeValue, onChange: function (val) {
|
@@ -185405,7 +185401,7 @@ exports.ThreePaneLayoutPattern = ThreePaneLayoutPattern;
|
|
185405
185401
|
/* 938 */
|
185406
185402
|
/***/ (function(module, exports) {
|
185407
185403
|
|
185408
|
-
module.exports = {"name":"superdesk-ui-framework","version":"4.0.
|
185404
|
+
module.exports = {"name":"superdesk-ui-framework","version":"4.0.11","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}' && npm run playground-lint","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build","unit-test":"mocha","debug-unit-tests":"mocha --inspect-brk"},"devDependencies":{"@types/assert":"^1.5.6","@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/enzyme":"^3.10.12","@types/enzyme-adapter-react-16":"^1.0.6","@types/lodash":"^4.14.161","@types/mocha":"^9.1.1","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"^5.58.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","enzyme":"^3.11.0","enzyme-adapter-react-16":"^1.15.7","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","jsdom":"20.0.3","jsdom-global":"3.0.2","lodash":"4.17.21","mocha":"^8.4.0","moment":"^2.29.3","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","ts-node":"^10.9.1","tslint":"^5.18.0","typescript":"4.9.5","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@popperjs/core":"^2.4.0","@superdesk/common":"0.0.28","@superdesk/primereact":"^5.0.2-12","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"2.7.0","popper-max-size-modifier":"^0.2.0","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-scrollspy":"^3.4.3"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
|
185409
185405
|
|
185410
185406
|
/***/ }),
|
185411
185407
|
/* 939 */
|
@@ -123222,11 +123222,9 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
123222
123222
|
function DateTimePicker() {
|
123223
123223
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
123224
123224
|
_this.handleTimeChange = function (time) {
|
123225
|
-
var _a;
|
123226
|
-
var
|
123227
|
-
|
123228
|
-
origDate.setHours(hours);
|
123229
|
-
origDate.setMinutes(minutes);
|
123225
|
+
var _a = time.split(':').map(function (x) { return (0, lodash_1.defaultTo)(parseInt(x, 10), 0); }), hours = _a[0], minutes = _a[1]; // handle NaN value
|
123226
|
+
var origDate = _this.props.value ? new Date(_this.props.value) : new Date();
|
123227
|
+
origDate.setHours(hours, minutes);
|
123230
123228
|
_this.props.onChange(origDate);
|
123231
123229
|
};
|
123232
123230
|
_this.handleDateChange = function (date) {
|
@@ -123235,10 +123233,9 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
123235
123233
|
_this.props.onChange(null);
|
123236
123234
|
return;
|
123237
123235
|
}
|
123238
|
-
var selectedDate = new Date(date);
|
123239
123236
|
var origDate = (_a = _this.props.value) !== null && _a !== void 0 ? _a : new Date();
|
123240
|
-
selectedDate
|
123241
|
-
selectedDate.
|
123237
|
+
var selectedDate = new Date(date);
|
123238
|
+
selectedDate.setHours(origDate.getHours(), origDate.getMinutes());
|
123242
123239
|
_this.props.onChange(selectedDate);
|
123243
123240
|
};
|
123244
123241
|
return _this;
|
@@ -123249,13 +123246,12 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
123249
123246
|
DateTimePicker.prototype.render = function () {
|
123250
123247
|
var _this = this;
|
123251
123248
|
var _a, _b;
|
123252
|
-
var
|
123253
|
-
|
123254
|
-
? "".concat(this.prepareFormat(value.getHours()), ":").concat(this.prepareFormat(value.getMinutes()))
|
123249
|
+
var convertedTimeValue = this.props.value != null
|
123250
|
+
? "".concat(this.prepareFormat(this.props.value.getHours()), ":").concat(this.prepareFormat(this.props.value.getMinutes()))
|
123255
123251
|
: '';
|
123256
123252
|
return (React.createElement("div", { style: { width: Number(this.props.width) > MIN_WIDTH ? this.props.width : MIN_WIDTH } },
|
123257
123253
|
React.createElement(common_1.Spacer, { h: true, gap: "0", noGrow: true, alignItems: 'end' },
|
123258
|
-
React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: value, onChange: function (val) {
|
123254
|
+
React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: this.props.value, onChange: function (val) {
|
123259
123255
|
_this.handleDateChange(val);
|
123260
123256
|
}, dateFormat: this.props.dateFormat, label: this.props.label.text, inlineLabel: (_a = this.props.label.hidden) !== null && _a !== void 0 ? _a : false, labelHidden: (_b = this.props.label.hidden) !== null && _b !== void 0 ? _b : false, fullWidth: this.props.fullWidth }),
|
123261
123257
|
React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled, preview: this.props.preview, value: convertedTimeValue, onChange: function (val) {
|
package/package.json
CHANGED
@@ -51,11 +51,9 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
51
51
|
function DateTimePicker() {
|
52
52
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
53
53
|
_this.handleTimeChange = function (time) {
|
54
|
-
var _a;
|
55
|
-
var
|
56
|
-
|
57
|
-
origDate.setHours(hours);
|
58
|
-
origDate.setMinutes(minutes);
|
54
|
+
var _a = time.split(':').map(function (x) { return (0, lodash_1.defaultTo)(parseInt(x, 10), 0); }), hours = _a[0], minutes = _a[1]; // handle NaN value
|
55
|
+
var origDate = _this.props.value ? new Date(_this.props.value) : new Date();
|
56
|
+
origDate.setHours(hours, minutes);
|
59
57
|
_this.props.onChange(origDate);
|
60
58
|
};
|
61
59
|
_this.handleDateChange = function (date) {
|
@@ -64,10 +62,9 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
64
62
|
_this.props.onChange(null);
|
65
63
|
return;
|
66
64
|
}
|
67
|
-
var selectedDate = new Date(date);
|
68
65
|
var origDate = (_a = _this.props.value) !== null && _a !== void 0 ? _a : new Date();
|
69
|
-
selectedDate
|
70
|
-
selectedDate.
|
66
|
+
var selectedDate = new Date(date);
|
67
|
+
selectedDate.setHours(origDate.getHours(), origDate.getMinutes());
|
71
68
|
_this.props.onChange(selectedDate);
|
72
69
|
};
|
73
70
|
return _this;
|
@@ -78,13 +75,12 @@ var DateTimePicker = /** @class */ (function (_super) {
|
|
78
75
|
DateTimePicker.prototype.render = function () {
|
79
76
|
var _this = this;
|
80
77
|
var _a, _b;
|
81
|
-
var
|
82
|
-
|
83
|
-
? "".concat(this.prepareFormat(value.getHours()), ":").concat(this.prepareFormat(value.getMinutes()))
|
78
|
+
var convertedTimeValue = this.props.value != null
|
79
|
+
? "".concat(this.prepareFormat(this.props.value.getHours()), ":").concat(this.prepareFormat(this.props.value.getMinutes()))
|
84
80
|
: '';
|
85
81
|
return (React.createElement("div", { style: { width: Number(this.props.width) > MIN_WIDTH ? this.props.width : MIN_WIDTH } },
|
86
82
|
React.createElement(common_1.Spacer, { h: true, gap: "0", noGrow: true, alignItems: 'end' },
|
87
|
-
React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: value, onChange: function (val) {
|
83
|
+
React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: this.props.value, onChange: function (val) {
|
88
84
|
_this.handleDateChange(val);
|
89
85
|
}, dateFormat: this.props.dateFormat, label: this.props.label.text, inlineLabel: (_a = this.props.label.hidden) !== null && _a !== void 0 ? _a : false, labelHidden: (_b = this.props.label.hidden) !== null && _b !== void 0 ? _b : false, fullWidth: this.props.fullWidth }),
|
90
86
|
React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled, preview: this.props.preview, value: convertedTimeValue, onChange: function (val) {
|