@etsoo/notificationbase 1.1.17 → 1.1.19

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.
@@ -1,3 +1,4 @@
1
+ import { DataTypes } from '@etsoo/shared';
1
2
  import {
2
3
  INotificaseBase,
3
4
  INotification,
@@ -36,7 +37,7 @@ jest.useFakeTimers();
36
37
 
37
38
  test('Tests for basic data', () => {
38
39
  expect(Object.keys(container.notifications).length).toBe(
39
- Object.keys(NotificationAlign).length / 2
40
+ DataTypes.getEnumKeys(NotificationAlign).length
40
41
  );
41
42
  });
42
43
 
@@ -2,16 +2,18 @@ import { DataTypes } from '@etsoo/shared';
2
2
  /**
3
3
  * Display align
4
4
  */
5
- export declare enum NotificationAlign {
6
- TopLeft = 0,
7
- TopCenter = 1,
8
- TopRight = 2,
9
- Center = 3,
10
- Unknown = 4,
11
- BottomLeft = 5,
12
- BottomCenter = 6,
13
- BottomRight = 7
14
- }
5
+ export declare const NotificationAlign: {
6
+ [x: number]: string;
7
+ TopLeft: DataTypes.PlacementEnum.TopLeft;
8
+ TopCenter: DataTypes.PlacementEnum.TopCenter;
9
+ TopRight: DataTypes.PlacementEnum.TopRight;
10
+ Center: DataTypes.PlacementEnum.Center;
11
+ BottomLeft: DataTypes.PlacementEnum.BottomLeft;
12
+ BottomCenter: DataTypes.PlacementEnum.BottomCenter;
13
+ BottomRight: DataTypes.PlacementEnum.BottomRight;
14
+ Unknown: DataTypes.PlacementEnum.Unknown;
15
+ };
16
+ export type NotificationAlign = Exclude<DataTypes.PlacementEnum, DataTypes.PlacementEnum.MiddleLeft | DataTypes.PlacementEnum.MiddleRight>;
15
17
  /**
16
18
  * Modal types
17
19
  */
@@ -1,18 +1,18 @@
1
- import { Utils } from '@etsoo/shared';
1
+ import { DataTypes, Utils } from '@etsoo/shared';
2
+ // https://devimalplanet.com/typescript-how-to-extend-one-enum-from-another
3
+ // Number index keys are still there
4
+ const { MiddleLeft, MiddleRight, ...alignItems } = DataTypes.PlacementEnum;
5
+ const newItems = {
6
+ ...alignItems
7
+ };
8
+ delete newItems[MiddleLeft];
9
+ delete newItems[MiddleRight];
2
10
  /**
3
11
  * Display align
4
12
  */
5
- export var NotificationAlign;
6
- (function (NotificationAlign) {
7
- NotificationAlign[NotificationAlign["TopLeft"] = 0] = "TopLeft";
8
- NotificationAlign[NotificationAlign["TopCenter"] = 1] = "TopCenter";
9
- NotificationAlign[NotificationAlign["TopRight"] = 2] = "TopRight";
10
- NotificationAlign[NotificationAlign["Center"] = 3] = "Center";
11
- NotificationAlign[NotificationAlign["Unknown"] = 4] = "Unknown";
12
- NotificationAlign[NotificationAlign["BottomLeft"] = 5] = "BottomLeft";
13
- NotificationAlign[NotificationAlign["BottomCenter"] = 6] = "BottomCenter";
14
- NotificationAlign[NotificationAlign["BottomRight"] = 7] = "BottomRight";
15
- })(NotificationAlign || (NotificationAlign = {}));
13
+ export const NotificationAlign = {
14
+ ...newItems
15
+ };
16
16
  /**
17
17
  * Modal types
18
18
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/notificationbase",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "description": "TypeScript notification component for extending with all features described and partially implemented",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -45,23 +45,23 @@
45
45
  },
46
46
  "homepage": "https://github.com/ETSOO/NotificationBase#readme",
47
47
  "dependencies": {
48
- "@etsoo/shared": "^1.1.77"
48
+ "@etsoo/shared": "^1.1.84"
49
49
  },
50
50
  "devDependencies": {
51
- "@babel/core": "^7.20.2",
51
+ "@babel/core": "^7.20.5",
52
52
  "@babel/plugin-transform-runtime": "^7.19.6",
53
53
  "@babel/preset-env": "^7.20.2",
54
- "@babel/runtime-corejs3": "^7.20.1",
55
- "@types/jest": "^29.2.3",
56
- "@typescript-eslint/eslint-plugin": "^5.43.0",
57
- "@typescript-eslint/parser": "^5.43.0",
54
+ "@babel/runtime-corejs3": "^7.20.6",
55
+ "@types/jest": "^29.2.4",
56
+ "@typescript-eslint/eslint-plugin": "^5.47.0",
57
+ "@typescript-eslint/parser": "^5.47.0",
58
58
  "babel-jest": "^29.3.1",
59
- "eslint": "^8.27.0",
59
+ "eslint": "^8.30.0",
60
60
  "eslint-config-airbnb-base": "^15.0.0",
61
61
  "eslint-plugin-import": "^2.26.0",
62
62
  "jest": "^29.3.1",
63
63
  "jest-environment-jsdom": "^29.3.1",
64
64
  "ts-jest": "^29.0.3",
65
- "typescript": "^4.9.3"
65
+ "typescript": "^4.9.4"
66
66
  }
67
67
  }
@@ -1,20 +1,24 @@
1
1
  import { DataTypes, Utils } from '@etsoo/shared';
2
2
 
3
+ // https://devimalplanet.com/typescript-how-to-extend-one-enum-from-another
4
+ // Number index keys are still there
5
+ const { MiddleLeft, MiddleRight, ...alignItems } = DataTypes.PlacementEnum;
6
+ const newItems = {
7
+ ...alignItems
8
+ };
9
+ delete newItems[MiddleLeft];
10
+ delete newItems[MiddleRight];
11
+
3
12
  /**
4
13
  * Display align
5
14
  */
6
- export enum NotificationAlign {
7
- TopLeft,
8
- TopCenter,
9
- TopRight,
10
-
11
- Center,
12
- Unknown, // Reserved for modal, only one instance held at the same time
13
-
14
- BottomLeft,
15
- BottomCenter,
16
- BottomRight
17
- }
15
+ export const NotificationAlign = {
16
+ ...newItems
17
+ };
18
+ export type NotificationAlign = Exclude<
19
+ DataTypes.PlacementEnum,
20
+ DataTypes.PlacementEnum.MiddleLeft | DataTypes.PlacementEnum.MiddleRight
21
+ >;
18
22
 
19
23
  /**
20
24
  * Modal types