@oslokommune/punkt-elements 16.26.7 → 17.0.2
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/CHANGELOG.md +110 -0
- package/dist/accordion-CbXDxOho.cjs +47 -0
- package/dist/{accordion-CBdIk9gw.js → accordion-DEUHQ4JD.js} +45 -35
- package/dist/{alert-HHTGY0sp.js → alert-CbtVGrHD.js} +31 -17
- package/dist/{alert-B8dLsiTz.cjs → alert-CkUnbPdA.cjs} +5 -5
- package/dist/base-elements/input-element.d.ts +1 -0
- package/dist/button-Cod17rKo.js +115 -0
- package/dist/{button-B5tQpKeG.cjs → button-gvDXtBMC.cjs} +5 -2
- package/dist/{calendar-DIzGBdbh.cjs → calendar-BVXW8DqC.cjs} +1 -1
- package/dist/{calendar-CjlUA-Lb.js → calendar-CjC4qlh6.js} +1 -1
- package/dist/{checkbox-Bt_sC_90.cjs → checkbox-8uxbeU30.cjs} +1 -1
- package/dist/{checkbox-D03BC2Va.js → checkbox-DJDphhqz.js} +1 -1
- package/dist/{combobox-CoQBTWqL.js → combobox-Du5yr-xM.js} +16 -2
- package/dist/combobox-hKrbYLUe.cjs +136 -0
- package/dist/components/accordion/accordion-context.d.ts +7 -0
- package/dist/components/accordion/accordion.d.ts +2 -0
- package/dist/components/accordion/accordionitem.d.ts +1 -0
- package/dist/components/alert/alert.d.ts +5 -0
- package/dist/components/alert/alert.test.d.ts +1 -0
- package/dist/components/button/button.d.ts +4 -1
- package/dist/components/datepicker/datepicker-base.d.ts +2 -0
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -2
- package/dist/components/footer/footer-base.d.ts +44 -0
- package/dist/components/footer/footer-simple.d.ts +20 -0
- package/dist/components/footer/footer.accessibility.test.d.ts +0 -0
- package/dist/components/footer/footer.d.ts +22 -0
- package/dist/components/footer/footer.test.d.ts +0 -0
- package/dist/components/footer/index.d.ts +3 -0
- package/dist/components/footer/types.d.ts +16 -0
- package/dist/components/header/header-chrome-controller.d.ts +44 -0
- package/dist/components/header/header-global.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-global.d.ts +78 -0
- package/dist/components/header/header-global.test.d.ts +0 -0
- package/dist/components/header/header-service.accessibility.test.d.ts +0 -0
- package/dist/components/header/header-service.d.ts +6 -21
- package/dist/components/header/header-service.test.d.ts +1 -1
- package/dist/components/header/header.d.ts +11 -3
- package/dist/components/header/header.test.d.ts +0 -0
- package/dist/components/header/index.d.ts +2 -1
- package/dist/components/header/types.d.ts +28 -2
- package/dist/components/header-menu/header-menu.d.ts +4 -5
- package/dist/components/header-menu/types.d.ts +1 -1
- package/dist/components/index.d.ts +5 -3
- package/dist/components/input-wrapper/input-wrapper.d.ts +2 -0
- package/dist/components/input-wrapper/input-wrapper.test.d.ts +1 -0
- package/dist/components/searchinput/searchinput.d.ts +5 -0
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.test.d.ts +1 -0
- package/dist/components/textarea/textarea.test.d.ts +2 -0
- package/dist/components/textinput/textinput.test.d.ts +1 -0
- package/dist/components/timepicker/timepicker.d.ts +2 -0
- package/dist/components/timepicker/timepicker.test.d.ts +3 -0
- package/dist/consent--Nw43WFU.cjs +18 -0
- package/dist/{consent-D5sY6JK3.js → consent-B2hSTCGC.js} +14 -7
- package/dist/consume-BiOhrhEy.js +167 -0
- package/dist/consume-DKf5SmP9.cjs +1 -0
- package/dist/{converters-BKGBRBpS.js → converters-BBfsEJV5.js} +25 -25
- package/dist/{converters-9jHlXDyy.cjs → converters-Cd0fPEly.cjs} +1 -1
- package/dist/{datepicker-BE5Ll0W4.js → datepicker--Fq8q-J3.js} +30 -12
- package/dist/{datepicker-x4xM3KQz.cjs → datepicker-CEoBYTBU.cjs} +11 -7
- package/dist/docs/components/alert.d.ts +3 -0
- package/dist/docs/components/footer.d.ts +9 -0
- package/dist/docs/components/form-sizes.d.ts +10 -0
- package/dist/docs/components/header-global-full.d.ts +20 -0
- package/dist/docs/components/header-global.d.ts +14 -0
- package/dist/docs/components/searchinput.d.ts +6 -3
- package/dist/fetch-header-footer-data-Pc32etrk.js +88 -0
- package/dist/fetch-header-footer-data-xohWFmYC.cjs +1 -0
- package/dist/fileupload-CGKUJrlj.cjs +401 -0
- package/dist/{fileupload-2hf8YNhO.js → fileupload-D4gQN64T.js} +156 -176
- package/dist/focus-trap-DG3pEuyJ.js +60 -0
- package/dist/focus-trap-DSv4Ifqm.cjs +1 -0
- package/dist/footer-BIrJeRuZ.js +303 -0
- package/dist/footer-Ber-jqM1.cjs +114 -0
- package/dist/footer.d.ts +1 -0
- package/dist/header-BFk1an4z.cjs +465 -0
- package/dist/header-Deg_LGJo.js +1287 -0
- package/dist/header-menu-BHqK4QA6.cjs +126 -0
- package/dist/{header-menu-C8b5vd3n.js → header-menu-GFtJKM4j.js} +25 -97
- package/dist/{helptext-OfqH5npD.js → helptext-C_brWCIT.js} +1 -1
- package/dist/{helptext-eckq4JEX.cjs → helptext-Cq5rNaAC.cjs} +1 -1
- package/dist/{input-element-ZGOWsvKM.cjs → input-element-B0qLbEdF.cjs} +1 -1
- package/dist/{input-element-BFHpeoV8.js → input-element-C0RnXi-J.js} +5 -2
- package/dist/{input-wrapper-DwwE0JcO.js → input-wrapper-BweP6t3O.js} +12 -0
- package/dist/{input-wrapper-BRjQB4zM.cjs → input-wrapper-DPkkiG7S.cjs} +13 -11
- package/dist/{input-wrapper-DaA98B5l.js → input-wrapper-fWV5P4MN.js} +22 -15
- package/dist/{input-wrapper-LcZjpt0L.cjs → input-wrapper-wh3fWIhk.cjs} +1 -1
- package/dist/modal-CPnFteYS.cjs +35 -0
- package/dist/{modal-C6pScpdG.js → modal-xNK_wpHk.js} +11 -20
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -0
- package/dist/pkt-footer.js +2 -0
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +2 -2
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +27 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/{radiobutton-DGO6H2Ki.js → radiobutton-C6htwDrT.js} +1 -1
- package/dist/{radiobutton-DY1WWepJ.cjs → radiobutton-DjWBoSHv.cjs} +1 -1
- package/dist/scroll-lock-BN8lOhV5.cjs +1 -0
- package/dist/scroll-lock-DAbNKAUy.js +18 -0
- package/dist/searchinput-CfUVfpqL.js +156 -0
- package/dist/searchinput-DGjeN1YI.cjs +60 -0
- package/dist/{select-D4_HQFkh.cjs → select-CZvAW7W2.cjs} +2 -1
- package/dist/{select-BwHUIlwQ.js → select-CsBXXbLP.js} +4 -3
- package/dist/setupTests.d.ts +0 -0
- package/dist/shared-types/footer.d.ts +95 -0
- package/dist/shared-types/{header-menu.d.ts → header-footer.d.ts} +51 -4
- package/dist/shared-types/header.d.ts +1 -1
- package/dist/shared-types/index.d.ts +6 -4
- package/dist/shared-types/searchinput.d.ts +2 -0
- package/dist/shared-types/select.d.ts +3 -2
- package/dist/shared-types/size.d.ts +4 -0
- package/dist/shared-types/timepicker.d.ts +0 -6
- package/dist/shared-utils/datepicker-utils.d.ts +5 -4
- package/dist/shared-utils/fileupload/focus-trap.d.ts +4 -10
- package/dist/shared-utils/focus-trap/index.d.ts +22 -0
- package/dist/shared-utils/{header-menu → header-footer}/example-data.d.ts +5 -4
- package/dist/shared-utils/header-footer/external-domain.d.ts +26 -0
- package/dist/shared-utils/{header-menu → header-footer}/fetch-header-footer-data.d.ts +6 -2
- package/dist/shared-utils/{header-menu → header-footer}/index.d.ts +2 -1
- package/dist/shared-utils/{header-menu → header-footer}/select-megamenu.d.ts +1 -1
- package/dist/shared-utils/scroll-lock/index.d.ts +24 -0
- package/dist/tabs-BqrKLCjd.js +214 -0
- package/dist/tabs-q62MK_-r.cjs +40 -0
- package/dist/{textarea-D6M7ZhtA.js → textarea-Cm392CEI.js} +5 -3
- package/dist/{textarea-Bt_Zs8gq.cjs → textarea-sTcZxOIB.cjs} +3 -2
- package/dist/{textinput-EDKjcUdg.cjs → textinput-DqJbTglM.cjs} +3 -2
- package/dist/{textinput-oU2EvFsi.js → textinput-TSPcBcih.js} +5 -3
- package/dist/{timepicker-CgOL2sd9.cjs → timepicker-CqFYMV8q.cjs} +8 -7
- package/dist/{timepicker-_G0V_HV3.js → timepicker-DWbgTDKq.js} +10 -9
- package/package.json +3 -3
- package/src/components/accordion/accordion-context.ts +8 -0
- package/src/components/accordion/accordion.test.ts +44 -0
- package/src/components/accordion/accordion.ts +13 -3
- package/src/components/accordion/accordionitem.ts +9 -1
- package/src/components/alert/alert.test.ts +51 -2
- package/src/components/alert/alert.ts +11 -5
- package/src/components/breadcrumbs/breadcrumbs.test.ts +11 -3
- package/src/components/button/button.test.ts +23 -0
- package/src/components/button/button.ts +28 -3
- package/src/components/combobox/combobox.core.test.ts +20 -0
- package/src/components/combobox/combobox.ts +2 -0
- package/src/components/consent/consent.test.ts +6 -3
- package/src/components/consent/consent.ts +15 -7
- package/src/components/datepicker/datepicker-base.ts +5 -1
- package/src/components/datepicker/datepicker-utils.test.ts +10 -0
- package/src/components/datepicker/datepicker.core.test.ts +17 -0
- package/src/components/datepicker/datepicker.ts +8 -0
- package/src/components/footer/footer-base.ts +238 -0
- package/src/components/footer/footer-simple.ts +71 -0
- package/src/components/footer/footer.accessibility.test.ts +66 -0
- package/src/components/footer/footer.test.ts +238 -0
- package/src/components/footer/footer.ts +81 -0
- package/src/components/footer/index.ts +4 -0
- package/src/components/footer/types.ts +21 -0
- package/src/components/header/header-chrome-controller.ts +123 -0
- package/src/components/header/header-global.accessibility.test.ts +110 -0
- package/src/components/header/header-global.test.ts +329 -0
- package/src/components/header/header-global.ts +648 -0
- package/src/components/header/header-service.accessibility.test.ts +79 -0
- package/src/components/header/header-service.test.ts +32 -12
- package/src/components/header/header-service.ts +38 -162
- package/src/components/header/header-user-menu.ts +0 -1
- package/src/components/header/header.test.ts +84 -0
- package/src/components/header/header.ts +52 -5
- package/src/components/header/index.ts +6 -0
- package/src/components/header/types.ts +38 -0
- package/src/components/header-menu/header-menu.test.ts +131 -10
- package/src/components/header-menu/header-menu.ts +23 -24
- package/src/components/header-menu/types.ts +1 -1
- package/src/components/index.ts +18 -2
- package/src/components/input-wrapper/input-wrapper.test.ts +45 -0
- package/src/components/input-wrapper/input-wrapper.ts +17 -9
- package/src/components/modal/modal.ts +8 -9
- package/src/components/searchinput/searchinput.test.ts +43 -0
- package/src/components/searchinput/searchinput.ts +29 -12
- package/src/components/select/index.ts +1 -1
- package/src/components/select/select.test.ts +28 -0
- package/src/components/select/select.ts +4 -3
- package/src/components/textarea/textarea.test.ts +16 -0
- package/src/components/textarea/textarea.ts +3 -1
- package/src/components/textinput/textinput.test.ts +28 -0
- package/src/components/textinput/textinput.ts +3 -1
- package/src/components/timepicker/timepicker.test.ts +26 -0
- package/src/components/timepicker/timepicker.ts +12 -6
- package/dist/accordion-FISAiAbX.cjs +0 -47
- package/dist/button-C_YzTSuU.js +0 -96
- package/dist/combobox-D6H9rWPV.cjs +0 -135
- package/dist/consent-X3wvhteO.cjs +0 -10
- package/dist/fileupload-BLVrslUX.cjs +0 -401
- package/dist/header-CFrsaq0c.cjs +0 -310
- package/dist/header-D_xvPR4R.js +0 -801
- package/dist/header-menu-DMdP_c6X.cjs +0 -126
- package/dist/modal-DKU7PnjJ.cjs +0 -35
- package/dist/searchinput-CyO5k4Q4.js +0 -148
- package/dist/searchinput-DG6YetL1.cjs +0 -60
- package/dist/shared-utils/modal-scroll-lock.d.ts +0 -10
- package/dist/tabs-CGo0ODPa.cjs +0 -40
- package/dist/tabs-ChdR0D1C.js +0 -379
- /package/dist/shared-utils/{header-menu → header-footer}/icon-map.d.ts +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { a as e, n as t, o as n, p as r, s as i, t as a } from "./element-BoJrqauR.js";
|
|
2
2
|
import { t as o } from "./class-map-CAQCRB1W.js";
|
|
3
|
-
import "./alert-
|
|
3
|
+
import "./alert-CbtVGrHD.js";
|
|
4
4
|
import "./icon-DGFEIlco.js";
|
|
5
5
|
import { t as s } from "./if-defined-D0bnetLJ.js";
|
|
6
|
-
import { t as c } from "./converters-
|
|
6
|
+
import { t as c } from "./converters-BBfsEJV5.js";
|
|
7
7
|
import { n as l } from "./utils-BwF4QSrq.js";
|
|
8
|
-
import "./input-wrapper-
|
|
9
|
-
import "./
|
|
8
|
+
import "./input-wrapper-fWV5P4MN.js";
|
|
9
|
+
import { r as u } from "./focus-trap-DG3pEuyJ.js";
|
|
10
|
+
import "./modal-xNK_wpHk.js";
|
|
10
11
|
import "./progressbar-mtjtbpCO.js";
|
|
11
12
|
//#region ../../shared-types/fileupload.ts
|
|
12
|
-
var
|
|
13
|
+
var d = {
|
|
13
14
|
dropZoneDragMultiple: "Dra filer hit for å laste dem opp eller",
|
|
14
15
|
dropZoneDragSingle: "Dra en fil hit for å laste den opp eller",
|
|
15
16
|
dropZoneDragMultipleThumbnail: "Dra bilder hit for å laste dem opp eller",
|
|
@@ -36,7 +37,7 @@ var u = {
|
|
|
36
37
|
};
|
|
37
38
|
//#endregion
|
|
38
39
|
//#region ../../shared-utils/fileupload/size.ts
|
|
39
|
-
function
|
|
40
|
+
function f(e) {
|
|
40
41
|
if (e == null || e === "") return;
|
|
41
42
|
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
42
43
|
let t = String(e).trim(), n = Number(t);
|
|
@@ -55,18 +56,18 @@ function d(e) {
|
|
|
55
56
|
default: return;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function p(e) {
|
|
59
60
|
return e < 1024 ? `${Math.round(e)} B` : e < 1024 * 1024 ? `${Math.round(e / 1024)} KB` : e < 1024 * 1024 * 1024 ? `${Math.round(e / (1024 * 1024))} MB` : `${Math.round(e / (1024 * 1024 * 1024))} GB`;
|
|
60
61
|
}
|
|
61
62
|
//#endregion
|
|
62
63
|
//#region ../../shared-utils/fileupload/formats.ts
|
|
63
|
-
function
|
|
64
|
+
function m(e) {
|
|
64
65
|
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function h(e) {
|
|
67
68
|
return e ? e.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean) : [];
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function g(e, t, n) {
|
|
70
71
|
let r = e.toLowerCase().replace(/^\./, "");
|
|
71
72
|
if (r.includes("/")) {
|
|
72
73
|
if (r.endsWith("/*")) {
|
|
@@ -77,42 +78,42 @@ function h(e, t, n) {
|
|
|
77
78
|
}
|
|
78
79
|
return t === r;
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
let n =
|
|
81
|
+
function _(e, t) {
|
|
82
|
+
let n = m(t);
|
|
82
83
|
if (n.length === 0) return !0;
|
|
83
84
|
let r = e.name.split(".").pop()?.toLowerCase() ?? "", i = e.type.toLowerCase();
|
|
84
|
-
return n.some((e) =>
|
|
85
|
+
return n.some((e) => g(e, r, i));
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
+
function v(e, t) {
|
|
87
88
|
let n = (e ?? "").trim();
|
|
88
89
|
if (n) return n;
|
|
89
|
-
let r =
|
|
90
|
+
let r = m(t);
|
|
90
91
|
return r.length === 0 ? "" : r.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function y(e) {
|
|
93
94
|
return e.includes("/") ? e : e.replace(/^\./, "").toUpperCase();
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
-
let n =
|
|
97
|
-
if (n.length > 0) return n.map(
|
|
98
|
-
let r =
|
|
99
|
-
return r.length > 0 ? r.map(
|
|
96
|
+
function b(e, t) {
|
|
97
|
+
let n = m(e);
|
|
98
|
+
if (n.length > 0) return n.map(y).join(", ");
|
|
99
|
+
let r = h(t);
|
|
100
|
+
return r.length > 0 ? r.map(y).join(", ") : "";
|
|
100
101
|
}
|
|
101
102
|
//#endregion
|
|
102
103
|
//#region ../../shared-utils/fileupload/validation.ts
|
|
103
|
-
function
|
|
104
|
+
function x(e, t, n) {
|
|
104
105
|
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
-
let n =
|
|
108
|
-
if (n.length > 0 && !
|
|
107
|
+
function S(e, t) {
|
|
108
|
+
let n = m(t.allowedFormats);
|
|
109
|
+
if (n.length > 0 && !_(e, n)) {
|
|
109
110
|
let e = n.join(", "), r = `Ugyldig filtype. Tillatte formater: ${e}`;
|
|
110
|
-
return
|
|
111
|
+
return x(t.formatErrorMessage, r, { formats: e });
|
|
111
112
|
}
|
|
112
|
-
let r =
|
|
113
|
+
let r = f(t.maxFileSize);
|
|
113
114
|
if (r !== void 0 && e.size > r) {
|
|
114
|
-
let e =
|
|
115
|
-
return
|
|
115
|
+
let e = p(r), n = `Filen er for stor. Maks størrelse er ${e}.`;
|
|
116
|
+
return x(t.sizeErrorMessage, n, { maxSize: e });
|
|
116
117
|
}
|
|
117
118
|
if (t.onFileValidation) {
|
|
118
119
|
let n = t.onFileValidation(e);
|
|
@@ -120,7 +121,7 @@ function x(e, t) {
|
|
|
120
121
|
}
|
|
121
122
|
return null;
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function C(e) {
|
|
124
125
|
let t = e.file;
|
|
125
126
|
if (t?.type?.startsWith("image/")) return !0;
|
|
126
127
|
let n = e.attributes?.targetFilename || t?.name || "";
|
|
@@ -128,10 +129,10 @@ function S(e) {
|
|
|
128
129
|
}
|
|
129
130
|
//#endregion
|
|
130
131
|
//#region ../../shared-utils/fileupload/transfers.ts
|
|
131
|
-
function
|
|
132
|
+
function w(e) {
|
|
132
133
|
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function T(e, t, n) {
|
|
135
136
|
let r = {
|
|
136
137
|
"in-progress": 0,
|
|
137
138
|
error: 1,
|
|
@@ -146,32 +147,11 @@ function w(e, t, n) {
|
|
|
146
147
|
showProgress: r?.showProgress,
|
|
147
148
|
lastProgress: r?.lastProgress
|
|
148
149
|
};
|
|
149
|
-
}).sort((e, t) => r[
|
|
150
|
-
}
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region ../../shared-utils/fileupload/focus-trap.ts
|
|
153
|
-
function T(e) {
|
|
154
|
-
if (!e) return [];
|
|
155
|
-
let t = [
|
|
156
|
-
"a[href]:not([tabindex=\"-1\"])",
|
|
157
|
-
"button:not([disabled]):not([tabindex=\"-1\"])",
|
|
158
|
-
"input:not([disabled]):not([type=\"hidden\"]):not([tabindex=\"-1\"])",
|
|
159
|
-
"select:not([disabled]):not([tabindex=\"-1\"])",
|
|
160
|
-
"textarea:not([disabled]):not([tabindex=\"-1\"])",
|
|
161
|
-
"[tabindex]:not([tabindex=\"-1\"])"
|
|
162
|
-
].join(", ");
|
|
163
|
-
return Array.from(e.querySelectorAll(t)).filter((e) => !e.hasAttribute("inert"));
|
|
164
|
-
}
|
|
165
|
-
function E(e, t) {
|
|
166
|
-
if (e.key !== "Tab") return !1;
|
|
167
|
-
let n = T(t);
|
|
168
|
-
if (n.length === 0) return e.preventDefault(), !0;
|
|
169
|
-
let r = n[0], i = n[n.length - 1], a = (t?.ownerDocument ?? document).activeElement, o = !!a && n.includes(a);
|
|
170
|
-
return e.shiftKey ? !o || a === r ? (e.preventDefault(), i.focus(), !0) : !1 : !o || a === i ? (e.preventDefault(), r.focus(), !0) : !1;
|
|
150
|
+
}).sort((e, t) => r[w(e.progress)] - r[w(t.progress)]);
|
|
171
151
|
}
|
|
172
152
|
//#endregion
|
|
173
153
|
//#region ../../shared-utils/fileupload/truncate.ts
|
|
174
|
-
function
|
|
154
|
+
function E(e, t) {
|
|
175
155
|
return !t || t <= 0 || e.length <= t + 3 ? null : {
|
|
176
156
|
head: e.slice(0, e.length - t),
|
|
177
157
|
tail: e.slice(-t)
|
|
@@ -179,12 +159,12 @@ function D(e, t) {
|
|
|
179
159
|
}
|
|
180
160
|
//#endregion
|
|
181
161
|
//#region ../../shared-utils/fileupload/navigation.ts
|
|
182
|
-
function
|
|
162
|
+
function D(e, t, n) {
|
|
183
163
|
return n <= 0 ? 0 : t === "prev" ? e <= 0 ? n - 1 : e - 1 : e >= n - 1 ? 0 : e + 1;
|
|
184
164
|
}
|
|
185
165
|
//#endregion
|
|
186
166
|
//#region ../../shared-utils/fileupload/announcements.ts
|
|
187
|
-
function
|
|
167
|
+
function O(e, t) {
|
|
188
168
|
let n = e.length;
|
|
189
169
|
if (n === 0 || !t || t.length === 0) return {
|
|
190
170
|
totalCount: n,
|
|
@@ -204,10 +184,10 @@ function k(e, t) {
|
|
|
204
184
|
}
|
|
205
185
|
//#endregion
|
|
206
186
|
//#region ../../shared-utils/fileupload/filename.ts
|
|
207
|
-
function
|
|
187
|
+
function k(e, t = d.unknownFilename) {
|
|
208
188
|
return e.attributes?.targetFilename || e.file?.name || t;
|
|
209
189
|
}
|
|
210
|
-
var
|
|
190
|
+
var A = {
|
|
211
191
|
name: "pkt-fileupload",
|
|
212
192
|
react: "PktFileUpload",
|
|
213
193
|
"css-class": "pkt-fileupload",
|
|
@@ -511,9 +491,9 @@ var j = {
|
|
|
511
491
|
}
|
|
512
492
|
}
|
|
513
493
|
}
|
|
514
|
-
},
|
|
494
|
+
}, j = class extends a {
|
|
515
495
|
constructor(...e) {
|
|
516
|
-
super(...e), this.id = `pkt-fileupload-${l()}`, this.name = "files", this.label = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton =
|
|
496
|
+
super(...e), this.id = `pkt-fileupload-${l()}`, this.name = "files", this.label = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = A.props.helptextDropdownButton.default, this.required = !1, this.multiple = !1, this.disabled = !1, this.fullwidth = !1, this.uploadStrategy = "form", this.itemRenderer = "filename", this.accept = "", this.allowedFormats = [], this.formatErrorMessage = "", this.sizeErrorMessage = "", this.transfers = [], this.addCommentsEnabled = !1, this.renameFilesEnabled = !1, this.extraOperations = [], this.enableImagePreview = !1, this.hasError = !1, this.errorMessage = "", this.optionalTag = !1, this.optionalText = A.props.optionalText.default, this.requiredTag = !1, this.requiredText = A.props.requiredText.default, this.tagText = null, this.truncateTail = 4, this.files = [], this.isDragActive = !1, this.validationErrorMessage = null, this.addedAnnouncement = "", this.thumbnailUrls = {}, this.hasInitializedValue = !1, this.hasWarnedInvalidValueCombo = !1, this.thumbnailFileById = /* @__PURE__ */ new Map(), this.connectedForm = null, this.addedAnnouncementTimer = null, this.requiredSelectionMessage = d.requiredMissing, this.onNativeFileChange = (e) => {
|
|
517
497
|
let t = e.target;
|
|
518
498
|
this.addFiles(t.files ? Array.from(t.files) : []), this.uploadStrategy === "custom" && (t.value = "");
|
|
519
499
|
}, this.openFileDialog = (e) => {
|
|
@@ -591,7 +571,7 @@ var j = {
|
|
|
591
571
|
file: e,
|
|
592
572
|
attributes: { targetFilename: e.name }
|
|
593
573
|
}));
|
|
594
|
-
this.setAddedAnnouncement(n.length === 1 ?
|
|
574
|
+
this.setAddedAnnouncement(n.length === 1 ? d.srFileAdded(n[0].attributes.targetFilename) : d.srFilesAdded(n.length));
|
|
595
575
|
let r = this.getCurrentFiles(), i = this.multiple ? [...r, ...n] : [n[0]];
|
|
596
576
|
this.commitFiles(i, "add", n.map((e) => e.fileId)), this.uploadStrategy === "custom" && n.forEach((e) => {
|
|
597
577
|
this.dispatchEvent(new CustomEvent("file-upload-requested", {
|
|
@@ -655,22 +635,22 @@ var j = {
|
|
|
655
635
|
return this.transfers.find((t) => t.fileId === e);
|
|
656
636
|
}
|
|
657
637
|
isImageFile(e) {
|
|
658
|
-
return
|
|
638
|
+
return C(e);
|
|
659
639
|
}
|
|
660
640
|
formatFileSize(e) {
|
|
661
|
-
return
|
|
641
|
+
return p(e);
|
|
662
642
|
}
|
|
663
643
|
getResolvedAcceptValue() {
|
|
664
|
-
return
|
|
644
|
+
return v(this.accept, this.allowedFormats);
|
|
665
645
|
}
|
|
666
646
|
getSupportedFormatsText() {
|
|
667
|
-
return
|
|
647
|
+
return b(this.allowedFormats, this.accept);
|
|
668
648
|
}
|
|
669
649
|
getSortedFilesAndTransfers() {
|
|
670
|
-
return
|
|
650
|
+
return T(this.getCurrentFiles(), this.transfers, this.uploadStrategy);
|
|
671
651
|
}
|
|
672
652
|
validateFile(e) {
|
|
673
|
-
let t =
|
|
653
|
+
let t = S(e, {
|
|
674
654
|
allowedFormats: this.allowedFormats,
|
|
675
655
|
maxFileSize: this.maxFileSize,
|
|
676
656
|
formatErrorMessage: this.formatErrorMessage,
|
|
@@ -687,7 +667,7 @@ var j = {
|
|
|
687
667
|
composed: !0,
|
|
688
668
|
cancelable: !0
|
|
689
669
|
});
|
|
690
|
-
return this.dispatchEvent(r), n.errorMessage ? n.errorMessage : r.defaultPrevented ?
|
|
670
|
+
return this.dispatchEvent(r), n.errorMessage ? n.errorMessage : r.defaultPrevented ? d.genericValidationRejection : null;
|
|
691
671
|
}
|
|
692
672
|
syncThumbnailUrls(e) {
|
|
693
673
|
if (!(typeof URL < "u" && typeof URL.createObjectURL == "function" && typeof URL.revokeObjectURL == "function")) {
|
|
@@ -721,12 +701,12 @@ var j = {
|
|
|
721
701
|
}
|
|
722
702
|
getSrUploadedMessage() {
|
|
723
703
|
if (this.addedAnnouncement) return this.addedAnnouncement;
|
|
724
|
-
let { totalCount: e, uploadedCount: t } =
|
|
725
|
-
return e === 0 || t === 0 ? "" :
|
|
704
|
+
let { totalCount: e, uploadedCount: t } = O(this.getCurrentFiles(), this.transfers);
|
|
705
|
+
return e === 0 || t === 0 ? "" : d.srFilesUploadedOfTotal(t, e, d.fileLabel(e));
|
|
726
706
|
}
|
|
727
707
|
getSrErrorsMessage() {
|
|
728
|
-
let { totalCount: e, failedCount: t } =
|
|
729
|
-
return e === 0 || t === 0 ? "" :
|
|
708
|
+
let { totalCount: e, failedCount: t } = O(this.getCurrentFiles(), this.transfers);
|
|
709
|
+
return e === 0 || t === 0 ? "" : d.srFilesFailedOfTotal(t, e, d.fileLabel(e));
|
|
730
710
|
}
|
|
731
711
|
syncFormSubmitListener() {
|
|
732
712
|
let e = this.closest("form");
|
|
@@ -736,92 +716,92 @@ var j = {
|
|
|
736
716
|
this.connectedForm &&= (this.connectedForm.removeEventListener("submit", this.onHostFormSubmit), null);
|
|
737
717
|
}
|
|
738
718
|
};
|
|
739
|
-
t([n({ type: String })],
|
|
719
|
+
t([n({ type: String })], j.prototype, "id", void 0), t([n({ type: String })], j.prototype, "name", void 0), t([n({ type: String })], j.prototype, "label", void 0), t([n({ type: String })], j.prototype, "helptext", void 0), t([n({
|
|
740
720
|
type: String,
|
|
741
721
|
attribute: "helptext-dropdown"
|
|
742
|
-
})],
|
|
722
|
+
})], j.prototype, "helptextDropdown", void 0), t([n({
|
|
743
723
|
type: String,
|
|
744
724
|
attribute: "helptext-dropdown-button"
|
|
745
|
-
})],
|
|
725
|
+
})], j.prototype, "helptextDropdownButton", void 0), t([n({
|
|
746
726
|
type: Boolean,
|
|
747
727
|
reflect: !0
|
|
748
|
-
})],
|
|
728
|
+
})], j.prototype, "required", void 0), t([n({
|
|
749
729
|
type: Boolean,
|
|
750
730
|
reflect: !0
|
|
751
|
-
})],
|
|
731
|
+
})], j.prototype, "multiple", void 0), t([n({
|
|
752
732
|
type: Boolean,
|
|
753
733
|
reflect: !0
|
|
754
|
-
})],
|
|
734
|
+
})], j.prototype, "disabled", void 0), t([n({
|
|
755
735
|
type: Boolean,
|
|
756
736
|
reflect: !0,
|
|
757
737
|
attribute: "fullwidth"
|
|
758
|
-
})],
|
|
738
|
+
})], j.prototype, "fullwidth", void 0), t([n({
|
|
759
739
|
type: String,
|
|
760
740
|
reflect: !0,
|
|
761
741
|
attribute: "upload-strategy"
|
|
762
|
-
})],
|
|
742
|
+
})], j.prototype, "uploadStrategy", void 0), t([n({
|
|
763
743
|
type: String,
|
|
764
744
|
reflect: !0,
|
|
765
745
|
attribute: "item-renderer"
|
|
766
|
-
})],
|
|
746
|
+
})], j.prototype, "itemRenderer", void 0), t([n({ type: String })], j.prototype, "accept", void 0), t([n({
|
|
767
747
|
converter: c.csvToArray,
|
|
768
748
|
attribute: "allowed-formats"
|
|
769
|
-
})],
|
|
749
|
+
})], j.prototype, "allowedFormats", void 0), t([n({
|
|
770
750
|
type: String,
|
|
771
751
|
attribute: "format-error-message"
|
|
772
|
-
})],
|
|
752
|
+
})], j.prototype, "formatErrorMessage", void 0), t([n({ attribute: "max-file-size" })], j.prototype, "maxFileSize", void 0), t([n({
|
|
773
753
|
type: String,
|
|
774
754
|
attribute: "size-error-message"
|
|
775
|
-
})],
|
|
755
|
+
})], j.prototype, "sizeErrorMessage", void 0), t([n({ attribute: !1 })], j.prototype, "onFileValidation", void 0), t([n({ attribute: !1 })], j.prototype, "transfers", void 0), t([n({
|
|
776
756
|
type: Boolean,
|
|
777
757
|
attribute: "add-comments-enabled"
|
|
778
|
-
})],
|
|
758
|
+
})], j.prototype, "addCommentsEnabled", void 0), t([n({
|
|
779
759
|
type: Boolean,
|
|
780
760
|
attribute: "rename-files-enabled"
|
|
781
|
-
})],
|
|
761
|
+
})], j.prototype, "renameFilesEnabled", void 0), t([n({ attribute: !1 })], j.prototype, "extraOperations", void 0), t([n({
|
|
782
762
|
type: Boolean,
|
|
783
763
|
reflect: !0,
|
|
784
764
|
attribute: "enable-image-preview"
|
|
785
|
-
})],
|
|
765
|
+
})], j.prototype, "enableImagePreview", void 0), t([n({
|
|
786
766
|
type: Boolean,
|
|
787
767
|
attribute: "has-error"
|
|
788
|
-
})],
|
|
768
|
+
})], j.prototype, "hasError", void 0), t([n({
|
|
789
769
|
type: String,
|
|
790
770
|
attribute: "error-message"
|
|
791
|
-
})],
|
|
771
|
+
})], j.prototype, "errorMessage", void 0), t([n({
|
|
792
772
|
type: Boolean,
|
|
793
773
|
attribute: "optional-tag"
|
|
794
|
-
})],
|
|
774
|
+
})], j.prototype, "optionalTag", void 0), t([n({
|
|
795
775
|
type: String,
|
|
796
776
|
attribute: "optional-text"
|
|
797
|
-
})],
|
|
777
|
+
})], j.prototype, "optionalText", void 0), t([n({
|
|
798
778
|
type: Boolean,
|
|
799
779
|
attribute: "required-tag"
|
|
800
|
-
})],
|
|
780
|
+
})], j.prototype, "requiredTag", void 0), t([n({
|
|
801
781
|
type: String,
|
|
802
782
|
attribute: "required-text"
|
|
803
|
-
})],
|
|
783
|
+
})], j.prototype, "requiredText", void 0), t([n({
|
|
804
784
|
type: String,
|
|
805
785
|
attribute: "tag-text"
|
|
806
|
-
})],
|
|
786
|
+
})], j.prototype, "tagText", void 0), t([n({
|
|
807
787
|
type: Number,
|
|
808
788
|
attribute: "truncate-tail"
|
|
809
|
-
})],
|
|
789
|
+
})], j.prototype, "truncateTail", void 0), t([n({ attribute: !1 })], j.prototype, "value", void 0), t([n({ attribute: !1 })], j.prototype, "defaultValue", void 0), t([e()], j.prototype, "files", void 0), t([e()], j.prototype, "isDragActive", void 0), t([e()], j.prototype, "validationErrorMessage", void 0), t([e()], j.prototype, "addedAnnouncement", void 0), t([e()], j.prototype, "thumbnailUrls", void 0);
|
|
810
790
|
//#endregion
|
|
811
791
|
//#region src/components/fileupload/fileupload-operations.ts
|
|
812
|
-
var
|
|
792
|
+
var M = "comments", N = (e) => {
|
|
813
793
|
let t = new Date(e);
|
|
814
794
|
return Number.isNaN(t.getTime()) ? e : `${String(t.getDate()).padStart(2, "0")}.${String(t.getMonth() + 1).padStart(2, "0")}.${t.getFullYear()} kl. ${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
815
|
-
},
|
|
795
|
+
}, P = (e, t, n) => {
|
|
816
796
|
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), t()), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), n());
|
|
817
|
-
},
|
|
797
|
+
}, F = (e, t, n) => {
|
|
818
798
|
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), n()), (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), t());
|
|
819
|
-
},
|
|
799
|
+
}, I = (e) => ({
|
|
820
800
|
id: "remove",
|
|
821
801
|
title: "Slett",
|
|
822
802
|
ariaLabel: "Slett fil",
|
|
823
803
|
onClick: ({ file: t }) => e(t.fileId)
|
|
824
|
-
}),
|
|
804
|
+
}), L = () => ({
|
|
825
805
|
id: "rename",
|
|
826
806
|
title: "Rediger",
|
|
827
807
|
ariaLabel: "Rediger filnavn",
|
|
@@ -838,7 +818,7 @@ var N = "comments", P = (e) => {
|
|
|
838
818
|
class="pkt-fileupload__queue-display__item__rename-input"
|
|
839
819
|
?disabled=${e.disabled}
|
|
840
820
|
.value=${t}
|
|
841
|
-
@keydown=${(t) =>
|
|
821
|
+
@keydown=${(t) => P(t, i, e.close)}
|
|
842
822
|
/>
|
|
843
823
|
<button
|
|
844
824
|
type="button"
|
|
@@ -866,14 +846,14 @@ var N = "comments", P = (e) => {
|
|
|
866
846
|
value=${t}
|
|
867
847
|
/>`;
|
|
868
848
|
}
|
|
869
|
-
}),
|
|
849
|
+
}), R = () => ({
|
|
870
850
|
id: "comment",
|
|
871
|
-
title: (e) => (e.attributes?.[
|
|
851
|
+
title: (e) => (e.attributes?.[M] ?? []).length > 0 ? "" : "Legg til kommentar",
|
|
872
852
|
ariaLabel: "Legg til kommentar",
|
|
873
853
|
renderExtendedUI: (e) => {
|
|
874
|
-
let t = (e.getAttribute(
|
|
854
|
+
let t = (e.getAttribute(M) ?? [])[0], n = `pkt-fileupload-comment-${e.file.fileId}`, i = () => {
|
|
875
855
|
let t = document.getElementById(n)?.value?.trim();
|
|
876
|
-
t && e.setAttribute(
|
|
856
|
+
t && e.setAttribute(M, [{
|
|
877
857
|
text: t,
|
|
878
858
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
879
859
|
}]), e.close();
|
|
@@ -889,7 +869,7 @@ var N = "comments", P = (e) => {
|
|
|
889
869
|
.value=${t?.text ?? ""}
|
|
890
870
|
rows="2"
|
|
891
871
|
placeholder="Skriv inn kommentar"
|
|
892
|
-
@keydown=${(t) =>
|
|
872
|
+
@keydown=${(t) => F(t, i, e.close)}
|
|
893
873
|
></textarea>
|
|
894
874
|
<button
|
|
895
875
|
type="button"
|
|
@@ -911,7 +891,7 @@ var N = "comments", P = (e) => {
|
|
|
911
891
|
},
|
|
912
892
|
renderContent: (e) => {
|
|
913
893
|
if (e.isActive) return null;
|
|
914
|
-
let t = e.getAttribute(
|
|
894
|
+
let t = e.getAttribute(M) ?? [];
|
|
915
895
|
if (t.length === 0) return null;
|
|
916
896
|
let n = t[0];
|
|
917
897
|
return r`
|
|
@@ -922,7 +902,7 @@ var N = "comments", P = (e) => {
|
|
|
922
902
|
${n.text}
|
|
923
903
|
</span>
|
|
924
904
|
<time class="pkt-fileupload__queue-display__item__comment__time">
|
|
925
|
-
${
|
|
905
|
+
${N(n.timestamp)}
|
|
926
906
|
</time>
|
|
927
907
|
</div>
|
|
928
908
|
<div class="pkt-fileupload__queue-display__item__comment__actions">
|
|
@@ -940,7 +920,7 @@ var N = "comments", P = (e) => {
|
|
|
940
920
|
class="pkt-fileupload__queue-display__item__comment__action"
|
|
941
921
|
aria-label="Slett kommentar"
|
|
942
922
|
?disabled=${e.disabled}
|
|
943
|
-
@click=${() => e.setAttribute(
|
|
923
|
+
@click=${() => e.setAttribute(M, void 0)}
|
|
944
924
|
>
|
|
945
925
|
<pkt-icon name="trash-can"></pkt-icon>
|
|
946
926
|
</button>
|
|
@@ -950,15 +930,15 @@ var N = "comments", P = (e) => {
|
|
|
950
930
|
`;
|
|
951
931
|
},
|
|
952
932
|
renderHidden: (e) => {
|
|
953
|
-
let t = e.getAttribute(
|
|
933
|
+
let t = e.getAttribute(M);
|
|
954
934
|
return r`<input
|
|
955
935
|
type="hidden"
|
|
956
936
|
name=${`${e.inputName}-comments`}
|
|
957
937
|
value=${t ? JSON.stringify(t) : ""}
|
|
958
938
|
/>`;
|
|
959
939
|
}
|
|
960
|
-
}),
|
|
961
|
-
let n =
|
|
940
|
+
}), z = (e, t) => {
|
|
941
|
+
let n = E(e, t);
|
|
962
942
|
return n ? r`<span
|
|
963
943
|
class="pkt-fileupload__queue-display__item__title__head"
|
|
964
944
|
data-pkt-truncate-part="first"
|
|
@@ -968,13 +948,13 @@ var N = "comments", P = (e) => {
|
|
|
968
948
|
data-pkt-truncate-part="tail"
|
|
969
949
|
>${n.tail}</span
|
|
970
950
|
>` : r`<span data-pkt-truncate-part="first">${e}</span>`;
|
|
971
|
-
},
|
|
951
|
+
}, B = (e, t, n) => r`
|
|
972
952
|
<p class="pkt-fileupload__queue-display__item__title">
|
|
973
|
-
${
|
|
953
|
+
${z(e, n)}${t ? r`<span class="pkt-fileupload__queue-display__item__filesize"> (${t})</span>` : null}
|
|
974
954
|
</p>
|
|
975
|
-
`,
|
|
955
|
+
`, V = (e) => typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle", H = (e) => r`<span class="pkt-fileupload__queue-display__item__loading-text" aria-label="Laster opp fil"
|
|
976
956
|
>${e ?? "Laster opp..."}</span
|
|
977
|
-
>`,
|
|
957
|
+
>`, U = ({ operationId: e, file: t, inputName: n, disabled: r, isActive: i, onActivateOperation: a, onCloseOperation: o, getFileAttribute: s, setFileAttribute: c }) => ({
|
|
978
958
|
file: t,
|
|
979
959
|
inputName: n,
|
|
980
960
|
disabled: r,
|
|
@@ -983,15 +963,15 @@ var N = "comments", P = (e) => {
|
|
|
983
963
|
close: () => o(t.fileId),
|
|
984
964
|
getAttribute: (e) => s(t.fileId, e),
|
|
985
965
|
setAttribute: (e, n) => c(t.fileId, e, n)
|
|
986
|
-
}),
|
|
987
|
-
let u =
|
|
966
|
+
}), W = ({ file: e, fileSize: t, disabled: n, transferProgress: i, transferShowProgress: a, loadingText: o, truncateTail: s, onCancel: c, iconName: l = "document-text" }) => {
|
|
967
|
+
let u = k(e), d = a ?? i !== 0;
|
|
988
968
|
return r`
|
|
989
969
|
<pkt-icon
|
|
990
970
|
name=${l}
|
|
991
971
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
992
972
|
aria-hidden="true"
|
|
993
973
|
></pkt-icon>
|
|
994
|
-
${
|
|
974
|
+
${B(u, t, s)}
|
|
995
975
|
<button
|
|
996
976
|
type="button"
|
|
997
977
|
class="pkt-fileupload__queue-display__item__cancel-button"
|
|
@@ -1012,17 +992,17 @@ var N = "comments", P = (e) => {
|
|
|
1012
992
|
<span class="pkt-fileupload__queue-display__item__percentage" aria-hidden="true"
|
|
1013
993
|
>${Math.round(i * 100)}%</span
|
|
1014
994
|
>
|
|
1015
|
-
` :
|
|
995
|
+
` : H(o)}
|
|
1016
996
|
`;
|
|
1017
|
-
},
|
|
1018
|
-
let l =
|
|
997
|
+
}, G = ({ file: e, fileSize: t, disabled: n, transferShowProgress: i, transferLastProgress: a, transferErrorMessage: o, truncateTail: s, onCancel: c }) => {
|
|
998
|
+
let l = k(e), u = !!i, d = Math.round((a ?? 1) * 100);
|
|
1019
999
|
return r`
|
|
1020
1000
|
<pkt-icon
|
|
1021
1001
|
name="alert-error"
|
|
1022
1002
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
1023
1003
|
aria-hidden="true"
|
|
1024
1004
|
></pkt-icon>
|
|
1025
|
-
${
|
|
1005
|
+
${B(l, t, s)}
|
|
1026
1006
|
<button
|
|
1027
1007
|
type="button"
|
|
1028
1008
|
class="pkt-fileupload__queue-display__item__cancel-button"
|
|
@@ -1045,11 +1025,11 @@ var N = "comments", P = (e) => {
|
|
|
1045
1025
|
>${o}</span
|
|
1046
1026
|
>` : null}
|
|
1047
1027
|
`;
|
|
1048
|
-
},
|
|
1028
|
+
}, K = ({ file: e, disabled: t, inputName: n, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: c, getFileAttribute: l, setFileAttribute: u }) => {
|
|
1049
1029
|
let d = i.find((e) => e.id === a);
|
|
1050
1030
|
if (d?.renderInlineUI || d?.renderExtendedUI) return null;
|
|
1051
1031
|
let f = i.map((i) => {
|
|
1052
|
-
let d =
|
|
1032
|
+
let d = U({
|
|
1053
1033
|
operationId: i.id,
|
|
1054
1034
|
file: e,
|
|
1055
1035
|
inputName: n,
|
|
@@ -1073,9 +1053,9 @@ var N = "comments", P = (e) => {
|
|
|
1073
1053
|
</button>` : null;
|
|
1074
1054
|
}).filter(Boolean);
|
|
1075
1055
|
return f.length === 0 ? null : r`<div class="pkt-fileupload__queue-display__item__actions">${f}</div>`;
|
|
1076
|
-
},
|
|
1056
|
+
}, q = ({ file: e, disabled: t, inputName: n, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => i.map((i) => {
|
|
1077
1057
|
if (!i.renderContent) return null;
|
|
1078
|
-
let u =
|
|
1058
|
+
let u = U({
|
|
1079
1059
|
operationId: i.id,
|
|
1080
1060
|
file: e,
|
|
1081
1061
|
inputName: n,
|
|
@@ -1089,11 +1069,11 @@ var N = "comments", P = (e) => {
|
|
|
1089
1069
|
return d == null ? null : r`<div class="pkt-fileupload__queue-display__item__operation-content">
|
|
1090
1070
|
${d}
|
|
1091
1071
|
</div>`;
|
|
1092
|
-
}),
|
|
1072
|
+
}), J = ({ file: e, disabled: t, inputName: n, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => {
|
|
1093
1073
|
if (!a) return null;
|
|
1094
1074
|
let u = i.find((e) => e.id === a);
|
|
1095
1075
|
if (!u?.renderExtendedUI) return null;
|
|
1096
|
-
let d =
|
|
1076
|
+
let d = U({
|
|
1097
1077
|
operationId: u.id,
|
|
1098
1078
|
file: e,
|
|
1099
1079
|
inputName: n,
|
|
@@ -1107,9 +1087,9 @@ var N = "comments", P = (e) => {
|
|
|
1107
1087
|
return r`<div class="pkt-fileupload__queue-display__item__expanded-operation-ui">
|
|
1108
1088
|
${u.renderExtendedUI(d)}
|
|
1109
1089
|
</div>`;
|
|
1110
|
-
},
|
|
1090
|
+
}, Y = ({ file: e, disabled: t, inputName: n, operations: r, activeOperationId: i, onActivateOperation: a, onCloseOperation: o, getFileAttribute: s, setFileAttribute: c }) => r.map((r) => {
|
|
1111
1091
|
if (!r.renderHidden) return null;
|
|
1112
|
-
let l =
|
|
1092
|
+
let l = U({
|
|
1113
1093
|
operationId: r.id,
|
|
1114
1094
|
file: e,
|
|
1115
1095
|
inputName: n,
|
|
@@ -1121,15 +1101,15 @@ var N = "comments", P = (e) => {
|
|
|
1121
1101
|
setFileAttribute: c
|
|
1122
1102
|
});
|
|
1123
1103
|
return r.renderHidden(l);
|
|
1124
|
-
}),
|
|
1104
|
+
}), X = (e, t, n) => r`
|
|
1125
1105
|
<pkt-icon
|
|
1126
1106
|
name="document-text"
|
|
1127
1107
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
1128
1108
|
aria-hidden="true"
|
|
1129
1109
|
></pkt-icon>
|
|
1130
|
-
${
|
|
1131
|
-
`,
|
|
1132
|
-
let u =
|
|
1110
|
+
${B(k(e), t, n)}
|
|
1111
|
+
`, Z = ({ file: e, thumbnailUrl: t, previewEnabled: n, canOpenPreview: i, truncateTail: a, onOpenPreview: c, onThumbnailImageError: l }) => {
|
|
1112
|
+
let u = k(e), d = !!t, f = !!n && !!i, p = f && !!c;
|
|
1133
1113
|
return r`
|
|
1134
1114
|
<div
|
|
1135
1115
|
class=${o({
|
|
@@ -1164,12 +1144,12 @@ var N = "comments", P = (e) => {
|
|
|
1164
1144
|
</span>
|
|
1165
1145
|
</button>
|
|
1166
1146
|
<span class="pkt-fileupload__queue-display__item__thumbnail__title"
|
|
1167
|
-
>${
|
|
1147
|
+
>${z(u, a)}</span
|
|
1168
1148
|
>
|
|
1169
1149
|
</div>
|
|
1170
1150
|
`;
|
|
1171
|
-
},
|
|
1172
|
-
let y =
|
|
1151
|
+
}, Q = ({ file: e, inputName: t, disabled: n, fileSize: i, operations: a, activeOperationId: s, onActivateOperation: c, onCloseOperation: l, getFileAttribute: u, setFileAttribute: d, transferProgress: f, transferErrorMessage: p, transferShowProgress: m, transferLastProgress: h, loadingText: g, truncateTail: _, onCancel: v }) => {
|
|
1152
|
+
let y = V(f), b = a.find((e) => e.id === s), x = b?.renderInlineUI ? b.renderInlineUI(U({
|
|
1173
1153
|
operationId: b.id,
|
|
1174
1154
|
file: e,
|
|
1175
1155
|
inputName: t,
|
|
@@ -1189,7 +1169,7 @@ var N = "comments", P = (e) => {
|
|
|
1189
1169
|
[`pkt-fileupload__queue-display__item--${f}`]: typeof f == "string"
|
|
1190
1170
|
})}
|
|
1191
1171
|
>
|
|
1192
|
-
${
|
|
1172
|
+
${Y({
|
|
1193
1173
|
file: e,
|
|
1194
1174
|
disabled: n,
|
|
1195
1175
|
inputName: t,
|
|
@@ -1200,7 +1180,7 @@ var N = "comments", P = (e) => {
|
|
|
1200
1180
|
getFileAttribute: u,
|
|
1201
1181
|
setFileAttribute: d
|
|
1202
1182
|
})}
|
|
1203
|
-
${y === "in-progress" ?
|
|
1183
|
+
${y === "in-progress" ? W({
|
|
1204
1184
|
file: e,
|
|
1205
1185
|
fileSize: i,
|
|
1206
1186
|
disabled: n,
|
|
@@ -1209,7 +1189,7 @@ var N = "comments", P = (e) => {
|
|
|
1209
1189
|
loadingText: g,
|
|
1210
1190
|
truncateTail: _,
|
|
1211
1191
|
onCancel: v
|
|
1212
|
-
}) : y === "error" ?
|
|
1192
|
+
}) : y === "error" ? G({
|
|
1213
1193
|
file: e,
|
|
1214
1194
|
fileSize: i,
|
|
1215
1195
|
disabled: n,
|
|
@@ -1227,8 +1207,8 @@ var N = "comments", P = (e) => {
|
|
|
1227
1207
|
<div class="pkt-fileupload__queue-display__item__inline-ui">
|
|
1228
1208
|
${x}
|
|
1229
1209
|
</div>
|
|
1230
|
-
` :
|
|
1231
|
-
${y === "idle" ?
|
|
1210
|
+
` : X(e, i, _)}
|
|
1211
|
+
${y === "idle" ? K({
|
|
1232
1212
|
file: e,
|
|
1233
1213
|
disabled: n,
|
|
1234
1214
|
inputName: t,
|
|
@@ -1239,7 +1219,7 @@ var N = "comments", P = (e) => {
|
|
|
1239
1219
|
getFileAttribute: u,
|
|
1240
1220
|
setFileAttribute: d
|
|
1241
1221
|
}) : null}
|
|
1242
|
-
${y === "idle" ?
|
|
1222
|
+
${y === "idle" ? q({
|
|
1243
1223
|
file: e,
|
|
1244
1224
|
disabled: n,
|
|
1245
1225
|
inputName: t,
|
|
@@ -1250,7 +1230,7 @@ var N = "comments", P = (e) => {
|
|
|
1250
1230
|
getFileAttribute: u,
|
|
1251
1231
|
setFileAttribute: d
|
|
1252
1232
|
}) : null}
|
|
1253
|
-
${y === "idle" ?
|
|
1233
|
+
${y === "idle" ? J({
|
|
1254
1234
|
file: e,
|
|
1255
1235
|
disabled: n,
|
|
1256
1236
|
inputName: t,
|
|
@@ -1263,8 +1243,8 @@ var N = "comments", P = (e) => {
|
|
|
1263
1243
|
}) : null}
|
|
1264
1244
|
</li>
|
|
1265
1245
|
`;
|
|
1266
|
-
},
|
|
1267
|
-
let w =
|
|
1246
|
+
}, ee = ({ file: e, inputName: t, disabled: n, fileSize: i, thumbnailUrl: a, previewEnabled: s, canOpenPreview: c, operations: l, activeOperationId: u, onActivateOperation: d, onCloseOperation: f, getFileAttribute: p, setFileAttribute: m, transferProgress: h, transferErrorMessage: g, transferShowProgress: _, transferLastProgress: v, loadingText: y, truncateTail: b, onCancel: x, onOpenPreview: S, onThumbnailImageError: C }) => {
|
|
1247
|
+
let w = V(h), T = l.find((e) => e.id === u), E = T?.renderInlineUI ? T.renderInlineUI(U({
|
|
1268
1248
|
operationId: T.id,
|
|
1269
1249
|
file: e,
|
|
1270
1250
|
inputName: t,
|
|
@@ -1284,7 +1264,7 @@ var N = "comments", P = (e) => {
|
|
|
1284
1264
|
[`pkt-fileupload__queue-display__item--${h}`]: typeof h == "string"
|
|
1285
1265
|
})}
|
|
1286
1266
|
>
|
|
1287
|
-
${
|
|
1267
|
+
${Y({
|
|
1288
1268
|
file: e,
|
|
1289
1269
|
disabled: n,
|
|
1290
1270
|
inputName: t,
|
|
@@ -1295,7 +1275,7 @@ var N = "comments", P = (e) => {
|
|
|
1295
1275
|
getFileAttribute: p,
|
|
1296
1276
|
setFileAttribute: m
|
|
1297
1277
|
})}
|
|
1298
|
-
${w === "in-progress" ?
|
|
1278
|
+
${w === "in-progress" ? W({
|
|
1299
1279
|
file: e,
|
|
1300
1280
|
fileSize: i,
|
|
1301
1281
|
disabled: n,
|
|
@@ -1305,7 +1285,7 @@ var N = "comments", P = (e) => {
|
|
|
1305
1285
|
truncateTail: b,
|
|
1306
1286
|
onCancel: x,
|
|
1307
1287
|
iconName: "picture"
|
|
1308
|
-
}) : w === "error" ?
|
|
1288
|
+
}) : w === "error" ? G({
|
|
1309
1289
|
file: e,
|
|
1310
1290
|
fileSize: i,
|
|
1311
1291
|
disabled: n,
|
|
@@ -1323,7 +1303,7 @@ var N = "comments", P = (e) => {
|
|
|
1323
1303
|
<div class="pkt-fileupload__queue-display__item__inline-ui">
|
|
1324
1304
|
${E}
|
|
1325
1305
|
</div>
|
|
1326
|
-
` :
|
|
1306
|
+
` : Z({
|
|
1327
1307
|
file: e,
|
|
1328
1308
|
thumbnailUrl: a,
|
|
1329
1309
|
previewEnabled: s,
|
|
@@ -1332,7 +1312,7 @@ var N = "comments", P = (e) => {
|
|
|
1332
1312
|
onOpenPreview: S,
|
|
1333
1313
|
onThumbnailImageError: C
|
|
1334
1314
|
})}
|
|
1335
|
-
${w === "idle" ?
|
|
1315
|
+
${w === "idle" ? K({
|
|
1336
1316
|
file: e,
|
|
1337
1317
|
disabled: n,
|
|
1338
1318
|
inputName: t,
|
|
@@ -1343,7 +1323,7 @@ var N = "comments", P = (e) => {
|
|
|
1343
1323
|
getFileAttribute: p,
|
|
1344
1324
|
setFileAttribute: m
|
|
1345
1325
|
}) : null}
|
|
1346
|
-
${w === "idle" ?
|
|
1326
|
+
${w === "idle" ? q({
|
|
1347
1327
|
file: e,
|
|
1348
1328
|
disabled: n,
|
|
1349
1329
|
inputName: t,
|
|
@@ -1354,7 +1334,7 @@ var N = "comments", P = (e) => {
|
|
|
1354
1334
|
getFileAttribute: p,
|
|
1355
1335
|
setFileAttribute: m
|
|
1356
1336
|
}) : null}
|
|
1357
|
-
${w === "idle" ?
|
|
1337
|
+
${w === "idle" ? J({
|
|
1358
1338
|
file: e,
|
|
1359
1339
|
disabled: n,
|
|
1360
1340
|
inputName: t,
|
|
@@ -1367,14 +1347,14 @@ var N = "comments", P = (e) => {
|
|
|
1367
1347
|
}) : null}
|
|
1368
1348
|
</li>
|
|
1369
1349
|
`;
|
|
1370
|
-
}, $ = class extends
|
|
1350
|
+
}, $ = class extends j {
|
|
1371
1351
|
constructor(...e) {
|
|
1372
1352
|
super(...e), this.activeOperationByFileId = {}, this.isPreviewModalOpen = !1, this.previewCurrentIndex = 0, this.failedImageFileIds = {}, this.closePreview = () => {
|
|
1373
1353
|
this.isPreviewModalOpen = !1;
|
|
1374
1354
|
}, this.onPreviewKeyDown = (e, t) => {
|
|
1375
1355
|
if (this.isPreviewModalOpen) {
|
|
1376
1356
|
if (e.key === "Tab") {
|
|
1377
|
-
|
|
1357
|
+
u(e, e.currentTarget);
|
|
1378
1358
|
return;
|
|
1379
1359
|
}
|
|
1380
1360
|
switch (e.key) {
|
|
@@ -1419,21 +1399,21 @@ var N = "comments", P = (e) => {
|
|
|
1419
1399
|
}
|
|
1420
1400
|
renderContent() {
|
|
1421
1401
|
let e = this.getSortedFilesAndTransfers(), t = this.getPreviewableImages(e), n = this.getSupportedFormatsText(), i = [!this.label && this.helptext ? `${this.id}-helptext` : void 0, this.hasEffectiveError ? `${this.id}-error` : void 0].filter(Boolean).join(" ") || void 0, a = this.itemRenderer === "thumbnail" ? this.multiple ? {
|
|
1422
|
-
dragInactive:
|
|
1423
|
-
dragActive:
|
|
1424
|
-
openFileDialog:
|
|
1402
|
+
dragInactive: d.dropZoneDragMultipleThumbnail,
|
|
1403
|
+
dragActive: d.dropZoneDragActiveMultipleThumbnail,
|
|
1404
|
+
openFileDialog: d.dropZoneOpenFileDialogMultipleThumbnail
|
|
1425
1405
|
} : {
|
|
1426
|
-
dragInactive:
|
|
1427
|
-
dragActive:
|
|
1428
|
-
openFileDialog:
|
|
1406
|
+
dragInactive: d.dropZoneDragSingleThumbnail,
|
|
1407
|
+
dragActive: d.dropZoneDragActiveSingleThumbnail,
|
|
1408
|
+
openFileDialog: d.dropZoneOpenFileDialogSingleThumbnail
|
|
1429
1409
|
} : this.multiple ? {
|
|
1430
|
-
dragInactive:
|
|
1431
|
-
dragActive:
|
|
1432
|
-
openFileDialog:
|
|
1410
|
+
dragInactive: d.dropZoneDragMultiple,
|
|
1411
|
+
dragActive: d.dropZoneDragActiveMultiple,
|
|
1412
|
+
openFileDialog: d.dropZoneOpenFileDialogMultiple
|
|
1433
1413
|
} : {
|
|
1434
|
-
dragInactive:
|
|
1435
|
-
dragActive:
|
|
1436
|
-
openFileDialog:
|
|
1414
|
+
dragInactive: d.dropZoneDragSingle,
|
|
1415
|
+
dragActive: d.dropZoneDragActiveSingle,
|
|
1416
|
+
openFileDialog: d.dropZoneOpenFileDialogSingle
|
|
1437
1417
|
};
|
|
1438
1418
|
return r`
|
|
1439
1419
|
<div
|
|
@@ -1495,7 +1475,7 @@ var N = "comments", P = (e) => {
|
|
|
1495
1475
|
</button>`}
|
|
1496
1476
|
</p>
|
|
1497
1477
|
${n ? r`<p class="pkt-fileupload__drop-zone__placeholder__formats">
|
|
1498
|
-
${
|
|
1478
|
+
${d.supportedFormatsPrefix} ${n}
|
|
1499
1479
|
</p>` : null}
|
|
1500
1480
|
</div>
|
|
1501
1481
|
</div>
|
|
@@ -1522,7 +1502,7 @@ var N = "comments", P = (e) => {
|
|
|
1522
1502
|
let n = typeof e.file?.size == "number" ? this.formatFileSize(e.file.size) : "", r = this.getQueueItemOperations();
|
|
1523
1503
|
if (this.itemRenderer === "thumbnail") {
|
|
1524
1504
|
let i = this.canOpenPreview(e), a = this.failedImageFileIds[e.fileId]?.thumbnail ? void 0 : this.getThumbnailUrl(e);
|
|
1525
|
-
return
|
|
1505
|
+
return ee({
|
|
1526
1506
|
file: e,
|
|
1527
1507
|
inputName: this.name,
|
|
1528
1508
|
disabled: this.disabled,
|
|
@@ -1547,7 +1527,7 @@ var N = "comments", P = (e) => {
|
|
|
1547
1527
|
onThumbnailImageError: (e) => this.markImageFailed(e, "thumbnail")
|
|
1548
1528
|
});
|
|
1549
1529
|
}
|
|
1550
|
-
return
|
|
1530
|
+
return Q({
|
|
1551
1531
|
file: e,
|
|
1552
1532
|
inputName: this.name,
|
|
1553
1533
|
disabled: this.disabled,
|
|
@@ -1593,7 +1573,7 @@ var N = "comments", P = (e) => {
|
|
|
1593
1573
|
});
|
|
1594
1574
|
}
|
|
1595
1575
|
navigatePreview(e, t) {
|
|
1596
|
-
t.length !== 0 && (this.previewCurrentIndex =
|
|
1576
|
+
t.length !== 0 && (this.previewCurrentIndex = D(this.previewCurrentIndex, e, t.length));
|
|
1597
1577
|
}
|
|
1598
1578
|
renderPreviewModal(e) {
|
|
1599
1579
|
if (!this.enableImagePreview || e.length === 0) return null;
|
|
@@ -1659,7 +1639,7 @@ var N = "comments", P = (e) => {
|
|
|
1659
1639
|
}
|
|
1660
1640
|
getQueueItemOperations() {
|
|
1661
1641
|
let e = [];
|
|
1662
|
-
return this.renameFilesEnabled && this.itemRenderer !== "thumbnail" && e.push(
|
|
1642
|
+
return this.renameFilesEnabled && this.itemRenderer !== "thumbnail" && e.push(L()), this.addCommentsEnabled && this.itemRenderer !== "thumbnail" && e.push(R()), e.push(...this.extraOperations), e.push(I((e) => this.removeFileItem(e))), e;
|
|
1663
1643
|
}
|
|
1664
1644
|
activateOperation(e, t) {
|
|
1665
1645
|
this.activeOperationByFileId = {
|
|
@@ -1690,6 +1670,6 @@ var N = "comments", P = (e) => {
|
|
|
1690
1670
|
t([e()], $.prototype, "activeOperationByFileId", void 0), t([e()], $.prototype, "isPreviewModalOpen", void 0), t([e()], $.prototype, "previewCurrentIndex", void 0), t([e()], $.prototype, "failedImageFileIds", void 0), $ = t([i("pkt-fileupload")], $);
|
|
1691
1671
|
//#endregion
|
|
1692
1672
|
//#region src/components/fileupload/index.ts
|
|
1693
|
-
var
|
|
1673
|
+
var te = $;
|
|
1694
1674
|
//#endregion
|
|
1695
|
-
export { $ as n,
|
|
1675
|
+
export { $ as n, te as t };
|