superdesk-ui-framework 4.0.53 → 4.0.54

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.
@@ -30,6 +30,7 @@ type IValue = {date?: string; time?: string};
30
30
 
31
31
  interface IPropsValueObject extends IInputWrapper {
32
32
  valueType: 'object';
33
+ timeRequiresDate?: boolean;
33
34
  value: IValue;
34
35
  dateFormat: string;
35
36
  onChange: (value: IValue) => void; //
@@ -129,6 +130,15 @@ export class DateTimePicker extends React.PureComponent<IProps> {
129
130
  render() {
130
131
  const timeValue = this.getTimeValue();
131
132
  const dateValue = this.getDateValue();
133
+ const timeRequiresDate = (() => {
134
+ if (this.props.valueType === 'object') {
135
+ return this.props.timeRequiresDate === true;
136
+ } else if (this.props.valueType === 'date') {
137
+ return false;
138
+ } else {
139
+ return assertNever(this.props);
140
+ }
141
+ })();
132
142
 
133
143
  return (
134
144
  <InputWrapper
@@ -165,7 +175,7 @@ export class DateTimePicker extends React.PureComponent<IProps> {
165
175
  </div>
166
176
  <div style={{flexGrow: 1}}>
167
177
  <TimePicker
168
- disabled={this.props.disabled}
178
+ disabled={this.props.disabled || (timeRequiresDate && dateValue == null)}
169
179
  preview={this.props.preview}
170
180
  value={timeValue}
171
181
  onChange={this.handleTimeChange}
@@ -127755,14 +127755,26 @@ var DateTimePicker = /** @class */ (function (_super) {
127755
127755
  }
127756
127756
  };
127757
127757
  DateTimePicker.prototype.render = function () {
127758
+ var _this = this;
127758
127759
  var timeValue = this.getTimeValue();
127759
127760
  var dateValue = this.getDateValue();
127761
+ var timeRequiresDate = (function () {
127762
+ if (_this.props.valueType === 'object') {
127763
+ return _this.props.timeRequiresDate === true;
127764
+ }
127765
+ else if (_this.props.valueType === 'date') {
127766
+ return false;
127767
+ }
127768
+ else {
127769
+ return (0, helpers_1.assertNever)(_this.props);
127770
+ }
127771
+ })();
127760
127772
  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, fullWidth: this.props.fullWidth, inputWrapper: this.props.inputWrapper, "data-test-id": this.props['data-test-id'], ref: this.props.ref },
127761
127773
  React.createElement(common_1.Spacer, { h: true, gap: "8", alignItems: "end", noWrap: true },
127762
127774
  React.createElement("div", { style: { flexGrow: 1 } },
127763
127775
  React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: dateValue, onChange: this.handleDateChange, dateFormat: this.props.dateFormat, inlineLabel: true, labelHidden: true, fullWidth: this.props.fullWidth, "data-test-id": "date-input" })),
127764
127776
  React.createElement("div", { style: { flexGrow: 1 } },
127765
- React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled, preview: this.props.preview, value: timeValue, onChange: this.handleTimeChange, inlineLabel: true, labelHidden: true, allowSeconds: this.props.allowSeconds, fullWidth: this.props.fullWidth, required: this.props.required, headerTemplate: this.props.timeHeaderTemplate, footerTemplate: this.props.timeFooterTemplate, "data-test-id": "time-input" })),
127777
+ React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled || (timeRequiresDate && dateValue == null), preview: this.props.preview, value: timeValue, onChange: this.handleTimeChange, inlineLabel: true, labelHidden: true, allowSeconds: this.props.allowSeconds, fullWidth: this.props.fullWidth, required: this.props.required, headerTemplate: this.props.timeHeaderTemplate, footerTemplate: this.props.timeFooterTemplate, "data-test-id": "time-input" })),
127766
127778
  this.props.preview !== true && (React.createElement(IconButton_1.IconButton, { disabled: this.props.disabled, icon: "remove-sign", onClick: this.handleClear, ariaValue: "Clear" })))));
127767
127779
  };
127768
127780
  return DateTimePicker;
@@ -191060,7 +191072,7 @@ exports.ThreePaneLayoutPattern = ThreePaneLayoutPattern;
191060
191072
  /* 959 */
191061
191073
  /***/ (function(module, exports) {
191062
191074
 
191063
- module.exports = {"name":"superdesk-ui-framework","version":"4.0.53","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":"tsc -p tsconfig.json --noEmit && webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","format-code":"npx prettier . --write","lint":"tsc -p tsconfig.json --noEmit && npx prettier . --check && 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","prettier":"3.5.3","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":"^5.8.3","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","@sourcefabric/common":"0.0.63","@superdesk/primereact":"^5.0.2-13","@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","tippy.js":"^6.3.7","weekstart":"^2.0.0"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
191075
+ module.exports = {"name":"superdesk-ui-framework","version":"4.0.54","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":"tsc -p tsconfig.json --noEmit && webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","playground-lint":"tsc -p examples/pages/playgrounds/react-playgrounds --noEmit","format-code":"npx prettier . --write","lint":"tsc -p tsconfig.json --noEmit && npx prettier . --check && 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","prettier":"3.5.3","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":"^5.8.3","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","@sourcefabric/common":"0.0.63","@superdesk/primereact":"^5.0.2-13","@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","tippy.js":"^6.3.7","weekstart":"^2.0.0"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
191064
191076
 
191065
191077
  /***/ }),
191066
191078
  /* 960 */
@@ -126851,14 +126851,26 @@ var DateTimePicker = /** @class */ (function (_super) {
126851
126851
  }
126852
126852
  };
126853
126853
  DateTimePicker.prototype.render = function () {
126854
+ var _this = this;
126854
126855
  var timeValue = this.getTimeValue();
126855
126856
  var dateValue = this.getDateValue();
126857
+ var timeRequiresDate = (function () {
126858
+ if (_this.props.valueType === 'object') {
126859
+ return _this.props.timeRequiresDate === true;
126860
+ }
126861
+ else if (_this.props.valueType === 'date') {
126862
+ return false;
126863
+ }
126864
+ else {
126865
+ return (0, helpers_1.assertNever)(_this.props);
126866
+ }
126867
+ })();
126856
126868
  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, fullWidth: this.props.fullWidth, inputWrapper: this.props.inputWrapper, "data-test-id": this.props['data-test-id'], ref: this.props.ref },
126857
126869
  React.createElement(common_1.Spacer, { h: true, gap: "8", alignItems: "end", noWrap: true },
126858
126870
  React.createElement("div", { style: { flexGrow: 1 } },
126859
126871
  React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: dateValue, onChange: this.handleDateChange, dateFormat: this.props.dateFormat, inlineLabel: true, labelHidden: true, fullWidth: this.props.fullWidth, "data-test-id": "date-input" })),
126860
126872
  React.createElement("div", { style: { flexGrow: 1 } },
126861
- React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled, preview: this.props.preview, value: timeValue, onChange: this.handleTimeChange, inlineLabel: true, labelHidden: true, allowSeconds: this.props.allowSeconds, fullWidth: this.props.fullWidth, required: this.props.required, headerTemplate: this.props.timeHeaderTemplate, footerTemplate: this.props.timeFooterTemplate, "data-test-id": "time-input" })),
126873
+ React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled || (timeRequiresDate && dateValue == null), preview: this.props.preview, value: timeValue, onChange: this.handleTimeChange, inlineLabel: true, labelHidden: true, allowSeconds: this.props.allowSeconds, fullWidth: this.props.fullWidth, required: this.props.required, headerTemplate: this.props.timeHeaderTemplate, footerTemplate: this.props.timeFooterTemplate, "data-test-id": "time-input" })),
126862
126874
  this.props.preview !== true && (React.createElement(IconButton_1.IconButton, { disabled: this.props.disabled, icon: "remove-sign", onClick: this.handleClear, ariaValue: "Clear" })))));
126863
126875
  };
126864
126876
  return DateTimePicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "4.0.53",
3
+ "version": "4.0.54",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,6 +22,7 @@ type IValue = {
22
22
  };
23
23
  interface IPropsValueObject extends IInputWrapper {
24
24
  valueType: 'object';
25
+ timeRequiresDate?: boolean;
25
26
  value: IValue;
26
27
  dateFormat: string;
27
28
  onChange: (value: IValue) => void;
@@ -153,14 +153,26 @@ var DateTimePicker = /** @class */ (function (_super) {
153
153
  }
154
154
  };
155
155
  DateTimePicker.prototype.render = function () {
156
+ var _this = this;
156
157
  var timeValue = this.getTimeValue();
157
158
  var dateValue = this.getDateValue();
159
+ var timeRequiresDate = (function () {
160
+ if (_this.props.valueType === 'object') {
161
+ return _this.props.timeRequiresDate === true;
162
+ }
163
+ else if (_this.props.valueType === 'date') {
164
+ return false;
165
+ }
166
+ else {
167
+ return (0, helpers_1.assertNever)(_this.props);
168
+ }
169
+ })();
158
170
  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, fullWidth: this.props.fullWidth, inputWrapper: this.props.inputWrapper, "data-test-id": this.props['data-test-id'], ref: this.props.ref },
159
171
  React.createElement(common_1.Spacer, { h: true, gap: "8", alignItems: "end", noWrap: true },
160
172
  React.createElement("div", { style: { flexGrow: 1 } },
161
173
  React.createElement(DatePicker_1.DatePicker, { disabled: this.props.disabled, preview: this.props.preview, required: this.props.required, hideClearButton: true, value: dateValue, onChange: this.handleDateChange, dateFormat: this.props.dateFormat, inlineLabel: true, labelHidden: true, fullWidth: this.props.fullWidth, "data-test-id": "date-input" })),
162
174
  React.createElement("div", { style: { flexGrow: 1 } },
163
- React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled, preview: this.props.preview, value: timeValue, onChange: this.handleTimeChange, inlineLabel: true, labelHidden: true, allowSeconds: this.props.allowSeconds, fullWidth: this.props.fullWidth, required: this.props.required, headerTemplate: this.props.timeHeaderTemplate, footerTemplate: this.props.timeFooterTemplate, "data-test-id": "time-input" })),
175
+ React.createElement(TimePicker_1.TimePicker, { disabled: this.props.disabled || (timeRequiresDate && dateValue == null), preview: this.props.preview, value: timeValue, onChange: this.handleTimeChange, inlineLabel: true, labelHidden: true, allowSeconds: this.props.allowSeconds, fullWidth: this.props.fullWidth, required: this.props.required, headerTemplate: this.props.timeHeaderTemplate, footerTemplate: this.props.timeFooterTemplate, "data-test-id": "time-input" })),
164
176
  this.props.preview !== true && (React.createElement(IconButton_1.IconButton, { disabled: this.props.disabled, icon: "remove-sign", onClick: this.handleClear, ariaValue: "Clear" })))));
165
177
  };
166
178
  return DateTimePicker;