superdesk-ui-framework 4.0.43 → 4.0.45
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-typescript/components/DatePicker.tsx +19 -4
- package/app-typescript/components/TreeSelect/TreeSelectItem.tsx +1 -6
- package/dist/examples.bundle.js +111 -89
- package/dist/superdesk-ui.bundle.js +110 -88
- package/package.json +1 -1
- package/react/components/DatePicker.d.ts +5 -1
- package/react/components/DatePicker.js +27 -2
- package/react/components/TreeSelect/TreeSelectItem.js +2 -5
@@ -14,6 +14,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
15
|
};
|
16
16
|
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
17
28
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
18
29
|
if (k2 === undefined) k2 = k;
|
19
30
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
@@ -64,6 +75,7 @@ var Button_1 = require("./Button");
|
|
64
75
|
var weekstart_1 = require("weekstart");
|
65
76
|
var common_1 = require("@sourcefabric/common");
|
66
77
|
var localization_1 = require("../localization");
|
78
|
+
var helpers_1 = require("../helpers");
|
67
79
|
var internalPrimereactClassnames = {
|
68
80
|
overlayVisible: 'p-input-overlay-visible',
|
69
81
|
};
|
@@ -153,7 +165,6 @@ var DatePicker = /** @class */ (function (_super) {
|
|
153
165
|
};
|
154
166
|
DatePicker.prototype.render = function () {
|
155
167
|
var _this = this;
|
156
|
-
var _a;
|
157
168
|
if (this.props.preview) {
|
158
169
|
return (
|
159
170
|
// We have to do type assertion here because we wrap primereact's component using
|
@@ -162,6 +173,20 @@ var DatePicker = /** @class */ (function (_super) {
|
|
162
173
|
React.createElement("div", null,
|
163
174
|
React.createElement("span", null, (0, moment_1.default)(this.state.value).format(this.props.dateFormat))));
|
164
175
|
}
|
176
|
+
var locale = (function () {
|
177
|
+
if (_this.props.locale == null) {
|
178
|
+
return undefined;
|
179
|
+
}
|
180
|
+
else if (_this.props.locale.type === 'code-only') {
|
181
|
+
return getDatePickerLocale(_this.props.locale.code);
|
182
|
+
}
|
183
|
+
else if (_this.props.locale.type === 'full') {
|
184
|
+
return __assign(__assign({}, _this.props.locale.payload), { today: localization_1.localization.translations.today, clear: localization_1.localization.translations.clear });
|
185
|
+
}
|
186
|
+
else {
|
187
|
+
return (0, helpers_1.assertNever)(_this.props.locale);
|
188
|
+
}
|
189
|
+
})();
|
165
190
|
var showClearButton = this.props.required === true
|
166
191
|
? false
|
167
192
|
: this.props.hideClearButton !== true;
|
@@ -189,7 +214,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
189
214
|
// updating internal state so a user can continue typing and enter a valid value
|
190
215
|
_this.setState({ value: event.value, valid: false });
|
191
216
|
}
|
192
|
-
}, locale:
|
217
|
+
}, locale: locale, dateFormat: this.props.dateFormat.replace('YYYY', 'yy').replace('MM', 'mm').replace('DD', 'dd'), showIcon: true, icon: "icon-calendar", headerTemplate: function () { return _this.props.headerButtonBar == null ? null : (React.createElement("div", { className: "datepicker-header-toolbar" }, _this.props.headerButtonBar.map(function (_a, i) {
|
193
218
|
var label = _a.label, days = _a.days;
|
194
219
|
return (React.createElement("button", { key: i, className: "btn btn--small", onClick: function () {
|
195
220
|
_this.props.onChange((0, addDays_1.default)(new Date(), days));
|
@@ -63,9 +63,6 @@ var TreeSelectItem = /** @class */ (function (_super) {
|
|
63
63
|
}
|
64
64
|
TreeSelectItem.prototype.render = function () {
|
65
65
|
var _this = this;
|
66
|
-
var ariaLabel = this.props.parentCategory !== undefined
|
67
|
-
? "".concat(this.props.getLabel(this.props.option.value), ", parent ").concat(this.props.parentCategory)
|
68
|
-
: this.props.getLabel(this.props.option.value);
|
69
66
|
return (React.createElement("li", { className: 'suggestion-item suggestion-item--multi-select', role: 'none', onClick: function (event) {
|
70
67
|
var _a, _b;
|
71
68
|
if (!_this.props.disabledItem) {
|
@@ -83,7 +80,7 @@ var TreeSelectItem = /** @class */ (function (_super) {
|
|
83
80
|
if (event.key === 'Enter' && _this.props.option.children) {
|
84
81
|
(_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a);
|
85
82
|
}
|
86
|
-
}, disabled: this.props.disabledItem, "data-test-id": "option", role: '
|
83
|
+
}, disabled: this.props.disabledItem, "data-test-id": "option", role: 'treeitem', "aria-selected": this.props.selectedItem === true, "aria-disabled": this.props.disabledItem === true },
|
87
84
|
(this.props.getBorderColor && !this.props.allowMultiple)
|
88
85
|
&& React.createElement("div", { className: "item-border", style: {
|
89
86
|
backgroundColor: this.props.getBorderColor(this.props.option.value),
|
@@ -94,7 +91,7 @@ var TreeSelectItem = /** @class */ (function (_super) {
|
|
94
91
|
backgroundColor: this.props.getBackgroundColor(this.props.option.value),
|
95
92
|
color: (0, helpers_1.getTextColor)(this.props.getBackgroundColor(this.props.option.value)),
|
96
93
|
}
|
97
|
-
: undefined
|
94
|
+
: undefined }, this.props.optionTemplate
|
98
95
|
? this.props.optionTemplate(this.props.option.value)
|
99
96
|
: this.props.getLabel(this.props.option.value)),
|
100
97
|
this.props.option.children
|