asab_webui_components 25.2.7-alpha.0 → 25.2.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.
@@ -9,20 +9,18 @@ exports.Credentials = Credentials;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
13
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14
  var _react = _interopRequireWildcard(require("react"));
14
15
  var _reactI18next = require("react-i18next");
15
16
  var _reactRedux = require("react-redux");
16
17
  var _LinkWithAuthz = require("./LinkWithAuthz");
17
18
  require("./Credentials.scss");
18
- var _excluded = ["isPlainCredentials"];
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
21
21
  function Credentials(_ref) {
22
22
  var _props$apiPath, _props$cleanupTime, _props$app;
23
- var _ref$isPlainCredentia = _ref.isPlainCredentials,
24
- isPlainCredentials = _ref$isPlainCredentia === void 0 ? false : _ref$isPlainCredentia,
25
- props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
23
+ var props = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref), _ref));
26
24
  // Validation on undefined credentials_ids
27
25
  if (props.credentials_ids == undefined) {
28
26
  return '';
@@ -126,9 +124,6 @@ function Credentials(_ref) {
126
124
  }
127
125
  setCredentials(usernamesToRender);
128
126
  };
129
- if (isPlainCredentials === true && credentials && credentials.length !== 0) {
130
- return renderPlainUsername();
131
- }
132
127
  function renderPlainCredentials(credentials_ids) {
133
128
  return credentials_ids.map(function (credentials_id, i) {
134
129
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -141,16 +136,6 @@ function Credentials(_ref) {
141
136
  }, credentials_id));
142
137
  });
143
138
  }
144
- function renderPlainUsername() {
145
- return credentials.map(function (credentialObj, i) {
146
- return /*#__PURE__*/_react["default"].createElement("div", {
147
- key: i,
148
- title: credentialObj.username || credentialObj.id
149
- }, /*#__PURE__*/_react["default"].createElement("i", {
150
- className: "bi bi-person pe-1"
151
- }), /*#__PURE__*/_react["default"].createElement("span", null, credentialObj.username || credentialObj.id));
152
- });
153
- }
154
139
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, credentials && credentials.length !== 0 ? credentials.map(function (credentialObj, i) {
155
140
  return /*#__PURE__*/_react["default"].createElement("div", {
156
141
  key: i,
@@ -9,7 +9,6 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _timeToString = _interopRequireDefault(require("./timeToString.js"));
10
10
  var _useDateFNSLocale = _interopRequireDefault(require("./useDateFNSLocale.js"));
11
11
  var _InvalidDate = require("./InvalidDate.js");
12
- var _splDatetimeToIso = require("./splDatetimeToIso");
13
12
  // Component that displays the absolute time and shows the relative time on hover
14
13
  function DateTime(props) {
15
14
  if (props.value == undefined) {
@@ -20,11 +19,10 @@ function DateTime(props) {
20
19
 
21
20
  // Declaration of locale must be below span returned for `undefined` values to avoid bad react state handling in useDateFNSLocale
22
21
  var locale = (0, _useDateFNSLocale["default"])();
23
- var datetime = validateDateTime(props.value);
24
- if (datetime.toString() === 'Invalid Date') {
22
+ if (new Date(props.value).toString() === 'Invalid Date') {
25
23
  return /*#__PURE__*/_react["default"].createElement(_InvalidDate.InvalidDate, null);
26
24
  }
27
- var date = (0, _timeToString["default"])(datetime, props.dateTimeFormat, locale);
25
+ var date = (0, _timeToString["default"])(props.value, props.dateTimeFormat, locale);
28
26
 
29
27
  // Check for invalid date from timeToString method
30
28
  if (date === 'Invalid Date') {
@@ -36,58 +34,4 @@ function DateTime(props) {
36
34
  }, /*#__PURE__*/_react["default"].createElement("i", {
37
35
  className: "bi bi-clock pe-1"
38
36
  }), date.date);
39
- }
40
- function validateDateTime(value) {
41
- // Return 'Invalid Date' if the input is null or undefined
42
- if (value == null) {
43
- return 'Invalid Date';
44
- }
45
-
46
- // Handle BigInt values explicitly
47
- if (typeof value === 'bigint') {
48
- // SP-Lang datetime format is represented as BigInt
49
- return (0, _splDatetimeToIso.splDatetimeToIso)(value);
50
- }
51
-
52
- // Handle string values
53
- if (typeof value === 'string') {
54
- var parsed = new Date(value); // Try to parse the string into a Date object
55
- // If the parsed date is invalid, return 'Invalid Date'; otherwise, return the date
56
- return isNaN(parsed.getTime()) ? 'Invalid Date' : parsed;
57
- }
58
-
59
- // Handle number values
60
- if (typeof value === 'number') {
61
- // Reject infinite, NaN, or negative numbers
62
- if (!Number.isFinite(value) || value < 0) {
63
- return 'Invalid Date';
64
- }
65
-
66
- // Consider numbers ≥ 1e17 as SP-Lang datetime format
67
- if (value >= 1e17) {
68
- // Convert number to BigInt and parse as SP-Lang datetime
69
- return (0, _splDatetimeToIso.splDatetimeToIso)(BigInt(value));
70
- }
71
-
72
- // Handle Unix timestamp in seconds (less than 1e10)
73
- if (value < 1e10) {
74
- return new Date(value * 1000); // Convert seconds to milliseconds
75
- }
76
-
77
- // Handle timestamps in milliseconds (less than 1e13)
78
- if (value < 1e13) {
79
- return new Date(value); // Already in milliseconds
80
- }
81
-
82
- // Handle timestamps in microseconds (less than 1e16)
83
- if (value < 1e16) {
84
- return new Date(value / 1000); // Convert microseconds to milliseconds
85
- }
86
-
87
- // Numbers that don't fall into any known range are considered invalid
88
- return 'Invalid Date';
89
- }
90
-
91
- // All other types are unsupported and result in 'Invalid Date'
92
- return 'Invalid Date';
93
37
  }
@@ -3,7 +3,6 @@ import React from 'react';
3
3
  import timeToString from './timeToString.js';
4
4
  import useDateFNSLocale from './useDateFNSLocale.js';
5
5
  import { InvalidDate } from './InvalidDate.jsx';
6
- import { splDatetimeToIso } from './splDatetimeToIso';
7
6
 
8
7
  // Component that displays the absolute time and shows the relative time on hover
9
8
  export function DateTime(props) {
@@ -15,16 +14,13 @@ export function DateTime(props) {
15
14
 
16
15
  // Declaration of locale must be below span returned for `undefined` values to avoid bad react state handling in useDateFNSLocale
17
16
  const locale = useDateFNSLocale();
18
-
19
- const datetime = validateDateTime(props.value);
20
-
21
- if (datetime.toString() === 'Invalid Date') {
17
+ if (new Date(props.value).toString() === 'Invalid Date') {
22
18
  return (
23
19
  <InvalidDate />
24
20
  );
25
21
  }
26
22
 
27
- const date = timeToString(datetime, props.dateTimeFormat, locale);
23
+ const date = timeToString(props.value, props.dateTimeFormat, locale);
28
24
 
29
25
  // Check for invalid date from timeToString method
30
26
  if (date === 'Invalid Date') {
@@ -43,58 +39,3 @@ export function DateTime(props) {
43
39
  </span>
44
40
  );
45
41
  }
46
-
47
- function validateDateTime(value) {
48
- // Return 'Invalid Date' if the input is null or undefined
49
- if (value == null) {
50
- return 'Invalid Date';
51
- }
52
-
53
- // Handle BigInt values explicitly
54
- if (typeof value === 'bigint') {
55
- // SP-Lang datetime format is represented as BigInt
56
- return splDatetimeToIso(value);
57
- }
58
-
59
- // Handle string values
60
- if (typeof value === 'string') {
61
- const parsed = new Date(value); // Try to parse the string into a Date object
62
- // If the parsed date is invalid, return 'Invalid Date'; otherwise, return the date
63
- return isNaN(parsed.getTime()) ? 'Invalid Date' : parsed;
64
- }
65
-
66
- // Handle number values
67
- if (typeof value === 'number') {
68
- // Reject infinite, NaN, or negative numbers
69
- if (!Number.isFinite(value) || value < 0) {
70
- return 'Invalid Date';
71
- }
72
-
73
- // Consider numbers ≥ 1e17 as SP-Lang datetime format
74
- if (value >= 1e17) {
75
- // Convert number to BigInt and parse as SP-Lang datetime
76
- return splDatetimeToIso(BigInt(value));
77
- }
78
-
79
- // Handle Unix timestamp in seconds (less than 1e10)
80
- if (value < 1e10) {
81
- return new Date(value * 1000); // Convert seconds to milliseconds
82
- }
83
-
84
- // Handle timestamps in milliseconds (less than 1e13)
85
- if (value < 1e13) {
86
- return new Date(value); // Already in milliseconds
87
- }
88
-
89
- // Handle timestamps in microseconds (less than 1e16)
90
- if (value < 1e16) {
91
- return new Date(value / 1000); // Convert microseconds to milliseconds
92
- }
93
-
94
- // Numbers that don't fall into any known range are considered invalid
95
- return 'Invalid Date';
96
- }
97
-
98
- // All other types are unsupported and result in 'Invalid Date'
99
- return 'Invalid Date';
100
- }
package/dist/index.js CHANGED
@@ -208,12 +208,6 @@ Object.defineProperty(exports, "UncontrolledSwitchWithAuthz", {
208
208
  return _UncontrolledSwitchWithAuthz.UncontrolledSwitchWithAuthz;
209
209
  }
210
210
  });
211
- Object.defineProperty(exports, "credentialsToString", {
212
- enumerable: true,
213
- get: function get() {
214
- return _Credentials.credentialsToString;
215
- }
216
- });
217
211
  Object.defineProperty(exports, "deepMerge", {
218
212
  enumerable: true,
219
213
  get: function get() {
@@ -46,14 +46,11 @@
46
46
  --slate-smoke: #6a6a6a8f; // The color of the disabled item text in the TreeMenu
47
47
  --slate-smoke-rgb: 106, 106, 106;
48
48
 
49
- --light-honey: #ffe082; // The color of the lowest Alert severity
50
- --light-honey-rgb: 255, 224, 130;
49
+ --deep-red: #D1004A; // The color of the highest Alert severity
50
+ --deep-red-rgb: 209, 0, 74;
51
51
 
52
- --bright-orange: #ff9800; // The color of the medium Alert severity
53
- --bright-orange-rgb: 255, 125, 0;
54
-
55
- --fiery-sunset: #ff5722; // The color of the high Alert severity
56
- --fiery-sunset-rgb: 255, 87, 34;
52
+ --deep-green: #0E6027; // The color of the lowest Alert severity
53
+ --deep-green-rgb: 14, 96, 39;
57
54
 
58
55
  --charcoal: #494949; // Console background dark theme
59
56
  --charcoal-rgb: 0, 43, 54;
@@ -66,4 +63,10 @@
66
63
 
67
64
  --moody-blues: #586E75; // Console font color for light theme
68
65
  --moody-blues-rgb: rgb(88, 110, 117);
69
- }
66
+
67
+ --soft-gray: #e1e2e7; // Emulate table hover row color for light theme
68
+ --soft-gray-rgb: rgb(225, 226, 231);
69
+
70
+ --charcoal-blue: #202636; // Emulate table hover row color for dark theme
71
+ --charcoal-blue-rgb: rgb(32, 38, 54);
72
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asab_webui_components",
3
- "version": "25.2.7-alpha.0",
3
+ "version": "25.2.7",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "TeskaLabs ASAB WebUI Components Library",
6
6
  "contributors": [
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@babel/runtime": "^7.22.11",
40
- "axios": "^0.21.1",
40
+ "axios": "^1.8.4",
41
41
  "bootstrap": "^5.3.1",
42
42
  "bootstrap-icons": "^1.10.5",
43
43
  "date-fns": "^2.30.0",
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.splDatetimeToIso = splDatetimeToIso;
7
- function splDatetimeToIso(datetime) {
8
- // Check if datetime is a number or BigInt
9
- if (typeof datetime !== 'bigint' && typeof datetime !== 'number') {
10
- return 'Invalid Date';
11
- }
12
- var BigIntDatetime = BigInt(datetime); // Convert to BigInt for correct bitwise operations
13
-
14
- // Year extraction (bits 46-60)
15
- var year = Number(BigIntDatetime >> BigInt(46) & BigInt(4095)); // 14 bits
16
- if (year >= 8192) {
17
- year -= 8192; // Adjust for sign bit if necessary
18
- }
19
-
20
- // Month extraction (bits 42-46)
21
- var month = Number(BigIntDatetime >> BigInt(42) & BigInt(15)); // 4 bits
22
-
23
- // Day extraction (bits 37-42)
24
- var day = Number(BigIntDatetime >> BigInt(37) & BigInt(31)); // 5 bits
25
-
26
- // Hour extraction (bits 32-37)
27
- var hour = Number(BigIntDatetime >> BigInt(32) & BigInt(31)); // 5 bits
28
-
29
- // Minute extraction (bits 26-32)
30
- var minute = Number(BigIntDatetime >> BigInt(26) & BigInt(63)); // 6 bits
31
-
32
- // Second extraction (bits 20-26)
33
- var second = Number(BigIntDatetime >> BigInt(20) & BigInt(63)); // 6 bits
34
-
35
- // Microsecond extraction (bits 0-20)
36
- var microsecond = Number(BigIntDatetime & BigInt(2097151)); // 20 bits
37
-
38
- // Adjust for zero-based month
39
- month += 1;
40
-
41
- // Check if the values are correct
42
- if (year < 0 || month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59 || second > 59) {
43
- return 'Invalid Date';
44
- }
45
-
46
- // Format date string
47
- return "".concat(year.toString().padStart(4, '0'), "-").concat(month.toString().padStart(2, '0'), "-").concat(day.toString().padStart(2, '0'), "T").concat(hour.toString().padStart(2, '0'), ":").concat(minute.toString().padStart(2, '0'), ":").concat(second.toString().padStart(2, '0'), ".").concat(microsecond.toString().padStart(6, '0'), "Z");
48
- }