@webitel/ui-sdk 26.8.63 → 26.8.64
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/{caseConverters-DXegZoCt.js → caseConverters-6cy_SaV5.js} +8 -8
- package/dist/{clients-BeKkM_Tf.js → clients-CB9U4xyd.js} +300 -216
- package/dist/{components-DelpnGuy.js → components-0bFcL-uW.js} +5228 -3247
- package/dist/{composables-BtWSAI5D.js → composables-DbGvukRz.js} +3 -3
- package/dist/{debounce-Bp3jy7S5.js → debounce-CCzQDuk5.js} +2 -2
- package/dist/{deep-copy-CTgLtgMO.js → deep-copy-CjYHLk2X.js} +1 -1
- package/dist/{dist-CAOIU8xq.js → dist-C_fngTiN.js} +1 -1
- package/dist/{dist-Crpfx4FA.js → dist-CugChoYz.js} +1 -1
- package/dist/{enums-DY3jIXFF.js → enums-CM8hOd_m.js} +29 -28
- package/dist/genClient-DVFU4u-o.js +2088 -0
- package/dist/{rolldown-runtime-BEcgMyyN.js → rolldown-runtime-to5KK-CW.js} +5 -2
- package/dist/{side-channel-8SnAuRMA.js → side-channel-M3LABDql.js} +2 -2
- package/dist/ui-sdk.js +42 -42
- package/dist/ui-sdk.umd.cjs +642 -641
- package/dist/{useValidation-Bvastl-C.js → useValidation-CDgb424A.js} +2 -2
- package/dist/{useWtTable-DLWucXPx.js → useWtTable-BbNT2rXz.js} +1 -1
- package/dist/utils-DqYQ_mrQ.js +1902 -0
- package/dist/{vue-i18n-Db_oYfO8.js → vue-i18n-DNulhn2J.js} +2 -2
- package/dist/{vue-router-Dwey8MMv.js → vue-router-B9nAVQtl.js} +1 -1
- package/dist/{wt-action-bar-C4JukltF.js → wt-action-bar-Dx2j2yCn.js} +3 -3
- package/dist/{wt-button-2_aOV7LX.js → wt-button-l_CCN7zG.js} +2 -2
- package/dist/{wt-chat-emoji-Be1WcCN8.js → wt-chat-emoji-CeTjymhG.js} +4 -4
- package/dist/{wt-datepicker-DmGisBuB.js → wt-datepicker-Dcg6mx6P.js} +3 -3
- package/dist/{wt-display-chip-items-C2xHjen9.js → wt-display-chip-items-9KCOYg0J.js} +2 -2
- package/dist/{wt-dual-panel-C98aGU8o.js → wt-dual-panel-sCqa1h4_.js} +1 -1
- package/dist/{wt-expansion-card-CEMaWXCy.js → wt-expansion-card-DKEhPBa9.js} +2 -2
- package/dist/{wt-expansion-panel-BjeXHSay.js → wt-expansion-panel-BnQ9Ow8D.js} +1 -1
- package/dist/{wt-galleria-DMCgiiju.js → wt-galleria-CNwBmLcX.js} +2 -2
- package/dist/{wt-icon-Ct0E7k_d.js → wt-icon-CjNYdMOP.js} +2 -2
- package/dist/{wt-icon-action-DB6P4E4K.js → wt-icon-action-DX9R-hzG.js} +2 -2
- package/dist/{wt-icon-btn-DZa_qsai.js → wt-icon-btn-BbPNcD-O.js} +1 -1
- package/dist/{wt-notifications-bar-BEomlIrN.js → wt-notifications-bar-BTt1vqwz.js} +2 -2
- package/dist/{wt-pagination-G2ZGU4Pi.js → wt-pagination-DNjYIHjv.js} +1 -1
- package/dist/{wt-player-CzNYyH1h.js → wt-player-CoB2InY0.js} +5 -5
- package/dist/{wt-popover-BCYPu5NC.js → wt-popover-B0SIrVz6.js} +1 -1
- package/dist/{wt-screen-recordings-action-DI1qlUi1.js → wt-screen-recordings-action-DCdRUBbd.js} +1 -0
- package/dist/{wt-search-bar-D0qgd2ve.js → wt-search-bar-DlNX3Sr8.js} +2 -2
- package/dist/{wt-selection-popup-CjYw4ppb.js → wt-selection-popup-C74__W9Z.js} +1 -1
- package/dist/{wt-send-message-popup-vBS3Rque.js → wt-send-message-popup-COrWsZPZ.js} +22 -22
- package/dist/{wt-slider-BPzRTeYU.js → wt-slider-4xCDNWv-.js} +1 -1
- package/dist/{wt-start-page-BFQExFUj.js → wt-start-page-BUjRx6RA.js} +1 -1
- package/dist/{wt-status-select-BuojqV_1.js → wt-status-select-C2-LFbrZ.js} +10 -10
- package/dist/{wt-table-DWnt7b9t.js → wt-table-BBFNhnGG.js} +2 -2
- package/dist/{wt-table-column-select-D4c56HPB.js → wt-table-column-select-CuQbrCkx.js} +3 -3
- package/dist/{wt-timepicker-C2X8A8fq.js → wt-timepicker-BltIOjh9.js} +3 -3
- package/dist/{wt-toast-eWzfeYuz.js → wt-toast-DHV4UvFz.js} +2 -2
- package/dist/{wt-tree-CMIpbXBo.js → wt-tree-DKSphRxr.js} +4 -4
- package/dist/{wt-tree-table-C-UM5kxp.js → wt-tree-table-9vnEJcX0.js} +2 -2
- package/dist/{wt-type-extension-value-input-BVBAwEBZ.js → wt-type-extension-value-input-t0VfexsE.js} +18 -18
- package/dist/{wt-vidstack-player-DW1JPk_N.js → wt-vidstack-player-C3Rh5v9F.js} +5 -5
- package/package.json +5 -1
- package/src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue +2 -2
- package/src/modules/Appearance/index.ts +2 -0
- package/src/scripts/convertDurationWithDays.ts +30 -0
- package/src/scripts/index.js +12 -0
- package/src/scripts/storageFile/downloadFilesAsZip.ts +55 -0
- package/src/scripts/storageFile/downloadStorageFile.ts +27 -0
- package/src/scripts/storageFile/getFileTypeIcon.ts +6 -0
- package/src/scripts/storageFile/getStorageFileUrl.ts +17 -0
- package/src/scripts/storageFile/openStorageFileInNewTab.ts +34 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/prettifyDate.ts +14 -0
- package/types/.tsbuildinfo +1 -1
- package/types/modules/Appearance/index.d.ts +2 -0
- package/types/scripts/convertDurationWithDays.d.ts +1 -0
- package/types/scripts/index.d.ts +7 -1
- package/types/scripts/storageFile/downloadFilesAsZip.d.ts +11 -0
- package/types/scripts/storageFile/downloadStorageFile.d.ts +8 -0
- package/types/scripts/storageFile/getFileTypeIcon.d.ts +1 -0
- package/types/scripts/storageFile/getStorageFileUrl.d.ts +6 -0
- package/types/scripts/storageFile/openStorageFileInNewTab.d.ts +5 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/prettifyDate.d.ts +1 -0
- package/dist/displayText-CtaxzaBz.js +0 -3
- package/dist/genClient-HHiOUj56.js +0 -2891
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
2
|
-
import { l as t, r as n } from "./enums-
|
|
3
|
-
import { t as r } from "./vue-i18n-
|
|
4
|
-
import { t as i } from "./useValidation-
|
|
2
|
+
import { l as t, r as n } from "./enums-CM8hOd_m.js";
|
|
3
|
+
import { t as r } from "./vue-i18n-DNulhn2J.js";
|
|
4
|
+
import { t as i } from "./useValidation-CDgb424A.js";
|
|
5
5
|
import { computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, guardReactiveProps as f, mergeProps as p, nextTick as m, normalizeClass as h, normalizeProps as g, openBlock as _, renderSlot as v, resolveComponent as y, toDisplayString as b, toRefs as x, unref as S, withCtx as C } from "vue";
|
|
6
6
|
//#region src/components/wt-timepicker/wt-timepicker.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var w = { class: "wt-timepicker__wrapper" }, T = 3600, E = 60, D = /*#__PURE__*/ e(/* @__PURE__ */ d({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./wt-icon-
|
|
2
|
-
import { i as t, l as n } from "./enums-
|
|
1
|
+
import { t as e } from "./wt-icon-CjNYdMOP.js";
|
|
2
|
+
import { i as t, l as n } from "./enums-CM8hOd_m.js";
|
|
3
3
|
import { Fragment as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, guardReactiveProps as u, normalizeProps as d, normalizeStyle as f, openBlock as p, resolveComponent as m, toDisplayString as h, unref as g, useAttrs as _, withCtx as v } from "vue";
|
|
4
4
|
//#region node_modules/mitt/dist/mitt.mjs
|
|
5
5
|
function y(e) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n, t as r } from "./dist-
|
|
3
|
-
import { n as i, t as a } from "./dist-
|
|
1
|
+
import { o as e, t } from "./rolldown-runtime-to5KK-CW.js";
|
|
2
|
+
import { n, t as r } from "./dist-C_fngTiN.js";
|
|
3
|
+
import { n as i, t as a } from "./dist-CugChoYz.js";
|
|
4
4
|
import { t as o } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
5
5
|
import { t as s } from "./wt-expand-transition-C2p9bR4j.js";
|
|
6
|
-
import { _ as c, a as l, c as u, d, f, g as p, h as m, i as h, l as g, m as _, n as v, o as y, p as b, r as x, s as S, t as C, u as w } from "./side-channel-
|
|
6
|
+
import { _ as c, a as l, c as u, d, f, g as p, h as m, i as h, l as g, m as _, n as v, o as y, p as b, r as x, s as S, t as C, u as w } from "./side-channel-M3LABDql.js";
|
|
7
7
|
import { Fragment as T, computed as E, createBlock as D, createCommentVNode as O, createElementBlock as k, createElementVNode as A, createSlots as j, createVNode as M, defineComponent as N, guardReactiveProps as P, normalizeClass as F, normalizeProps as I, onMounted as L, openBlock as R, ref as z, renderList as B, renderSlot as V, resolveComponent as H, toDisplayString as U, unref as W, vShow as ee, watch as te, withCtx as G, withDirectives as ne } from "vue";
|
|
8
8
|
//#region node_modules/object-keys/isArguments.js
|
|
9
9
|
var re = /* @__PURE__ */ t(((e, t) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
2
2
|
import { n as t } from "./sortQueryAdapters-CyYXvnDN.js";
|
|
3
|
-
import { n, t as r } from "./wt-icon-btn-
|
|
4
|
-
import { t as i } from "./useWtTable-
|
|
3
|
+
import { n, t as r } from "./wt-icon-btn-BbPNcD-O.js";
|
|
4
|
+
import { t as i } from "./useWtTable-BbNT2rXz.js";
|
|
5
5
|
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as d, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, normalizeStyle as g, onMounted as _, openBlock as v, ref as y, renderList as b, renderSlot as x, resolveComponent as S, toDisplayString as C, toRef as w, unref as T, withCtx as E, withModifiers as D } from "vue";
|
|
6
6
|
//#region src/components/wt-tree-table-row/wt-tree-table-row.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var O = { class: "wt-tree-table-td__content" }, k = {
|
package/dist/{wt-type-extension-value-input-BVBAwEBZ.js → wt-type-extension-value-input-t0VfexsE.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as a } from "./enums-
|
|
4
|
-
import { t as o } from "./vue-i18n-
|
|
1
|
+
import { a as e, o as t, r as n, s as r } from "./components-0bFcL-uW.js";
|
|
2
|
+
import { t as i } from "./clients-CB9U4xyd.js";
|
|
3
|
+
import { t as a } from "./enums-CM8hOd_m.js";
|
|
4
|
+
import { t as o } from "./vue-i18n-DNulhn2J.js";
|
|
5
5
|
import { computed as s, createBlock as c, createCommentVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, openBlock as m, renderSlot as h, resolveComponent as g, unref as _, useModel as v } from "vue";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue
|
|
@@ -34,11 +34,11 @@ var y = /* @__PURE__ */ d({
|
|
|
34
34
|
searchMethod: O(y.field.lookup)
|
|
35
35
|
})), E = s(() => ({ ...T.value })), D = (e) => {
|
|
36
36
|
f.value = e;
|
|
37
|
-
}, O = ({ path:
|
|
38
|
-
...
|
|
39
|
-
path:
|
|
40
|
-
display:
|
|
41
|
-
primary:
|
|
37
|
+
}, O = ({ path: e = "", display: t = "", primary: n = "" } = {}) => (r) => i.getLookup({
|
|
38
|
+
...r,
|
|
39
|
+
path: e,
|
|
40
|
+
display: t,
|
|
41
|
+
primary: n
|
|
42
42
|
}), k = (e) => {
|
|
43
43
|
let t = e ?? {};
|
|
44
44
|
if (Object.values(t).length === 0) return D(null);
|
|
@@ -52,7 +52,7 @@ var y = /* @__PURE__ */ d({
|
|
|
52
52
|
name: e.name
|
|
53
53
|
})));
|
|
54
54
|
};
|
|
55
|
-
return (
|
|
55
|
+
return (i, o) => {
|
|
56
56
|
let s = g("wt-input-text"), f = g("wt-input-number");
|
|
57
57
|
return d.field.kind === _(a).Text ? (m(), c(s, p({ key: 0 }, w.value, {
|
|
58
58
|
"model-value": C.value,
|
|
@@ -60,44 +60,44 @@ var y = /* @__PURE__ */ d({
|
|
|
60
60
|
}), null, 16, ["model-value"])) : d.field.kind === _(a).Number ? (m(), c(f, p({ key: 1 }, w.value, {
|
|
61
61
|
"model-value": C.value,
|
|
62
62
|
"onUpdate:modelValue": D
|
|
63
|
-
}), null, 16, ["model-value"])) : d.field.kind === _(a).Boolean ? h(
|
|
63
|
+
}), null, 16, ["model-value"])) : d.field.kind === _(a).Boolean ? h(i.$slots, _(a).Boolean, {
|
|
64
64
|
key: 2,
|
|
65
65
|
defaultProps: { ...w.value }
|
|
66
|
-
}, () => [u(_(
|
|
66
|
+
}, () => [u(_(e), p(w.value, {
|
|
67
67
|
"model-value": C.value,
|
|
68
68
|
"onUpdate:modelValue": D
|
|
69
|
-
}), null, 16, ["model-value"])]) : d.field.kind === _(a).Select ? h(
|
|
69
|
+
}), null, 16, ["model-value"])]) : d.field.kind === _(a).Select ? h(i.$slots, _(a).Select, {
|
|
70
70
|
key: 3,
|
|
71
71
|
defaultProps: {
|
|
72
72
|
...w.value,
|
|
73
73
|
...T.value,
|
|
74
74
|
value: C.value
|
|
75
75
|
}
|
|
76
|
-
}, () => [u(_(
|
|
76
|
+
}, () => [u(_(t), p(w.value, {
|
|
77
77
|
"model-value": C.value,
|
|
78
78
|
"search-method": O(d.field.lookup),
|
|
79
79
|
"data-key": "id",
|
|
80
80
|
"onUpdate:modelValue": k
|
|
81
|
-
}), null, 16, ["model-value", "search-method"])]) : d.field.kind === _(a).Multiselect ? h(
|
|
81
|
+
}), null, 16, ["model-value", "search-method"])]) : d.field.kind === _(a).Multiselect ? h(i.$slots, _(a).Multiselect, {
|
|
82
82
|
key: 4,
|
|
83
83
|
defaultProps: {
|
|
84
84
|
...w.value,
|
|
85
85
|
...E.value,
|
|
86
86
|
value: C.value
|
|
87
87
|
}
|
|
88
|
-
}, () => [u(_(
|
|
88
|
+
}, () => [u(_(r), p({
|
|
89
89
|
...w.value,
|
|
90
90
|
...E.value
|
|
91
91
|
}, {
|
|
92
92
|
"model-value": C.value,
|
|
93
93
|
"onUpdate:modelValue": A
|
|
94
|
-
}), null, 16, ["model-value"])]) : d.field.kind === _(a).Calendar ? h(
|
|
94
|
+
}), null, 16, ["model-value"])]) : d.field.kind === _(a).Calendar ? h(i.$slots, _(a).Calendar, {
|
|
95
95
|
key: 5,
|
|
96
96
|
defaultProps: {
|
|
97
97
|
...w.value,
|
|
98
98
|
value: C.value
|
|
99
99
|
}
|
|
100
|
-
}, () => [u(_(
|
|
100
|
+
}, () => [u(_(n), p(w.value, {
|
|
101
101
|
"model-value": C.value,
|
|
102
102
|
"show-time": "",
|
|
103
103
|
"onUpdate:modelValue": D
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as e } from "./components-0bFcL-uW.js";
|
|
2
2
|
import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
3
|
-
import { l as n } from "./enums-
|
|
4
|
-
import "./wt-button-
|
|
5
|
-
import { t as r } from "./wt-icon-btn-
|
|
3
|
+
import { l as n } from "./enums-CM8hOd_m.js";
|
|
4
|
+
import "./wt-button-l_CCN7zG.js";
|
|
5
|
+
import { t as r } from "./wt-icon-btn-BbPNcD-O.js";
|
|
6
6
|
import { $ as i, C as a, D as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, M as m, N as h, O as ee, P as te, Q as g, R as ne, S as _, U as re, V as v, W as y, X as b, Y as ie, Z as x, _ as S, a as ae, b as oe, c as se, d as ce, et as le, f as ue, g as de, h as fe, i as C, it as pe, j as me, k as he, l as w, m as ge, n as T, nt as E, o as D, ot as _e, p as O, q as k, r as A, rt as ve, t as ye, tt as be, u as xe, v as j, w as Se, y as Ce, z as we } from "./vidstack-D9mvYVIz-DesuYgKV.js";
|
|
7
7
|
import { _ as M, a as Te, c as Ee, d as De, f as Oe, g as ke, h as Ae, i as je, l as Me, m as Ne, n as Pe, o as Fe, p as Ie, r as Le, s as Re, t as N, u as ze } from "./vidstack-CgfrU1hS-CNTJkyzm.js";
|
|
8
8
|
import { _ as Be, a as Ve, c as He, f as Ue, g as We, h as Ge, i as Ke, l as qe, n as Je, r as Ye, s as Xe, t as Ze, u as Qe, v as $e, x as et, y as tt } from "./useVidstackSrc-aQcqC_v0.js";
|
|
@@ -13,7 +13,7 @@ import { a as ot, i as st, n as I, o as ct, r as L, t as lt } from "./vidstack-D
|
|
|
13
13
|
import { t as R } from "./vidstack-_E7LrUjK-DaCLs8ge.js";
|
|
14
14
|
import { n as ut, t as dt } from "./vidstack-CDOoBnJL-BCwLE1fB.js";
|
|
15
15
|
import { i as ft, n as pt, r as mt, t as ht } from "./vidstack-CdfyZegh-Bn47J4h6.js";
|
|
16
|
-
import { t as gt } from "./wt-slider-
|
|
16
|
+
import { t as gt } from "./wt-slider-4xCDNWv-.js";
|
|
17
17
|
import { computed as _t, createBlock as vt, createCommentVNode as yt, createElementBlock as bt, createElementVNode as z, createSlots as xt, createVNode as B, defineComponent as St, inject as Ct, normalizeClass as wt, onBeforeUnmount as Tt, onMounted as Et, openBlock as V, provide as Dt, ref as Ot, renderSlot as H, resolveComponent as kt, toDisplayString as At, toRefs as jt, unref as U, useTemplateRef as Mt, withCtx as Nt } from "vue";
|
|
18
18
|
//#region node_modules/vidstack/prod/chunks/vidstack-CYE89tBD.js
|
|
19
19
|
var Pt = ge();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "26.8.
|
|
3
|
+
"version": "26.8.64",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npm run docs:dev",
|
|
@@ -351,6 +351,10 @@
|
|
|
351
351
|
"types": "./types/modules/Userinfo/index.d.ts",
|
|
352
352
|
"import": "./src/modules/Userinfo/index.ts"
|
|
353
353
|
},
|
|
354
|
+
"./modules/Appearance": {
|
|
355
|
+
"types": "./types/modules/Appearance/index.d.ts",
|
|
356
|
+
"import": "./src/modules/Appearance/index.ts"
|
|
357
|
+
},
|
|
354
358
|
"./modules/ObjectPermissions": {
|
|
355
359
|
"types": "./types/modules/ObjectPermissions/index.d.ts",
|
|
356
360
|
"import": "./src/modules/ObjectPermissions/index.ts"
|
package/src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue
CHANGED
|
@@ -111,7 +111,7 @@ const props = defineProps<{
|
|
|
111
111
|
|
|
112
112
|
const { t } = useI18n();
|
|
113
113
|
|
|
114
|
-
const
|
|
114
|
+
const resolvedLabel = computed(() => {
|
|
115
115
|
return props.label || t(props.field?.name || 'vocabulary.labels');
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -125,7 +125,7 @@ const value = computed<any>(() => {
|
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
const sharedChildrenProps = computed(() => ({
|
|
128
|
-
label:
|
|
128
|
+
label: resolvedLabel.value,
|
|
129
129
|
required: isRequired.value,
|
|
130
130
|
v: props.v,
|
|
131
131
|
}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const convertDurationWithDays = (
|
|
2
|
+
duration: number,
|
|
3
|
+
timerFormatting = false,
|
|
4
|
+
): string => {
|
|
5
|
+
if (!duration && !timerFormatting) return '00:00:00';
|
|
6
|
+
|
|
7
|
+
// Convert milliseconds to seconds because if timerFormatting is true, duration is in milliseconds
|
|
8
|
+
const totalSeconds = timerFormatting
|
|
9
|
+
? Math.abs(Number(duration)) / 1000
|
|
10
|
+
: Math.abs(Number(duration));
|
|
11
|
+
|
|
12
|
+
const isNegative = duration < 0;
|
|
13
|
+
|
|
14
|
+
const days = Math.floor(totalSeconds / (24 * 60 * 60));
|
|
15
|
+
const hours = Math.floor((totalSeconds % (24 * 60 * 60)) / (60 * 60));
|
|
16
|
+
const minutes = Math.floor((totalSeconds % (60 * 60)) / 60);
|
|
17
|
+
|
|
18
|
+
if (timerFormatting) {
|
|
19
|
+
// Format: "Xd Xh Xm"
|
|
20
|
+
const formatted = `${days}d ${hours}h ${minutes}m`;
|
|
21
|
+
return isNegative ? `- ${formatted}` : formatted;
|
|
22
|
+
} else {
|
|
23
|
+
// Format: "DD:HH:MM" with manual zero-padding
|
|
24
|
+
const paddedDays = days < 10 ? `0${days}` : `${days}`;
|
|
25
|
+
const paddedHours = hours < 10 ? `0${hours}` : `${hours}`;
|
|
26
|
+
const paddedMinutes = minutes < 10 ? `0${minutes}` : `${minutes}`;
|
|
27
|
+
const formatted = `${paddedDays}:${paddedHours}:${paddedMinutes}`;
|
|
28
|
+
return isNegative ? `-${formatted}` : formatted;
|
|
29
|
+
}
|
|
30
|
+
};
|
package/src/scripts/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
smallerThen as sizeSmallerThen,
|
|
18
18
|
} from './compareSize.ts';
|
|
19
19
|
import convertDuration from './convertDuration.js';
|
|
20
|
+
import { convertDurationWithDays } from './convertDurationWithDays';
|
|
20
21
|
import debounce from './debounce.js';
|
|
21
22
|
import downloadFile from './downloadFile/downloadFile';
|
|
22
23
|
import eventBus from './eventBus.js';
|
|
@@ -37,6 +38,11 @@ import {
|
|
|
37
38
|
queryToSortAdapter,
|
|
38
39
|
sortToQueryAdapter,
|
|
39
40
|
} from './sortQueryAdapters.js';
|
|
41
|
+
import { downloadFilesAsZip } from './storageFile/downloadFilesAsZip';
|
|
42
|
+
import { downloadStorageFile } from './storageFile/downloadStorageFile';
|
|
43
|
+
import { getFileTypeIcon } from './storageFile/getFileTypeIcon';
|
|
44
|
+
import { getStorageFileUrl } from './storageFile/getStorageFileUrl';
|
|
45
|
+
import { openStorageFileInNewTab } from './storageFile/openStorageFileInNewTab';
|
|
40
46
|
import updateObject from './updateObject.js';
|
|
41
47
|
|
|
42
48
|
export {
|
|
@@ -44,13 +50,18 @@ export {
|
|
|
44
50
|
camelToSnake,
|
|
45
51
|
compareSize,
|
|
46
52
|
convertDuration,
|
|
53
|
+
convertDurationWithDays,
|
|
47
54
|
debounce,
|
|
48
55
|
downloadFile,
|
|
56
|
+
downloadFilesAsZip,
|
|
57
|
+
downloadStorageFile,
|
|
49
58
|
eventBus,
|
|
50
59
|
getConnectionQuality,
|
|
51
60
|
getEndOfDay,
|
|
61
|
+
getFileTypeIcon,
|
|
52
62
|
getNextSortOrder,
|
|
53
63
|
getStartOfDay,
|
|
64
|
+
getStorageFileUrl,
|
|
54
65
|
isEmpty,
|
|
55
66
|
isRelativeDatetimeValue,
|
|
56
67
|
kebabToCamel,
|
|
@@ -59,6 +70,7 @@ export {
|
|
|
59
70
|
objCamelToKebab,
|
|
60
71
|
objCamelToSnake,
|
|
61
72
|
objSnakeToCamel,
|
|
73
|
+
openStorageFileInNewTab,
|
|
62
74
|
prettifyFileSize,
|
|
63
75
|
prettifyTime,
|
|
64
76
|
preventHiddenPageCallsDecorator,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { saveAs } from 'file-saver-es';
|
|
2
|
+
import JSZip from 'jszip';
|
|
3
|
+
|
|
4
|
+
interface FileToDownload {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface DownloadFilesAsZipParams {
|
|
10
|
+
filesToDownload: FileToDownload[];
|
|
11
|
+
apiUrl: string;
|
|
12
|
+
token: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const downloadFilesAsZip = async ({
|
|
16
|
+
filesToDownload,
|
|
17
|
+
apiUrl,
|
|
18
|
+
token,
|
|
19
|
+
}: DownloadFilesAsZipParams) => {
|
|
20
|
+
if (!filesToDownload?.length) return;
|
|
21
|
+
|
|
22
|
+
const zip = new JSZip();
|
|
23
|
+
|
|
24
|
+
const filePromises = filesToDownload.map(async (item) => {
|
|
25
|
+
const { id, name } = item;
|
|
26
|
+
const fileUrl = `${apiUrl}/storage/file/${id}/download?access_token=${token}`;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(fileUrl);
|
|
30
|
+
if (!response.ok) throw new Error(`Failed to download ${name}`);
|
|
31
|
+
|
|
32
|
+
const blob = await response.blob();
|
|
33
|
+
zip.file(name, blob, {
|
|
34
|
+
binary: true,
|
|
35
|
+
});
|
|
36
|
+
} catch (error) {
|
|
37
|
+
throw new Error(`Failed to download ${name}`, {
|
|
38
|
+
cause: error,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
await Promise.all(filePromises);
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const zipBlob = await zip.generateAsync({
|
|
47
|
+
type: 'blob',
|
|
48
|
+
});
|
|
49
|
+
saveAs(zipBlob, 'files.zip');
|
|
50
|
+
} catch (error) {
|
|
51
|
+
throw new Error('Failed to create ZIP file', {
|
|
52
|
+
cause: error,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getStorageFileUrl } from './getStorageFileUrl';
|
|
2
|
+
|
|
3
|
+
interface DownloadStorageFileParams {
|
|
4
|
+
id?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const downloadStorageFile = ({
|
|
11
|
+
id,
|
|
12
|
+
name,
|
|
13
|
+
type,
|
|
14
|
+
url,
|
|
15
|
+
}: DownloadStorageFileParams) => {
|
|
16
|
+
const a = document.createElement('a');
|
|
17
|
+
|
|
18
|
+
a.href =
|
|
19
|
+
url ||
|
|
20
|
+
getStorageFileUrl({
|
|
21
|
+
id: id as string,
|
|
22
|
+
type,
|
|
23
|
+
});
|
|
24
|
+
a.target = '_blank';
|
|
25
|
+
a.download = name ?? '';
|
|
26
|
+
a.click();
|
|
27
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const getFileTypeIcon = (mimeType: string): string => {
|
|
2
|
+
if (mimeType.includes('image')) return 'preview-tag-image';
|
|
3
|
+
if (mimeType.includes('video')) return 'preview-tag-video';
|
|
4
|
+
if (mimeType.includes('audio')) return 'preview-tag-audio';
|
|
5
|
+
return 'attach';
|
|
6
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface GetStorageFileUrlParams {
|
|
2
|
+
id: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const getStorageFileUrl = ({
|
|
7
|
+
id,
|
|
8
|
+
type,
|
|
9
|
+
}: GetStorageFileUrlParams): string => {
|
|
10
|
+
const token = localStorage.getItem('access-token');
|
|
11
|
+
let url = `${import.meta.env.VITE_API_URL}/storage/file/${id}/download?access_token=${token}`;
|
|
12
|
+
|
|
13
|
+
const source = type?.match(/source=[^;]+/)?.[0];
|
|
14
|
+
if (source) url = `${url}&${source}`;
|
|
15
|
+
|
|
16
|
+
return url;
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getStorageFileUrl } from './getStorageFileUrl';
|
|
2
|
+
|
|
3
|
+
interface OpenStorageFileInNewTabParams {
|
|
4
|
+
id?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const openStorageFileInNewTab = async (
|
|
8
|
+
item?: OpenStorageFileInNewTabParams,
|
|
9
|
+
) => {
|
|
10
|
+
if (!item?.id) return;
|
|
11
|
+
|
|
12
|
+
// opened synchronously, before the awaits below, so browsers don't
|
|
13
|
+
// treat it as a blocked popup once the user-gesture context is gone
|
|
14
|
+
const newTab = window.open('', '_blank');
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const url = getStorageFileUrl({
|
|
18
|
+
id: item.id,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const response = await fetch(url);
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`Failed to fetch file: ${response.statusText}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const blob = await response.blob();
|
|
27
|
+
const fileURL = URL.createObjectURL(blob);
|
|
28
|
+
|
|
29
|
+
if (newTab) newTab.location.href = fileURL;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
newTab?.close();
|
|
32
|
+
console.error('Error opening file:', error);
|
|
33
|
+
}
|
|
34
|
+
};
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormatDateMode } from '../enums';
|
|
2
|
+
import { formatDate } from './formatDate';
|
|
3
|
+
|
|
4
|
+
export function prettifyDate(
|
|
5
|
+
timestamp: string | number,
|
|
6
|
+
timezone?: string,
|
|
7
|
+
): string {
|
|
8
|
+
const value = Number(timestamp);
|
|
9
|
+
if (!value) return '';
|
|
10
|
+
|
|
11
|
+
return formatDate(new Date(value), FormatDateMode.DATETIME_SHORT, {
|
|
12
|
+
timezone,
|
|
13
|
+
});
|
|
14
|
+
}
|