@oslokommune/punkt-elements 16.26.2 → 16.26.5
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 +34 -0
- package/dist/base-elements/input-element.d.ts +1 -0
- package/dist/{checkbox-DB_ZAuJJ.js → checkbox-D3uflJEb.js} +5 -1
- package/dist/{checkbox-HKXLLpXq.cjs → checkbox-DfIvuwAj.cjs} +3 -2
- package/dist/{combobox-vaCanZCq.js → combobox-B9YSsRZB.js} +1 -1
- package/dist/{combobox-DsqvSokZ.cjs → combobox-BhIqExJZ.cjs} +1 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -0
- package/dist/components/fileupload/fileupload-base.d.ts +10 -0
- package/dist/components/fileupload/fileupload-types.d.ts +10 -0
- package/dist/components/radiobutton/radiobutton.d.ts +1 -0
- package/dist/{datepicker-CKghFMu2.js → datepicker-B_J5APcK.js} +2 -2
- package/dist/{datepicker-DNEUkbB0.cjs → datepicker-DXxTiHJd.cjs} +2 -2
- package/dist/docs/components/event-log.d.ts +20 -0
- package/dist/docs/components/textinput.d.ts +1 -0
- package/dist/{fileupload-DpvQ3e_T.js → fileupload-2hf8YNhO.js} +414 -92
- package/dist/{fileupload-BMHJaAKR.cjs → fileupload-BLVrslUX.cjs} +42 -37
- package/dist/{header-C7kSI9zP.js → header-CFzvRT3j.js} +1 -1
- package/dist/{header-VfLyhEYL.cjs → header-DaFGbtLu.cjs} +1 -1
- package/dist/{input-element-Df9FHnfn.cjs → input-element-DZLXF2rI.cjs} +1 -1
- package/dist/{input-element-C_zP_x4a.js → input-element-DgylI1GK.js} +6 -8
- 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-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-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +10 -10
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.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-DbezjeDT.cjs → radiobutton-BH6rl98w.cjs} +3 -3
- package/dist/{radiobutton-CKhWm7CI.js → radiobutton-DFCA9V07.js} +5 -2
- package/dist/{select-3689MFnH.cjs → select-BVPcJEIz.cjs} +1 -1
- package/dist/{select-CrTmkOw0.js → select-C1--vTZ2.js} +1 -1
- package/dist/{textarea-BWOuU6m6.cjs → textarea-Cb0pj6ki.cjs} +1 -1
- package/dist/{textarea-tKZakgjC.js → textarea-DNitIoWX.js} +2 -2
- package/dist/{textinput-CqvE701N.cjs → textinput-CaIDCB2J.cjs} +1 -1
- package/dist/{textinput-D-gsl53I.js → textinput-CurFrsfQ.js} +2 -2
- package/dist/{timepicker-DTI6LY0j.cjs → timepicker-BcHEEtpX.cjs} +1 -1
- package/dist/{timepicker-D2KJmxrZ.js → timepicker-Ch-ums4R.js} +1 -1
- package/package.json +2 -2
- package/src/components/checkbox/checkbox.ts +6 -0
- package/src/components/datepicker/datepicker.selection.test.ts +33 -0
- package/src/components/datepicker/datepicker.ts +0 -4
- package/src/components/fileupload/fileupload-base.ts +14 -0
- package/src/components/fileupload/fileupload-types.ts +10 -0
- package/src/components/fileupload/fileupload.test.ts +35 -0
- package/src/components/fileupload/fileupload.ts +5 -0
- package/src/components/radiobutton/radiobutton.ts +6 -1
- package/src/components/textarea/textarea.ts +1 -1
- package/src/components/textinput/textinput.ts +1 -1
|
@@ -179,12 +179,12 @@ function D(e, t) {
|
|
|
179
179
|
}
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region ../../shared-utils/fileupload/navigation.ts
|
|
182
|
-
function
|
|
182
|
+
function O(e, t, n) {
|
|
183
183
|
return n <= 0 ? 0 : t === "prev" ? e <= 0 ? n - 1 : e - 1 : e >= n - 1 ? 0 : e + 1;
|
|
184
184
|
}
|
|
185
185
|
//#endregion
|
|
186
186
|
//#region ../../shared-utils/fileupload/announcements.ts
|
|
187
|
-
function
|
|
187
|
+
function k(e, t) {
|
|
188
188
|
let n = e.length;
|
|
189
189
|
if (n === 0 || !t || t.length === 0) return {
|
|
190
190
|
totalCount: n,
|
|
@@ -204,14 +204,316 @@ function O(e, t) {
|
|
|
204
204
|
}
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region ../../shared-utils/fileupload/filename.ts
|
|
207
|
-
function
|
|
207
|
+
function A(e, t = u.unknownFilename) {
|
|
208
208
|
return e.attributes?.targetFilename || e.file?.name || t;
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
var j = {
|
|
211
|
+
name: "pkt-fileupload",
|
|
212
|
+
react: "PktFileUpload",
|
|
213
|
+
"css-class": "pkt-fileupload",
|
|
214
|
+
isElement: !1,
|
|
215
|
+
isPureReact: !0,
|
|
216
|
+
"dark-mode": !0,
|
|
217
|
+
props: {
|
|
218
|
+
name: {
|
|
219
|
+
type: "string",
|
|
220
|
+
name: "Navn for innsending",
|
|
221
|
+
category: "tech",
|
|
222
|
+
required: !0
|
|
223
|
+
},
|
|
224
|
+
label: {
|
|
225
|
+
type: "string",
|
|
226
|
+
name: "Etikett",
|
|
227
|
+
description: "Etikett/tittel over komponenten",
|
|
228
|
+
category: "form"
|
|
229
|
+
},
|
|
230
|
+
helptext: {
|
|
231
|
+
type: "string | ReactNode",
|
|
232
|
+
name: "Hjelpetekst",
|
|
233
|
+
description: "Hjelpetekst under etiketten",
|
|
234
|
+
category: "form"
|
|
235
|
+
},
|
|
236
|
+
helptextDropdown: {
|
|
237
|
+
type: "string",
|
|
238
|
+
name: "Utvidet hjelpetekst",
|
|
239
|
+
description: "Hjelpetekst som vises i en lukket boks man kan åpne",
|
|
240
|
+
category: "contents"
|
|
241
|
+
},
|
|
242
|
+
helptextDropdownButton: {
|
|
243
|
+
type: "string",
|
|
244
|
+
name: "Knappetekst for utvidet hjelpetekst",
|
|
245
|
+
default: "Les mer",
|
|
246
|
+
category: "contents"
|
|
247
|
+
},
|
|
248
|
+
required: {
|
|
249
|
+
type: "boolean",
|
|
250
|
+
name: "Påkrevd",
|
|
251
|
+
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.",
|
|
252
|
+
default: !1,
|
|
253
|
+
category: "form"
|
|
254
|
+
},
|
|
255
|
+
value: {
|
|
256
|
+
type: "FileItemList",
|
|
257
|
+
name: "Fil-liste (controlled)",
|
|
258
|
+
description: "Liste over filer i komponenten. Bruk denne for controlled-modus.",
|
|
259
|
+
category: "form"
|
|
260
|
+
},
|
|
261
|
+
defaultValue: {
|
|
262
|
+
type: "FileItem[]",
|
|
263
|
+
name: "Default-verdi (uncontrolled)",
|
|
264
|
+
description: "Default-verdi når komponenten brukes 'uncontrolled'. Ingen grunn til at denne ikke skal være tom array `[]`",
|
|
265
|
+
category: "form"
|
|
266
|
+
},
|
|
267
|
+
onFilesChanged: {
|
|
268
|
+
type: "(files: FileItem[]) => void",
|
|
269
|
+
name: "Callback ved fil-endring",
|
|
270
|
+
description: "Kalles når fil(er) legges til, fjernes eller oppdateres",
|
|
271
|
+
category: "tech"
|
|
272
|
+
},
|
|
273
|
+
uploadStrategy: {
|
|
274
|
+
name: "Opplastingstype",
|
|
275
|
+
type: ["form", "custom"],
|
|
276
|
+
values: {
|
|
277
|
+
form: "form (når filer lastes opp ved submit)",
|
|
278
|
+
custom: "custom (når filer lastes opp via webappens egen logikk)"
|
|
279
|
+
},
|
|
280
|
+
description: "Velg mellom skjemaopplasting (filene sendes når skjemaet sendes inn) og bakgrunnsopplasting (webappen håndterer opplasting via `onFileUploadRequested` og oppdaterer `transfers`).",
|
|
281
|
+
default: "form",
|
|
282
|
+
category: "functionality"
|
|
283
|
+
},
|
|
284
|
+
multiple: {
|
|
285
|
+
type: "boolean",
|
|
286
|
+
name: "Tillat opplasting av flere filer",
|
|
287
|
+
default: !1,
|
|
288
|
+
category: "functionality"
|
|
289
|
+
},
|
|
290
|
+
itemRenderer: {
|
|
291
|
+
type: ["filename", "thumbnail"],
|
|
292
|
+
name: "Visningtype av filer",
|
|
293
|
+
description: "Hvordan filer skal vises i opplastings-køen. Enten filnavn eller som thumbnails. Du kan også (eksperimentelt) lage din egen komponent.",
|
|
294
|
+
default: "filename",
|
|
295
|
+
category: "functionality"
|
|
296
|
+
},
|
|
297
|
+
optionalTag: {
|
|
298
|
+
type: "boolean",
|
|
299
|
+
name: "Vis 'Valgfritt'-tag",
|
|
300
|
+
description: "Vis 'Valgfritt'-tag ved etiketten",
|
|
301
|
+
category: "form"
|
|
302
|
+
},
|
|
303
|
+
optionalText: {
|
|
304
|
+
type: "string",
|
|
305
|
+
name: "Valgfritt-tekst",
|
|
306
|
+
description: "Tekst som vises i valgfritt-merkingen",
|
|
307
|
+
default: "Valgfritt",
|
|
308
|
+
category: "contents"
|
|
309
|
+
},
|
|
310
|
+
requiredTag: {
|
|
311
|
+
type: "boolean",
|
|
312
|
+
name: "Vis 'Må fylles ut'-tag",
|
|
313
|
+
description: "Vis 'Må fylles ut'-tag ved etiketten",
|
|
314
|
+
category: "form"
|
|
315
|
+
},
|
|
316
|
+
requiredText: {
|
|
317
|
+
type: "string",
|
|
318
|
+
name: "Påkrevd-tekst",
|
|
319
|
+
description: "Tekst som vises i påkrevd-merkingen",
|
|
320
|
+
default: "Må fylles ut",
|
|
321
|
+
category: "contents"
|
|
322
|
+
},
|
|
323
|
+
tagText: {
|
|
324
|
+
type: "string",
|
|
325
|
+
name: "Tag-tekst",
|
|
326
|
+
description: "Tekst som vises i en tag ved siden av label",
|
|
327
|
+
category: "ui"
|
|
328
|
+
},
|
|
329
|
+
disabled: {
|
|
330
|
+
type: "boolean",
|
|
331
|
+
name: "Deaktivert",
|
|
332
|
+
description: "Deaktiverer hele komponenten - ingen interaksjon mulig",
|
|
333
|
+
default: !1,
|
|
334
|
+
category: "form"
|
|
335
|
+
},
|
|
336
|
+
errorMessage: {
|
|
337
|
+
type: "string",
|
|
338
|
+
name: "Feilmelding",
|
|
339
|
+
description: "Feilmelding for å vise under komponenten (ekstern/programmatisk feil)",
|
|
340
|
+
default: "Det oppstod en feil ved opplastingen av fil(ene).",
|
|
341
|
+
category: "form"
|
|
342
|
+
},
|
|
343
|
+
hasError: {
|
|
344
|
+
type: "boolean",
|
|
345
|
+
name: "Har feil",
|
|
346
|
+
description: "Om komponenten har en feiltilstand",
|
|
347
|
+
default: !1,
|
|
348
|
+
category: "form"
|
|
349
|
+
},
|
|
350
|
+
allowedFormats: {
|
|
351
|
+
type: "string[]",
|
|
352
|
+
name: "Tillatte filformater",
|
|
353
|
+
description: "Liste over tillatte filformater. F.eks. ['pdf', 'jpg', 'png'] eller ['image/*', 'application/pdf']",
|
|
354
|
+
category: "validation"
|
|
355
|
+
},
|
|
356
|
+
formatErrorMessage: {
|
|
357
|
+
type: "string",
|
|
358
|
+
name: "Feilmelding for ugyldig format",
|
|
359
|
+
description: "Tilpasset feilmelding ved ugyldig filtype.",
|
|
360
|
+
category: "validation"
|
|
361
|
+
},
|
|
362
|
+
maxFileSize: {
|
|
363
|
+
type: "string | number",
|
|
364
|
+
name: "Maks filstørrelse",
|
|
365
|
+
description: "Maksimal filstørrelse. F.eks. '5MB', '500KB', '1GB' eller antall bytes",
|
|
366
|
+
category: "validation"
|
|
367
|
+
},
|
|
368
|
+
onFileValidation: {
|
|
369
|
+
type: "(file: File) => string | null",
|
|
370
|
+
name: "Egendefinert validering",
|
|
371
|
+
description: "Kjører etter innebygd format/størrelse-validering. Returner feilmeldingsstreng hvis ugyldig, null hvis gyldig.",
|
|
372
|
+
category: "validation"
|
|
373
|
+
},
|
|
374
|
+
sizeErrorMessage: {
|
|
375
|
+
type: "string",
|
|
376
|
+
name: "Feilmelding for stor fil",
|
|
377
|
+
description: "Tilpasset feilmelding ved for stor fil.",
|
|
378
|
+
category: "validation"
|
|
379
|
+
},
|
|
380
|
+
addCommentsEnabled: {
|
|
381
|
+
type: "boolean",
|
|
382
|
+
name: "Tillat kommentarer",
|
|
383
|
+
description: "La brukeren skrive en kommentar pr fil. Kommentarene postes i felter med navn `{fileupload-navn}-comment`",
|
|
384
|
+
default: !1,
|
|
385
|
+
showIf: { itemRenderer: "filename" },
|
|
386
|
+
category: "functionality"
|
|
387
|
+
},
|
|
388
|
+
enableImagePreview: {
|
|
389
|
+
type: "boolean",
|
|
390
|
+
name: "Forhåndsvisning av bilder",
|
|
391
|
+
description: "Aktiver forhåndsvisning av bilder i modal (kun for thumbnail-visning)",
|
|
392
|
+
default: !1,
|
|
393
|
+
showIf: { itemRenderer: "thumbnail" },
|
|
394
|
+
category: "functionality"
|
|
395
|
+
},
|
|
396
|
+
extraOperations: {
|
|
397
|
+
type: "Array<QueueItemOperation>",
|
|
398
|
+
name: "Ekstra operasjoner",
|
|
399
|
+
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.",
|
|
400
|
+
category: "functionality"
|
|
401
|
+
},
|
|
402
|
+
fullwidth: {
|
|
403
|
+
type: "boolean",
|
|
404
|
+
name: "Full bredde",
|
|
405
|
+
description: "Om komponenten skal ta full bredde av foreldreelementet",
|
|
406
|
+
default: !1,
|
|
407
|
+
category: "styling"
|
|
408
|
+
},
|
|
409
|
+
onFileUploadRequested: {
|
|
410
|
+
type: "(fileItem: FileItem) => void",
|
|
411
|
+
name: "Callback for opplastingsforespørsel",
|
|
412
|
+
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.",
|
|
413
|
+
relatedTypes: ["FileItem"],
|
|
414
|
+
category: "functionality"
|
|
415
|
+
},
|
|
416
|
+
onTransferCancelled: {
|
|
417
|
+
type: "(fileItemId: string) => void",
|
|
418
|
+
name: "Callback for avbrutt opplasting",
|
|
419
|
+
description: "Kalles når brukeren klikker 'Slett' eller 'Avbryt'. Webappen må dermed avbryte opplastingen av denne fila.",
|
|
420
|
+
category: "functionality"
|
|
421
|
+
},
|
|
422
|
+
renameFilesEnabled: {
|
|
423
|
+
type: "boolean",
|
|
424
|
+
name: "Tillat å gi nytt navn",
|
|
425
|
+
description: "La brukeren angi et navn pr fil. Filnavnene postes i felter med navn `{fileupload-navn}-targetFilename`",
|
|
426
|
+
default: !1,
|
|
427
|
+
showIf: { itemRenderer: "filename" },
|
|
428
|
+
category: "functionality"
|
|
429
|
+
},
|
|
430
|
+
transfers: {
|
|
431
|
+
type: "Array<FileTransfer>",
|
|
432
|
+
name: "Pågående filoverføringer",
|
|
433
|
+
description: "Ved <code>uploadStrategy='custom'</code> vil du fortelle komponenten om pågående overføringer her. Hver fil har en progress-verdi.",
|
|
434
|
+
items: {
|
|
435
|
+
type: "object",
|
|
436
|
+
elementType: "FileTransfer",
|
|
437
|
+
ref: "FileTransfer"
|
|
438
|
+
},
|
|
439
|
+
category: "functionality"
|
|
440
|
+
},
|
|
441
|
+
truncateTail: {
|
|
442
|
+
type: "number",
|
|
443
|
+
name: "Forkort filnavn",
|
|
444
|
+
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.",
|
|
445
|
+
category: "functionality"
|
|
446
|
+
},
|
|
447
|
+
previewUploadIntervalMs: {
|
|
448
|
+
type: "number",
|
|
449
|
+
name: "Demo: opplastingshastighet (ms/5%)",
|
|
450
|
+
description: "Kun for dokumentasjons-forhåndsvisning. Senker simulert opplasting for å demonstrere statusvisning. Gjelder kun i `uploadStrategy='custom'`.",
|
|
451
|
+
default: 100,
|
|
452
|
+
showIf: { uploadStrategy: "custom" },
|
|
453
|
+
category: "demo"
|
|
454
|
+
},
|
|
455
|
+
previewSimulateUploadError: {
|
|
456
|
+
type: "boolean",
|
|
457
|
+
name: "Demo: simuler feil ved 90% opplasting",
|
|
458
|
+
description: "Kun for dokumentasjons-forhåndsvisning. Hvis aktivert feiler simulert opplasting rundt 90%.",
|
|
459
|
+
default: !1,
|
|
460
|
+
showIf: { uploadStrategy: "custom" },
|
|
461
|
+
category: "demo"
|
|
462
|
+
},
|
|
463
|
+
previewUploadStatus: {
|
|
464
|
+
type: ["progressbar", "text"],
|
|
465
|
+
name: "Visning av opplastingstatus",
|
|
466
|
+
description: "Kun for dokumentasjons-forhåndsvisning. Vises kun når `uploadStrategy='custom'`. Status vises først etter at brukeren faktisk har valgt fil(er).",
|
|
467
|
+
default: "progressbar",
|
|
468
|
+
showIf: { uploadStrategy: "custom" },
|
|
469
|
+
category: "demo"
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
types: {
|
|
473
|
+
FileItem: {
|
|
474
|
+
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>).",
|
|
475
|
+
properties: {
|
|
476
|
+
fileId: {
|
|
477
|
+
type: "string",
|
|
478
|
+
description: "Unik id for filen i komponenten."
|
|
479
|
+
},
|
|
480
|
+
file: {
|
|
481
|
+
type: "File",
|
|
482
|
+
description: "Fil-objektet fra nettleseren."
|
|
483
|
+
},
|
|
484
|
+
attributes: {
|
|
485
|
+
type: "Record<string, unknown>",
|
|
486
|
+
description: "Metadata per fil (f.eks. <code>targetFilename</code> for visningsnavn)."
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
FileTransfer: {
|
|
491
|
+
description: "Status for én pågående opplasting når <code>uploadStrategy=\"custom\"</code>.",
|
|
492
|
+
properties: {
|
|
493
|
+
fileId: {
|
|
494
|
+
type: "string",
|
|
495
|
+
description: "Kobler til <code>FileItem.fileId</code>."
|
|
496
|
+
},
|
|
497
|
+
progress: {
|
|
498
|
+
type: "number | 'done' | 'error' | 'canceled' | 'queued'",
|
|
499
|
+
description: "Fremdrift (<code>0..1</code>) eller tilstand."
|
|
500
|
+
},
|
|
501
|
+
errorMessage: {
|
|
502
|
+
type: "string",
|
|
503
|
+
description: "Feilmelding ved <code>error</code>.",
|
|
504
|
+
required: !1
|
|
505
|
+
},
|
|
506
|
+
showProgress: {
|
|
507
|
+
type: "boolean",
|
|
508
|
+
description: "Vis determinate progress vs. «Laster opp…».",
|
|
509
|
+
required: !1
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}, M = class extends a {
|
|
213
515
|
constructor(...e) {
|
|
214
|
-
super(...e), this.id = `pkt-fileupload-${l()}`, this.name = "files", this.label = "", this.helptext = "", 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.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 = u.requiredMissing, this.onNativeFileChange = (e) => {
|
|
516
|
+
super(...e), this.id = `pkt-fileupload-${l()}`, this.name = "files", this.label = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = j.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 = j.props.optionalText.default, this.requiredTag = !1, this.requiredText = j.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 = u.requiredMissing, this.onNativeFileChange = (e) => {
|
|
215
517
|
let t = e.target;
|
|
216
518
|
this.addFiles(t.files ? Array.from(t.files) : []), this.uploadStrategy === "custom" && (t.value = "");
|
|
217
519
|
}, this.openFileDialog = (e) => {
|
|
@@ -419,11 +721,11 @@ var A = class extends a {
|
|
|
419
721
|
}
|
|
420
722
|
getSrUploadedMessage() {
|
|
421
723
|
if (this.addedAnnouncement) return this.addedAnnouncement;
|
|
422
|
-
let { totalCount: e, uploadedCount: t } =
|
|
724
|
+
let { totalCount: e, uploadedCount: t } = k(this.getCurrentFiles(), this.transfers);
|
|
423
725
|
return e === 0 || t === 0 ? "" : u.srFilesUploadedOfTotal(t, e, u.fileLabel(e));
|
|
424
726
|
}
|
|
425
727
|
getSrErrorsMessage() {
|
|
426
|
-
let { totalCount: e, failedCount: t } =
|
|
728
|
+
let { totalCount: e, failedCount: t } = k(this.getCurrentFiles(), this.transfers);
|
|
427
729
|
return e === 0 || t === 0 ? "" : u.srFilesFailedOfTotal(t, e, u.fileLabel(e));
|
|
428
730
|
}
|
|
429
731
|
syncFormSubmitListener() {
|
|
@@ -434,77 +736,92 @@ var A = class extends a {
|
|
|
434
736
|
this.connectedForm &&= (this.connectedForm.removeEventListener("submit", this.onHostFormSubmit), null);
|
|
435
737
|
}
|
|
436
738
|
};
|
|
437
|
-
t([n({ type: String })],
|
|
739
|
+
t([n({ type: String })], M.prototype, "id", void 0), t([n({ type: String })], M.prototype, "name", void 0), t([n({ type: String })], M.prototype, "label", void 0), t([n({ type: String })], M.prototype, "helptext", void 0), t([n({
|
|
740
|
+
type: String,
|
|
741
|
+
attribute: "helptext-dropdown"
|
|
742
|
+
})], M.prototype, "helptextDropdown", void 0), t([n({
|
|
743
|
+
type: String,
|
|
744
|
+
attribute: "helptext-dropdown-button"
|
|
745
|
+
})], M.prototype, "helptextDropdownButton", void 0), t([n({
|
|
438
746
|
type: Boolean,
|
|
439
747
|
reflect: !0
|
|
440
|
-
})],
|
|
748
|
+
})], M.prototype, "required", void 0), t([n({
|
|
441
749
|
type: Boolean,
|
|
442
750
|
reflect: !0
|
|
443
|
-
})],
|
|
751
|
+
})], M.prototype, "multiple", void 0), t([n({
|
|
444
752
|
type: Boolean,
|
|
445
753
|
reflect: !0
|
|
446
|
-
})],
|
|
754
|
+
})], M.prototype, "disabled", void 0), t([n({
|
|
447
755
|
type: Boolean,
|
|
448
756
|
reflect: !0,
|
|
449
757
|
attribute: "fullwidth"
|
|
450
|
-
})],
|
|
758
|
+
})], M.prototype, "fullwidth", void 0), t([n({
|
|
451
759
|
type: String,
|
|
452
760
|
reflect: !0,
|
|
453
761
|
attribute: "upload-strategy"
|
|
454
|
-
})],
|
|
762
|
+
})], M.prototype, "uploadStrategy", void 0), t([n({
|
|
455
763
|
type: String,
|
|
456
764
|
reflect: !0,
|
|
457
765
|
attribute: "item-renderer"
|
|
458
|
-
})],
|
|
766
|
+
})], M.prototype, "itemRenderer", void 0), t([n({ type: String })], M.prototype, "accept", void 0), t([n({
|
|
459
767
|
converter: c.csvToArray,
|
|
460
768
|
attribute: "allowed-formats"
|
|
461
|
-
})],
|
|
769
|
+
})], M.prototype, "allowedFormats", void 0), t([n({
|
|
462
770
|
type: String,
|
|
463
771
|
attribute: "format-error-message"
|
|
464
|
-
})],
|
|
772
|
+
})], M.prototype, "formatErrorMessage", void 0), t([n({ attribute: "max-file-size" })], M.prototype, "maxFileSize", void 0), t([n({
|
|
465
773
|
type: String,
|
|
466
774
|
attribute: "size-error-message"
|
|
467
|
-
})],
|
|
775
|
+
})], M.prototype, "sizeErrorMessage", void 0), t([n({ attribute: !1 })], M.prototype, "onFileValidation", void 0), t([n({ attribute: !1 })], M.prototype, "transfers", void 0), t([n({
|
|
468
776
|
type: Boolean,
|
|
469
777
|
attribute: "add-comments-enabled"
|
|
470
|
-
})],
|
|
778
|
+
})], M.prototype, "addCommentsEnabled", void 0), t([n({
|
|
471
779
|
type: Boolean,
|
|
472
780
|
attribute: "rename-files-enabled"
|
|
473
|
-
})],
|
|
781
|
+
})], M.prototype, "renameFilesEnabled", void 0), t([n({ attribute: !1 })], M.prototype, "extraOperations", void 0), t([n({
|
|
474
782
|
type: Boolean,
|
|
475
783
|
reflect: !0,
|
|
476
784
|
attribute: "enable-image-preview"
|
|
477
|
-
})],
|
|
785
|
+
})], M.prototype, "enableImagePreview", void 0), t([n({
|
|
478
786
|
type: Boolean,
|
|
479
787
|
attribute: "has-error"
|
|
480
|
-
})],
|
|
788
|
+
})], M.prototype, "hasError", void 0), t([n({
|
|
481
789
|
type: String,
|
|
482
790
|
attribute: "error-message"
|
|
483
|
-
})],
|
|
791
|
+
})], M.prototype, "errorMessage", void 0), t([n({
|
|
484
792
|
type: Boolean,
|
|
485
793
|
attribute: "optional-tag"
|
|
486
|
-
})],
|
|
794
|
+
})], M.prototype, "optionalTag", void 0), t([n({
|
|
795
|
+
type: String,
|
|
796
|
+
attribute: "optional-text"
|
|
797
|
+
})], M.prototype, "optionalText", void 0), t([n({
|
|
487
798
|
type: Boolean,
|
|
488
799
|
attribute: "required-tag"
|
|
489
|
-
})],
|
|
800
|
+
})], M.prototype, "requiredTag", void 0), t([n({
|
|
801
|
+
type: String,
|
|
802
|
+
attribute: "required-text"
|
|
803
|
+
})], M.prototype, "requiredText", void 0), t([n({
|
|
804
|
+
type: String,
|
|
805
|
+
attribute: "tag-text"
|
|
806
|
+
})], M.prototype, "tagText", void 0), t([n({
|
|
490
807
|
type: Number,
|
|
491
808
|
attribute: "truncate-tail"
|
|
492
|
-
})],
|
|
809
|
+
})], M.prototype, "truncateTail", void 0), t([n({ attribute: !1 })], M.prototype, "value", void 0), t([n({ attribute: !1 })], M.prototype, "defaultValue", void 0), t([e()], M.prototype, "files", void 0), t([e()], M.prototype, "isDragActive", void 0), t([e()], M.prototype, "validationErrorMessage", void 0), t([e()], M.prototype, "addedAnnouncement", void 0), t([e()], M.prototype, "thumbnailUrls", void 0);
|
|
493
810
|
//#endregion
|
|
494
811
|
//#region src/components/fileupload/fileupload-operations.ts
|
|
495
|
-
var
|
|
812
|
+
var N = "comments", P = (e) => {
|
|
496
813
|
let t = new Date(e);
|
|
497
814
|
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")}`;
|
|
498
|
-
},
|
|
815
|
+
}, F = (e, t, n) => {
|
|
499
816
|
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), t()), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), n());
|
|
500
|
-
},
|
|
817
|
+
}, I = (e, t, n) => {
|
|
501
818
|
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), n()), (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), t());
|
|
502
|
-
},
|
|
819
|
+
}, L = (e) => ({
|
|
503
820
|
id: "remove",
|
|
504
821
|
title: "Slett",
|
|
505
822
|
ariaLabel: "Slett fil",
|
|
506
823
|
onClick: ({ file: t }) => e(t.fileId)
|
|
507
|
-
}),
|
|
824
|
+
}), R = () => ({
|
|
508
825
|
id: "rename",
|
|
509
826
|
title: "Rediger",
|
|
510
827
|
ariaLabel: "Rediger filnavn",
|
|
@@ -521,7 +838,7 @@ var j = "comments", M = (e) => {
|
|
|
521
838
|
class="pkt-fileupload__queue-display__item__rename-input"
|
|
522
839
|
?disabled=${e.disabled}
|
|
523
840
|
.value=${t}
|
|
524
|
-
@keydown=${(t) =>
|
|
841
|
+
@keydown=${(t) => F(t, i, e.close)}
|
|
525
842
|
/>
|
|
526
843
|
<button
|
|
527
844
|
type="button"
|
|
@@ -549,14 +866,14 @@ var j = "comments", M = (e) => {
|
|
|
549
866
|
value=${t}
|
|
550
867
|
/>`;
|
|
551
868
|
}
|
|
552
|
-
}),
|
|
869
|
+
}), z = () => ({
|
|
553
870
|
id: "comment",
|
|
554
|
-
title: (e) => (e.attributes?.[
|
|
871
|
+
title: (e) => (e.attributes?.[N] ?? []).length > 0 ? "" : "Legg til kommentar",
|
|
555
872
|
ariaLabel: "Legg til kommentar",
|
|
556
873
|
renderExtendedUI: (e) => {
|
|
557
|
-
let t = (e.getAttribute(
|
|
874
|
+
let t = (e.getAttribute(N) ?? [])[0], n = `pkt-fileupload-comment-${e.file.fileId}`, i = () => {
|
|
558
875
|
let t = document.getElementById(n)?.value?.trim();
|
|
559
|
-
t && e.setAttribute(
|
|
876
|
+
t && e.setAttribute(N, [{
|
|
560
877
|
text: t,
|
|
561
878
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
562
879
|
}]), e.close();
|
|
@@ -572,7 +889,7 @@ var j = "comments", M = (e) => {
|
|
|
572
889
|
.value=${t?.text ?? ""}
|
|
573
890
|
rows="2"
|
|
574
891
|
placeholder="Skriv inn kommentar"
|
|
575
|
-
@keydown=${(t) =>
|
|
892
|
+
@keydown=${(t) => I(t, i, e.close)}
|
|
576
893
|
></textarea>
|
|
577
894
|
<button
|
|
578
895
|
type="button"
|
|
@@ -594,7 +911,7 @@ var j = "comments", M = (e) => {
|
|
|
594
911
|
},
|
|
595
912
|
renderContent: (e) => {
|
|
596
913
|
if (e.isActive) return null;
|
|
597
|
-
let t = e.getAttribute(
|
|
914
|
+
let t = e.getAttribute(N) ?? [];
|
|
598
915
|
if (t.length === 0) return null;
|
|
599
916
|
let n = t[0];
|
|
600
917
|
return r`
|
|
@@ -605,7 +922,7 @@ var j = "comments", M = (e) => {
|
|
|
605
922
|
${n.text}
|
|
606
923
|
</span>
|
|
607
924
|
<time class="pkt-fileupload__queue-display__item__comment__time">
|
|
608
|
-
${
|
|
925
|
+
${P(n.timestamp)}
|
|
609
926
|
</time>
|
|
610
927
|
</div>
|
|
611
928
|
<div class="pkt-fileupload__queue-display__item__comment__actions">
|
|
@@ -623,7 +940,7 @@ var j = "comments", M = (e) => {
|
|
|
623
940
|
class="pkt-fileupload__queue-display__item__comment__action"
|
|
624
941
|
aria-label="Slett kommentar"
|
|
625
942
|
?disabled=${e.disabled}
|
|
626
|
-
@click=${() => e.setAttribute(
|
|
943
|
+
@click=${() => e.setAttribute(N, void 0)}
|
|
627
944
|
>
|
|
628
945
|
<pkt-icon name="trash-can"></pkt-icon>
|
|
629
946
|
</button>
|
|
@@ -633,14 +950,14 @@ var j = "comments", M = (e) => {
|
|
|
633
950
|
`;
|
|
634
951
|
},
|
|
635
952
|
renderHidden: (e) => {
|
|
636
|
-
let t = e.getAttribute(
|
|
953
|
+
let t = e.getAttribute(N);
|
|
637
954
|
return r`<input
|
|
638
955
|
type="hidden"
|
|
639
956
|
name=${`${e.inputName}-comments`}
|
|
640
957
|
value=${t ? JSON.stringify(t) : ""}
|
|
641
958
|
/>`;
|
|
642
959
|
}
|
|
643
|
-
}),
|
|
960
|
+
}), B = (e, t) => {
|
|
644
961
|
let n = D(e, t);
|
|
645
962
|
return n ? r`<span
|
|
646
963
|
class="pkt-fileupload__queue-display__item__title__head"
|
|
@@ -651,13 +968,13 @@ var j = "comments", M = (e) => {
|
|
|
651
968
|
data-pkt-truncate-part="tail"
|
|
652
969
|
>${n.tail}</span
|
|
653
970
|
>` : r`<span data-pkt-truncate-part="first">${e}</span>`;
|
|
654
|
-
},
|
|
971
|
+
}, V = (e, t, n) => r`
|
|
655
972
|
<p class="pkt-fileupload__queue-display__item__title">
|
|
656
|
-
${
|
|
973
|
+
${B(e, n)}${t ? r`<span class="pkt-fileupload__queue-display__item__filesize"> (${t})</span>` : null}
|
|
657
974
|
</p>
|
|
658
|
-
`,
|
|
975
|
+
`, H = (e) => typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle", U = (e) => r`<span class="pkt-fileupload__queue-display__item__loading-text" aria-label="Laster opp fil"
|
|
659
976
|
>${e ?? "Laster opp..."}</span
|
|
660
|
-
>`,
|
|
977
|
+
>`, W = ({ operationId: e, file: t, inputName: n, disabled: r, isActive: i, onActivateOperation: a, onCloseOperation: o, getFileAttribute: s, setFileAttribute: c }) => ({
|
|
661
978
|
file: t,
|
|
662
979
|
inputName: n,
|
|
663
980
|
disabled: r,
|
|
@@ -666,15 +983,15 @@ var j = "comments", M = (e) => {
|
|
|
666
983
|
close: () => o(t.fileId),
|
|
667
984
|
getAttribute: (e) => s(t.fileId, e),
|
|
668
985
|
setAttribute: (e, n) => c(t.fileId, e, n)
|
|
669
|
-
}),
|
|
670
|
-
let u =
|
|
986
|
+
}), G = ({ file: e, fileSize: t, disabled: n, transferProgress: i, transferShowProgress: a, loadingText: o, truncateTail: s, onCancel: c, iconName: l = "document-text" }) => {
|
|
987
|
+
let u = A(e), d = a ?? i !== 0;
|
|
671
988
|
return r`
|
|
672
989
|
<pkt-icon
|
|
673
990
|
name=${l}
|
|
674
991
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
675
992
|
aria-hidden="true"
|
|
676
993
|
></pkt-icon>
|
|
677
|
-
${
|
|
994
|
+
${V(u, t, s)}
|
|
678
995
|
<button
|
|
679
996
|
type="button"
|
|
680
997
|
class="pkt-fileupload__queue-display__item__cancel-button"
|
|
@@ -695,17 +1012,17 @@ var j = "comments", M = (e) => {
|
|
|
695
1012
|
<span class="pkt-fileupload__queue-display__item__percentage" aria-hidden="true"
|
|
696
1013
|
>${Math.round(i * 100)}%</span
|
|
697
1014
|
>
|
|
698
|
-
` :
|
|
1015
|
+
` : U(o)}
|
|
699
1016
|
`;
|
|
700
|
-
},
|
|
701
|
-
let l =
|
|
1017
|
+
}, K = ({ file: e, fileSize: t, disabled: n, transferShowProgress: i, transferLastProgress: a, transferErrorMessage: o, truncateTail: s, onCancel: c }) => {
|
|
1018
|
+
let l = A(e), u = !!i, d = Math.round((a ?? 1) * 100);
|
|
702
1019
|
return r`
|
|
703
1020
|
<pkt-icon
|
|
704
1021
|
name="alert-error"
|
|
705
1022
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
706
1023
|
aria-hidden="true"
|
|
707
1024
|
></pkt-icon>
|
|
708
|
-
${
|
|
1025
|
+
${V(l, t, s)}
|
|
709
1026
|
<button
|
|
710
1027
|
type="button"
|
|
711
1028
|
class="pkt-fileupload__queue-display__item__cancel-button"
|
|
@@ -728,11 +1045,11 @@ var j = "comments", M = (e) => {
|
|
|
728
1045
|
>${o}</span
|
|
729
1046
|
>` : null}
|
|
730
1047
|
`;
|
|
731
|
-
},
|
|
1048
|
+
}, q = ({ file: e, disabled: t, inputName: n, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: c, getFileAttribute: l, setFileAttribute: u }) => {
|
|
732
1049
|
let d = i.find((e) => e.id === a);
|
|
733
1050
|
if (d?.renderInlineUI || d?.renderExtendedUI) return null;
|
|
734
1051
|
let f = i.map((i) => {
|
|
735
|
-
let d =
|
|
1052
|
+
let d = W({
|
|
736
1053
|
operationId: i.id,
|
|
737
1054
|
file: e,
|
|
738
1055
|
inputName: n,
|
|
@@ -756,9 +1073,9 @@ var j = "comments", M = (e) => {
|
|
|
756
1073
|
</button>` : null;
|
|
757
1074
|
}).filter(Boolean);
|
|
758
1075
|
return f.length === 0 ? null : r`<div class="pkt-fileupload__queue-display__item__actions">${f}</div>`;
|
|
759
|
-
},
|
|
1076
|
+
}, J = ({ file: e, disabled: t, inputName: n, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => i.map((i) => {
|
|
760
1077
|
if (!i.renderContent) return null;
|
|
761
|
-
let u =
|
|
1078
|
+
let u = W({
|
|
762
1079
|
operationId: i.id,
|
|
763
1080
|
file: e,
|
|
764
1081
|
inputName: n,
|
|
@@ -772,11 +1089,11 @@ var j = "comments", M = (e) => {
|
|
|
772
1089
|
return d == null ? null : r`<div class="pkt-fileupload__queue-display__item__operation-content">
|
|
773
1090
|
${d}
|
|
774
1091
|
</div>`;
|
|
775
|
-
}),
|
|
1092
|
+
}), Y = ({ file: e, disabled: t, inputName: n, operations: i, activeOperationId: a, onActivateOperation: o, onCloseOperation: s, getFileAttribute: c, setFileAttribute: l }) => {
|
|
776
1093
|
if (!a) return null;
|
|
777
1094
|
let u = i.find((e) => e.id === a);
|
|
778
1095
|
if (!u?.renderExtendedUI) return null;
|
|
779
|
-
let d =
|
|
1096
|
+
let d = W({
|
|
780
1097
|
operationId: u.id,
|
|
781
1098
|
file: e,
|
|
782
1099
|
inputName: n,
|
|
@@ -790,9 +1107,9 @@ var j = "comments", M = (e) => {
|
|
|
790
1107
|
return r`<div class="pkt-fileupload__queue-display__item__expanded-operation-ui">
|
|
791
1108
|
${u.renderExtendedUI(d)}
|
|
792
1109
|
</div>`;
|
|
793
|
-
},
|
|
1110
|
+
}, X = ({ file: e, disabled: t, inputName: n, operations: r, activeOperationId: i, onActivateOperation: a, onCloseOperation: o, getFileAttribute: s, setFileAttribute: c }) => r.map((r) => {
|
|
794
1111
|
if (!r.renderHidden) return null;
|
|
795
|
-
let l =
|
|
1112
|
+
let l = W({
|
|
796
1113
|
operationId: r.id,
|
|
797
1114
|
file: e,
|
|
798
1115
|
inputName: n,
|
|
@@ -804,15 +1121,15 @@ var j = "comments", M = (e) => {
|
|
|
804
1121
|
setFileAttribute: c
|
|
805
1122
|
});
|
|
806
1123
|
return r.renderHidden(l);
|
|
807
|
-
}),
|
|
1124
|
+
}), Z = (e, t, n) => r`
|
|
808
1125
|
<pkt-icon
|
|
809
1126
|
name="document-text"
|
|
810
1127
|
class="pkt-fileupload__queue-display__item__icon pkt-icon--medium"
|
|
811
1128
|
aria-hidden="true"
|
|
812
1129
|
></pkt-icon>
|
|
813
|
-
${
|
|
814
|
-
`,
|
|
815
|
-
let u =
|
|
1130
|
+
${V(A(e), t, n)}
|
|
1131
|
+
`, Q = ({ file: e, thumbnailUrl: t, previewEnabled: n, canOpenPreview: i, truncateTail: a, onOpenPreview: c, onThumbnailImageError: l }) => {
|
|
1132
|
+
let u = A(e), d = !!t, f = !!n && !!i, p = f && !!c;
|
|
816
1133
|
return r`
|
|
817
1134
|
<div
|
|
818
1135
|
class=${o({
|
|
@@ -847,12 +1164,12 @@ var j = "comments", M = (e) => {
|
|
|
847
1164
|
</span>
|
|
848
1165
|
</button>
|
|
849
1166
|
<span class="pkt-fileupload__queue-display__item__thumbnail__title"
|
|
850
|
-
>${
|
|
1167
|
+
>${B(u, a)}</span
|
|
851
1168
|
>
|
|
852
1169
|
</div>
|
|
853
1170
|
`;
|
|
854
|
-
},
|
|
855
|
-
let y =
|
|
1171
|
+
}, ee = ({ 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 }) => {
|
|
1172
|
+
let y = H(f), b = a.find((e) => e.id === s), x = b?.renderInlineUI ? b.renderInlineUI(W({
|
|
856
1173
|
operationId: b.id,
|
|
857
1174
|
file: e,
|
|
858
1175
|
inputName: t,
|
|
@@ -872,7 +1189,7 @@ var j = "comments", M = (e) => {
|
|
|
872
1189
|
[`pkt-fileupload__queue-display__item--${f}`]: typeof f == "string"
|
|
873
1190
|
})}
|
|
874
1191
|
>
|
|
875
|
-
${
|
|
1192
|
+
${X({
|
|
876
1193
|
file: e,
|
|
877
1194
|
disabled: n,
|
|
878
1195
|
inputName: t,
|
|
@@ -883,7 +1200,7 @@ var j = "comments", M = (e) => {
|
|
|
883
1200
|
getFileAttribute: u,
|
|
884
1201
|
setFileAttribute: d
|
|
885
1202
|
})}
|
|
886
|
-
${y === "in-progress" ?
|
|
1203
|
+
${y === "in-progress" ? G({
|
|
887
1204
|
file: e,
|
|
888
1205
|
fileSize: i,
|
|
889
1206
|
disabled: n,
|
|
@@ -892,7 +1209,7 @@ var j = "comments", M = (e) => {
|
|
|
892
1209
|
loadingText: g,
|
|
893
1210
|
truncateTail: _,
|
|
894
1211
|
onCancel: v
|
|
895
|
-
}) : y === "error" ?
|
|
1212
|
+
}) : y === "error" ? K({
|
|
896
1213
|
file: e,
|
|
897
1214
|
fileSize: i,
|
|
898
1215
|
disabled: n,
|
|
@@ -910,8 +1227,8 @@ var j = "comments", M = (e) => {
|
|
|
910
1227
|
<div class="pkt-fileupload__queue-display__item__inline-ui">
|
|
911
1228
|
${x}
|
|
912
1229
|
</div>
|
|
913
|
-
` :
|
|
914
|
-
${y === "idle" ?
|
|
1230
|
+
` : Z(e, i, _)}
|
|
1231
|
+
${y === "idle" ? q({
|
|
915
1232
|
file: e,
|
|
916
1233
|
disabled: n,
|
|
917
1234
|
inputName: t,
|
|
@@ -922,7 +1239,7 @@ var j = "comments", M = (e) => {
|
|
|
922
1239
|
getFileAttribute: u,
|
|
923
1240
|
setFileAttribute: d
|
|
924
1241
|
}) : null}
|
|
925
|
-
${y === "idle" ?
|
|
1242
|
+
${y === "idle" ? J({
|
|
926
1243
|
file: e,
|
|
927
1244
|
disabled: n,
|
|
928
1245
|
inputName: t,
|
|
@@ -933,7 +1250,7 @@ var j = "comments", M = (e) => {
|
|
|
933
1250
|
getFileAttribute: u,
|
|
934
1251
|
setFileAttribute: d
|
|
935
1252
|
}) : null}
|
|
936
|
-
${y === "idle" ?
|
|
1253
|
+
${y === "idle" ? Y({
|
|
937
1254
|
file: e,
|
|
938
1255
|
disabled: n,
|
|
939
1256
|
inputName: t,
|
|
@@ -946,8 +1263,8 @@ var j = "comments", M = (e) => {
|
|
|
946
1263
|
}) : null}
|
|
947
1264
|
</li>
|
|
948
1265
|
`;
|
|
949
|
-
},
|
|
950
|
-
let w =
|
|
1266
|
+
}, te = ({ 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 }) => {
|
|
1267
|
+
let w = H(h), T = l.find((e) => e.id === u), E = T?.renderInlineUI ? T.renderInlineUI(W({
|
|
951
1268
|
operationId: T.id,
|
|
952
1269
|
file: e,
|
|
953
1270
|
inputName: t,
|
|
@@ -967,7 +1284,7 @@ var j = "comments", M = (e) => {
|
|
|
967
1284
|
[`pkt-fileupload__queue-display__item--${h}`]: typeof h == "string"
|
|
968
1285
|
})}
|
|
969
1286
|
>
|
|
970
|
-
${
|
|
1287
|
+
${X({
|
|
971
1288
|
file: e,
|
|
972
1289
|
disabled: n,
|
|
973
1290
|
inputName: t,
|
|
@@ -978,7 +1295,7 @@ var j = "comments", M = (e) => {
|
|
|
978
1295
|
getFileAttribute: p,
|
|
979
1296
|
setFileAttribute: m
|
|
980
1297
|
})}
|
|
981
|
-
${w === "in-progress" ?
|
|
1298
|
+
${w === "in-progress" ? G({
|
|
982
1299
|
file: e,
|
|
983
1300
|
fileSize: i,
|
|
984
1301
|
disabled: n,
|
|
@@ -988,7 +1305,7 @@ var j = "comments", M = (e) => {
|
|
|
988
1305
|
truncateTail: b,
|
|
989
1306
|
onCancel: x,
|
|
990
1307
|
iconName: "picture"
|
|
991
|
-
}) : w === "error" ?
|
|
1308
|
+
}) : w === "error" ? K({
|
|
992
1309
|
file: e,
|
|
993
1310
|
fileSize: i,
|
|
994
1311
|
disabled: n,
|
|
@@ -1006,7 +1323,7 @@ var j = "comments", M = (e) => {
|
|
|
1006
1323
|
<div class="pkt-fileupload__queue-display__item__inline-ui">
|
|
1007
1324
|
${E}
|
|
1008
1325
|
</div>
|
|
1009
|
-
` :
|
|
1326
|
+
` : Q({
|
|
1010
1327
|
file: e,
|
|
1011
1328
|
thumbnailUrl: a,
|
|
1012
1329
|
previewEnabled: s,
|
|
@@ -1015,7 +1332,7 @@ var j = "comments", M = (e) => {
|
|
|
1015
1332
|
onOpenPreview: S,
|
|
1016
1333
|
onThumbnailImageError: C
|
|
1017
1334
|
})}
|
|
1018
|
-
${w === "idle" ?
|
|
1335
|
+
${w === "idle" ? q({
|
|
1019
1336
|
file: e,
|
|
1020
1337
|
disabled: n,
|
|
1021
1338
|
inputName: t,
|
|
@@ -1026,7 +1343,7 @@ var j = "comments", M = (e) => {
|
|
|
1026
1343
|
getFileAttribute: p,
|
|
1027
1344
|
setFileAttribute: m
|
|
1028
1345
|
}) : null}
|
|
1029
|
-
${w === "idle" ?
|
|
1346
|
+
${w === "idle" ? J({
|
|
1030
1347
|
file: e,
|
|
1031
1348
|
disabled: n,
|
|
1032
1349
|
inputName: t,
|
|
@@ -1037,7 +1354,7 @@ var j = "comments", M = (e) => {
|
|
|
1037
1354
|
getFileAttribute: p,
|
|
1038
1355
|
setFileAttribute: m
|
|
1039
1356
|
}) : null}
|
|
1040
|
-
${w === "idle" ?
|
|
1357
|
+
${w === "idle" ? Y({
|
|
1041
1358
|
file: e,
|
|
1042
1359
|
disabled: n,
|
|
1043
1360
|
inputName: t,
|
|
@@ -1050,7 +1367,7 @@ var j = "comments", M = (e) => {
|
|
|
1050
1367
|
}) : null}
|
|
1051
1368
|
</li>
|
|
1052
1369
|
`;
|
|
1053
|
-
}, $ = class extends
|
|
1370
|
+
}, $ = class extends M {
|
|
1054
1371
|
constructor(...e) {
|
|
1055
1372
|
super(...e), this.activeOperationByFileId = {}, this.isPreviewModalOpen = !1, this.previewCurrentIndex = 0, this.failedImageFileIds = {}, this.closePreview = () => {
|
|
1056
1373
|
this.isPreviewModalOpen = !1;
|
|
@@ -1082,10 +1399,15 @@ var j = "comments", M = (e) => {
|
|
|
1082
1399
|
.forId=${`${this.id}-input`}
|
|
1083
1400
|
.label=${this.label}
|
|
1084
1401
|
.helptext=${this.helptext}
|
|
1402
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
1403
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
1085
1404
|
?disabled=${this.disabled}
|
|
1086
1405
|
?hasError=${this.hasEffectiveError}
|
|
1087
1406
|
?optionalTag=${this.optionalTag}
|
|
1407
|
+
.optionalText=${this.optionalText}
|
|
1088
1408
|
?requiredTag=${this.requiredTag}
|
|
1409
|
+
.requiredText=${this.requiredText}
|
|
1410
|
+
.tagText=${this.tagText}
|
|
1089
1411
|
class=${o({
|
|
1090
1412
|
"pkt-fileupload-wrapper": !0,
|
|
1091
1413
|
"pkt-fileupload-wrapper--full-width": this.fullwidth
|
|
@@ -1200,7 +1522,7 @@ var j = "comments", M = (e) => {
|
|
|
1200
1522
|
let n = typeof e.file?.size == "number" ? this.formatFileSize(e.file.size) : "", r = this.getQueueItemOperations();
|
|
1201
1523
|
if (this.itemRenderer === "thumbnail") {
|
|
1202
1524
|
let i = this.canOpenPreview(e), a = this.failedImageFileIds[e.fileId]?.thumbnail ? void 0 : this.getThumbnailUrl(e);
|
|
1203
|
-
return
|
|
1525
|
+
return te({
|
|
1204
1526
|
file: e,
|
|
1205
1527
|
inputName: this.name,
|
|
1206
1528
|
disabled: this.disabled,
|
|
@@ -1225,7 +1547,7 @@ var j = "comments", M = (e) => {
|
|
|
1225
1547
|
onThumbnailImageError: (e) => this.markImageFailed(e, "thumbnail")
|
|
1226
1548
|
});
|
|
1227
1549
|
}
|
|
1228
|
-
return
|
|
1550
|
+
return ee({
|
|
1229
1551
|
file: e,
|
|
1230
1552
|
inputName: this.name,
|
|
1231
1553
|
disabled: this.disabled,
|
|
@@ -1271,7 +1593,7 @@ var j = "comments", M = (e) => {
|
|
|
1271
1593
|
});
|
|
1272
1594
|
}
|
|
1273
1595
|
navigatePreview(e, t) {
|
|
1274
|
-
t.length !== 0 && (this.previewCurrentIndex =
|
|
1596
|
+
t.length !== 0 && (this.previewCurrentIndex = O(this.previewCurrentIndex, e, t.length));
|
|
1275
1597
|
}
|
|
1276
1598
|
renderPreviewModal(e) {
|
|
1277
1599
|
if (!this.enableImagePreview || e.length === 0) return null;
|
|
@@ -1337,7 +1659,7 @@ var j = "comments", M = (e) => {
|
|
|
1337
1659
|
}
|
|
1338
1660
|
getQueueItemOperations() {
|
|
1339
1661
|
let e = [];
|
|
1340
|
-
return this.renameFilesEnabled && this.itemRenderer !== "thumbnail" && e.push(
|
|
1662
|
+
return this.renameFilesEnabled && this.itemRenderer !== "thumbnail" && e.push(R()), this.addCommentsEnabled && this.itemRenderer !== "thumbnail" && e.push(z()), e.push(...this.extraOperations), e.push(L((e) => this.removeFileItem(e))), e;
|
|
1341
1663
|
}
|
|
1342
1664
|
activateOperation(e, t) {
|
|
1343
1665
|
this.activeOperationByFileId = {
|
|
@@ -1368,6 +1690,6 @@ var j = "comments", M = (e) => {
|
|
|
1368
1690
|
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")], $);
|
|
1369
1691
|
//#endregion
|
|
1370
1692
|
//#region src/components/fileupload/index.ts
|
|
1371
|
-
var
|
|
1693
|
+
var ne = $;
|
|
1372
1694
|
//#endregion
|
|
1373
|
-
export { $ as n,
|
|
1695
|
+
export { $ as n, ne as t };
|