asab_webui_components 25.1.1

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.
Files changed (103) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/LICENSE +28 -0
  3. package/README.md +3 -0
  4. package/dist/abc/Module.js +20 -0
  5. package/dist/abc/Renderer.js +67 -0
  6. package/dist/abc/Service.js +24 -0
  7. package/dist/components/AdvancedCard/AdvancedCard.js +38 -0
  8. package/dist/components/AdvancedCard/AdvancedCard.jsx +34 -0
  9. package/dist/components/AttentionRequired/AttentionRequiredBadge.js +22 -0
  10. package/dist/components/AttentionRequired/AttentionRequiredBadge.jsx +17 -0
  11. package/dist/components/Authz/ButtonWithAuthz.js +81 -0
  12. package/dist/components/Authz/ControlledSwitchWithAuthz.js +78 -0
  13. package/dist/components/Authz/Credentials.js +217 -0
  14. package/dist/components/Authz/Credentials.scss +7 -0
  15. package/dist/components/Authz/LinkWithAuthz.js +56 -0
  16. package/dist/components/Authz/UncontrolledSwitchWithAuthz.js +79 -0
  17. package/dist/components/Authz/utils/authz.js +38 -0
  18. package/dist/components/Authz/utils/isAuthorized.js +31 -0
  19. package/dist/components/Console/ConsoleCard.js +98 -0
  20. package/dist/components/Console/ConsoleCard.jsx +70 -0
  21. package/dist/components/Console/ConsoleCard.scss +26 -0
  22. package/dist/components/Console/ConsoleContext.js +14 -0
  23. package/dist/components/Console/ConsoleContext.jsx +5 -0
  24. package/dist/components/Console/components/ConsoleModeButton.js +35 -0
  25. package/dist/components/Console/components/ConsoleModeButton.jsx +30 -0
  26. package/dist/components/ContentLoader.js +57 -0
  27. package/dist/components/Context/PubSubContext.js +51 -0
  28. package/dist/components/ControlledSwitch/index.js +33 -0
  29. package/dist/components/ControlledSwitch/switch.scss +82 -0
  30. package/dist/components/DataTable/ActionButton.js +63 -0
  31. package/dist/components/DataTable/Buttons.js +116 -0
  32. package/dist/components/DataTable/CustomDropdownButton.js +49 -0
  33. package/dist/components/DataTable/DataTable.scss +37 -0
  34. package/dist/components/DataTable/LimitDropdown.js +52 -0
  35. package/dist/components/DataTable/Pagination.js +204 -0
  36. package/dist/components/DataTable/Search.js +29 -0
  37. package/dist/components/DataTable/Sort.js +44 -0
  38. package/dist/components/DataTable/Table.js +310 -0
  39. package/dist/components/DataTable/index.js +180 -0
  40. package/dist/components/DataTable2/DataTable2.js +532 -0
  41. package/dist/components/DataTable2/DataTable2.jsx +446 -0
  42. package/dist/components/DataTable2/DataTable2.scss +38 -0
  43. package/dist/components/DataTable2/DataTableContext.js +401 -0
  44. package/dist/components/DataTable2/DataTableContext.jsx +338 -0
  45. package/dist/components/DataTable2/components/filters/DataTableAdvFilter2.scss +20 -0
  46. package/dist/components/DataTable2/components/filters/DataTableAdvFilterMultiValue2.js +80 -0
  47. package/dist/components/DataTable2/components/filters/DataTableAdvFilterMultiValue2.jsx +64 -0
  48. package/dist/components/DataTable2/components/filters/DataTableAdvFilterSingleValue2.js +61 -0
  49. package/dist/components/DataTable2/components/filters/DataTableAdvFilterSingleValue2.jsx +49 -0
  50. package/dist/components/DataTable2/components/filters/DataTableSimpleFilter2.js +38 -0
  51. package/dist/components/DataTable2/components/filters/DataTableSimpleFilter2.jsx +35 -0
  52. package/dist/components/DataTable2/components/filters/index.js +26 -0
  53. package/dist/components/DataTable2/components/filters/index.jsx +3 -0
  54. package/dist/components/DataTable2/components/utils/updateTableLimit.js +37 -0
  55. package/dist/components/DataTable2/components/utils/updateTableLimit.jsx +22 -0
  56. package/dist/components/DateTime/index.js +44 -0
  57. package/dist/components/DateTime/timeToString.js +88 -0
  58. package/dist/components/DateTime/useDateFNSLocale.js +48 -0
  59. package/dist/components/FullscreenButton.js +35 -0
  60. package/dist/components/FullscreenButton.jsx +26 -0
  61. package/dist/components/Humanize/humanizeToString.js +99 -0
  62. package/dist/components/Humanize/index.js +32 -0
  63. package/dist/components/ResultCard/ResultCard.js +24 -0
  64. package/dist/components/ResultCard/ResultCard.scss +9 -0
  65. package/dist/components/Spinner.js +25 -0
  66. package/dist/components/TreeMenu/TreeMenu.js +78 -0
  67. package/dist/components/TreeMenu/TreeMenu.jsx +63 -0
  68. package/dist/components/TreeMenu/TreeMenu.scss +32 -0
  69. package/dist/components/TreeMenu/TreeMenuCard.js +189 -0
  70. package/dist/components/TreeMenu/TreeMenuItem.js +135 -0
  71. package/dist/components/TreeMenu/index.js +41 -0
  72. package/dist/components/TreeMenu/utils/flattenTree.js +54 -0
  73. package/dist/components/TreeMenu/utils/flattenTree.jsx +44 -0
  74. package/dist/components/TreeMenu/utils/formatIntoLeafFolderTree.js +56 -0
  75. package/dist/components/TreeMenu/utils/formatIntoTree.js +67 -0
  76. package/dist/components/TreeMenu/utils/removeTreeContent.js +97 -0
  77. package/dist/components/UncontrolledSwitch/index.js +60 -0
  78. package/dist/index.js +372 -0
  79. package/dist/styles/components/alert.scss +53 -0
  80. package/dist/styles/components/button.scss +104 -0
  81. package/dist/styles/components/card.scss +174 -0
  82. package/dist/styles/components/form.scss +20 -0
  83. package/dist/styles/components/html.scss +16 -0
  84. package/dist/styles/constants/colors.scss +66 -0
  85. package/dist/styles/constants/index.scss +70 -0
  86. package/dist/styles/constants/theme-dark.scss +55 -0
  87. package/dist/styles/constants/theme-light.scss +46 -0
  88. package/dist/styles/constants/theme-print.scss +198 -0
  89. package/dist/styles/index.scss +15 -0
  90. package/dist/utils/ErrorHandler.js +27 -0
  91. package/dist/utils/deepMerge.js +47 -0
  92. package/dist/utils/deepMerge.jsx +33 -0
  93. package/dist/utils/hexToString.js +27 -0
  94. package/dist/utils/isPrivateIP.js +37 -0
  95. package/dist/utils/isValidIP.js +82 -0
  96. package/dist/utils/itemExtensionHandler.js +24 -0
  97. package/dist/utils/localStorage.js +65 -0
  98. package/dist/utils/lookups/isoCodeCountries.js +264 -0
  99. package/dist/utils/monaco/problemMarkers.js +78 -0
  100. package/dist/utils/monaco/problemMarkers.jsx +57 -0
  101. package/dist/utils/removeFileExtension.js +26 -0
  102. package/dist/utils/validateAccess.js +143 -0
  103. package/package.json +43 -0
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.deepMerge = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
+ // Function to check if a value is an object but not an array
10
+ var isObject = function isObject(obj) {
11
+ return obj && (0, _typeof2["default"])(obj) === 'object' && !Array.isArray(obj);
12
+ };
13
+
14
+ // Util function for deep merging of objects
15
+ var _deepMerge = exports.deepMerge = function deepMerge(target) {
16
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
17
+ sources[_key - 1] = arguments[_key];
18
+ }
19
+ // If no sources are provided, return the target object as is
20
+ if (!sources.length) return target;
21
+
22
+ // Iterate through each source object provided
23
+ for (var _i = 0, _sources = sources; _i < _sources.length; _i++) {
24
+ var source = _sources[_i];
25
+ // Ensure both target and source are objects before merging
26
+ if (isObject(target) && isObject(source)) {
27
+ // Iterate through each key in the source object
28
+ for (var key in source) {
29
+ // If the value of the current key is an object, perform a recursive deep merge
30
+ if (isObject(source[key])) {
31
+ // If the key does not exist in the target, initialize it as an empty object
32
+ if (!target[key]) {
33
+ target[key] = {};
34
+ }
35
+ // Recursively merge the nested objects
36
+ _deepMerge(target[key], source[key]);
37
+ } else {
38
+ // For non-object values, directly assign the value to the target
39
+ target[key] = source[key];
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ // Return the merged object
46
+ return target;
47
+ };
@@ -0,0 +1,33 @@
1
+ // Function to check if a value is an object but not an array
2
+ const isObject = (obj) => obj && (typeof obj === 'object') && !Array.isArray(obj);
3
+
4
+ // Util function for deep merging of objects
5
+ export const deepMerge = (target, ...sources) => {
6
+ // If no sources are provided, return the target object as is
7
+ if (!sources.length) return target;
8
+
9
+ // Iterate through each source object provided
10
+ for (const source of sources) {
11
+ // Ensure both target and source are objects before merging
12
+ if (isObject(target) && isObject(source)) {
13
+ // Iterate through each key in the source object
14
+ for (const key in source) {
15
+ // If the value of the current key is an object, perform a recursive deep merge
16
+ if (isObject(source[key])) {
17
+ // If the key does not exist in the target, initialize it as an empty object
18
+ if (!target[key]) {
19
+ target[key] = {};
20
+ }
21
+ // Recursively merge the nested objects
22
+ deepMerge(target[key], source[key]);
23
+ } else {
24
+ // For non-object values, directly assign the value to the target
25
+ target[key] = source[key];
26
+ }
27
+ }
28
+ }
29
+ }
30
+
31
+ // Return the merged object
32
+ return target;
33
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hexToString = hexToString;
7
+ /*
8
+ The hexToString function converts a hexadecimal string into its corresponding ASCII string
9
+
10
+ Example of usage:
11
+
12
+ const hex = '48656c6c6f20576f726c64'
13
+ const asciiString = hexToString(hex);
14
+
15
+ console.log(asciiString); // Output: 'Hello World'
16
+
17
+ */
18
+
19
+ // Convert a hex string into ASCII string
20
+ function hexToString(hex) {
21
+ var str = '';
22
+ for (var i = 0; i < hex.length; i += 2) {
23
+ str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
24
+ }
25
+ return str;
26
+ }
27
+ ;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isPrivateIP = isPrivateIP;
7
+ /*
8
+ The isPrivateIP function checks if a given IP address is a private IP address.
9
+ This function supports both IPv4 and IPv6 formats.
10
+
11
+ Example of usage:
12
+
13
+ const ip1 = '192.168.1.1';
14
+ const result1 = isPrivate(ip1);
15
+ console.log(result1); // Output: true
16
+ */
17
+
18
+ // Utility function to check if an IP address is private
19
+ function isPrivateIP(ip) {
20
+ var privateIPv4Ranges = [/^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, /^172\.(1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}$/, /^192\.168\.\d{1,3}\.\d{1,3}$/];
21
+ var privateIPv6Ranges = [/^fc00:/, /^fd00:/];
22
+
23
+ // Check if the IP is a private IPv4 address
24
+ if (privateIPv4Ranges.some(function (range) {
25
+ return range.test(ip);
26
+ })) {
27
+ return true;
28
+ }
29
+
30
+ // Check if the IP is a private IPv6 address
31
+ if (privateIPv6Ranges.some(function (range) {
32
+ return range.test(ip);
33
+ })) {
34
+ return true;
35
+ }
36
+ return false;
37
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isValidIP = isValidIP;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /*
11
+ The isValidIPAddress function checks if a given IP address is a valid IP address.
12
+
13
+ Example of usage:
14
+
15
+ const ip1 = '192.168.1.1';
16
+ const result1 = isValidIP(ip1);
17
+ console.log(result1); // Output: true
18
+ */
19
+
20
+ // Function to check if IP address is valid IPv4 or IPv6 address
21
+ function isValidIP(ip) {
22
+ if (ip == undefined || typeof ip !== 'string' || ip === '') {
23
+ // Check if address is string and not empty
24
+ return false;
25
+ }
26
+ return isValidIPv4(ip) || isValidIPv6(ip);
27
+ }
28
+
29
+ // Function to validate IPv4 address
30
+ function isValidIPv4(ip) {
31
+ var octets = ip.split('.'); // Octet is on of the segments of an IP address
32
+ if (octets.length !== 4) return false; // Check if there are exactly 4 octets
33
+ var _iterator = _createForOfIteratorHelper(octets),
34
+ _step;
35
+ try {
36
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
37
+ var octet = _step.value;
38
+ var num = Number(octet);
39
+ if (num < 0 || num > 255 || octet !== String(num)) {
40
+ // Check if is valid number or has leading zeros
41
+ return false;
42
+ }
43
+ }
44
+ } catch (err) {
45
+ _iterator.e(err);
46
+ } finally {
47
+ _iterator.f();
48
+ }
49
+ return true; // Valid IPv4
50
+ }
51
+ ;
52
+
53
+ // Function to validate IPv6 address
54
+ function isValidIPv6(ip) {
55
+ var blocks = ip.split(':');
56
+ if (blocks.length < 3 || blocks.length > 8) return false; // Check if there are between 3 and 8 blocks
57
+
58
+ var doubleColonCount = 0; // Count occurrences of '::'
59
+ var _iterator2 = _createForOfIteratorHelper(blocks),
60
+ _step2;
61
+ try {
62
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
63
+ var block = _step2.value;
64
+ if (block === '') {
65
+ doubleColonCount++;
66
+ continue; // Skip empty blocks (indicating '::')
67
+ }
68
+
69
+ // Check if the block is a valid hex block
70
+ if (block.length > 4 || !/^[0-9a-fA-F]{0,4}$/.test(block)) {
71
+ // Regex check for valid hexadecimal digit (numbers 1-9, letters a-f)
72
+ return false;
73
+ }
74
+ }
75
+ } catch (err) {
76
+ _iterator2.e(err);
77
+ } finally {
78
+ _iterator2.f();
79
+ }
80
+ return doubleColonCount <= 1; // Valid if '::' appears only once
81
+ }
82
+ ;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.itemExtensionHandler = itemExtensionHandler;
7
+ /*
8
+ itemExtensionHandler checks if the variable has an extension and returns it
9
+ This function takes 2 arguments:
10
+ - itemName - string
11
+ - extension - string, file extension in this format '.json' or '.yaml'
12
+ */
13
+ function itemExtensionHandler(itemName, extension) {
14
+ // Get the last five characters of itemName for extension checking
15
+ var lastFiveChars = itemName.slice(-5);
16
+ // Check if itemName already has an extension that's not '.io' or '.d'
17
+ if (lastFiveChars.includes('.') && !itemName.endsWith('.io') && !itemName.endsWith('.d')) {
18
+ // If itemName has a non-special extension, return the original itemName
19
+ return itemName;
20
+ }
21
+
22
+ // If itemName has no valid extension, add the new extension
23
+ return "".concat(itemName).concat(extension);
24
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getFromLS = getFromLS;
8
+ exports.removeFromLS = removeFromLS;
9
+ exports.saveToLS = saveToLS;
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ /*
12
+ Reusable utils for saving, getting and removing LocalStorage content.
13
+
14
+ `params` property is optional
15
+
16
+ Example of usage:
17
+
18
+ - Save:
19
+ saveToLS("My Storage key", "My URL params", "filter=abc&size=99");
20
+ saveToLS("My Other key", "123 abc");
21
+ - Get:
22
+ getFromLS("My Storage key");
23
+ - Remove:
24
+ removeFromLS("My Storage key");
25
+ */
26
+
27
+ // Save pathname and params to localstorage
28
+ function saveToLS(key, entry, params) {
29
+ if (global.localStorage) {
30
+ if (params) {
31
+ // For pathname save to LS
32
+ global.localStorage.setItem(key.toString(), JSON.stringify((0, _defineProperty2["default"])({}, entry, params)));
33
+ } else {
34
+ // For favourite fields save to LS
35
+ global.localStorage.setItem(key.toString(), JSON.stringify(entry));
36
+ }
37
+ }
38
+ }
39
+
40
+ // Get pathname and params from localstorage
41
+ function getFromLS(key, entry) {
42
+ var ls = {};
43
+ if (global.localStorage) {
44
+ try {
45
+ ls = JSON.parse(global.localStorage.getItem(key === null || key === void 0 ? void 0 : key.toString())) || {};
46
+ } catch (e) {
47
+ /*Ignore*/
48
+ }
49
+ if (entry) {
50
+ ls = ls[entry] ? ls[entry] : {};
51
+ }
52
+ }
53
+ return ls;
54
+ }
55
+
56
+ // Remove item from localstorage
57
+ function removeFromLS(key) {
58
+ if (global.localStorage) {
59
+ try {
60
+ global.localStorage.removeItem(key.toString());
61
+ } catch (e) {
62
+ /*Ignore*/
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isoCodeCountries = void 0;
7
+ /*
8
+ The ISO codes for countries are aligned with the ISO 3166-2,
9
+ which is an international standard of short alphanumeric codes to represent
10
+ relevant countries.
11
+ The list was taken from: https://en.wikipedia.org/wiki/ISO_3166-2
12
+ */
13
+
14
+ var isoCodeCountries = exports.isoCodeCountries = {
15
+ "AD": "Andorra",
16
+ "AE": "United Arab Emirates",
17
+ "AF": "Afghanistan",
18
+ "AG": "Antigua and Barbuda",
19
+ "AI": "Anguilla",
20
+ "AL": "Albania",
21
+ "AM": "Armenia",
22
+ "AO": "Angola",
23
+ "AQ": "Antarctica",
24
+ "AR": "Argentina",
25
+ "AS": "American Samoa",
26
+ "AT": "Austria",
27
+ "AU": "Australia",
28
+ "AW": "Aruba",
29
+ "AX": "Åland Islands",
30
+ "AZ": "Azerbaijan",
31
+ "BA": "Bosnia and Herzegovina",
32
+ "BB": "Barbados",
33
+ "BD": "Bangladesh",
34
+ "BE": "Belgium",
35
+ "BF": "Burkina Faso",
36
+ "BG": "Bulgaria",
37
+ "BH": "Bahrain",
38
+ "BI": "Burundi",
39
+ "BJ": "Benin",
40
+ "BL": "Saint Barthélemy",
41
+ "BM": "Bermuda",
42
+ "BN": "Brunei Darussalam",
43
+ "BO": "Bolivia, Plurinational State of",
44
+ "BQ": "Bonaire, Sint Eustatius and Saba",
45
+ "BR": "Brazil",
46
+ "BS": "Bahamas",
47
+ "BT": "Bhutan",
48
+ "BV": "Bouvet Island",
49
+ "BW": "Botswana",
50
+ "BY": "Belarus",
51
+ "BZ": "Belize",
52
+ "CA": "Canada",
53
+ "CC": "Cocos (Keeling) Islands",
54
+ "CD": "Congo, Democratic Republic of the",
55
+ "CF": "Central African Republic",
56
+ "CG": "Congo",
57
+ "CH": "Switzerland",
58
+ "CI": "Côte d'Ivoire",
59
+ "CK": "Cook Islands",
60
+ "CL": "Chile",
61
+ "CM": "Cameroon",
62
+ "CN": "China",
63
+ "CO": "Colombia",
64
+ "CR": "Costa Rica",
65
+ "CU": "Cuba",
66
+ "CV": "Cape Verde",
67
+ "CW": "Curaçao",
68
+ "CX": "Christmas Island",
69
+ "CY": "Cyprus",
70
+ "CZ": "Czechia",
71
+ "DE": "Germany",
72
+ "DJ": "Djibouti",
73
+ "DK": "Denmark",
74
+ "DM": "Dominica",
75
+ "DO": "Dominican Republic",
76
+ "DZ": "Algeria",
77
+ "EC": "Ecuador",
78
+ "EE": "Estonia",
79
+ "EG": "Egypt",
80
+ "EH": "Western Sahara",
81
+ "ER": "Eritrea",
82
+ "ES": "Spain",
83
+ "ET": "Ethiopia",
84
+ "FI": "Finland",
85
+ "FJ": "Fiji",
86
+ "FK": "Falkland Islands (Malvinas)",
87
+ "FM": "Micronesia, Federated States of",
88
+ "FO": "Faroe Islands",
89
+ "FR": "France",
90
+ "GA": "Gabon",
91
+ "GB": "United Kingdom of Great Britain and Northern Ireland",
92
+ "GD": "Grenada",
93
+ "GE": "Georgia",
94
+ "GF": "French Guiana",
95
+ "GG": "Guernsey",
96
+ "GH": "Ghana",
97
+ "GI": "Gibraltar",
98
+ "GL": "Greenland",
99
+ "GM": "Gambia",
100
+ "GN": "Guinea",
101
+ "GP": "Guadeloupe",
102
+ "GQ": "Equatorial Guinea",
103
+ "GR": "Greece",
104
+ "GS": "South Georgia and the South Sandwich Islands",
105
+ "GT": "Guatemala",
106
+ "GU": "Guam",
107
+ "GW": "Guinea-Bissau",
108
+ "GY": "Guyana",
109
+ "HK": "Hong Kong",
110
+ "HM": "Heard Island and Mcdonald Islands",
111
+ "HN": "Honduras",
112
+ "HR": "Croatia",
113
+ "HT": "Haiti",
114
+ "HU": "Hungary",
115
+ "ID": "Indonesia",
116
+ "IE": "Ireland",
117
+ "IL": "Israel",
118
+ "IM": "Isle of Man",
119
+ "IN": "India",
120
+ "IO": "British Indian Ocean Territory",
121
+ "IQ": "Iraq",
122
+ "IR": "Iran, Islamic Republic Of",
123
+ "IS": "Iceland",
124
+ "IT": "Italy",
125
+ "JE": "Jersey",
126
+ "JM": "Jamaica",
127
+ "JO": "Jordan",
128
+ "JP": "Japan",
129
+ "KE": "Kenya",
130
+ "KG": "Kyrgyzstan",
131
+ "KH": "Cambodia",
132
+ "KI": "Kiribati",
133
+ "KM": "Comoros",
134
+ "KN": "Saint Kitts and Nevis",
135
+ "KP": "Korea, Democratic People's Republic of",
136
+ "KR": "Korea, Republic of",
137
+ "KW": "Kuwait",
138
+ "KY": "Cayman Islands",
139
+ "KZ": "Kazakhstan",
140
+ "LA": "Lao People'S Democratic Republic",
141
+ "LB": "Lebanon",
142
+ "LC": "Saint Lucia",
143
+ "LI": "Liechtenstein",
144
+ "LK": "Sri Lanka",
145
+ "LR": "Liberia",
146
+ "LS": "Lesotho",
147
+ "LT": "Lithuania",
148
+ "LU": "Luxembourg",
149
+ "LV": "Latvia",
150
+ "LY": "Libya",
151
+ "MA": "Morocco",
152
+ "MC": "Monaco",
153
+ "MD": "Moldova, Republic of",
154
+ "ME": "Montenegro",
155
+ "MF": "Saint Martin",
156
+ "MG": "Madagascar",
157
+ "MH": "Marshall Islands",
158
+ "MK": "North Macedonia",
159
+ "ML": "Mali",
160
+ "MM": "Myanmar",
161
+ "MN": "Mongolia",
162
+ "MO": "Macao",
163
+ "MP": "Northern Mariana Islands",
164
+ "MQ": "Martinique",
165
+ "MR": "Mauritania",
166
+ "MS": "Montserrat",
167
+ "MT": "Malta",
168
+ "MU": "Mauritius",
169
+ "MV": "Maldives",
170
+ "MW": "Malawi",
171
+ "MX": "Mexico",
172
+ "MY": "Malaysia",
173
+ "MZ": "Mozambique",
174
+ "NA": "Namibia",
175
+ "NC": "New Caledonia",
176
+ "NE": "Niger",
177
+ "NF": "Norfolk Island",
178
+ "NG": "Nigeria",
179
+ "NI": "Nicaragua",
180
+ "NL": "Netherlands, Kingdom of the",
181
+ "NO": "Norway",
182
+ "NP": "Nepal",
183
+ "NR": "Nauru",
184
+ "NU": "Niue",
185
+ "NZ": "New Zealand",
186
+ "OM": "Oman",
187
+ "PA": "Panama",
188
+ "PE": "Peru",
189
+ "PF": "French Polynesia",
190
+ "PG": "Papua New Guinea",
191
+ "PH": "Philippines",
192
+ "PK": "Pakistan",
193
+ "PL": "Poland",
194
+ "PM": "Saint Pierre and Miquelon",
195
+ "PN": "Pitcairn",
196
+ "PR": "Puerto Rico",
197
+ "PS": "Palestine, State of",
198
+ "PT": "Portugal",
199
+ "PW": "Palau",
200
+ "PY": "Paraguay",
201
+ "QA": "Qatar",
202
+ "RE": "Reunion",
203
+ "RO": "Romania",
204
+ "RS": "Serbia",
205
+ "RU": "Russian Federation",
206
+ "RW": "Rwanda",
207
+ "SA": "Saudi Arabia",
208
+ "SB": "Solomon Islands",
209
+ "SC": "Seychelles",
210
+ "SD": "Sudan",
211
+ "SE": "Sweden",
212
+ "SG": "Singapore",
213
+ "SH": "Saint Helena, Ascension and Tristan da Cunha",
214
+ "SI": "Slovenia",
215
+ "SJ": "Svalbard and Jan Mayen",
216
+ "SK": "Slovakia",
217
+ "SL": "Sierra Leone",
218
+ "SM": "San Marino",
219
+ "SN": "Senegal",
220
+ "SO": "Somalia",
221
+ "SR": "Suriname",
222
+ "SS": "South Sudan",
223
+ "ST": "Sao Tome and Principe",
224
+ "SV": "El Salvador",
225
+ "SX": "Sint Maarten",
226
+ "SY": "Syrian Arab Republic",
227
+ "SZ": "Eswatini",
228
+ "TC": "Turks and Caicos Islands",
229
+ "TD": "Chad",
230
+ "TF": "French Southern Territories",
231
+ "TG": "Togo",
232
+ "TH": "Thailand",
233
+ "TJ": "Tajikistan",
234
+ "TK": "Tokelau",
235
+ "TL": "Timor-Leste",
236
+ "TM": "Turkmenistan",
237
+ "TN": "Tunisia",
238
+ "TO": "Tonga",
239
+ "TR": "Türkiye",
240
+ "TT": "Trinidad and Tobago",
241
+ "TV": "Tuvalu",
242
+ "TW": "Taiwan, Province of China",
243
+ "TZ": "Tanzania, United Republic of",
244
+ "UA": "Ukraine",
245
+ "UG": "Uganda",
246
+ "UM": "United States Minor Outlying Islands",
247
+ "US": "United States of America",
248
+ "UY": "Uruguay",
249
+ "UZ": "Uzbekistan",
250
+ "VA": "Holy See",
251
+ "VC": "Saint Vincent and the Grenadines",
252
+ "VE": "Venezuela, Bolivian Republic of",
253
+ "VG": "Virgin Islands, British",
254
+ "VI": "Virgin Islands, U.S.",
255
+ "VN": "Viet Nam",
256
+ "VU": "Vanuatu",
257
+ "WF": "Wallis and Futuna",
258
+ "WS": "Samoa",
259
+ "YE": "Yemen",
260
+ "YT": "Mayotte",
261
+ "ZA": "South Africa",
262
+ "ZM": "Zambia",
263
+ "ZW": "Zimbabwe"
264
+ };
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.problemMarkers = void 0;
7
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10
+ /*
11
+ Monaco editor problem markers
12
+
13
+ This is to be used only with Monaco editor!
14
+
15
+ Example of usage
16
+
17
+ ```
18
+ import * as monaco from 'monaco-editor'; // Import monaco
19
+ ...
20
+
21
+ const model = editorRef.current.getModel(); // Set model (this is just an example)
22
+ ...
23
+
24
+ // Use setProblemMarkers as a method wherever needed to set a problem markers
25
+ const setProblemMarkers = (problems, model) => {
26
+ // Use problemMarkers util from asab webui components to get the monaco markers
27
+ const markers = problemMarkers({problems, model});
28
+
29
+ monaco.editor.setModelMarkers(model, 'owner', markers);
30
+ };
31
+ ...
32
+ ```
33
+
34
+ */
35
+
36
+ var problemMarkers = exports.problemMarkers = function problemMarkers(_ref) {
37
+ var problems = _ref.problems,
38
+ model = _ref.model;
39
+ var markers = [];
40
+ if (problems) {
41
+ var _iterator = _createForOfIteratorHelper(problems),
42
+ _step;
43
+ try {
44
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
45
+ var problem = _step.value;
46
+ var message = problem.message || problem.problem; // Fallback on problem
47
+ // Validation on empty lines
48
+ if (message && !message.endsWith('\n\n')) {
49
+ // Add a empty line to the end of a message if the message ends with less than 2 newlines
50
+ if (!message.endsWith('\n')) {
51
+ message = message + '\n\n';
52
+ } else {
53
+ message = message + '\n';
54
+ }
55
+ }
56
+ markers.push({
57
+ message: message,
58
+ severity: problem.severity || 8,
59
+ // 1 = hint, 2 = info, 4 = warning, 8 = error
60
+ startLineNumber: problem.line_start || problem.line,
61
+ startColumn: problem.column_start || problem.column,
62
+ endLineNumber: problem.line_end || problem.line,
63
+ endColumn: problem.column_end || problem.column_start && (model === null || model === void 0 ? void 0 : model.getLineLength(problem.column_start)) + 1 || problem.line && (model === null || model === void 0 ? void 0 : model.getLineLength(problem.line)) + 1,
64
+ tags: problem.tags || null,
65
+ // Example [2] (possible values 2 | 1)
66
+ code: problem.code || null,
67
+ // Example { target: 'https://teskalabs.com', value: 'TeskaLabs' }
68
+ source: problem.source || null // Example 'asab-parser'
69
+ });
70
+ }
71
+ } catch (err) {
72
+ _iterator.e(err);
73
+ } finally {
74
+ _iterator.f();
75
+ }
76
+ }
77
+ return markers;
78
+ };