@oslokommune/punkt-elements 17.1.3 → 18.1.0
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 +35 -0
- package/dist/{accordion-BeLvLPrB.js → accordion-CcUosZjL.js} +27 -27
- package/dist/{accordion-B3GBlvUC.cjs → accordion-k0pWTG1X.cjs} +5 -5
- package/dist/alert-BD8YVKia.cjs +35 -0
- package/dist/{alert-DKK_Tb9J.js → alert-Bmaly2Yo.js} +57 -52
- package/dist/{async-directive-BPf6K-V2.js → async-directive-COqx0IYj.js} +5 -5
- package/dist/{async-directive-Da7TJpnq.cjs → async-directive-DN2eg9gA.cjs} +1 -1
- package/dist/{backlink-D1y26pj3.js → backlink-C_ZO-ZbR.js} +9 -9
- package/dist/{backlink-CMmrKTe4.cjs → backlink-Ch64Pivx.cjs} +3 -3
- package/dist/base-elements/element.d.ts +13 -1
- package/dist/base-elements/input-element.d.ts +4 -2
- package/dist/{breadcrumbs-CcTQ3Grm.js → breadcrumbs-CF_gAbUk.js} +16 -16
- package/dist/{breadcrumbs-B6JGhJgC.cjs → breadcrumbs-CzzbardP.cjs} +7 -7
- package/dist/{button-2-OSPJkj.js → button-C1CQSASU.js} +28 -28
- package/dist/{button-CE97NQIk.cjs → button-CF3dNKeI.cjs} +7 -7
- package/dist/{calendar-kn4SrtJy.cjs → calendar-BxF81kB9.cjs} +28 -27
- package/dist/{calendar-pOW3R5Pw.js → calendar-DRmxORMc.js} +82 -68
- package/dist/{card-CETDFkxR.cjs → card-Cg1daj05.cjs} +26 -26
- package/dist/{card-zQ0eKRMV.js → card-W_Jb0Tlo.js} +44 -44
- package/dist/{checkbox-CQNr_sEg.cjs → checkbox-BHQv8lHq.cjs} +11 -11
- package/dist/{checkbox-CH7NpINF.js → checkbox-BQw2dMSX.js} +23 -23
- package/dist/{class-map-BeimMvPv.cjs → class-map-C33ixq7O.cjs} +1 -1
- package/dist/{class-map-CnWCnBSX.js → class-map-wh4Yi3oj.js} +3 -3
- package/dist/{combobox-Bvg0UO9w.cjs → combobox-BpZow9OU.cjs} +19 -18
- package/dist/{combobox-CRdYYlxu.js → combobox-C9wwnUfM.js} +55 -54
- package/dist/components/accordion/accordion.d.ts +2 -6
- package/dist/components/accordion/accordionitem.d.ts +2 -8
- package/dist/components/alert/alert.d.ts +2 -2
- package/dist/components/backlink/backlink.d.ts +4 -5
- package/dist/components/backlink/backlink.test.d.ts +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +6 -7
- package/dist/components/breadcrumbs/index.d.ts +1 -1
- package/dist/components/calendar/calendar.d.ts +21 -6
- package/dist/components/checkbox/checkbox.d.ts +4 -2
- package/dist/components/combobox/combobox-base.d.ts +2 -1
- package/dist/components/consent/strings.d.ts +1 -85
- package/dist/components/datepicker/datepicker-base.d.ts +0 -3
- package/dist/components/datepicker/datepicker-multiple.d.ts +0 -2
- package/dist/components/datepicker/datepicker-range.d.ts +0 -2
- package/dist/components/datepicker/datepicker-single.d.ts +0 -2
- package/dist/components/datepicker/datepicker-utils.d.ts +2 -1
- package/dist/components/fileupload/fileupload-base.d.ts +7 -4
- package/dist/components/fileupload/fileupload-types.d.ts +5 -43
- package/dist/components/header/header-service.d.ts +3 -1
- package/dist/components/header/header.d.ts +2 -1
- package/dist/components/helptext/helptext.d.ts +2 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/input-wrapper/input-wrapper.d.ts +4 -2
- package/dist/components/radiobutton/radiobutton.d.ts +4 -2
- package/dist/components/searchinput/searchinput.d.ts +2 -1
- package/dist/{consent-CyY3RyoC.cjs → consent-CPtr7cBw.cjs} +5 -5
- package/dist/{consent-DZEkhgJ1.js → consent-D8MrqGKk.js} +10 -10
- package/dist/controllers/strings-controller.d.ts +27 -0
- package/dist/{datepicker-ButIas85.js → datepicker-D4YnAtWG.js} +104 -104
- package/dist/{datepicker-VTqSDQk5.cjs → datepicker-DaoumZT9.cjs} +38 -37
- package/dist/define-component-spec-BYOSeplU.js +6 -0
- package/dist/define-component-spec-DBNd2FJY.cjs +1 -0
- package/dist/{directive-helpers-CI8YZqku.js → directive-helpers-BWSAVe00.js} +1 -1
- package/dist/{directive-helpers-BlAV5EQD.cjs → directive-helpers-C6J4AkFk.cjs} +1 -1
- package/dist/docs/components/alert.d.ts +2 -3
- package/dist/docs/components/fileupload.d.ts +1 -0
- package/dist/element-DiFhBcIl.cjs +2 -0
- package/dist/{element-ChsFgr_B.js → element-WEzISABa.js} +241 -100
- package/dist/{element-with-slot-BvG9ctC-.js → element-with-slot-BKYUx4gb.js} +4 -4
- package/dist/{element-with-slot-Bj7nm7fO.cjs → element-with-slot-CBK4zrdN.cjs} +1 -1
- package/dist/{fileupload-D5IQ9HDe.js → fileupload-DEHSETw0.js} +340 -652
- package/dist/fileupload-DWu6FIMv.cjs +402 -0
- package/dist/{footer-DrR64HiK.js → footer-BJLEw6Ab.js} +91 -91
- package/dist/{footer-DbYQUYNR.cjs → footer-D_yYWkQ6.cjs} +32 -32
- package/dist/format-B8meU8Tm.cjs +1 -0
- package/dist/format-BTeSVkED.js +18 -0
- package/dist/{header-ClgIac6n.cjs → header-B7_4Cwaq.cjs} +84 -84
- package/dist/{header-KvJ1mGwA.js → header-DLVq7-dM.js} +267 -264
- package/dist/{header-menu-hVPXsb8g.js → header-menu-BsrrTjpT.js} +75 -75
- package/dist/{header-menu-BAsUNKSx.cjs → header-menu-m7nOOC1g.cjs} +24 -24
- package/dist/{heading-g-_IUB5T.js → heading-DSArgrDK.js} +16 -16
- package/dist/{heading-CFmiSuCQ.cjs → heading-_RPw2UW9.cjs} +1 -1
- package/dist/helptext-QMVsW5g6.cjs +27 -0
- package/dist/{helptext-DZng1D5i.js → helptext-dtVVufNH.js} +18 -19
- package/dist/{icon-D-LA22xD.js → icon-DEtOSWRK.js} +17 -17
- package/dist/{icon-9iwd2F2l.cjs → icon-DIavy2cB.cjs} +1 -1
- package/dist/{if-defined-CGzIlZ9-.js → if-defined-BmnvvxtR.js} +1 -1
- package/dist/if-defined-Dc3xFDaM.cjs +1 -0
- package/dist/input-element-DQY1Rpbp.cjs +1 -0
- package/dist/{input-element-DBMNBplu.js → input-element-IBypGOaV.js} +121 -120
- package/dist/input-wrapper-CQgAL1Br.js +308 -0
- package/dist/input-wrapper-mJZLVXy_.cjs +58 -0
- package/dist/link-DwLeY37f.js +131 -0
- package/dist/link-yk4IXDWm.cjs +7 -0
- package/dist/linkcard-BinKnxQF.cjs +13 -0
- package/dist/{linkcard-zqbg7Oqm.js → linkcard-D5DXpmXI.js} +16 -16
- package/dist/{listbox-Dc4rGdPi.cjs → listbox-C5zTRNAO.cjs} +15 -15
- package/dist/{listbox-va_E8afs.js → listbox-C8ooO8qZ.js} +100 -99
- package/dist/{loader-D_RDICnw.js → loader-C3HyayzL.js} +14 -14
- package/dist/{loader-CMUkVJmE.cjs → loader-DHF7M5Vn.cjs} +5 -5
- package/dist/{messagebox-Cv8LaSxv.cjs → messagebox-DqYf6VmQ.cjs} +5 -5
- package/dist/{messagebox-Cw-OWDya.js → messagebox-u8i3R5QA.js} +15 -15
- package/dist/{modal-BtInv031.cjs → modal-CnJ9y2TQ.cjs} +8 -8
- package/dist/{modal-D0t_X2dX.js → modal-V-jEe0aY.js} +20 -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-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-breadcrumbs.cjs +1 -1
- package/dist/pkt-breadcrumbs.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-card.cjs +1 -1
- package/dist/pkt-card.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 -1
- package/dist/pkt-footer.js +1 -1
- 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 +1 -1
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +35 -34
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/{pkt-options-controller-C5EBX2T0.cjs → pkt-options-controller-BhMNCWcc.cjs} +1 -1
- package/dist/{pkt-options-controller-B77vH3PE.js → pkt-options-controller-CuQ6SClv.js} +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.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-tag.cjs +1 -1
- package/dist/pkt-tag.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/{progressbar-CbcfLerF.js → progressbar-DS4i8IWq.js} +21 -21
- package/dist/{progressbar-D5MmnQId.cjs → progressbar-DY5hxImR.cjs} +5 -5
- package/dist/{radiobutton-BUnf3EPi.js → radiobutton-BhvZztMZ.js} +24 -24
- package/dist/{radiobutton-DpsO1F-8.cjs → radiobutton-BswqwRnA.cjs} +8 -8
- package/dist/{ref-CQoEIIp0.cjs → ref-DZmN5Qgj.cjs} +1 -1
- package/dist/{ref-CWD6PjVd.js → ref-OU8ryfP6.js} +2 -2
- package/dist/{repeat-sY6B7fAT.cjs → repeat-DIa_g6WL.cjs} +1 -1
- package/dist/{repeat-C02g7d5S.js → repeat-Dx2H127b.js} +4 -4
- package/dist/{searchinput-DwnjsvJ1.js → searchinput-CJo1PpM7.js} +43 -43
- package/dist/searchinput-Cl46nW0r.cjs +60 -0
- package/dist/{select-DMre80qs.js → select-CBrjauXT.js} +21 -20
- package/dist/{select-BOJi6H6T.cjs → select-Dman8Skr.cjs} +4 -3
- package/dist/shared-strings/consent.d.ts +71 -0
- package/dist/shared-strings/format.d.ts +21 -0
- package/dist/shared-strings/index.d.ts +14 -0
- package/dist/shared-strings/nb.d.ts +121 -0
- package/dist/shared-strings/resolve.d.ts +12 -0
- package/dist/shared-strings/store.d.ts +27 -0
- package/dist/shared-strings/types.d.ts +40 -0
- package/dist/shared-types/accordion.d.ts +58 -0
- package/dist/shared-types/alert.d.ts +20 -0
- package/dist/shared-types/aria.d.ts +2 -1
- package/dist/shared-types/backlink.d.ts +23 -0
- package/dist/shared-types/breadcrumbs.d.ts +33 -0
- package/dist/shared-types/fileupload.d.ts +55 -28
- package/dist/shared-types/footer.d.ts +10 -0
- package/dist/shared-types/form-field.d.ts +45 -0
- package/dist/shared-types/header-footer.d.ts +2 -0
- package/dist/shared-types/index.d.ts +15 -6
- package/dist/shared-types/render-link.d.ts +22 -0
- package/dist/shared-types/skin.d.ts +2 -9
- package/dist/shared-utils/combobox/index.d.ts +1 -0
- package/dist/shared-utils/combobox/input-utils.d.ts +2 -1
- package/dist/shared-utils/combobox/messages.d.ts +7 -0
- package/dist/shared-utils/combobox/option-utils.d.ts +2 -1
- package/dist/shared-utils/combobox/selection-manager.d.ts +3 -2
- package/dist/{tabs-Cf9ai0FD.cjs → tabs-C1m5rSrR.cjs} +7 -7
- package/dist/{tabs-TvxgbrCF.js → tabs-Xu3mIedh.js} +32 -32
- package/dist/{tag-Ds6n1LIs.js → tag-Azkjhkeu.js} +33 -32
- package/dist/tag-BS6dDPxY.cjs +27 -0
- package/dist/tests/strings-override.test.d.ts +0 -0
- package/dist/{textarea-vfzIcXhX.js → textarea-D4qXcVGD.js} +30 -29
- package/dist/{textarea-BydiLM9Z.cjs → textarea-DftUkR6w.cjs} +3 -2
- package/dist/{textinput-DGdicNSx.cjs → textinput-Ar-1Sbqy.cjs} +13 -12
- package/dist/{textinput-CMP2jPP_.js → textinput-iCgwwNPU.js} +28 -27
- package/dist/{timepicker-ClwgYywH.js → timepicker-W6HVWtmA.js} +67 -64
- package/dist/timepicker-dpAF7h49.cjs +196 -0
- package/package.json +3 -3
- package/src/components/accordion/accordion.ts +2 -10
- package/src/components/accordion/accordionitem.ts +2 -9
- package/src/components/alert/alert.ts +19 -10
- package/src/components/backlink/backlink.test.ts +3 -3
- package/src/components/backlink/backlink.ts +5 -7
- package/src/components/breadcrumbs/breadcrumbs.ts +9 -10
- package/src/components/breadcrumbs/index.ts +1 -1
- package/src/components/calendar/calendar.ts +56 -26
- package/src/components/checkbox/checkbox.test.ts +0 -2
- package/src/components/checkbox/checkbox.ts +8 -4
- package/src/components/combobox/combobox-base.ts +2 -1
- package/src/components/combobox/combobox-value.ts +10 -9
- package/src/components/combobox/combobox.selection.test.ts +5 -1
- package/src/components/combobox/combobox.ts +4 -1
- package/src/components/consent/strings.ts +1 -125
- package/src/components/datepicker/date-tags.ts +4 -1
- package/src/components/datepicker/datepicker-base.ts +2 -6
- package/src/components/datepicker/datepicker-multiple.ts +0 -3
- package/src/components/datepicker/datepicker-range.ts +4 -7
- package/src/components/datepicker/datepicker-single.ts +0 -3
- package/src/components/datepicker/datepicker-utils.test.ts +5 -5
- package/src/components/datepicker/datepicker-utils.ts +6 -11
- package/src/components/datepicker/datepicker.ts +8 -1
- package/src/components/fileupload/fileupload-base.ts +29 -19
- package/src/components/fileupload/fileupload-renderers.ts +2 -1
- package/src/components/fileupload/fileupload-types.ts +5 -42
- package/src/components/fileupload/fileupload.test.ts +16 -0
- package/src/components/fileupload/fileupload.ts +19 -15
- package/src/components/header/header-global.ts +3 -3
- package/src/components/header/header-service.ts +13 -8
- package/src/components/header/header.ts +2 -1
- package/src/components/helptext/helptext.test.ts +1 -1
- package/src/components/helptext/helptext.ts +3 -3
- package/src/components/index.ts +10 -1
- package/src/components/input-wrapper/input-wrapper.ts +18 -10
- package/src/components/link/link.ts +8 -3
- package/src/components/listbox/listbox.ts +3 -3
- package/src/components/radiobutton/radiobutton.ts +8 -4
- package/src/components/searchinput/searchinput.ts +5 -3
- package/src/components/select/select.ts +1 -0
- package/src/components/tag/tag.ts +2 -1
- package/src/components/textarea/textarea.ts +1 -0
- package/src/components/textinput/textinput.ts +1 -0
- package/src/components/timepicker/timepicker.ts +23 -21
- package/dist/alert-Cs4Rmq_J.cjs +0 -33
- package/dist/element-BA8v6S7z.cjs +0 -2
- package/dist/fileupload-BeWiTAoW.cjs +0 -401
- package/dist/helptext-CTtKJcML.cjs +0 -27
- package/dist/if-defined-B89_ZeCj.cjs +0 -1
- package/dist/input-element-DYmQw-fH.cjs +0 -1
- package/dist/input-wrapper-BmxNvznr.js +0 -128
- package/dist/input-wrapper-D-fPaTbY.js +0 -176
- package/dist/input-wrapper-D5PR0rJn.cjs +0 -1
- package/dist/input-wrapper-Q-B-aBeb.cjs +0 -54
- package/dist/link-D-Eqm5KH.js +0 -98
- package/dist/link-DK7gvmnj.cjs +0 -7
- package/dist/linkcard-B29cmZqh.cjs +0 -13
- package/dist/searchinput-Bh975rjX.cjs +0 -60
- package/dist/tag-CzojNU7z.cjs +0 -27
- package/dist/timepicker-DYrnLHqN.cjs +0 -195
- package/dist/translations/no.json.d.ts +0 -94
|
@@ -1,43 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
|
|
13
|
-
var d = {
|
|
14
|
-
dropZoneDragMultiple: "Dra filer hit for å laste dem opp eller",
|
|
15
|
-
dropZoneDragSingle: "Dra en fil hit for å laste den opp eller",
|
|
16
|
-
dropZoneDragMultipleThumbnail: "Dra bilder hit for å laste dem opp eller",
|
|
17
|
-
dropZoneDragSingleThumbnail: "Dra et bilde hit for å laste det opp eller",
|
|
18
|
-
dropZoneDragActiveMultiple: "Slipp filene her",
|
|
19
|
-
dropZoneDragActiveSingle: "Slipp filen her",
|
|
20
|
-
dropZoneDragActiveMultipleThumbnail: "Slipp bildene her",
|
|
21
|
-
dropZoneDragActiveSingleThumbnail: "Slipp bildet her",
|
|
22
|
-
dropZoneOpenFileDialogMultiple: "velg filer",
|
|
23
|
-
dropZoneOpenFileDialogSingle: "velg en fil",
|
|
24
|
-
dropZoneOpenFileDialogMultipleThumbnail: "velg fra kamerarull",
|
|
25
|
-
dropZoneOpenFileDialogSingleThumbnail: "velg fra kamerarull",
|
|
26
|
-
supportedFormatsPrefix: "Format:",
|
|
27
|
-
invalidFormatDefault: (e) => `Ugyldig filtype. Tillatte formater: ${e}`,
|
|
28
|
-
sizeTooLargeDefault: (e) => `Filen er for stor. Maks størrelse er ${e}.`,
|
|
29
|
-
requiredMissing: "Du må laste opp minst én fil.",
|
|
30
|
-
genericValidationRejection: "Filen ble avvist av validering.",
|
|
31
|
-
unknownFilename: "Ukjent fil",
|
|
32
|
-
fileLabel: (e) => e === 1 ? "fil" : "filer",
|
|
33
|
-
srFileAdded: (e) => `Filen «${e}» er lagt til`,
|
|
34
|
-
srFilesAdded: (e) => `${e} filer er lagt til`,
|
|
35
|
-
srFilesUploadedOfTotal: (e, t, n) => `${e} av ${t} ${n} lastet opp`,
|
|
36
|
-
srFilesFailedOfTotal: (e, t, n) => `Feil ved opplasting: ${e} av ${t} ${n} feilet`
|
|
37
|
-
};
|
|
38
|
-
//#endregion
|
|
1
|
+
import { _ as e, d as t, l as n, n as r, s as i, t as a, u as o } from "./element-WEzISABa.js";
|
|
2
|
+
import { t as s } from "./class-map-wh4Yi3oj.js";
|
|
3
|
+
import { n as c, t as l } from "./format-BTeSVkED.js";
|
|
4
|
+
import "./alert-Bmaly2Yo.js";
|
|
5
|
+
import "./icon-DEtOSWRK.js";
|
|
6
|
+
import { t as u } from "./if-defined-BmnvvxtR.js";
|
|
7
|
+
import { t as d } from "./converters-CkjLSYpa.js";
|
|
8
|
+
import { n as f } from "./utils-BwF4QSrq.js";
|
|
9
|
+
import "./input-wrapper-CQgAL1Br.js";
|
|
10
|
+
import { r as p } from "./focus-trap-DG3pEuyJ.js";
|
|
11
|
+
import "./modal-V-jEe0aY.js";
|
|
12
|
+
import "./progressbar-DS4i8IWq.js";
|
|
39
13
|
//#region ../../shared-utils/fileupload/size.ts
|
|
40
|
-
function
|
|
14
|
+
function m(e) {
|
|
41
15
|
if (e == null || e === "") return;
|
|
42
16
|
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
43
17
|
let t = String(e).trim(), n = Number(t);
|
|
@@ -56,18 +30,18 @@ function f(e) {
|
|
|
56
30
|
default: return;
|
|
57
31
|
}
|
|
58
32
|
}
|
|
59
|
-
function
|
|
33
|
+
function h(e) {
|
|
60
34
|
return e < 1024 ? `${Math.round(e)} B` : e < 1048576 ? `${Math.round(e / 1024)} KB` : e < 1073741824 ? `${Math.round(e / 1048576)} MB` : `${Math.round(e / 1073741824)} GB`;
|
|
61
35
|
}
|
|
62
36
|
//#endregion
|
|
63
37
|
//#region ../../shared-utils/fileupload/formats.ts
|
|
64
|
-
function
|
|
38
|
+
function g(e) {
|
|
65
39
|
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
66
40
|
}
|
|
67
|
-
function
|
|
41
|
+
function _(e) {
|
|
68
42
|
return e ? e.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean) : [];
|
|
69
43
|
}
|
|
70
|
-
function
|
|
44
|
+
function v(e, t, n) {
|
|
71
45
|
let r = e.toLowerCase().replace(/^\./, "");
|
|
72
46
|
if (r.includes("/")) {
|
|
73
47
|
if (r.endsWith("/*")) {
|
|
@@ -78,42 +52,42 @@ function g(e, t, n) {
|
|
|
78
52
|
}
|
|
79
53
|
return t === r;
|
|
80
54
|
}
|
|
81
|
-
function
|
|
82
|
-
let n =
|
|
55
|
+
function y(e, t) {
|
|
56
|
+
let n = g(t);
|
|
83
57
|
if (n.length === 0) return !0;
|
|
84
58
|
let r = e.name.split(".").pop()?.toLowerCase() ?? "", i = e.type.toLowerCase();
|
|
85
|
-
return n.some((e) =>
|
|
59
|
+
return n.some((e) => v(e, r, i));
|
|
86
60
|
}
|
|
87
|
-
function
|
|
61
|
+
function b(e, t) {
|
|
88
62
|
let n = (e ?? "").trim();
|
|
89
63
|
if (n) return n;
|
|
90
|
-
let r =
|
|
64
|
+
let r = g(t);
|
|
91
65
|
return r.length === 0 ? "" : r.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
92
66
|
}
|
|
93
|
-
function
|
|
67
|
+
function x(e) {
|
|
94
68
|
return e.includes("/") ? e : e.replace(/^\./, "").toUpperCase();
|
|
95
69
|
}
|
|
96
|
-
function
|
|
97
|
-
let n =
|
|
98
|
-
if (n.length > 0) return n.map(
|
|
99
|
-
let r =
|
|
100
|
-
return r.length > 0 ? r.map(
|
|
70
|
+
function S(e, t) {
|
|
71
|
+
let n = g(e);
|
|
72
|
+
if (n.length > 0) return n.map(x).join(", ");
|
|
73
|
+
let r = _(t);
|
|
74
|
+
return r.length > 0 ? r.map(x).join(", ") : "";
|
|
101
75
|
}
|
|
102
76
|
//#endregion
|
|
103
77
|
//#region ../../shared-utils/fileupload/validation.ts
|
|
104
|
-
function
|
|
78
|
+
function C(e, t, n) {
|
|
105
79
|
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
106
80
|
}
|
|
107
|
-
function
|
|
108
|
-
let n =
|
|
109
|
-
if (n.length > 0 && !
|
|
110
|
-
let e = n.join(", "), r =
|
|
111
|
-
return
|
|
81
|
+
function w(e, t) {
|
|
82
|
+
let n = g(t.allowedFormats);
|
|
83
|
+
if (n.length > 0 && !y(e, n)) {
|
|
84
|
+
let e = n.join(", "), r = i.fileupload.invalidFormat;
|
|
85
|
+
return C(t.formatErrorMessage, r, { formats: e });
|
|
112
86
|
}
|
|
113
|
-
let r =
|
|
87
|
+
let r = m(t.maxFileSize);
|
|
114
88
|
if (r !== void 0 && e.size > r) {
|
|
115
|
-
let e =
|
|
116
|
-
return
|
|
89
|
+
let e = h(r), n = i.fileupload.sizeTooLarge;
|
|
90
|
+
return C(t.sizeErrorMessage, n, { maxSize: e });
|
|
117
91
|
}
|
|
118
92
|
if (t.onFileValidation) {
|
|
119
93
|
let n = t.onFileValidation(e);
|
|
@@ -121,7 +95,7 @@ function S(e, t) {
|
|
|
121
95
|
}
|
|
122
96
|
return null;
|
|
123
97
|
}
|
|
124
|
-
function
|
|
98
|
+
function T(e) {
|
|
125
99
|
let t = e.file;
|
|
126
100
|
if (t?.type?.startsWith("image/")) return !0;
|
|
127
101
|
let n = e.attributes?.targetFilename || t?.name || "";
|
|
@@ -129,10 +103,10 @@ function C(e) {
|
|
|
129
103
|
}
|
|
130
104
|
//#endregion
|
|
131
105
|
//#region ../../shared-utils/fileupload/transfers.ts
|
|
132
|
-
function
|
|
106
|
+
function E(e) {
|
|
133
107
|
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
134
108
|
}
|
|
135
|
-
function
|
|
109
|
+
function ee(e, t, n) {
|
|
136
110
|
let r = {
|
|
137
111
|
"in-progress": 0,
|
|
138
112
|
error: 1,
|
|
@@ -147,11 +121,11 @@ function T(e, t, n) {
|
|
|
147
121
|
showProgress: r?.showProgress,
|
|
148
122
|
lastProgress: r?.lastProgress
|
|
149
123
|
};
|
|
150
|
-
}).sort((e, t) => r[
|
|
124
|
+
}).sort((e, t) => r[E(e.progress)] - r[E(t.progress)]);
|
|
151
125
|
}
|
|
152
126
|
//#endregion
|
|
153
127
|
//#region ../../shared-utils/fileupload/truncate.ts
|
|
154
|
-
function
|
|
128
|
+
function D(e, t) {
|
|
155
129
|
return !t || t <= 0 || e.length <= t + 3 ? null : {
|
|
156
130
|
head: e.slice(0, e.length - t),
|
|
157
131
|
tail: e.slice(-t)
|
|
@@ -159,12 +133,12 @@ function E(e, t) {
|
|
|
159
133
|
}
|
|
160
134
|
//#endregion
|
|
161
135
|
//#region ../../shared-utils/fileupload/navigation.ts
|
|
162
|
-
function
|
|
136
|
+
function O(e, t, n) {
|
|
163
137
|
return n <= 0 ? 0 : t === "prev" ? e <= 0 ? n - 1 : e - 1 : e >= n - 1 ? 0 : e + 1;
|
|
164
138
|
}
|
|
165
139
|
//#endregion
|
|
166
140
|
//#region ../../shared-utils/fileupload/announcements.ts
|
|
167
|
-
function
|
|
141
|
+
function k(e, t) {
|
|
168
142
|
let n = e.length;
|
|
169
143
|
if (n === 0 || !t || t.length === 0) return {
|
|
170
144
|
totalCount: n,
|
|
@@ -184,316 +158,14 @@ function O(e, t) {
|
|
|
184
158
|
}
|
|
185
159
|
//#endregion
|
|
186
160
|
//#region ../../shared-utils/fileupload/filename.ts
|
|
187
|
-
function
|
|
161
|
+
function A(e, t = i.fileupload.unknownFilename) {
|
|
188
162
|
return e.attributes?.targetFilename || e.file?.name || t;
|
|
189
163
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
"css-class": "pkt-fileupload",
|
|
194
|
-
isElement: !1,
|
|
195
|
-
isPureReact: !0,
|
|
196
|
-
"dark-mode": !0,
|
|
197
|
-
props: {
|
|
198
|
-
name: {
|
|
199
|
-
type: "string",
|
|
200
|
-
name: "Navn for innsending",
|
|
201
|
-
category: "tech",
|
|
202
|
-
required: !0
|
|
203
|
-
},
|
|
204
|
-
label: {
|
|
205
|
-
type: "string",
|
|
206
|
-
name: "Etikett",
|
|
207
|
-
description: "Etikett/tittel over komponenten",
|
|
208
|
-
category: "form"
|
|
209
|
-
},
|
|
210
|
-
helptext: {
|
|
211
|
-
type: "string | ReactNode",
|
|
212
|
-
name: "Hjelpetekst",
|
|
213
|
-
description: "Hjelpetekst under etiketten",
|
|
214
|
-
category: "form"
|
|
215
|
-
},
|
|
216
|
-
helptextDropdown: {
|
|
217
|
-
type: "string",
|
|
218
|
-
name: "Utvidet hjelpetekst",
|
|
219
|
-
description: "Hjelpetekst som vises i en lukket boks man kan åpne",
|
|
220
|
-
category: "contents"
|
|
221
|
-
},
|
|
222
|
-
helptextDropdownButton: {
|
|
223
|
-
type: "string",
|
|
224
|
-
name: "Knappetekst for utvidet hjelpetekst",
|
|
225
|
-
default: "Les mer",
|
|
226
|
-
category: "contents"
|
|
227
|
-
},
|
|
228
|
-
required: {
|
|
229
|
-
type: "boolean",
|
|
230
|
-
name: "Påkrevd",
|
|
231
|
-
description: "Gjør feltet obligatorisk. I `uploadStrategy='form'` brukes native validering på file input. I `uploadStrategy='custom'` valideres kravet ved submit og komponenten viser feilmelding hvis ingen filer er valgt.",
|
|
232
|
-
default: !1,
|
|
233
|
-
category: "form"
|
|
234
|
-
},
|
|
235
|
-
value: {
|
|
236
|
-
type: "FileItemList",
|
|
237
|
-
name: "Fil-liste (controlled)",
|
|
238
|
-
description: "Liste over filer i komponenten. Bruk denne for controlled-modus.",
|
|
239
|
-
category: "form"
|
|
240
|
-
},
|
|
241
|
-
defaultValue: {
|
|
242
|
-
type: "FileItem[]",
|
|
243
|
-
name: "Default-verdi (uncontrolled)",
|
|
244
|
-
description: "Default-verdi når komponenten brukes 'uncontrolled'. Ingen grunn til at denne ikke skal være tom array `[]`",
|
|
245
|
-
category: "form"
|
|
246
|
-
},
|
|
247
|
-
onFilesChanged: {
|
|
248
|
-
type: "(files: FileItem[]) => void",
|
|
249
|
-
name: "Callback ved fil-endring",
|
|
250
|
-
description: "Kalles når fil(er) legges til, fjernes eller oppdateres",
|
|
251
|
-
category: "tech"
|
|
252
|
-
},
|
|
253
|
-
uploadStrategy: {
|
|
254
|
-
name: "Opplastingstype",
|
|
255
|
-
type: ["form", "custom"],
|
|
256
|
-
values: {
|
|
257
|
-
form: "form (når filer lastes opp ved submit)",
|
|
258
|
-
custom: "custom (når filer lastes opp via webappens egen logikk)"
|
|
259
|
-
},
|
|
260
|
-
description: "Velg mellom skjemaopplasting (filene sendes når skjemaet sendes inn) og bakgrunnsopplasting (webappen håndterer opplasting via `onFileUploadRequested` og oppdaterer `transfers`).",
|
|
261
|
-
default: "form",
|
|
262
|
-
category: "functionality"
|
|
263
|
-
},
|
|
264
|
-
multiple: {
|
|
265
|
-
type: "boolean",
|
|
266
|
-
name: "Tillat opplasting av flere filer",
|
|
267
|
-
default: !1,
|
|
268
|
-
category: "functionality"
|
|
269
|
-
},
|
|
270
|
-
itemRenderer: {
|
|
271
|
-
type: ["filename", "thumbnail"],
|
|
272
|
-
name: "Visningtype av filer",
|
|
273
|
-
description: "Hvordan filer skal vises i opplastings-køen. Enten filnavn eller som thumbnails. Du kan også (eksperimentelt) lage din egen komponent.",
|
|
274
|
-
default: "filename",
|
|
275
|
-
category: "functionality"
|
|
276
|
-
},
|
|
277
|
-
optionalTag: {
|
|
278
|
-
type: "boolean",
|
|
279
|
-
name: "Vis 'Valgfritt'-tag",
|
|
280
|
-
description: "Vis 'Valgfritt'-tag ved etiketten",
|
|
281
|
-
category: "form"
|
|
282
|
-
},
|
|
283
|
-
optionalText: {
|
|
284
|
-
type: "string",
|
|
285
|
-
name: "Valgfritt-tekst",
|
|
286
|
-
description: "Tekst som vises i valgfritt-merkingen",
|
|
287
|
-
default: "Valgfritt",
|
|
288
|
-
category: "contents"
|
|
289
|
-
},
|
|
290
|
-
requiredTag: {
|
|
291
|
-
type: "boolean",
|
|
292
|
-
name: "Vis 'Må fylles ut'-tag",
|
|
293
|
-
description: "Vis 'Må fylles ut'-tag ved etiketten",
|
|
294
|
-
category: "form"
|
|
295
|
-
},
|
|
296
|
-
requiredText: {
|
|
297
|
-
type: "string",
|
|
298
|
-
name: "Påkrevd-tekst",
|
|
299
|
-
description: "Tekst som vises i påkrevd-merkingen",
|
|
300
|
-
default: "Må fylles ut",
|
|
301
|
-
category: "contents"
|
|
302
|
-
},
|
|
303
|
-
tagText: {
|
|
304
|
-
type: "string",
|
|
305
|
-
name: "Tag-tekst",
|
|
306
|
-
description: "Tekst som vises i en tag ved siden av label",
|
|
307
|
-
category: "ui"
|
|
308
|
-
},
|
|
309
|
-
disabled: {
|
|
310
|
-
type: "boolean",
|
|
311
|
-
name: "Deaktivert",
|
|
312
|
-
description: "Deaktiverer hele komponenten - ingen interaksjon mulig",
|
|
313
|
-
default: !1,
|
|
314
|
-
category: "form"
|
|
315
|
-
},
|
|
316
|
-
errorMessage: {
|
|
317
|
-
type: "string",
|
|
318
|
-
name: "Feilmelding",
|
|
319
|
-
description: "Feilmelding for å vise under komponenten (ekstern/programmatisk feil)",
|
|
320
|
-
default: "Det oppstod en feil ved opplastingen av fil(ene).",
|
|
321
|
-
category: "form"
|
|
322
|
-
},
|
|
323
|
-
hasError: {
|
|
324
|
-
type: "boolean",
|
|
325
|
-
name: "Har feil",
|
|
326
|
-
description: "Om komponenten har en feiltilstand",
|
|
327
|
-
default: !1,
|
|
328
|
-
category: "form"
|
|
329
|
-
},
|
|
330
|
-
allowedFormats: {
|
|
331
|
-
type: "string[]",
|
|
332
|
-
name: "Tillatte filformater",
|
|
333
|
-
description: "Liste over tillatte filformater. F.eks. ['pdf', 'jpg', 'png'] eller ['image/*', 'application/pdf']",
|
|
334
|
-
category: "validation"
|
|
335
|
-
},
|
|
336
|
-
formatErrorMessage: {
|
|
337
|
-
type: "string",
|
|
338
|
-
name: "Feilmelding for ugyldig format",
|
|
339
|
-
description: "Tilpasset feilmelding ved ugyldig filtype.",
|
|
340
|
-
category: "validation"
|
|
341
|
-
},
|
|
342
|
-
maxFileSize: {
|
|
343
|
-
type: "string | number",
|
|
344
|
-
name: "Maks filstørrelse",
|
|
345
|
-
description: "Maksimal filstørrelse. F.eks. '5MB', '500KB', '1GB' eller antall bytes",
|
|
346
|
-
category: "validation"
|
|
347
|
-
},
|
|
348
|
-
onFileValidation: {
|
|
349
|
-
type: "(file: File) => string | null",
|
|
350
|
-
name: "Egendefinert validering",
|
|
351
|
-
description: "Kjører etter innebygd format/størrelse-validering. Returner feilmeldingsstreng hvis ugyldig, null hvis gyldig.",
|
|
352
|
-
category: "validation"
|
|
353
|
-
},
|
|
354
|
-
sizeErrorMessage: {
|
|
355
|
-
type: "string",
|
|
356
|
-
name: "Feilmelding for stor fil",
|
|
357
|
-
description: "Tilpasset feilmelding ved for stor fil.",
|
|
358
|
-
category: "validation"
|
|
359
|
-
},
|
|
360
|
-
addCommentsEnabled: {
|
|
361
|
-
type: "boolean",
|
|
362
|
-
name: "Tillat kommentarer",
|
|
363
|
-
description: "La brukeren skrive en kommentar pr fil. Kommentarene postes i felter med navn `{fileupload-navn}-comment`",
|
|
364
|
-
default: !1,
|
|
365
|
-
showIf: { itemRenderer: "filename" },
|
|
366
|
-
category: "functionality"
|
|
367
|
-
},
|
|
368
|
-
enableImagePreview: {
|
|
369
|
-
type: "boolean",
|
|
370
|
-
name: "Forhåndsvisning av bilder",
|
|
371
|
-
description: "Aktiver forhåndsvisning av bilder i modal (kun for thumbnail-visning)",
|
|
372
|
-
default: !1,
|
|
373
|
-
showIf: { itemRenderer: "thumbnail" },
|
|
374
|
-
category: "functionality"
|
|
375
|
-
},
|
|
376
|
-
extraOperations: {
|
|
377
|
-
type: "Array<QueueItemOperation>",
|
|
378
|
-
name: "Ekstra operasjoner",
|
|
379
|
-
description: "Ekstra operasjoner pr fil (eksperimentelt). Hver operasjon er et objekt med stabil `id`, `title` og valgfrie `onClick`/`renderInlineUI`/`renderExtendedUI`/`renderContent`/`renderHidden`. Callbacks får et `context`-objekt med file, disabled, isActive, activate, close, getAttribute og setAttribute.",
|
|
380
|
-
category: "functionality"
|
|
381
|
-
},
|
|
382
|
-
fullwidth: {
|
|
383
|
-
type: "boolean",
|
|
384
|
-
name: "Full bredde",
|
|
385
|
-
description: "Om komponenten skal ta full bredde av foreldreelementet",
|
|
386
|
-
default: !1,
|
|
387
|
-
category: "styling"
|
|
388
|
-
},
|
|
389
|
-
onFileUploadRequested: {
|
|
390
|
-
type: "(fileItem: FileItem) => void",
|
|
391
|
-
name: "Callback for opplastingsforespørsel",
|
|
392
|
-
description: "Ved <code>uploadStrategy='custom'</code> blir denne funksjonen kalt når brukeren velger en eller flere filer. Dette lar webappen sette i gang opplasting i bakgrunnen.",
|
|
393
|
-
relatedTypes: ["FileItem"],
|
|
394
|
-
category: "functionality"
|
|
395
|
-
},
|
|
396
|
-
onTransferCancelled: {
|
|
397
|
-
type: "(fileItemId: string) => void",
|
|
398
|
-
name: "Callback for avbrutt opplasting",
|
|
399
|
-
description: "Kalles når brukeren klikker 'Slett' eller 'Avbryt'. Webappen må dermed avbryte opplastingen av denne fila.",
|
|
400
|
-
category: "functionality"
|
|
401
|
-
},
|
|
402
|
-
renameFilesEnabled: {
|
|
403
|
-
type: "boolean",
|
|
404
|
-
name: "Tillat å gi nytt navn",
|
|
405
|
-
description: "La brukeren angi et navn pr fil. Filnavnene postes i felter med navn `{fileupload-navn}-targetFilename`",
|
|
406
|
-
default: !1,
|
|
407
|
-
showIf: { itemRenderer: "filename" },
|
|
408
|
-
category: "functionality"
|
|
409
|
-
},
|
|
410
|
-
transfers: {
|
|
411
|
-
type: "Array<FileTransfer>",
|
|
412
|
-
name: "Pågående filoverføringer",
|
|
413
|
-
description: "Ved <code>uploadStrategy='custom'</code> vil du fortelle komponenten om pågående overføringer her. Hver fil har en progress-verdi.",
|
|
414
|
-
items: {
|
|
415
|
-
type: "object",
|
|
416
|
-
elementType: "FileTransfer",
|
|
417
|
-
ref: "FileTransfer"
|
|
418
|
-
},
|
|
419
|
-
category: "functionality"
|
|
420
|
-
},
|
|
421
|
-
truncateTail: {
|
|
422
|
-
type: "number",
|
|
423
|
-
name: "Forkort filnavn",
|
|
424
|
-
description: "Hvordan lange filnavn skal forkortes med ellipse i køen. Med `4` vil filnavnet vises som `langt-filnavn-med ... .pdf`. Med verdi `0` kommer ellipsen til slutt.",
|
|
425
|
-
category: "functionality"
|
|
426
|
-
},
|
|
427
|
-
previewUploadIntervalMs: {
|
|
428
|
-
type: "number",
|
|
429
|
-
name: "Demo: opplastingshastighet (ms/5%)",
|
|
430
|
-
description: "Kun for dokumentasjons-forhåndsvisning. Senker simulert opplasting for å demonstrere statusvisning. Gjelder kun i `uploadStrategy='custom'`.",
|
|
431
|
-
default: 100,
|
|
432
|
-
showIf: { uploadStrategy: "custom" },
|
|
433
|
-
category: "demo"
|
|
434
|
-
},
|
|
435
|
-
previewSimulateUploadError: {
|
|
436
|
-
type: "boolean",
|
|
437
|
-
name: "Demo: simuler feil ved 90% opplasting",
|
|
438
|
-
description: "Kun for dokumentasjons-forhåndsvisning. Hvis aktivert feiler simulert opplasting rundt 90%.",
|
|
439
|
-
default: !1,
|
|
440
|
-
showIf: { uploadStrategy: "custom" },
|
|
441
|
-
category: "demo"
|
|
442
|
-
},
|
|
443
|
-
previewUploadStatus: {
|
|
444
|
-
type: ["progressbar", "text"],
|
|
445
|
-
name: "Visning av opplastingstatus",
|
|
446
|
-
description: "Kun for dokumentasjons-forhåndsvisning. Vises kun når `uploadStrategy='custom'`. Status vises først etter at brukeren faktisk har valgt fil(er).",
|
|
447
|
-
default: "progressbar",
|
|
448
|
-
showIf: { uploadStrategy: "custom" },
|
|
449
|
-
category: "demo"
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
types: {
|
|
453
|
-
FileItem: {
|
|
454
|
-
description: "En valgt fil i køen. <code>FileItemList</code> er en array av <code>FileItem</code>. Brukes som parameter i callbacks som <code>onFileUploadRequested</code> og i <code>FileItemList</code> (<code>value</code> / <code>defaultValue</code>).",
|
|
455
|
-
properties: {
|
|
456
|
-
fileId: {
|
|
457
|
-
type: "string",
|
|
458
|
-
description: "Unik id for filen i komponenten."
|
|
459
|
-
},
|
|
460
|
-
file: {
|
|
461
|
-
type: "File",
|
|
462
|
-
description: "Fil-objektet fra nettleseren."
|
|
463
|
-
},
|
|
464
|
-
attributes: {
|
|
465
|
-
type: "Record<string, unknown>",
|
|
466
|
-
description: "Metadata per fil (f.eks. <code>targetFilename</code> for visningsnavn)."
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
},
|
|
470
|
-
FileTransfer: {
|
|
471
|
-
description: "Status for én pågående opplasting når <code>uploadStrategy=\"custom\"</code>.",
|
|
472
|
-
properties: {
|
|
473
|
-
fileId: {
|
|
474
|
-
type: "string",
|
|
475
|
-
description: "Kobler til <code>FileItem.fileId</code>."
|
|
476
|
-
},
|
|
477
|
-
progress: {
|
|
478
|
-
type: "number | 'done' | 'error' | 'canceled' | 'queued'",
|
|
479
|
-
description: "Fremdrift (<code>0..1</code>) eller tilstand."
|
|
480
|
-
},
|
|
481
|
-
errorMessage: {
|
|
482
|
-
type: "string",
|
|
483
|
-
description: "Feilmelding ved <code>error</code>.",
|
|
484
|
-
required: !1
|
|
485
|
-
},
|
|
486
|
-
showProgress: {
|
|
487
|
-
type: "boolean",
|
|
488
|
-
description: "Vis determinate progress vs. «Laster opp…».",
|
|
489
|
-
required: !1
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}, j = class extends a {
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/components/fileupload/fileupload-base.ts
|
|
166
|
+
var j = class extends a {
|
|
495
167
|
constructor(...e) {
|
|
496
|
-
super(...e), this.id = `pkt-fileupload-${
|
|
168
|
+
super(...e), this.id = `pkt-fileupload-${f()}`, this.name = "files", this.label = "", this.helptext = "", this.helptextDropdown = "", 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.requiredTag = !1, 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.onNativeFileChange = (e) => {
|
|
497
169
|
let t = e.target;
|
|
498
170
|
this.addFiles(t.files ? Array.from(t.files) : []), this.uploadStrategy === "custom" && (t.value = "");
|
|
499
171
|
}, this.openFileDialog = (e) => {
|
|
@@ -512,6 +184,9 @@ var A = {
|
|
|
512
184
|
!this.required || this.uploadStrategy !== "custom" || this.getCurrentFiles().length > 0 || (this.validationErrorMessage = this.requiredSelectionMessage, e.preventDefault());
|
|
513
185
|
};
|
|
514
186
|
}
|
|
187
|
+
get requiredSelectionMessage() {
|
|
188
|
+
return this.pktStrings.get("fileupload").requiredMissing;
|
|
189
|
+
}
|
|
515
190
|
get isControlled() {
|
|
516
191
|
return this.value !== void 0;
|
|
517
192
|
}
|
|
@@ -567,13 +242,13 @@ var A = {
|
|
|
567
242
|
}
|
|
568
243
|
this.validationErrorMessage = null;
|
|
569
244
|
let n = t.map((e) => ({
|
|
570
|
-
fileId:
|
|
245
|
+
fileId: f(),
|
|
571
246
|
file: e,
|
|
572
247
|
attributes: { targetFilename: e.name }
|
|
573
|
-
}));
|
|
574
|
-
this.setAddedAnnouncement(n.length === 1 ?
|
|
575
|
-
let
|
|
576
|
-
this.commitFiles(
|
|
248
|
+
})), r = this.pktStrings.get("fileupload");
|
|
249
|
+
this.setAddedAnnouncement(n.length === 1 ? l(r.srFileAdded, { filename: n[0].attributes.targetFilename }) : l(r.srFilesAdded, { count: n.length }));
|
|
250
|
+
let i = this.getCurrentFiles(), a = this.multiple ? [...i, ...n] : [n[0]];
|
|
251
|
+
this.commitFiles(a, "add", n.map((e) => e.fileId)), this.uploadStrategy === "custom" && n.forEach((e) => {
|
|
577
252
|
this.dispatchEvent(new CustomEvent("file-upload-requested", {
|
|
578
253
|
detail: {
|
|
579
254
|
fileId: e.fileId,
|
|
@@ -635,22 +310,22 @@ var A = {
|
|
|
635
310
|
return this.transfers.find((t) => t.fileId === e);
|
|
636
311
|
}
|
|
637
312
|
isImageFile(e) {
|
|
638
|
-
return
|
|
313
|
+
return T(e);
|
|
639
314
|
}
|
|
640
315
|
formatFileSize(e) {
|
|
641
|
-
return
|
|
316
|
+
return h(e);
|
|
642
317
|
}
|
|
643
318
|
getResolvedAcceptValue() {
|
|
644
|
-
return
|
|
319
|
+
return b(this.accept, this.allowedFormats);
|
|
645
320
|
}
|
|
646
321
|
getSupportedFormatsText() {
|
|
647
|
-
return
|
|
322
|
+
return S(this.allowedFormats, this.accept);
|
|
648
323
|
}
|
|
649
324
|
getSortedFilesAndTransfers() {
|
|
650
|
-
return
|
|
325
|
+
return ee(this.getCurrentFiles(), this.transfers, this.uploadStrategy);
|
|
651
326
|
}
|
|
652
327
|
validateFile(e) {
|
|
653
|
-
let t =
|
|
328
|
+
let t = w(e, {
|
|
654
329
|
allowedFormats: this.allowedFormats,
|
|
655
330
|
maxFileSize: this.maxFileSize,
|
|
656
331
|
formatErrorMessage: this.formatErrorMessage,
|
|
@@ -667,7 +342,7 @@ var A = {
|
|
|
667
342
|
composed: !0,
|
|
668
343
|
cancelable: !0
|
|
669
344
|
});
|
|
670
|
-
return this.dispatchEvent(r), n.errorMessage ? n.errorMessage : r.defaultPrevented ?
|
|
345
|
+
return this.dispatchEvent(r), n.errorMessage ? n.errorMessage : r.defaultPrevented ? this.pktStrings.get("fileupload").genericValidationRejection : null;
|
|
671
346
|
}
|
|
672
347
|
syncThumbnailUrls(e) {
|
|
673
348
|
if (!(typeof URL < "u" && typeof URL.createObjectURL == "function" && typeof URL.revokeObjectURL == "function")) {
|
|
@@ -701,12 +376,24 @@ var A = {
|
|
|
701
376
|
}
|
|
702
377
|
getSrUploadedMessage() {
|
|
703
378
|
if (this.addedAnnouncement) return this.addedAnnouncement;
|
|
704
|
-
let { totalCount: e, uploadedCount: t } =
|
|
705
|
-
|
|
379
|
+
let { totalCount: e, uploadedCount: t } = k(this.getCurrentFiles(), this.transfers);
|
|
380
|
+
if (e === 0 || t === 0) return "";
|
|
381
|
+
let n = this.pktStrings.get("fileupload");
|
|
382
|
+
return l(n.srFilesUploadedOfTotal, {
|
|
383
|
+
uploaded: t,
|
|
384
|
+
total: e,
|
|
385
|
+
label: c(e, n.fileLabelOne, n.fileLabelOther)
|
|
386
|
+
});
|
|
706
387
|
}
|
|
707
388
|
getSrErrorsMessage() {
|
|
708
|
-
let { totalCount: e, failedCount: t } =
|
|
709
|
-
|
|
389
|
+
let { totalCount: e, failedCount: t } = k(this.getCurrentFiles(), this.transfers);
|
|
390
|
+
if (e === 0 || t === 0) return "";
|
|
391
|
+
let n = this.pktStrings.get("fileupload");
|
|
392
|
+
return l(n.srFilesFailedOfTotal, {
|
|
393
|
+
failed: t,
|
|
394
|
+
total: e,
|
|
395
|
+
label: c(e, n.fileLabelOne, n.fileLabelOther)
|
|
396
|
+
});
|
|
710
397
|
}
|
|
711
398
|
syncFormSubmitListener() {
|
|
712
399
|
let e = this.closest("form");
|
|
@@ -716,77 +403,77 @@ var A = {
|
|
|
716
403
|
this.connectedForm &&= (this.connectedForm.removeEventListener("submit", this.onHostFormSubmit), null);
|
|
717
404
|
}
|
|
718
405
|
};
|
|
719
|
-
|
|
406
|
+
r([o({ type: String })], j.prototype, "id", void 0), r([o({ type: String })], j.prototype, "name", void 0), r([o({ type: String })], j.prototype, "label", void 0), r([o({ type: String })], j.prototype, "helptext", void 0), r([o({
|
|
720
407
|
type: String,
|
|
721
408
|
attribute: "helptext-dropdown"
|
|
722
|
-
})], j.prototype, "helptextDropdown", void 0),
|
|
409
|
+
})], j.prototype, "helptextDropdown", void 0), r([o({
|
|
723
410
|
type: String,
|
|
724
411
|
attribute: "helptext-dropdown-button"
|
|
725
|
-
})], j.prototype, "helptextDropdownButton", void 0),
|
|
412
|
+
})], j.prototype, "helptextDropdownButton", void 0), r([o({
|
|
726
413
|
type: Boolean,
|
|
727
414
|
reflect: !0
|
|
728
|
-
})], j.prototype, "required", void 0),
|
|
415
|
+
})], j.prototype, "required", void 0), r([o({
|
|
729
416
|
type: Boolean,
|
|
730
417
|
reflect: !0
|
|
731
|
-
})], j.prototype, "multiple", void 0),
|
|
418
|
+
})], j.prototype, "multiple", void 0), r([o({
|
|
732
419
|
type: Boolean,
|
|
733
420
|
reflect: !0
|
|
734
|
-
})], j.prototype, "disabled", void 0),
|
|
421
|
+
})], j.prototype, "disabled", void 0), r([o({
|
|
735
422
|
type: Boolean,
|
|
736
423
|
reflect: !0,
|
|
737
424
|
attribute: "fullwidth"
|
|
738
|
-
})], j.prototype, "fullwidth", void 0),
|
|
425
|
+
})], j.prototype, "fullwidth", void 0), r([o({
|
|
739
426
|
type: String,
|
|
740
427
|
reflect: !0,
|
|
741
428
|
attribute: "upload-strategy"
|
|
742
|
-
})], j.prototype, "uploadStrategy", void 0),
|
|
429
|
+
})], j.prototype, "uploadStrategy", void 0), r([o({
|
|
743
430
|
type: String,
|
|
744
431
|
reflect: !0,
|
|
745
432
|
attribute: "item-renderer"
|
|
746
|
-
})], j.prototype, "itemRenderer", void 0),
|
|
747
|
-
converter:
|
|
433
|
+
})], j.prototype, "itemRenderer", void 0), r([o({ type: String })], j.prototype, "accept", void 0), r([o({
|
|
434
|
+
converter: d.csvToArray,
|
|
748
435
|
attribute: "allowed-formats"
|
|
749
|
-
})], j.prototype, "allowedFormats", void 0),
|
|
436
|
+
})], j.prototype, "allowedFormats", void 0), r([o({
|
|
750
437
|
type: String,
|
|
751
438
|
attribute: "format-error-message"
|
|
752
|
-
})], j.prototype, "formatErrorMessage", void 0),
|
|
439
|
+
})], j.prototype, "formatErrorMessage", void 0), r([o({ attribute: "max-file-size" })], j.prototype, "maxFileSize", void 0), r([o({
|
|
753
440
|
type: String,
|
|
754
441
|
attribute: "size-error-message"
|
|
755
|
-
})], j.prototype, "sizeErrorMessage", void 0),
|
|
442
|
+
})], j.prototype, "sizeErrorMessage", void 0), r([o({ attribute: !1 })], j.prototype, "onFileValidation", void 0), r([o({ attribute: !1 })], j.prototype, "transfers", void 0), r([o({
|
|
756
443
|
type: Boolean,
|
|
757
444
|
attribute: "add-comments-enabled"
|
|
758
|
-
})], j.prototype, "addCommentsEnabled", void 0),
|
|
445
|
+
})], j.prototype, "addCommentsEnabled", void 0), r([o({
|
|
759
446
|
type: Boolean,
|
|
760
447
|
attribute: "rename-files-enabled"
|
|
761
|
-
})], j.prototype, "renameFilesEnabled", void 0),
|
|
448
|
+
})], j.prototype, "renameFilesEnabled", void 0), r([o({ attribute: !1 })], j.prototype, "extraOperations", void 0), r([o({
|
|
762
449
|
type: Boolean,
|
|
763
450
|
reflect: !0,
|
|
764
451
|
attribute: "enable-image-preview"
|
|
765
|
-
})], j.prototype, "enableImagePreview", void 0),
|
|
452
|
+
})], j.prototype, "enableImagePreview", void 0), r([o({
|
|
766
453
|
type: Boolean,
|
|
767
454
|
attribute: "has-error"
|
|
768
|
-
})], j.prototype, "hasError", void 0),
|
|
455
|
+
})], j.prototype, "hasError", void 0), r([o({
|
|
769
456
|
type: String,
|
|
770
457
|
attribute: "error-message"
|
|
771
|
-
})], j.prototype, "errorMessage", void 0),
|
|
458
|
+
})], j.prototype, "errorMessage", void 0), r([o({
|
|
772
459
|
type: Boolean,
|
|
773
460
|
attribute: "optional-tag"
|
|
774
|
-
})], j.prototype, "optionalTag", void 0),
|
|
461
|
+
})], j.prototype, "optionalTag", void 0), r([o({
|
|
775
462
|
type: String,
|
|
776
463
|
attribute: "optional-text"
|
|
777
|
-
})], j.prototype, "optionalText", void 0),
|
|
464
|
+
})], j.prototype, "optionalText", void 0), r([o({
|
|
778
465
|
type: Boolean,
|
|
779
466
|
attribute: "required-tag"
|
|
780
|
-
})], j.prototype, "requiredTag", void 0),
|
|
467
|
+
})], j.prototype, "requiredTag", void 0), r([o({
|
|
781
468
|
type: String,
|
|
782
469
|
attribute: "required-text"
|
|
783
|
-
})], j.prototype, "requiredText", void 0),
|
|
470
|
+
})], j.prototype, "requiredText", void 0), r([o({
|
|
784
471
|
type: String,
|
|
785
472
|
attribute: "tag-text"
|
|
786
|
-
})], j.prototype, "tagText", void 0),
|
|
473
|
+
})], j.prototype, "tagText", void 0), r([o({
|
|
787
474
|
type: Number,
|
|
788
475
|
attribute: "truncate-tail"
|
|
789
|
-
})], j.prototype, "truncateTail", void 0),
|
|
476
|
+
})], j.prototype, "truncateTail", void 0), r([o({ attribute: !1 })], j.prototype, "value", void 0), r([o({ attribute: !1 })], j.prototype, "defaultValue", void 0), r([n()], j.prototype, "files", void 0), r([n()], j.prototype, "isDragActive", void 0), r([n()], j.prototype, "validationErrorMessage", void 0), r([n()], j.prototype, "addedAnnouncement", void 0), r([n()], j.prototype, "thumbnailUrls", void 0);
|
|
790
477
|
//#endregion
|
|
791
478
|
//#region src/components/fileupload/fileupload-operations.ts
|
|
792
479
|
var M = "comments", N = (e) => {
|
|
@@ -805,25 +492,25 @@ var M = "comments", N = (e) => {
|
|
|
805
492
|
id: "rename",
|
|
806
493
|
title: "Rediger",
|
|
807
494
|
ariaLabel: "Rediger filnavn",
|
|
808
|
-
renderInlineUI: (
|
|
809
|
-
let
|
|
810
|
-
let
|
|
811
|
-
|
|
495
|
+
renderInlineUI: (t) => {
|
|
496
|
+
let n = t.getAttribute("targetFilename") || t.file.attributes?.targetFilename || t.file.file?.name || "", r = `pkt-fileupload-rename-${t.file.fileId}`, i = () => {
|
|
497
|
+
let e = document.getElementById(r)?.value?.trim();
|
|
498
|
+
e && t.setAttribute("targetFilename", e), t.close();
|
|
812
499
|
};
|
|
813
|
-
return
|
|
814
|
-
<label for=${
|
|
500
|
+
return e`
|
|
501
|
+
<label for=${r} class="pkt-sr-only">Endre filnavn</label>
|
|
815
502
|
<input
|
|
816
|
-
id=${
|
|
503
|
+
id=${r}
|
|
817
504
|
type="text"
|
|
818
505
|
class="pkt-fileupload__queue-display__item__rename-input"
|
|
819
|
-
?disabled=${
|
|
820
|
-
.value=${
|
|
821
|
-
@keydown=${(
|
|
506
|
+
?disabled=${t.disabled}
|
|
507
|
+
.value=${n}
|
|
508
|
+
@keydown=${(e) => P(e, i, t.close)}
|
|
822
509
|
/>
|
|
823
510
|
<button
|
|
824
511
|
type="button"
|
|
825
512
|
class="pkt-btn pkt-btn--secondary pkt-btn--small"
|
|
826
|
-
?disabled=${
|
|
513
|
+
?disabled=${t.disabled}
|
|
827
514
|
@click=${i}
|
|
828
515
|
>
|
|
829
516
|
Lagre
|
|
@@ -831,78 +518,78 @@ var M = "comments", N = (e) => {
|
|
|
831
518
|
<button
|
|
832
519
|
type="button"
|
|
833
520
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small"
|
|
834
|
-
?disabled=${
|
|
835
|
-
@click=${
|
|
521
|
+
?disabled=${t.disabled}
|
|
522
|
+
@click=${t.close}
|
|
836
523
|
>
|
|
837
524
|
Avbryt
|
|
838
525
|
</button>
|
|
839
526
|
`;
|
|
840
527
|
},
|
|
841
|
-
renderHidden: (
|
|
842
|
-
let
|
|
843
|
-
return
|
|
528
|
+
renderHidden: (t) => {
|
|
529
|
+
let n = t.getAttribute("targetFilename") || t.file.attributes?.targetFilename || t.file.file?.name || "";
|
|
530
|
+
return e`<input
|
|
844
531
|
type="hidden"
|
|
845
|
-
name=${`${
|
|
846
|
-
value=${
|
|
532
|
+
name=${`${t.inputName}-targetFilename`}
|
|
533
|
+
value=${n}
|
|
847
534
|
/>`;
|
|
848
535
|
}
|
|
849
536
|
}), R = () => ({
|
|
850
537
|
id: "comment",
|
|
851
538
|
title: (e) => (e.attributes?.[M] ?? []).length > 0 ? "" : "Legg til kommentar",
|
|
852
539
|
ariaLabel: "Legg til kommentar",
|
|
853
|
-
renderExtendedUI: (
|
|
854
|
-
let
|
|
855
|
-
let
|
|
856
|
-
|
|
857
|
-
text:
|
|
540
|
+
renderExtendedUI: (t) => {
|
|
541
|
+
let n = (t.getAttribute(M) ?? [])[0], r = `pkt-fileupload-comment-${t.file.fileId}`, i = () => {
|
|
542
|
+
let e = document.getElementById(r)?.value?.trim();
|
|
543
|
+
e && t.setAttribute(M, [{
|
|
544
|
+
text: e,
|
|
858
545
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
859
|
-
}]),
|
|
546
|
+
}]), t.close();
|
|
860
547
|
};
|
|
861
|
-
return
|
|
862
|
-
<label for=${
|
|
863
|
-
${
|
|
548
|
+
return e`
|
|
549
|
+
<label for=${r} class="pkt-fileupload__queue-display__item__comment-label">
|
|
550
|
+
${n ? "Rediger kommentar" : "Legg til kommentar"}
|
|
864
551
|
</label>
|
|
865
552
|
<textarea
|
|
866
|
-
id=${
|
|
553
|
+
id=${r}
|
|
867
554
|
class="pkt-fileupload__queue-display__item__comment-input"
|
|
868
|
-
?disabled=${
|
|
869
|
-
.value=${
|
|
555
|
+
?disabled=${t.disabled}
|
|
556
|
+
.value=${n?.text ?? ""}
|
|
870
557
|
rows="2"
|
|
871
558
|
placeholder="Skriv inn kommentar"
|
|
872
|
-
@keydown=${(
|
|
559
|
+
@keydown=${(e) => F(e, i, t.close)}
|
|
873
560
|
></textarea>
|
|
874
561
|
<button
|
|
875
562
|
type="button"
|
|
876
563
|
class="pkt-btn pkt-btn--secondary pkt-btn--small"
|
|
877
|
-
?disabled=${
|
|
564
|
+
?disabled=${t.disabled}
|
|
878
565
|
@click=${i}
|
|
879
566
|
>
|
|
880
|
-
${
|
|
567
|
+
${n ? "Lagre kommentar" : "Legg til kommentar"}
|
|
881
568
|
</button>
|
|
882
569
|
<button
|
|
883
570
|
type="button"
|
|
884
571
|
class="pkt-btn pkt-btn--tertiary pkt-btn--small"
|
|
885
|
-
?disabled=${
|
|
886
|
-
@click=${
|
|
572
|
+
?disabled=${t.disabled}
|
|
573
|
+
@click=${t.close}
|
|
887
574
|
>
|
|
888
575
|
Avbryt
|
|
889
576
|
</button>
|
|
890
577
|
`;
|
|
891
578
|
},
|
|
892
|
-
renderContent: (
|
|
893
|
-
if (
|
|
894
|
-
let
|
|
895
|
-
if (
|
|
896
|
-
let
|
|
897
|
-
return
|
|
579
|
+
renderContent: (t) => {
|
|
580
|
+
if (t.isActive) return null;
|
|
581
|
+
let n = t.getAttribute(M) ?? [];
|
|
582
|
+
if (n.length === 0) return null;
|
|
583
|
+
let r = n[0];
|
|
584
|
+
return e`
|
|
898
585
|
<div class="pkt-fileupload__queue-display__item__comments">
|
|
899
586
|
<div class="pkt-fileupload__queue-display__item__comment">
|
|
900
587
|
<div class="pkt-fileupload__queue-display__item__comment__content">
|
|
901
588
|
<span class="pkt-fileupload__queue-display__item__comment__text" aria-label="Kommentar tekst">
|
|
902
|
-
${
|
|
589
|
+
${r.text}
|
|
903
590
|
</span>
|
|
904
591
|
<time class="pkt-fileupload__queue-display__item__comment__time">
|
|
905
|
-
${N(
|
|
592
|
+
${N(r.timestamp)}
|
|
906
593
|
</time>
|
|
907
594
|
</div>
|
|
908
595
|
<div class="pkt-fileupload__queue-display__item__comment__actions">
|
|
@@ -910,8 +597,8 @@ var M = "comments", N = (e) => {
|
|
|
910
597
|
type="button"
|
|
911
598
|
class="pkt-fileupload__queue-display__item__comment__action"
|
|
912
599
|
aria-label="Rediger kommentar"
|
|
913
|
-
?disabled=${
|
|
914
|
-
@click=${
|
|
600
|
+
?disabled=${t.disabled}
|
|
601
|
+
@click=${t.activate}
|
|
915
602
|
>
|
|
916
603
|
<pkt-icon name="edit"></pkt-icon>
|
|
917
604
|
</button>
|
|
@@ -919,8 +606,8 @@ var M = "comments", N = (e) => {
|
|
|
919
606
|
type="button"
|
|
920
607
|
class="pkt-fileupload__queue-display__item__comment__action"
|
|
921
608
|
aria-label="Slett kommentar"
|
|
922
|
-
?disabled=${
|
|
923
|
-
@click=${() =>
|
|
609
|
+
?disabled=${t.disabled}
|
|
610
|
+
@click=${() => t.setAttribute(M, void 0)}
|
|
924
611
|
>
|
|
925
612
|
<pkt-icon name="trash-can"></pkt-icon>
|
|
926
613
|
</button>
|
|
@@ -929,31 +616,31 @@ var M = "comments", N = (e) => {
|
|
|
929
616
|
</div>
|
|
930
617
|
`;
|
|
931
618
|
},
|
|
932
|
-
renderHidden: (
|
|
933
|
-
let
|
|
934
|
-
return
|
|
619
|
+
renderHidden: (t) => {
|
|
620
|
+
let n = t.getAttribute(M);
|
|
621
|
+
return e`<input
|
|
935
622
|
type="hidden"
|
|
936
|
-
name=${`${
|
|
937
|
-
value=${
|
|
623
|
+
name=${`${t.inputName}-comments`}
|
|
624
|
+
value=${n ? JSON.stringify(n) : ""}
|
|
938
625
|
/>`;
|
|
939
626
|
}
|
|
940
|
-
}), z = (
|
|
941
|
-
let
|
|
942
|
-
return
|
|
627
|
+
}), z = (t, n) => {
|
|
628
|
+
let r = D(t, n);
|
|
629
|
+
return r ? e`<span
|
|
943
630
|
class="pkt-fileupload__queue-display__item__title__head"
|
|
944
631
|
data-pkt-truncate-part="first"
|
|
945
|
-
>${
|
|
632
|
+
>${r.head}</span
|
|
946
633
|
><span
|
|
947
634
|
class="pkt-fileupload__queue-display__item__title__tail"
|
|
948
635
|
data-pkt-truncate-part="tail"
|
|
949
|
-
>${
|
|
950
|
-
>` :
|
|
951
|
-
}, B = (
|
|
636
|
+
>${r.tail}</span
|
|
637
|
+
>` : e`<span data-pkt-truncate-part="first">${t}</span>`;
|
|
638
|
+
}, B = (t, n, r) => e`
|
|
952
639
|
<p class="pkt-fileupload__queue-display__item__title">
|
|
953
|
-
${z(
|
|
640
|
+
${z(t, r)}${n ? e`<span class="pkt-fileupload__queue-display__item__filesize"> (${n})</span>` : null}
|
|
954
641
|
</p>
|
|
955
|
-
`, V = (e) => typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle", H = (
|
|
956
|
-
>${
|
|
642
|
+
`, V = (e) => typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle", H = (t) => e`<span class="pkt-fileupload__queue-display__item__loading-text" aria-label="Laster opp fil"
|
|
643
|
+
>${t ?? "Laster opp..."}</span
|
|
957
644
|
>`, U = ({ operationId: e, file: t, inputName: n, disabled: r, isActive: i, onActivateOperation: a, onCloseOperation: o, getFileAttribute: s, setFileAttribute: c }) => ({
|
|
958
645
|
file: t,
|
|
959
646
|
inputName: n,
|
|
@@ -963,25 +650,25 @@ var M = "comments", N = (e) => {
|
|
|
963
650
|
close: () => o(t.fileId),
|
|
964
651
|
getAttribute: (e) => s(t.fileId, e),
|
|
965
652
|
setAttribute: (e, n) => c(t.fileId, e, n)
|
|
966
|
-
}), W = ({ file:
|
|
967
|
-
let u =
|
|
968
|
-
return
|
|
653
|
+
}), W = ({ file: t, fileSize: n, disabled: r, transferProgress: i, transferShowProgress: a, loadingText: o, truncateTail: s, onCancel: c, iconName: l = "document-text" }) => {
|
|
654
|
+
let u = A(t), d = a ?? i !== 0;
|
|
655
|
+
return e`
|
|
969
656
|
<pkt-icon
|
|
970
657
|
name=${l}
|
|
971
658
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
972
659
|
aria-hidden="true"
|
|
973
660
|
></pkt-icon>
|
|
974
|
-
${B(u,
|
|
661
|
+
${B(u, n, s)}
|
|
975
662
|
<button
|
|
976
663
|
type="button"
|
|
977
664
|
class="pkt-fileupload__queue-display__item__cancel-button"
|
|
978
665
|
aria-label="Avbryt opplasting"
|
|
979
|
-
?disabled=${
|
|
980
|
-
@click=${() => c(
|
|
666
|
+
?disabled=${r}
|
|
667
|
+
@click=${() => c(t.fileId)}
|
|
981
668
|
>
|
|
982
669
|
Avbryt
|
|
983
670
|
</button>
|
|
984
|
-
${d ?
|
|
671
|
+
${d ? e`
|
|
985
672
|
<pkt-progressbar
|
|
986
673
|
class="pkt-fileupload__queue-display__item__progress"
|
|
987
674
|
valueCurrent=${Math.round(i * 100)}
|
|
@@ -994,25 +681,25 @@ var M = "comments", N = (e) => {
|
|
|
994
681
|
>
|
|
995
682
|
` : H(o)}
|
|
996
683
|
`;
|
|
997
|
-
}, G = ({ file:
|
|
998
|
-
let l =
|
|
999
|
-
return
|
|
684
|
+
}, G = ({ file: t, fileSize: n, disabled: r, transferShowProgress: i, transferLastProgress: a, transferErrorMessage: o, truncateTail: s, onCancel: c }) => {
|
|
685
|
+
let l = A(t), u = !!i, d = Math.round((a ?? 1) * 100);
|
|
686
|
+
return e`
|
|
1000
687
|
<pkt-icon
|
|
1001
688
|
name="alert-error"
|
|
1002
689
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
1003
690
|
aria-hidden="true"
|
|
1004
691
|
></pkt-icon>
|
|
1005
|
-
${B(l,
|
|
692
|
+
${B(l, n, s)}
|
|
1006
693
|
<button
|
|
1007
694
|
type="button"
|
|
1008
695
|
class="pkt-fileupload__queue-display__item__cancel-button"
|
|
1009
696
|
aria-label="Fjern fil som feilet under opplasting"
|
|
1010
|
-
?disabled=${
|
|
1011
|
-
@click=${() => c(
|
|
697
|
+
?disabled=${r}
|
|
698
|
+
@click=${() => c(t.fileId)}
|
|
1012
699
|
>
|
|
1013
700
|
Fjern
|
|
1014
701
|
</button>
|
|
1015
|
-
${u ?
|
|
702
|
+
${u ? e`
|
|
1016
703
|
<pkt-progressbar
|
|
1017
704
|
class="pkt-fileupload__queue-display__item__progress pkt-fileupload__queue-display__item__progress--error"
|
|
1018
705
|
valueCurrent=${d}
|
|
@@ -1021,32 +708,32 @@ var M = "comments", N = (e) => {
|
|
|
1021
708
|
statusPlacement="following"
|
|
1022
709
|
></pkt-progressbar>
|
|
1023
710
|
` : null}
|
|
1024
|
-
${o ?
|
|
711
|
+
${o ? e`<span class="pkt-fileupload__queue-display__item__error-message"
|
|
1025
712
|
>${o}</span
|
|
1026
713
|
>` : null}
|
|
1027
714
|
`;
|
|
1028
|
-
}, K = ({ file:
|
|
715
|
+
}, K = ({ file: t, disabled: n, inputName: r, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => {
|
|
1029
716
|
let d = i.find((e) => e.id === a);
|
|
1030
717
|
if (d?.renderInlineUI || d?.renderExtendedUI) return null;
|
|
1031
718
|
let f = i.map((i) => {
|
|
1032
719
|
let d = U({
|
|
1033
720
|
operationId: i.id,
|
|
1034
|
-
file:
|
|
1035
|
-
inputName:
|
|
1036
|
-
disabled:
|
|
721
|
+
file: t,
|
|
722
|
+
inputName: r,
|
|
723
|
+
disabled: n,
|
|
1037
724
|
isActive: i.id === a,
|
|
1038
725
|
onActivateOperation: o,
|
|
1039
|
-
onCloseOperation:
|
|
1040
|
-
getFileAttribute:
|
|
1041
|
-
setFileAttribute:
|
|
1042
|
-
}), f = typeof i.title == "function" ? i.title(
|
|
726
|
+
onCloseOperation: s,
|
|
727
|
+
getFileAttribute: c,
|
|
728
|
+
setFileAttribute: l
|
|
729
|
+
}), f = typeof i.title == "function" ? i.title(t) : i.title;
|
|
1043
730
|
if (!f) return null;
|
|
1044
|
-
let p = typeof i.ariaLabel == "function" ? i.ariaLabel(
|
|
1045
|
-
return
|
|
731
|
+
let p = typeof i.ariaLabel == "function" ? i.ariaLabel(t) : i.ariaLabel;
|
|
732
|
+
return e`<button
|
|
1046
733
|
type="button"
|
|
1047
734
|
class="pkt-fileupload__queue-display__item__operation"
|
|
1048
|
-
aria-label=${
|
|
1049
|
-
?disabled=${
|
|
735
|
+
aria-label=${u(p)}
|
|
736
|
+
?disabled=${n}
|
|
1050
737
|
@click=${() => {
|
|
1051
738
|
(i.renderInlineUI || i.renderExtendedUI) && d.activate(), i.onClick?.(d);
|
|
1052
739
|
}}
|
|
@@ -1054,39 +741,39 @@ var M = "comments", N = (e) => {
|
|
|
1054
741
|
${f}
|
|
1055
742
|
</button>`;
|
|
1056
743
|
}).filter(Boolean);
|
|
1057
|
-
return f.length === 0 ? null :
|
|
1058
|
-
}, q = ({ file:
|
|
744
|
+
return f.length === 0 ? null : e`<div class="pkt-fileupload__queue-display__item__actions">${f}</div>`;
|
|
745
|
+
}, q = ({ file: t, disabled: n, inputName: r, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => i.map((i) => {
|
|
1059
746
|
if (!i.renderContent) return null;
|
|
1060
747
|
let u = U({
|
|
1061
748
|
operationId: i.id,
|
|
1062
|
-
file:
|
|
1063
|
-
inputName:
|
|
1064
|
-
disabled:
|
|
749
|
+
file: t,
|
|
750
|
+
inputName: r,
|
|
751
|
+
disabled: n,
|
|
1065
752
|
isActive: i.id === a,
|
|
1066
753
|
onActivateOperation: o,
|
|
1067
754
|
onCloseOperation: s,
|
|
1068
755
|
getFileAttribute: c,
|
|
1069
756
|
setFileAttribute: l
|
|
1070
757
|
}), d = i.renderContent(u);
|
|
1071
|
-
return d == null ? null :
|
|
758
|
+
return d == null ? null : e`<div class="pkt-fileupload__queue-display__item__operation-content">
|
|
1072
759
|
${d}
|
|
1073
760
|
</div>`;
|
|
1074
|
-
}), J = ({ file:
|
|
761
|
+
}), J = ({ file: t, disabled: n, inputName: r, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => {
|
|
1075
762
|
if (!a) return null;
|
|
1076
763
|
let u = i.find((e) => e.id === a);
|
|
1077
764
|
if (!u?.renderExtendedUI) return null;
|
|
1078
765
|
let d = U({
|
|
1079
766
|
operationId: u.id,
|
|
1080
|
-
file:
|
|
1081
|
-
inputName:
|
|
1082
|
-
disabled:
|
|
767
|
+
file: t,
|
|
768
|
+
inputName: r,
|
|
769
|
+
disabled: n,
|
|
1083
770
|
isActive: !0,
|
|
1084
771
|
onActivateOperation: o,
|
|
1085
772
|
onCloseOperation: s,
|
|
1086
773
|
getFileAttribute: c,
|
|
1087
774
|
setFileAttribute: l
|
|
1088
775
|
});
|
|
1089
|
-
return
|
|
776
|
+
return e`<div class="pkt-fileupload__queue-display__item__expanded-operation-ui">
|
|
1090
777
|
${u.renderExtendedUI(d)}
|
|
1091
778
|
</div>`;
|
|
1092
779
|
}, Y = ({ file: e, disabled: t, inputName: n, operations: r, activeOperationId: i, onActivateOperation: a, onCloseOperation: o, getFileAttribute: s, setFileAttribute: c }) => r.map((r) => {
|
|
@@ -1103,45 +790,45 @@ var M = "comments", N = (e) => {
|
|
|
1103
790
|
setFileAttribute: c
|
|
1104
791
|
});
|
|
1105
792
|
return r.renderHidden(l);
|
|
1106
|
-
}), X = (
|
|
1107
|
-
let i =
|
|
1108
|
-
return
|
|
793
|
+
}), X = (t, n, r) => {
|
|
794
|
+
let i = A(t);
|
|
795
|
+
return e`
|
|
1109
796
|
<pkt-icon
|
|
1110
797
|
name="document-text"
|
|
1111
798
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
1112
799
|
aria-hidden="true"
|
|
1113
800
|
></pkt-icon>
|
|
1114
|
-
${B(i,
|
|
801
|
+
${B(i, n, r)}
|
|
1115
802
|
`;
|
|
1116
|
-
}, Z = ({ file:
|
|
1117
|
-
let
|
|
1118
|
-
return
|
|
803
|
+
}, Z = ({ file: t, thumbnailUrl: n, previewEnabled: r, canOpenPreview: a, truncateTail: o, onOpenPreview: c, onThumbnailImageError: d }) => {
|
|
804
|
+
let f = A(t), p = !!n, m = !!r && !!a, h = m && !!c;
|
|
805
|
+
return e`
|
|
1119
806
|
<div
|
|
1120
|
-
class=${
|
|
807
|
+
class=${s({
|
|
1121
808
|
"pkt-fileupload__queue-display__item__thumbnail": !0,
|
|
1122
|
-
"pkt-fileupload__queue-display__item__thumbnail--fallback": !
|
|
809
|
+
"pkt-fileupload__queue-display__item__thumbnail--fallback": !p
|
|
1123
810
|
})}
|
|
1124
811
|
>
|
|
1125
812
|
<button
|
|
1126
813
|
type="button"
|
|
1127
814
|
class="pkt-fileupload__queue-display__item__thumbnail__image-wrapper pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--label-only"
|
|
1128
|
-
aria-label=${
|
|
1129
|
-
?disabled=${!
|
|
815
|
+
aria-label=${l(i.fileupload.previewImage, { filename: f })}
|
|
816
|
+
?disabled=${!h}
|
|
1130
817
|
@click=${() => {
|
|
1131
|
-
!
|
|
818
|
+
!h || !c || c(t.fileId);
|
|
1132
819
|
}}
|
|
1133
820
|
>
|
|
1134
821
|
<span class="pkt-btn__text">
|
|
1135
|
-
${
|
|
822
|
+
${m ? e`<pkt-icon
|
|
1136
823
|
name="expand"
|
|
1137
824
|
class="pkt-fileupload__queue-display__item__thumbnail__expand-icon"
|
|
1138
825
|
aria-hidden="true"
|
|
1139
826
|
></pkt-icon>` : null}
|
|
1140
|
-
${
|
|
1141
|
-
src=${
|
|
1142
|
-
alt=${
|
|
1143
|
-
@error=${() =>
|
|
1144
|
-
/>` :
|
|
827
|
+
${p ? e`<img
|
|
828
|
+
src=${u(n)}
|
|
829
|
+
alt=${f}
|
|
830
|
+
@error=${() => d?.(t.fileId)}
|
|
831
|
+
/>` : e`<pkt-icon
|
|
1145
832
|
name="document-text"
|
|
1146
833
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
1147
834
|
aria-hidden="true"
|
|
@@ -1149,25 +836,25 @@ var M = "comments", N = (e) => {
|
|
|
1149
836
|
</span>
|
|
1150
837
|
</button>
|
|
1151
838
|
<span class="pkt-fileupload__queue-display__item__thumbnail__title"
|
|
1152
|
-
>${z(
|
|
839
|
+
>${z(f, o)}</span
|
|
1153
840
|
>
|
|
1154
841
|
</div>
|
|
1155
842
|
`;
|
|
1156
|
-
}, Q = ({ file:
|
|
1157
|
-
let y = V(f), b = a.find((e) => e.id ===
|
|
843
|
+
}, Q = ({ file: t, inputName: n, disabled: r, fileSize: i, operations: a, activeOperationId: o, onActivateOperation: c, onCloseOperation: l, getFileAttribute: u, setFileAttribute: d, transferProgress: f, transferErrorMessage: p, transferShowProgress: m, transferLastProgress: h, loadingText: g, truncateTail: _, onCancel: v }) => {
|
|
844
|
+
let y = V(f), b = a.find((e) => e.id === o), x = b?.renderInlineUI ? b.renderInlineUI(U({
|
|
1158
845
|
operationId: b.id,
|
|
1159
|
-
file:
|
|
1160
|
-
inputName:
|
|
1161
|
-
disabled:
|
|
846
|
+
file: t,
|
|
847
|
+
inputName: n,
|
|
848
|
+
disabled: r,
|
|
1162
849
|
isActive: !0,
|
|
1163
850
|
onActivateOperation: c,
|
|
1164
851
|
onCloseOperation: l,
|
|
1165
852
|
getFileAttribute: u,
|
|
1166
853
|
setFileAttribute: d
|
|
1167
854
|
})) : null;
|
|
1168
|
-
return
|
|
855
|
+
return e`
|
|
1169
856
|
<li
|
|
1170
|
-
class=${
|
|
857
|
+
class=${s({
|
|
1171
858
|
"pkt-fileupload__queue-display__item": !0,
|
|
1172
859
|
"pkt-fileupload__queue-display__item--in-progress": y === "in-progress",
|
|
1173
860
|
"pkt-fileupload__queue-display__item--error": y === "error",
|
|
@@ -1175,35 +862,35 @@ var M = "comments", N = (e) => {
|
|
|
1175
862
|
})}
|
|
1176
863
|
>
|
|
1177
864
|
${Y({
|
|
1178
|
-
file:
|
|
1179
|
-
disabled:
|
|
1180
|
-
inputName:
|
|
865
|
+
file: t,
|
|
866
|
+
disabled: r,
|
|
867
|
+
inputName: n,
|
|
1181
868
|
operations: a,
|
|
1182
|
-
activeOperationId:
|
|
869
|
+
activeOperationId: o,
|
|
1183
870
|
onActivateOperation: c,
|
|
1184
871
|
onCloseOperation: l,
|
|
1185
872
|
getFileAttribute: u,
|
|
1186
873
|
setFileAttribute: d
|
|
1187
874
|
})}
|
|
1188
875
|
${y === "in-progress" ? W({
|
|
1189
|
-
file:
|
|
876
|
+
file: t,
|
|
1190
877
|
fileSize: i,
|
|
1191
|
-
disabled:
|
|
878
|
+
disabled: r,
|
|
1192
879
|
transferProgress: f,
|
|
1193
880
|
transferShowProgress: m,
|
|
1194
881
|
loadingText: g,
|
|
1195
882
|
truncateTail: _,
|
|
1196
883
|
onCancel: v
|
|
1197
884
|
}) : y === "error" ? G({
|
|
1198
|
-
file:
|
|
885
|
+
file: t,
|
|
1199
886
|
fileSize: i,
|
|
1200
|
-
disabled:
|
|
887
|
+
disabled: r,
|
|
1201
888
|
transferShowProgress: m,
|
|
1202
889
|
transferLastProgress: h,
|
|
1203
890
|
transferErrorMessage: p,
|
|
1204
891
|
truncateTail: _,
|
|
1205
892
|
onCancel: v
|
|
1206
|
-
}) : x ?
|
|
893
|
+
}) : x ? e`
|
|
1207
894
|
<pkt-icon
|
|
1208
895
|
name="document-text"
|
|
1209
896
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
@@ -1212,35 +899,35 @@ var M = "comments", N = (e) => {
|
|
|
1212
899
|
<div class="pkt-fileupload__queue-display__item__inline-ui">
|
|
1213
900
|
${x}
|
|
1214
901
|
</div>
|
|
1215
|
-
` : X(
|
|
902
|
+
` : X(t, i, _)}
|
|
1216
903
|
${y === "idle" ? K({
|
|
1217
|
-
file:
|
|
1218
|
-
disabled:
|
|
1219
|
-
inputName:
|
|
904
|
+
file: t,
|
|
905
|
+
disabled: r,
|
|
906
|
+
inputName: n,
|
|
1220
907
|
operations: a,
|
|
1221
|
-
activeOperationId:
|
|
908
|
+
activeOperationId: o,
|
|
1222
909
|
onActivateOperation: c,
|
|
1223
910
|
onCloseOperation: l,
|
|
1224
911
|
getFileAttribute: u,
|
|
1225
912
|
setFileAttribute: d
|
|
1226
913
|
}) : null}
|
|
1227
914
|
${y === "idle" ? q({
|
|
1228
|
-
file:
|
|
1229
|
-
disabled:
|
|
1230
|
-
inputName:
|
|
915
|
+
file: t,
|
|
916
|
+
disabled: r,
|
|
917
|
+
inputName: n,
|
|
1231
918
|
operations: a,
|
|
1232
|
-
activeOperationId:
|
|
919
|
+
activeOperationId: o,
|
|
1233
920
|
onActivateOperation: c,
|
|
1234
921
|
onCloseOperation: l,
|
|
1235
922
|
getFileAttribute: u,
|
|
1236
923
|
setFileAttribute: d
|
|
1237
924
|
}) : null}
|
|
1238
925
|
${y === "idle" ? J({
|
|
1239
|
-
file:
|
|
1240
|
-
disabled:
|
|
1241
|
-
inputName:
|
|
926
|
+
file: t,
|
|
927
|
+
disabled: r,
|
|
928
|
+
inputName: n,
|
|
1242
929
|
operations: a,
|
|
1243
|
-
activeOperationId:
|
|
930
|
+
activeOperationId: o,
|
|
1244
931
|
onActivateOperation: c,
|
|
1245
932
|
onCloseOperation: l,
|
|
1246
933
|
getFileAttribute: u,
|
|
@@ -1248,21 +935,21 @@ var M = "comments", N = (e) => {
|
|
|
1248
935
|
}) : null}
|
|
1249
936
|
</li>
|
|
1250
937
|
`;
|
|
1251
|
-
},
|
|
938
|
+
}, te = ({ file: t, inputName: n, disabled: r, fileSize: i, thumbnailUrl: a, previewEnabled: o, 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 }) => {
|
|
1252
939
|
let w = V(h), T = l.find((e) => e.id === u), E = T?.renderInlineUI ? T.renderInlineUI(U({
|
|
1253
940
|
operationId: T.id,
|
|
1254
|
-
file:
|
|
1255
|
-
inputName:
|
|
1256
|
-
disabled:
|
|
941
|
+
file: t,
|
|
942
|
+
inputName: n,
|
|
943
|
+
disabled: r,
|
|
1257
944
|
isActive: !0,
|
|
1258
945
|
onActivateOperation: d,
|
|
1259
946
|
onCloseOperation: f,
|
|
1260
947
|
getFileAttribute: p,
|
|
1261
948
|
setFileAttribute: m
|
|
1262
949
|
})) : null;
|
|
1263
|
-
return
|
|
950
|
+
return e`
|
|
1264
951
|
<li
|
|
1265
|
-
class=${
|
|
952
|
+
class=${s({
|
|
1266
953
|
"pkt-fileupload__queue-display__item": !0,
|
|
1267
954
|
"pkt-fileupload__queue-display__item--in-progress": w === "in-progress",
|
|
1268
955
|
"pkt-fileupload__queue-display__item--error": w === "error",
|
|
@@ -1270,9 +957,9 @@ var M = "comments", N = (e) => {
|
|
|
1270
957
|
})}
|
|
1271
958
|
>
|
|
1272
959
|
${Y({
|
|
1273
|
-
file:
|
|
1274
|
-
disabled:
|
|
1275
|
-
inputName:
|
|
960
|
+
file: t,
|
|
961
|
+
disabled: r,
|
|
962
|
+
inputName: n,
|
|
1276
963
|
operations: l,
|
|
1277
964
|
activeOperationId: u,
|
|
1278
965
|
onActivateOperation: d,
|
|
@@ -1281,9 +968,9 @@ var M = "comments", N = (e) => {
|
|
|
1281
968
|
setFileAttribute: m
|
|
1282
969
|
})}
|
|
1283
970
|
${w === "in-progress" ? W({
|
|
1284
|
-
file:
|
|
971
|
+
file: t,
|
|
1285
972
|
fileSize: i,
|
|
1286
|
-
disabled:
|
|
973
|
+
disabled: r,
|
|
1287
974
|
transferProgress: h,
|
|
1288
975
|
transferShowProgress: _,
|
|
1289
976
|
loadingText: y,
|
|
@@ -1291,15 +978,15 @@ var M = "comments", N = (e) => {
|
|
|
1291
978
|
onCancel: x,
|
|
1292
979
|
iconName: "picture"
|
|
1293
980
|
}) : w === "error" ? G({
|
|
1294
|
-
file:
|
|
981
|
+
file: t,
|
|
1295
982
|
fileSize: i,
|
|
1296
|
-
disabled:
|
|
983
|
+
disabled: r,
|
|
1297
984
|
transferShowProgress: _,
|
|
1298
985
|
transferLastProgress: v,
|
|
1299
986
|
transferErrorMessage: g,
|
|
1300
987
|
truncateTail: b,
|
|
1301
988
|
onCancel: x
|
|
1302
|
-
}) : E ?
|
|
989
|
+
}) : E ? e`
|
|
1303
990
|
<pkt-icon
|
|
1304
991
|
name="picture"
|
|
1305
992
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
@@ -1309,18 +996,18 @@ var M = "comments", N = (e) => {
|
|
|
1309
996
|
${E}
|
|
1310
997
|
</div>
|
|
1311
998
|
` : Z({
|
|
1312
|
-
file:
|
|
999
|
+
file: t,
|
|
1313
1000
|
thumbnailUrl: a,
|
|
1314
|
-
previewEnabled:
|
|
1001
|
+
previewEnabled: o,
|
|
1315
1002
|
canOpenPreview: c,
|
|
1316
1003
|
truncateTail: b,
|
|
1317
1004
|
onOpenPreview: S,
|
|
1318
1005
|
onThumbnailImageError: C
|
|
1319
1006
|
})}
|
|
1320
1007
|
${w === "idle" ? K({
|
|
1321
|
-
file:
|
|
1322
|
-
disabled:
|
|
1323
|
-
inputName:
|
|
1008
|
+
file: t,
|
|
1009
|
+
disabled: r,
|
|
1010
|
+
inputName: n,
|
|
1324
1011
|
operations: l,
|
|
1325
1012
|
activeOperationId: u,
|
|
1326
1013
|
onActivateOperation: d,
|
|
@@ -1329,9 +1016,9 @@ var M = "comments", N = (e) => {
|
|
|
1329
1016
|
setFileAttribute: m
|
|
1330
1017
|
}) : null}
|
|
1331
1018
|
${w === "idle" ? q({
|
|
1332
|
-
file:
|
|
1333
|
-
disabled:
|
|
1334
|
-
inputName:
|
|
1019
|
+
file: t,
|
|
1020
|
+
disabled: r,
|
|
1021
|
+
inputName: n,
|
|
1335
1022
|
operations: l,
|
|
1336
1023
|
activeOperationId: u,
|
|
1337
1024
|
onActivateOperation: d,
|
|
@@ -1340,9 +1027,9 @@ var M = "comments", N = (e) => {
|
|
|
1340
1027
|
setFileAttribute: m
|
|
1341
1028
|
}) : null}
|
|
1342
1029
|
${w === "idle" ? J({
|
|
1343
|
-
file:
|
|
1344
|
-
disabled:
|
|
1345
|
-
inputName:
|
|
1030
|
+
file: t,
|
|
1031
|
+
disabled: r,
|
|
1032
|
+
inputName: n,
|
|
1346
1033
|
operations: l,
|
|
1347
1034
|
activeOperationId: u,
|
|
1348
1035
|
onActivateOperation: d,
|
|
@@ -1359,7 +1046,7 @@ var M = "comments", N = (e) => {
|
|
|
1359
1046
|
}, this.onPreviewKeyDown = (e, t) => {
|
|
1360
1047
|
if (this.isPreviewModalOpen) {
|
|
1361
1048
|
if (e.key === "Tab") {
|
|
1362
|
-
|
|
1049
|
+
p(e, e.currentTarget);
|
|
1363
1050
|
return;
|
|
1364
1051
|
}
|
|
1365
1052
|
switch (e.key) {
|
|
@@ -1378,9 +1065,10 @@ var M = "comments", N = (e) => {
|
|
|
1378
1065
|
super.updated(e), this.classList.add("pkt-fileupload-component");
|
|
1379
1066
|
}
|
|
1380
1067
|
render() {
|
|
1381
|
-
let
|
|
1382
|
-
return this.label ?
|
|
1068
|
+
let t = this.renderContent();
|
|
1069
|
+
return this.label ? e`
|
|
1383
1070
|
<pkt-input-wrapper
|
|
1071
|
+
.strings=${this.strings}
|
|
1384
1072
|
.forId=${`${this.id}-input`}
|
|
1385
1073
|
.label=${this.label}
|
|
1386
1074
|
.helptext=${this.helptext}
|
|
@@ -1393,36 +1081,36 @@ var M = "comments", N = (e) => {
|
|
|
1393
1081
|
?requiredTag=${this.requiredTag}
|
|
1394
1082
|
.requiredText=${this.requiredText}
|
|
1395
1083
|
.tagText=${this.tagText}
|
|
1396
|
-
class=${
|
|
1084
|
+
class=${s({
|
|
1397
1085
|
"pkt-fileupload-wrapper": !0,
|
|
1398
1086
|
"pkt-fileupload-wrapper--full-width": this.fullwidth
|
|
1399
1087
|
})}
|
|
1400
1088
|
>
|
|
1401
|
-
${
|
|
1089
|
+
${t}
|
|
1402
1090
|
</pkt-input-wrapper>
|
|
1403
|
-
` :
|
|
1091
|
+
` : t;
|
|
1404
1092
|
}
|
|
1405
1093
|
renderContent() {
|
|
1406
|
-
let
|
|
1407
|
-
dragInactive:
|
|
1408
|
-
dragActive:
|
|
1409
|
-
openFileDialog:
|
|
1094
|
+
let t = this.getSortedFilesAndTransfers(), n = this.getPreviewableImages(t), r = this.pktStrings.get("fileupload"), i = this.getSupportedFormatsText(), a = [!this.label && this.helptext ? `${this.id}-helptext` : void 0, this.hasEffectiveError ? `${this.id}-error` : void 0].filter(Boolean).join(" ") || void 0, o = this.itemRenderer === "thumbnail" ? this.multiple ? {
|
|
1095
|
+
dragInactive: r.dropZoneDragMultipleThumbnail,
|
|
1096
|
+
dragActive: r.dropZoneDragActiveMultipleThumbnail,
|
|
1097
|
+
openFileDialog: r.dropZoneOpenFileDialogMultipleThumbnail
|
|
1410
1098
|
} : {
|
|
1411
|
-
dragInactive:
|
|
1412
|
-
dragActive:
|
|
1413
|
-
openFileDialog:
|
|
1099
|
+
dragInactive: r.dropZoneDragSingleThumbnail,
|
|
1100
|
+
dragActive: r.dropZoneDragActiveSingleThumbnail,
|
|
1101
|
+
openFileDialog: r.dropZoneOpenFileDialogSingleThumbnail
|
|
1414
1102
|
} : this.multiple ? {
|
|
1415
|
-
dragInactive:
|
|
1416
|
-
dragActive:
|
|
1417
|
-
openFileDialog:
|
|
1103
|
+
dragInactive: r.dropZoneDragMultiple,
|
|
1104
|
+
dragActive: r.dropZoneDragActiveMultiple,
|
|
1105
|
+
openFileDialog: r.dropZoneOpenFileDialogMultiple
|
|
1418
1106
|
} : {
|
|
1419
|
-
dragInactive:
|
|
1420
|
-
dragActive:
|
|
1421
|
-
openFileDialog:
|
|
1107
|
+
dragInactive: r.dropZoneDragSingle,
|
|
1108
|
+
dragActive: r.dropZoneDragActiveSingle,
|
|
1109
|
+
openFileDialog: r.dropZoneOpenFileDialogSingle
|
|
1422
1110
|
};
|
|
1423
|
-
return
|
|
1111
|
+
return e`
|
|
1424
1112
|
<div
|
|
1425
|
-
class=${
|
|
1113
|
+
class=${s({
|
|
1426
1114
|
"pkt-fileupload": !0,
|
|
1427
1115
|
"pkt-fileupload--full-width": this.fullwidth,
|
|
1428
1116
|
"pkt-fileupload--error": this.hasEffectiveError,
|
|
@@ -1438,7 +1126,7 @@ var M = "comments", N = (e) => {
|
|
|
1438
1126
|
${this.getSrErrorsMessage()}
|
|
1439
1127
|
</div>
|
|
1440
1128
|
<div
|
|
1441
|
-
class=${
|
|
1129
|
+
class=${s({
|
|
1442
1130
|
"pkt-fileupload__drop-zone": !0,
|
|
1443
1131
|
"pkt-fileupload__drop-zone--drag-active": this.isDragActive,
|
|
1444
1132
|
"pkt-fileupload__drop-zone--disabled": this.disabled
|
|
@@ -1451,18 +1139,18 @@ var M = "comments", N = (e) => {
|
|
|
1451
1139
|
<input
|
|
1452
1140
|
id=${`${this.id}-input`}
|
|
1453
1141
|
type="file"
|
|
1454
|
-
name=${
|
|
1142
|
+
name=${u(this.uploadStrategy === "form" ? this.name : void 0)}
|
|
1455
1143
|
?multiple=${this.multiple}
|
|
1456
1144
|
?disabled=${this.disabled}
|
|
1457
1145
|
?required=${this.required && this.uploadStrategy === "form"}
|
|
1458
1146
|
accept=${this.getResolvedAcceptValue()}
|
|
1459
|
-
aria-label=${
|
|
1460
|
-
aria-required=${
|
|
1461
|
-
aria-invalid=${
|
|
1462
|
-
aria-describedby=${
|
|
1147
|
+
aria-label=${u(this.label ? void 0 : this.multiple ? "Velg filer" : "Velg fil")}
|
|
1148
|
+
aria-required=${u(this.required ? "true" : void 0)}
|
|
1149
|
+
aria-invalid=${u(this.hasEffectiveError ? "true" : void 0)}
|
|
1150
|
+
aria-describedby=${u(a)}
|
|
1463
1151
|
@change=${this.onNativeFileChange}
|
|
1464
1152
|
/>
|
|
1465
|
-
${this.uploadStrategy === "custom" ?
|
|
1153
|
+
${this.uploadStrategy === "custom" ? t.map((t) => e`<input type="hidden" name=${this.name} value=${t.fileId} />`) : null}
|
|
1466
1154
|
<div class="pkt-fileupload__drop-zone__placeholder">
|
|
1467
1155
|
<pkt-icon
|
|
1468
1156
|
name="attachment"
|
|
@@ -1470,21 +1158,21 @@ var M = "comments", N = (e) => {
|
|
|
1470
1158
|
aria-hidden="true"
|
|
1471
1159
|
></pkt-icon>
|
|
1472
1160
|
<p class="pkt-fileupload__drop-zone__placeholder__title">
|
|
1473
|
-
${this.isDragActive ? `${
|
|
1161
|
+
${this.isDragActive ? `${o.dragActive} ...` : e`${o.dragInactive}
|
|
1474
1162
|
<button
|
|
1475
1163
|
type="button"
|
|
1476
1164
|
class="pkt-fileupload__drop-zone__placeholder__title__open-file-dialog"
|
|
1477
1165
|
@click=${this.openFileDialog}
|
|
1478
1166
|
>
|
|
1479
|
-
${
|
|
1167
|
+
${o.openFileDialog}
|
|
1480
1168
|
</button>`}
|
|
1481
1169
|
</p>
|
|
1482
|
-
${
|
|
1483
|
-
${
|
|
1170
|
+
${i ? e`<p class="pkt-fileupload__drop-zone__placeholder__formats">
|
|
1171
|
+
${r.supportedFormatsPrefix} ${i}
|
|
1484
1172
|
</p>` : null}
|
|
1485
1173
|
</div>
|
|
1486
1174
|
</div>
|
|
1487
|
-
${this.hasEffectiveError ?
|
|
1175
|
+
${this.hasEffectiveError ? e`
|
|
1488
1176
|
<pkt-alert
|
|
1489
1177
|
skin="error"
|
|
1490
1178
|
role="alert"
|
|
@@ -1496,10 +1184,10 @@ var M = "comments", N = (e) => {
|
|
|
1496
1184
|
${this.effectiveErrorMessage}
|
|
1497
1185
|
</pkt-alert>
|
|
1498
1186
|
` : null}
|
|
1499
|
-
${
|
|
1500
|
-
${
|
|
1187
|
+
${t.length > 0 ? e`<ul class="pkt-fileupload__queue-display">
|
|
1188
|
+
${t.map((e) => this.renderQueueItem(e, n))}
|
|
1501
1189
|
</ul>` : null}
|
|
1502
|
-
${this.renderPreviewModal(
|
|
1190
|
+
${this.renderPreviewModal(n)}
|
|
1503
1191
|
</div>
|
|
1504
1192
|
`;
|
|
1505
1193
|
}
|
|
@@ -1507,7 +1195,7 @@ var M = "comments", N = (e) => {
|
|
|
1507
1195
|
let n = typeof e.file?.size == "number" ? this.formatFileSize(e.file.size) : "", r = this.getQueueItemOperations();
|
|
1508
1196
|
if (this.itemRenderer === "thumbnail") {
|
|
1509
1197
|
let i = this.canOpenPreview(e), a = this.failedImageFileIds[e.fileId]?.thumbnail ? void 0 : this.getThumbnailUrl(e);
|
|
1510
|
-
return
|
|
1198
|
+
return te({
|
|
1511
1199
|
file: e,
|
|
1512
1200
|
inputName: this.name,
|
|
1513
1201
|
disabled: this.disabled,
|
|
@@ -1578,28 +1266,28 @@ var M = "comments", N = (e) => {
|
|
|
1578
1266
|
});
|
|
1579
1267
|
}
|
|
1580
1268
|
navigatePreview(e, t) {
|
|
1581
|
-
t.length !== 0 && (this.previewCurrentIndex =
|
|
1269
|
+
t.length !== 0 && (this.previewCurrentIndex = O(this.previewCurrentIndex, e, t.length));
|
|
1582
1270
|
}
|
|
1583
|
-
renderPreviewModal(
|
|
1584
|
-
if (!this.enableImagePreview ||
|
|
1585
|
-
let
|
|
1586
|
-
if (!
|
|
1587
|
-
let
|
|
1588
|
-
return
|
|
1271
|
+
renderPreviewModal(t) {
|
|
1272
|
+
if (!this.enableImagePreview || t.length === 0) return null;
|
|
1273
|
+
let n = this.pktStrings.get("fileupload"), r = t[this.previewCurrentIndex];
|
|
1274
|
+
if (!r) return null;
|
|
1275
|
+
let i = t.length > 1, a = this.getThumbnailUrl(r), o = !!a && !this.failedImageFileIds[r.fileId]?.preview, s = r.attributes?.targetFilename || r.file?.name || n.previewFallbackName;
|
|
1276
|
+
return e`
|
|
1589
1277
|
<pkt-modal
|
|
1590
1278
|
.open=${this.isPreviewModalOpen}
|
|
1591
|
-
.headingText=${
|
|
1279
|
+
.headingText=${s}
|
|
1592
1280
|
closeOnBackdropClick
|
|
1593
1281
|
class="pkt-fileupload__image-preview-modal"
|
|
1594
1282
|
@close=${this.closePreview}
|
|
1595
|
-
@keydown=${(
|
|
1283
|
+
@keydown=${(e) => this.onPreviewKeyDown(e, t)}
|
|
1596
1284
|
>
|
|
1597
1285
|
<div class="pkt-fileupload__image-preview">
|
|
1598
|
-
${
|
|
1286
|
+
${i ? e`<button
|
|
1599
1287
|
type="button"
|
|
1600
1288
|
class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--prev pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
|
|
1601
|
-
aria-label=${`Forrige bilde ${this.previewCurrentIndex} / ${
|
|
1602
|
-
@click=${() => this.navigatePreview("prev",
|
|
1289
|
+
aria-label=${`Forrige bilde ${this.previewCurrentIndex} / ${t.length}`}
|
|
1290
|
+
@click=${() => this.navigatePreview("prev", t)}
|
|
1603
1291
|
>
|
|
1604
1292
|
<pkt-icon
|
|
1605
1293
|
class="pkt-btn__icon pkt-icon"
|
|
@@ -1610,26 +1298,26 @@ var M = "comments", N = (e) => {
|
|
|
1610
1298
|
</button>` : null}
|
|
1611
1299
|
|
|
1612
1300
|
<div class="pkt-fileupload__image-preview__content">
|
|
1613
|
-
${
|
|
1614
|
-
src=${
|
|
1615
|
-
alt=${`${
|
|
1301
|
+
${o ? e`<img
|
|
1302
|
+
src=${a}
|
|
1303
|
+
alt=${`${s} - ${this.previewCurrentIndex + 1} av ${t.length}`}
|
|
1616
1304
|
class="pkt-fileupload__image-preview__image"
|
|
1617
|
-
@error=${() => this.markImageFailed(
|
|
1618
|
-
/>` :
|
|
1305
|
+
@error=${() => this.markImageFailed(r.fileId, "preview")}
|
|
1306
|
+
/>` : e`<pkt-icon
|
|
1619
1307
|
name="picture"
|
|
1620
1308
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
1621
1309
|
aria-hidden="true"
|
|
1622
1310
|
></pkt-icon>`}
|
|
1623
1311
|
</div>
|
|
1624
1312
|
|
|
1625
|
-
${
|
|
1626
|
-
${this.previewCurrentIndex + 1} / ${
|
|
1313
|
+
${i ? e`<span class="pkt-fileupload__image-preview__counter">
|
|
1314
|
+
${this.previewCurrentIndex + 1} / ${t.length}
|
|
1627
1315
|
</span>` : null}
|
|
1628
|
-
${
|
|
1316
|
+
${i ? e`<button
|
|
1629
1317
|
type="button"
|
|
1630
1318
|
class="pkt-fileupload__image-preview__nav pkt-fileupload__image-preview__nav--next pkt-btn pkt-btn--medium pkt-btn--secondary pkt-btn--icon-only"
|
|
1631
|
-
aria-label=${`Neste bilde ${this.previewCurrentIndex + 2} / ${
|
|
1632
|
-
@click=${() => this.navigatePreview("next",
|
|
1319
|
+
aria-label=${`Neste bilde ${this.previewCurrentIndex + 2} / ${t.length}`}
|
|
1320
|
+
@click=${() => this.navigatePreview("next", t)}
|
|
1633
1321
|
>
|
|
1634
1322
|
<pkt-icon
|
|
1635
1323
|
class="pkt-btn__icon pkt-icon"
|
|
@@ -1672,9 +1360,9 @@ var M = "comments", N = (e) => {
|
|
|
1672
1360
|
n === void 0 && delete i[t], this.updateFileItem(e, { attributes: i });
|
|
1673
1361
|
}
|
|
1674
1362
|
};
|
|
1675
|
-
|
|
1363
|
+
r([n()], $.prototype, "activeOperationByFileId", void 0), r([n()], $.prototype, "isPreviewModalOpen", void 0), r([n()], $.prototype, "previewCurrentIndex", void 0), r([n()], $.prototype, "failedImageFileIds", void 0), $ = r([t("pkt-fileupload")], $);
|
|
1676
1364
|
//#endregion
|
|
1677
1365
|
//#region src/components/fileupload/index.ts
|
|
1678
|
-
var
|
|
1366
|
+
var ne = $;
|
|
1679
1367
|
//#endregion
|
|
1680
|
-
export { $ as n,
|
|
1368
|
+
export { $ as n, ne as t };
|