iguazio.dashboard-react-controls 3.2.17 → 3.2.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.
- package/dist/elements/TableLinkCell/TableLinkCell.d.ts.map +1 -1
- package/dist/elements/TableLinkCell/TableLinkCell.mjs +24 -21
- package/dist/elements/TableLinkCell/TableLinkCell.mjs.map +1 -1
- package/dist/images/entity-type-infra.svg +3 -0
- package/dist/utils/datetime.util.mjs +20 -20
- package/dist/utils/datetime.util.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLinkCell.d.ts","sourceRoot":"","sources":["../../../src/lib/elements/TableLinkCell/TableLinkCell.jsx"],"names":[],"mappings":";AAkCA;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TableLinkCell.d.ts","sourceRoot":"","sources":["../../../src/lib/elements/TableLinkCell/TableLinkCell.jsx"],"names":[],"mappings":";AAkCA;;;;;;;;;gBAsGC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as o, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Link as
|
|
3
|
+
import { Link as w } from "react-router-dom";
|
|
4
4
|
import a from "prop-types";
|
|
5
5
|
import u from "classnames";
|
|
6
6
|
import r from "../../components/Tooltip/Tooltip.mjs";
|
|
7
7
|
import i from "../../components/TooltipTemplate/TextTooltipTemplate.mjs";
|
|
8
8
|
import { formatDatetime as N } from "../../utils/datetime.util.mjs";
|
|
9
|
-
import { truncateUid as
|
|
9
|
+
import { truncateUid as k } from "../../utils/string.util.mjs";
|
|
10
10
|
import T from "../../images/arrow.svg.mjs";
|
|
11
11
|
/* empty css */
|
|
12
12
|
const C = ({
|
|
@@ -14,29 +14,32 @@ const C = ({
|
|
|
14
14
|
className: b = "",
|
|
15
15
|
item: t,
|
|
16
16
|
link: n,
|
|
17
|
-
selectItem:
|
|
17
|
+
selectItem: x,
|
|
18
18
|
selectedItem: m = {},
|
|
19
|
-
showExpandButton:
|
|
19
|
+
showExpandButton: f = !1,
|
|
20
20
|
toggleRow: p = null
|
|
21
21
|
}) => {
|
|
22
|
-
const
|
|
22
|
+
const g = u(
|
|
23
23
|
"table-body__cell",
|
|
24
24
|
e.className,
|
|
25
25
|
b,
|
|
26
26
|
e.bodyCellClassName
|
|
27
27
|
), c = u("item-name"), { value: d, label: l, className: h } = t.state ?? {};
|
|
28
|
-
return /* @__PURE__ */ o("td", { "data-testid": e.headerId, className:
|
|
29
|
-
e.linkIsExternal ? /* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
return /* @__PURE__ */ o("td", { "data-testid": e.headerId, className: g, children: [
|
|
29
|
+
e.linkIsExternal ? /* @__PURE__ */ o("div", { className: "data-ellipsis", children: [
|
|
30
|
+
/* @__PURE__ */ o("a", { href: n, className: "link", target: "_top", children: [
|
|
31
|
+
/* @__PURE__ */ s(
|
|
32
|
+
r,
|
|
33
|
+
{
|
|
34
|
+
className: c,
|
|
35
|
+
template: /* @__PURE__ */ s(i, { text: e.tooltip || e.value || "" }),
|
|
36
|
+
children: e.value
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
e.showStatus && d && l && /* @__PURE__ */ s(r, { className: "status", template: /* @__PURE__ */ s(i, { text: l }), children: /* @__PURE__ */ s("i", { className: h }) })
|
|
40
|
+
] }),
|
|
41
|
+
e.showTag && /* @__PURE__ */ s(r, { className: "item-tag", template: /* @__PURE__ */ s(i, { text: t.tag }), children: /* @__PURE__ */ s("span", { className: "link-subtext", children: t.tag }) })
|
|
42
|
+
] }) : /* @__PURE__ */ o(w, { to: n, onClick: () => x(t), className: "data-ellipsis", children: [
|
|
40
43
|
/* @__PURE__ */ o("div", { className: "name-wrapper", children: [
|
|
41
44
|
/* @__PURE__ */ o("div", { className: "link", children: [
|
|
42
45
|
/* @__PURE__ */ s(
|
|
@@ -56,15 +59,15 @@ const C = ({
|
|
|
56
59
|
t.startTime || t.created,
|
|
57
60
|
d === "aborted" ? "N/A" : "Not yet started"
|
|
58
61
|
) }),
|
|
59
|
-
e.value !== t.uid && e.value !== t.hash && /* @__PURE__ */ s("span", { className: "link-subtext", children:
|
|
62
|
+
e.value !== t.uid && e.value !== t.hash && /* @__PURE__ */ s("span", { className: "link-subtext", children: k(t.uid || t.hash) })
|
|
60
63
|
] }),
|
|
61
64
|
e.additionalInfo && Object.values(m).length !== 0 && /* @__PURE__ */ s("span", { className: "link-subtext", children: e.additionalInfo })
|
|
62
65
|
] }),
|
|
63
|
-
|
|
66
|
+
f && /* @__PURE__ */ s(
|
|
64
67
|
T,
|
|
65
68
|
{
|
|
66
|
-
onClick: (
|
|
67
|
-
p && p(
|
|
69
|
+
onClick: (v) => {
|
|
70
|
+
p && p(v, t);
|
|
68
71
|
},
|
|
69
72
|
className: "expand-arrow"
|
|
70
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLinkCell.mjs","sources":["../../../src/lib/elements/TableLinkCell/TableLinkCell.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport { Link } from 'react-router-dom'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tooltip from '../../components/Tooltip/Tooltip'\nimport TextTooltipTemplate from '../../components/TooltipTemplate/TextTooltipTemplate'\n\nimport { formatDatetime } from '../../utils/datetime.util'\nimport { truncateUid } from '../../utils/string.util'\n\nimport Arrow from '../../images/arrow.svg?react'\n\nimport './tableLinkCell.scss'\n\nconst TableLinkCell = ({\n cellData = {},\n className = '',\n item,\n link,\n selectItem,\n selectedItem = {},\n showExpandButton = false,\n toggleRow = null\n}) => {\n const tableCellClassNames = classnames(\n 'table-body__cell',\n cellData.className,\n className,\n cellData.bodyCellClassName\n )\n const itemNameClassNames = classnames('item-name')\n const { value: stateValue, label: stateLabel, className: stateClassName } = item.state ?? {}\n\n return (\n <td data-testid={cellData.headerId} className={tableCellClassNames}>\n {cellData.linkIsExternal ? (\n <
|
|
1
|
+
{"version":3,"file":"TableLinkCell.mjs","sources":["../../../src/lib/elements/TableLinkCell/TableLinkCell.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React from 'react'\nimport { Link } from 'react-router-dom'\nimport PropTypes from 'prop-types'\nimport classnames from 'classnames'\n\nimport Tooltip from '../../components/Tooltip/Tooltip'\nimport TextTooltipTemplate from '../../components/TooltipTemplate/TextTooltipTemplate'\n\nimport { formatDatetime } from '../../utils/datetime.util'\nimport { truncateUid } from '../../utils/string.util'\n\nimport Arrow from '../../images/arrow.svg?react'\n\nimport './tableLinkCell.scss'\n\nconst TableLinkCell = ({\n cellData = {},\n className = '',\n item,\n link,\n selectItem,\n selectedItem = {},\n showExpandButton = false,\n toggleRow = null\n}) => {\n const tableCellClassNames = classnames(\n 'table-body__cell',\n cellData.className,\n className,\n cellData.bodyCellClassName\n )\n const itemNameClassNames = classnames('item-name')\n const { value: stateValue, label: stateLabel, className: stateClassName } = item.state ?? {}\n\n return (\n <td data-testid={cellData.headerId} className={tableCellClassNames}>\n {cellData.linkIsExternal ? (\n <div className=\"data-ellipsis\">\n <a href={link} className=\"link\" target=\"_top\">\n <Tooltip\n className={itemNameClassNames}\n template={<TextTooltipTemplate text={cellData.tooltip || cellData.value || ''} />}\n >\n {cellData.value}\n </Tooltip>\n\n {cellData.showStatus && stateValue && stateLabel && (\n <Tooltip className=\"status\" template={<TextTooltipTemplate text={stateLabel} />}>\n <i className={stateClassName} />\n </Tooltip>\n )}\n </a>\n\n {cellData.showTag && (\n <Tooltip className=\"item-tag\" template={<TextTooltipTemplate text={item.tag} />}>\n <span className=\"link-subtext\">{item.tag}</span>\n </Tooltip>\n )}\n </div>\n ) : (\n <Link to={link} onClick={() => selectItem(item)} className=\"data-ellipsis\">\n <div className=\"name-wrapper\">\n <div className=\"link\">\n <Tooltip\n className={itemNameClassNames}\n template={<TextTooltipTemplate text={cellData.tooltip || cellData.value || ''} />}\n >\n {cellData.value}\n </Tooltip>\n\n {cellData.showStatus && stateValue && stateLabel && (\n <Tooltip className=\"status\" template={<TextTooltipTemplate text={stateLabel} />}>\n <i className={stateClassName} />\n </Tooltip>\n )}\n </div>\n {cellData.showTag && (\n <Tooltip className=\"item-tag\" template={<TextTooltipTemplate text={item.tag} />}>\n <span className=\"link-subtext\">{item.tag}</span>\n </Tooltip>\n )}\n </div>\n {(cellData.showUid ||\n (cellData.showSelectedUid && Object.values(selectedItem).length !== 0)) && (\n <div className=\"date-uid-row\">\n {(item.startTime || item.created || item.updated) &&\n cellData.type !== 'date' &&\n (cellData.showDate || cellData.showUpdatedDate) && (\n <span className=\"link-subtext\">\n {cellData.showUpdatedDate\n ? formatDatetime(item.updated, 'N/A')\n : formatDatetime(\n item.startTime || item.created,\n stateValue === 'aborted' ? 'N/A' : 'Not yet started'\n )}\n </span>\n )}\n {cellData.value !== item.uid && cellData.value !== item.hash && (\n <span className=\"link-subtext\">{truncateUid(item.uid || item.hash)}</span>\n )}\n </div>\n )}\n {cellData.additionalInfo && Object.values(selectedItem).length !== 0 && (\n <span className=\"link-subtext\">{cellData.additionalInfo}</span>\n )}\n </Link>\n )}\n {showExpandButton && (\n <Arrow\n onClick={e => {\n toggleRow && toggleRow(e, item)\n }}\n className=\"expand-arrow\"\n />\n )}\n </td>\n )\n}\n\nTableLinkCell.propTypes = {\n cellData: PropTypes.object,\n className: PropTypes.string,\n item: PropTypes.object.isRequired,\n link: PropTypes.string.isRequired,\n selectItem: PropTypes.func.isRequired,\n selectedItem: PropTypes.object,\n showExpandButton: PropTypes.bool,\n toggleRow: PropTypes.func\n}\n\nexport default TableLinkCell\n"],"names":["TableLinkCell","cellData","className","item","link","selectItem","selectedItem","showExpandButton","toggleRow","tableCellClassNames","classnames","itemNameClassNames","stateValue","stateLabel","stateClassName","jsxs","jsx","Tooltip","TextTooltipTemplate","Link","formatDatetime","truncateUid","Arrow","e","PropTypes"],"mappings":";;;;;;;;;;;AAkCA,MAAMA,IAAgB,CAAC;AAAA,EACrB,UAAAC,IAAW,CAAA;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC,IAAe,CAAA;AAAA,EACf,kBAAAC,IAAmB;AAAA,EACnB,WAAAC,IAAY;AACd,MAAM;AACJ,QAAMC,IAAsBC;AAAA,IAC1B;AAAA,IACAT,EAAS;AAAA,IACTC;AAAA,IACAD,EAAS;AAAA,EAAA,GAELU,IAAqBD,EAAW,WAAW,GAC3C,EAAE,OAAOE,GAAY,OAAOC,GAAY,WAAWC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SAAS,CAAAC,MAAK;AACZ,UAAAf,KAAaA,EAAUe,GAAGpB,CAAI;AAAA,QAChC;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GAEJ;AAEJ;AAEAH,EAAc,YAAY;AAAA,EACxB,UAAUwB,EAAU;AAAA,EACpB,WAAWA,EAAU;AAAA,EACrB,MAAMA,EAAU,OAAO;AAAA,EACvB,MAAMA,EAAU,OAAO;AAAA,EACvB,YAAYA,EAAU,KAAK;AAAA,EAC3B,cAAcA,EAAU;AAAA,EACxB,kBAAkBA,EAAU;AAAA,EAC5B,WAAWA,EAAU;AACvB;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4 17H20V11H4V17ZM18.0625 15.0625C18.3542 14.7708 18.5 14.4167 18.5 14C18.5 13.5833 18.3542 13.2292 18.0625 12.9375C17.7708 12.6458 17.4167 12.5 17 12.5C16.5833 12.5 16.2292 12.6458 15.9375 12.9375C15.6458 13.2292 15.5 13.5833 15.5 14C15.5 14.4167 15.6458 14.7708 15.9375 15.0625C16.2292 15.3542 16.5833 15.5 17 15.5C17.4167 15.5 17.7708 15.3542 18.0625 15.0625ZM22 9H19.175L17.175 7H6.825L4.825 9H2L5.425 5.575C5.60833 5.39167 5.82083 5.25 6.0625 5.15C6.30417 5.05 6.55833 5 6.825 5H17.175C17.4417 5 17.6958 5.05 17.9375 5.15C18.1792 5.25 18.3917 5.39167 18.575 5.575L22 9ZM4 19C3.45 19 2.97917 18.8042 2.5875 18.4125C2.19583 18.0208 2 17.55 2 17V9H22V17C22 17.55 21.8042 18.0208 21.4125 18.4125C21.0208 18.8042 20.55 19 20 19H4Z" fill="#1F1F1F"/>
|
|
3
|
+
</svg>
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import a from "moment";
|
|
2
|
-
function
|
|
2
|
+
function m() {
|
|
3
3
|
const e = /* @__PURE__ */ new Set(["en-GB", "en-US"]);
|
|
4
4
|
return (navigator.languages || [navigator.language]).find((o) => e.has(o)) || "en-US";
|
|
5
5
|
}
|
|
6
|
-
const
|
|
6
|
+
const c = m(), d = (e, t, n = {
|
|
7
7
|
year: "numeric",
|
|
8
8
|
month: "short",
|
|
9
9
|
day: "numeric",
|
|
10
10
|
hour: "2-digit",
|
|
11
11
|
minute: "2-digit",
|
|
12
12
|
second: "2-digit"
|
|
13
|
-
}, o =
|
|
13
|
+
}, o = c) => {
|
|
14
14
|
if (!e)
|
|
15
15
|
return t;
|
|
16
|
-
const
|
|
17
|
-
return isNaN(
|
|
16
|
+
const r = new Date(e);
|
|
17
|
+
return isNaN(r) || typeof r != "object" || !(r instanceof Date) || isNaN(r) ? t : new Intl.DateTimeFormat(o, {
|
|
18
18
|
numberingSystem: "latn",
|
|
19
19
|
calendar: "gregory",
|
|
20
|
-
...
|
|
21
|
-
}).format(
|
|
22
|
-
},
|
|
23
|
-
const [t,
|
|
24
|
-
return
|
|
20
|
+
...n
|
|
21
|
+
}).format(r);
|
|
22
|
+
}, g = (e) => {
|
|
23
|
+
const [t, n] = e.split(":");
|
|
24
|
+
return n ? {
|
|
25
25
|
hour: t.replace(/_/g, "0"),
|
|
26
|
-
minute:
|
|
26
|
+
minute: n.replace(/_/g, "0")
|
|
27
27
|
} : {
|
|
28
28
|
hour: "0",
|
|
29
29
|
minute: "0"
|
|
30
30
|
};
|
|
31
|
-
},
|
|
31
|
+
}, h = (e) => (a.updateLocale("en", {
|
|
32
32
|
relativeTime: {
|
|
33
33
|
future: "in %s",
|
|
34
34
|
past: "%s ago",
|
|
@@ -47,17 +47,17 @@ const m = c(), d = (e, t, r = {
|
|
|
47
47
|
y: "a year",
|
|
48
48
|
yy: "%d years"
|
|
49
49
|
}
|
|
50
|
-
}), a.utc(e).fromNow()),
|
|
51
|
-
const s = Date.parse(o[t]), u = Date.parse(
|
|
52
|
-
return
|
|
50
|
+
}), a.utc(e).fromNow()), p = (e, t) => a(e).format(t), y = (e = [], t, n = !0) => [...e].sort((o, r) => {
|
|
51
|
+
const s = Date.parse(o[t]), u = Date.parse(r[t]);
|
|
52
|
+
return n ? s - u : u - s;
|
|
53
53
|
});
|
|
54
54
|
export {
|
|
55
55
|
d as formatDatetime,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
p as getDateAndTimeByFormat,
|
|
57
|
+
g as getFormatTime,
|
|
58
|
+
m as getSupportedLocale,
|
|
59
|
+
h as getTimeElapsedByDate,
|
|
60
60
|
y as sortListByDate,
|
|
61
|
-
|
|
61
|
+
c as supportedLocale
|
|
62
62
|
};
|
|
63
63
|
//# sourceMappingURL=datetime.util.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.util.mjs","sources":["../../src/lib/utils/datetime.util.js"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport moment from 'moment'\n\nexport function getSupportedLocale() {\n const SUPPORTED_LOCALES = new Set(['en-GB', 'en-US'])\n\n const userLocales = navigator.languages || [navigator.language]\n\n // browser always returns locales in descending order of preference\n const match = userLocales.find(locale => SUPPORTED_LOCALES.has(locale))\n\n return match || 'en-US'\n}\n\nexport const supportedLocale = getSupportedLocale()\n\nexport const formatDatetime = (\n datetime,\n invalidDateMessage,\n options = {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n },\n locale = supportedLocale\n) => {\n if (!datetime) {\n return invalidDateMessage\n }\n\n const date = new Date(datetime
|
|
1
|
+
{"version":3,"file":"datetime.util.mjs","sources":["../../src/lib/utils/datetime.util.js"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport moment from 'moment'\n\nexport function getSupportedLocale() {\n const SUPPORTED_LOCALES = new Set(['en-GB', 'en-US'])\n\n const userLocales = navigator.languages || [navigator.language]\n\n // browser always returns locales in descending order of preference\n const match = userLocales.find(locale => SUPPORTED_LOCALES.has(locale))\n\n return match || 'en-US'\n}\n\nexport const supportedLocale = getSupportedLocale()\n\nexport const formatDatetime = (\n datetime,\n invalidDateMessage,\n options = {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n },\n locale = supportedLocale\n) => {\n if (!datetime) {\n return invalidDateMessage\n }\n\n const date = new Date(datetime)\n\n if (isNaN(date)) {\n return invalidDateMessage\n }\n\n return typeof date !== 'object' || !(date instanceof Date) || isNaN(date)\n ? invalidDateMessage\n : new Intl.DateTimeFormat(locale, {\n numberingSystem: 'latn',\n calendar: 'gregory',\n ...options\n }).format(date)\n}\n\nexport const getFormatTime = time => {\n const [hour, minute] = time.split(':')\n if (!minute) {\n return {\n hour: '0',\n minute: '0'\n }\n }\n return {\n hour: hour.replace(/_/g, '0'),\n minute: minute.replace(/_/g, '0')\n }\n}\n\nexport const getTimeElapsedByDate = creationDate => {\n moment.updateLocale('en', {\n relativeTime: {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n w: 'a week',\n ww: '%d weeks',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years'\n }\n })\n\n const time = moment.utc(creationDate)\n\n return time.fromNow()\n}\n\nexport const getDateAndTimeByFormat = (date, dateFormat) => {\n return moment(date).format(dateFormat)\n}\n\nexport const sortListByDate = (list = [], field, isAscending = true) => {\n return [...list].sort((prevElem, nextElem) => {\n const prev = Date.parse(prevElem[field])\n const next = Date.parse(nextElem[field])\n\n return isAscending ? prev - next : next - prev\n })\n}\n"],"names":["getSupportedLocale","SUPPORTED_LOCALES","locale","supportedLocale","formatDatetime","datetime","invalidDateMessage","options","date","getFormatTime","time","hour","minute","getTimeElapsedByDate","creationDate","moment","getDateAndTimeByFormat","dateFormat","sortListByDate","list","field","isAscending","prevElem","nextElem","prev","next"],"mappings":";AAqBO,SAASA,IAAqB;AACnC,QAAMC,IAAoB,oBAAI,IAAI,CAAC,SAAS,OAAO,CAAC;AAOpD,UALoB,UAAU,aAAa,CAAC,UAAU,QAAQ,GAGpC,KAAK,CAAAC,MAAUD,EAAkB,IAAIC,CAAM,CAAC,KAEtD;AAClB;AAEY,MAACC,IAAkBH,EAAkB,GAEpCI,IAAiB,CAC5BC,GACAC,GACAC,IAAU;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AACZ,GACEL,IAASC,MACN;AACH,MAAI,CAACE;AACH,WAAOC;AAGT,QAAME,IAAO,IAAI,KAAKH,CAAQ;AAE9B,SAAI,MAAMG,CAA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1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.19",
|
|
4
4
|
"description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.mjs",
|