superdesk-ui-framework 5.1.5 → 5.1.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.
@@ -337,6 +337,13 @@ export class DatePickerISO extends React.PureComponent<IDatePickerISO> {
337
337
  }
338
338
  }
339
339
 
340
+ function getOptionLabel(options: Array<{id: string; label?: string}>, id: string | null | undefined): string {
341
+ if (id == null) {
342
+ return '';
343
+ }
344
+ return options.find((option) => option.id === id)?.label ?? id;
345
+ }
346
+
340
347
  const MonthNavigator = ({
341
348
  value,
342
349
  options,
@@ -346,7 +353,7 @@ const MonthNavigator = ({
346
353
  kind="synchronous"
347
354
  value={[value]}
348
355
  getOptions={() => options.map((option) => ({value: option.id}))}
349
- getLabel={(option) => options[parseInt(option, 10)].label}
356
+ getLabel={(optionId) => getOptionLabel(options, optionId)}
350
357
  getId={(option) => option}
351
358
  onChange={(selected) => {
352
359
  onChange(selected[0]);
@@ -355,7 +362,7 @@ const MonthNavigator = ({
355
362
  labelHidden
356
363
  valueTemplate={(item) => (
357
364
  <div className="sd-datepicker__navigator-value sd-datepicker__navigator-month">
358
- <div>{options[parseInt(item, 10)].label}</div>
365
+ <div>{getOptionLabel(options, item)}</div>
359
366
  <Icon name="chevron-down-thin" />
360
367
  </div>
361
368
  )}
@@ -18,7 +18,7 @@ export class EmptyState extends React.PureComponent<IProps> {
18
18
 
19
19
  const size = this.props.size ?? 'small';
20
20
  const illustration = this.props.illustration ?? '1';
21
- const image = require(`../../app/img/empty_states/empty-state--${size}-${illustration}.svg`);
21
+ const image = require(`../../app/img/empty_states/empty-state--${size}-${illustration}.svg`).default;
22
22
 
23
23
  return (
24
24
  <div
@@ -60620,12 +60620,19 @@ var DatePickerISO = /** @class */ (function (_super) {
60620
60620
  return DatePickerISO;
60621
60621
  }(React.PureComponent));
60622
60622
  exports.DatePickerISO = DatePickerISO;
60623
+ function getOptionLabel(options, id) {
60624
+ var _a, _b;
60625
+ if (id == null) {
60626
+ return '';
60627
+ }
60628
+ return (_b = (_a = options.find(function (option) { return option.id === id; })) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : id;
60629
+ }
60623
60630
  var MonthNavigator = function (_a) {
60624
60631
  var value = _a.value, options = _a.options, onChange = _a.onChange;
60625
- return (React.createElement(TreeSelect_1.TreeSelect, { kind: "synchronous", value: [value], getOptions: function () { return options.map(function (option) { return ({ value: option.id }); }); }, getLabel: function (option) { return options[parseInt(option, 10)].label; }, getId: function (option) { return option; }, onChange: function (selected) {
60632
+ return (React.createElement(TreeSelect_1.TreeSelect, { kind: "synchronous", value: [value], getOptions: function () { return options.map(function (option) { return ({ value: option.id }); }); }, getLabel: function (optionId) { return getOptionLabel(options, optionId); }, getId: function (option) { return option; }, onChange: function (selected) {
60626
60633
  onChange(selected[0]);
60627
60634
  }, clearable: false, labelHidden: true, valueTemplate: function (item) { return (React.createElement("div", { className: "sd-datepicker__navigator-value sd-datepicker__navigator-month" },
60628
- React.createElement("div", null, options[parseInt(item, 10)].label),
60635
+ React.createElement("div", null, getOptionLabel(options, item)),
60629
60636
  React.createElement(Icon_1.Icon, { name: "chevron-down-thin" }))); }, inputWrapper: {
60630
60637
  kind: 'custom',
60631
60638
  component: function (_a) {
@@ -137264,7 +137271,7 @@ var EmptyState = /** @class */ (function (_super) {
137264
137271
  _a));
137265
137272
  var size = (_b = this.props.size) !== null && _b !== void 0 ? _b : 'small';
137266
137273
  var illustration = (_c = this.props.illustration) !== null && _c !== void 0 ? _c : '1';
137267
- var image = __webpack_require__(799)("./empty-state--".concat(size, "-").concat(illustration, ".svg"));
137274
+ var image = __webpack_require__(799)("./empty-state--".concat(size, "-").concat(illustration, ".svg")).default;
137268
137275
  return (React.createElement("div", { className: 'content-state--empty-container' +
137269
137276
  (this.props.absolutePositioned ? ' content-state__empty-container--absolute' : '') },
137270
137277
  React.createElement("div", { className: "content-state__empty-info" },
@@ -196554,7 +196561,7 @@ exports.ThreePaneLayoutPattern = ThreePaneLayoutPattern;
196554
196561
  /* 1055 */
196555
196562
  /***/ (function(module, exports) {
196556
196563
 
196557
- module.exports = {"name":"superdesk-ui-framework","version":"5.1.5","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","Konstantin Markov","Helmy Giacoman"],"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 && npm run unit-test","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","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.66","@superdesk/primereact":"^5.0.2-16","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"^4.1.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","weekstart":"^2.0.0"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
196564
+ module.exports = {"name":"superdesk-ui-framework","version":"5.1.7","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","Konstantin Markov","Helmy Giacoman"],"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 && npm run unit-test","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","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.66","@superdesk/primereact":"^5.0.2-16","@superdesk/react-resizable-panels":"0.0.39","chart.js":"^2.9.3","date-fns":"^4.1.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","weekstart":"^2.0.0"},"peerDependencies":{"moment":"*"},"volta":{"node":"14.21.3"}}
196558
196565
 
196559
196566
  /***/ }),
196560
196567
  /* 1056 */
@@ -60350,12 +60350,19 @@ var DatePickerISO = /** @class */ (function (_super) {
60350
60350
  return DatePickerISO;
60351
60351
  }(React.PureComponent));
60352
60352
  exports.DatePickerISO = DatePickerISO;
60353
+ function getOptionLabel(options, id) {
60354
+ var _a, _b;
60355
+ if (id == null) {
60356
+ return '';
60357
+ }
60358
+ return (_b = (_a = options.find(function (option) { return option.id === id; })) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : id;
60359
+ }
60353
60360
  var MonthNavigator = function (_a) {
60354
60361
  var value = _a.value, options = _a.options, onChange = _a.onChange;
60355
- return (React.createElement(TreeSelect_1.TreeSelect, { kind: "synchronous", value: [value], getOptions: function () { return options.map(function (option) { return ({ value: option.id }); }); }, getLabel: function (option) { return options[parseInt(option, 10)].label; }, getId: function (option) { return option; }, onChange: function (selected) {
60362
+ return (React.createElement(TreeSelect_1.TreeSelect, { kind: "synchronous", value: [value], getOptions: function () { return options.map(function (option) { return ({ value: option.id }); }); }, getLabel: function (optionId) { return getOptionLabel(options, optionId); }, getId: function (option) { return option; }, onChange: function (selected) {
60356
60363
  onChange(selected[0]);
60357
60364
  }, clearable: false, labelHidden: true, valueTemplate: function (item) { return (React.createElement("div", { className: "sd-datepicker__navigator-value sd-datepicker__navigator-month" },
60358
- React.createElement("div", null, options[parseInt(item, 10)].label),
60365
+ React.createElement("div", null, getOptionLabel(options, item)),
60359
60366
  React.createElement(Icon_1.Icon, { name: "chevron-down-thin" }))); }, inputWrapper: {
60360
60367
  kind: 'custom',
60361
60368
  component: function (_a) {
@@ -136611,7 +136618,7 @@ var EmptyState = /** @class */ (function (_super) {
136611
136618
  _a));
136612
136619
  var size = (_b = this.props.size) !== null && _b !== void 0 ? _b : 'small';
136613
136620
  var illustration = (_c = this.props.illustration) !== null && _c !== void 0 ? _c : '1';
136614
- var image = __webpack_require__(799)("./empty-state--".concat(size, "-").concat(illustration, ".svg"));
136621
+ var image = __webpack_require__(799)("./empty-state--".concat(size, "-").concat(illustration, ".svg")).default;
136615
136622
  return (React.createElement("div", { className: 'content-state--empty-container' +
136616
136623
  (this.props.absolutePositioned ? ' content-state__empty-container--absolute' : '') },
136617
136624
  React.createElement("div", { className: "content-state__empty-info" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superdesk-ui-framework",
3
- "version": "5.1.5",
3
+ "version": "5.1.7",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -264,12 +264,19 @@ var DatePickerISO = /** @class */ (function (_super) {
264
264
  return DatePickerISO;
265
265
  }(React.PureComponent));
266
266
  exports.DatePickerISO = DatePickerISO;
267
+ function getOptionLabel(options, id) {
268
+ var _a, _b;
269
+ if (id == null) {
270
+ return '';
271
+ }
272
+ return (_b = (_a = options.find(function (option) { return option.id === id; })) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : id;
273
+ }
267
274
  var MonthNavigator = function (_a) {
268
275
  var value = _a.value, options = _a.options, onChange = _a.onChange;
269
- return (React.createElement(TreeSelect_1.TreeSelect, { kind: "synchronous", value: [value], getOptions: function () { return options.map(function (option) { return ({ value: option.id }); }); }, getLabel: function (option) { return options[parseInt(option, 10)].label; }, getId: function (option) { return option; }, onChange: function (selected) {
276
+ return (React.createElement(TreeSelect_1.TreeSelect, { kind: "synchronous", value: [value], getOptions: function () { return options.map(function (option) { return ({ value: option.id }); }); }, getLabel: function (optionId) { return getOptionLabel(options, optionId); }, getId: function (option) { return option; }, onChange: function (selected) {
270
277
  onChange(selected[0]);
271
278
  }, clearable: false, labelHidden: true, valueTemplate: function (item) { return (React.createElement("div", { className: "sd-datepicker__navigator-value sd-datepicker__navigator-month" },
272
- React.createElement("div", null, options[parseInt(item, 10)].label),
279
+ React.createElement("div", null, getOptionLabel(options, item)),
273
280
  React.createElement(Icon_1.Icon, { name: "chevron-down-thin" }))); }, inputWrapper: {
274
281
  kind: 'custom',
275
282
  component: function (_a) {
@@ -69,7 +69,7 @@ var EmptyState = /** @class */ (function (_super) {
69
69
  _a));
70
70
  var size = (_b = this.props.size) !== null && _b !== void 0 ? _b : 'small';
71
71
  var illustration = (_c = this.props.illustration) !== null && _c !== void 0 ? _c : '1';
72
- var image = require("../../app/img/empty_states/empty-state--".concat(size, "-").concat(illustration, ".svg"));
72
+ var image = require("../../app/img/empty_states/empty-state--".concat(size, "-").concat(illustration, ".svg")).default;
73
73
  return (React.createElement("div", { className: 'content-state--empty-container' +
74
74
  (this.props.absolutePositioned ? ' content-state__empty-container--absolute' : '') },
75
75
  React.createElement("div", { className: "content-state__empty-info" },