iguazio.dashboard-react-controls 3.2.14 → 3.2.16
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,25 +1,25 @@
|
|
|
1
1
|
import a from "moment";
|
|
2
|
-
function
|
|
2
|
+
function c() {
|
|
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 m = c(), d = (e, t, r = {
|
|
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 = m) => {
|
|
14
14
|
if (!e)
|
|
15
15
|
return t;
|
|
16
|
-
const n = new Date(e.replace("+00:00", ""));
|
|
16
|
+
const n = new Date(e.replace ? e.replace("+00:00", "") : e);
|
|
17
17
|
return isNaN(n) || typeof n != "object" || !(n instanceof Date) || isNaN(n) ? t : new Intl.DateTimeFormat(o, {
|
|
18
18
|
numberingSystem: "latn",
|
|
19
19
|
calendar: "gregory",
|
|
20
20
|
...r
|
|
21
21
|
}).format(n);
|
|
22
|
-
},
|
|
22
|
+
}, p = (e) => {
|
|
23
23
|
const [t, r] = e.split(":");
|
|
24
24
|
return r ? {
|
|
25
25
|
hour: t.replace(/_/g, "0"),
|
|
@@ -28,7 +28,7 @@ const c = m(), d = (e, t, r = {
|
|
|
28
28
|
hour: "0",
|
|
29
29
|
minute: "0"
|
|
30
30
|
};
|
|
31
|
-
},
|
|
31
|
+
}, g = (e) => (a.updateLocale("en", {
|
|
32
32
|
relativeTime: {
|
|
33
33
|
future: "in %s",
|
|
34
34
|
past: "%s ago",
|
|
@@ -54,10 +54,10 @@ const c = m(), d = (e, t, r = {
|
|
|
54
54
|
export {
|
|
55
55
|
d as formatDatetime,
|
|
56
56
|
h as getDateAndTimeByFormat,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
p as getFormatTime,
|
|
58
|
+
c as getSupportedLocale,
|
|
59
|
+
g as getTimeElapsedByDate,
|
|
60
60
|
y as sortListByDate,
|
|
61
|
-
|
|
61
|
+
m 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.replace('+00:00', ''))\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,EAAS,QAAQ,UAAU,EAAE,
|
|
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.replace ? datetime.replace('+00:00', '') : 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,IA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AK,CAAC,GACjCK,IAAO,KAAK,MAAMF,EAASH,CAAK,CAAC;AAEvC,SAAOC,IAAcG,IAAOC,IAAOA,IAAOD;AAC5C,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.16",
|
|
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",
|