@synerise/ds-date-range-picker 0.9.55 → 0.10.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.10.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.9.54...@synerise/ds-date-range-picker@0.10.0) (2021-10-26)
7
+
8
+
9
+ ### Features
10
+
11
+ * **date-range-picker:** update definition of lifetime relative value ([1eb4fd4](https://github.com/Synerise/synerise-design/commit/1eb4fd4d4ca82be50937d94b29d606a453209da0))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.9.55](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@0.9.54...@synerise/ds-date-range-picker@0.9.55) (2021-10-19)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-date-range-picker
@@ -1,3 +1,15 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
1
13
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
14
 
3
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
@@ -226,6 +238,20 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
226
238
  state.currentRange = currentRange;
227
239
  state.groupedRanges = ranges;
228
240
 
241
+ if (state.groupedRanges) {
242
+ if (!(relativeModes === null || relativeModes === void 0 ? void 0 : relativeModes.includes('PAST'))) {
243
+ state.groupedRanges = state.groupedRanges.filter(function (preset) {
244
+ return preset.future;
245
+ });
246
+ }
247
+
248
+ if (!(relativeModes === null || relativeModes === void 0 ? void 0 : relativeModes.includes('FUTURE'))) {
249
+ state.groupedRanges = state.groupedRanges.filter(function (preset) {
250
+ return !preset.future;
251
+ });
252
+ }
253
+ }
254
+
229
255
  if (future !== prevState.future || past !== prevState.past || relativeModes && !relativeModes.includes(state.currentGroup)) {
230
256
  state.currentGroup = getCurrentGroupFromProps(nextProps);
231
257
  state.future = prevState.future;
@@ -240,7 +266,7 @@ var RelativeRangePicker = /*#__PURE__*/function (_React$PureComponent) {
240
266
  }(React.PureComponent);
241
267
 
242
268
  RelativeRangePicker.defaultProps = {
243
- ranges: CONST.RELATIVE_PRESETS,
269
+ ranges: [].concat(_toConsumableArray(CONST.RELATIVE_PRESETS), _toConsumableArray(CONST.ABSOLUTE_PRESETS)),
244
270
  relativeModes: ['PAST', 'FUTURE'],
245
271
  rangeUnits: CONST.RELATIVE_UNITS,
246
272
  showCustomRange: true
@@ -1,4 +1,4 @@
1
- import { RelativeDateRange, RelativeUnits } from './date.types';
1
+ import { AbsoluteDateRange, RelativeDateRange, RelativeUnits } from './date.types';
2
2
  export declare const SECONDS = "SECONDS";
3
3
  export declare const MINUTES = "MINUTES";
4
4
  export declare const HOURS = "HOURS";
@@ -18,6 +18,7 @@ export declare const DURATION_MODIFIERS: {
18
18
  NEXT: string;
19
19
  };
20
20
  export declare const RELATIVE_PRESETS: RelativeDateRange[];
21
+ export declare const ABSOLUTE_PRESETS: AbsoluteDateRange[];
21
22
  export declare const TIME_OPTIONS: {
22
23
  HOURS: number[];
23
24
  MINUTES: number[];
package/dist/constants.js CHANGED
@@ -292,18 +292,12 @@ export var RELATIVE_PRESETS = [{
292
292
  type: YEARS,
293
293
  value: 1
294
294
  }
295
- }, {
295
+ }];
296
+ export var ABSOLUTE_PRESETS = [{
296
297
  key: 'ALL_TIME',
297
298
  translationKey: 'allTime',
298
- type: RELATIVE,
299
- offset: {
300
- type: SECONDS,
301
- value: 1
302
- },
303
- duration: {
304
- type: YEARS,
305
- value: 100
306
- }
299
+ type: ABSOLUTE,
300
+ future: false
307
301
  }];
308
302
  export var TIME_OPTIONS = {
309
303
  HOURS: range(0, 24),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-date-range-picker",
3
- "version": "0.9.55",
3
+ "version": "0.10.0",
4
4
  "description": "Date-Range-Picker UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,12 +33,12 @@
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
35
  "@date-fns/upgrade": "^1.0.3",
36
- "@synerise/ds-button": "^0.14.0",
37
- "@synerise/ds-date-picker": "^0.5.67",
38
- "@synerise/ds-icon": "^0.45.1",
39
- "@synerise/ds-manageable-list": "^0.20.57",
40
- "@synerise/ds-time-picker": "^0.5.46",
41
- "@synerise/ds-tooltip": "^0.10.54",
36
+ "@synerise/ds-button": "^0.15.0",
37
+ "@synerise/ds-date-picker": "^0.5.68",
38
+ "@synerise/ds-icon": "^0.45.2",
39
+ "@synerise/ds-manageable-list": "^0.20.58",
40
+ "@synerise/ds-time-picker": "^0.5.47",
41
+ "@synerise/ds-tooltip": "^0.10.55",
42
42
  "@synerise/ds-utils": "^0.19.0",
43
43
  "date-fns": "^2.16.1",
44
44
  "dayjs": "^1.8.35",
@@ -54,5 +54,5 @@
54
54
  "devDependencies": {
55
55
  "@types/ramda": "^0.27.14"
56
56
  },
57
- "gitHead": "b69adf958dccdf8cc697fbba1a47acc96218f40e"
57
+ "gitHead": "daaf50ad62081d7ad77eb4ac65100173df77c731"
58
58
  }