@italia/video 0.1.0-alpha.1 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +15 -6
- package/dist/src/it-video.d.ts +1 -0
- package/dist/src/it-video.d.ts.map +1 -1
- package/dist/src/it-video.js +676 -76
- package/dist/src/it-video.js.map +1 -1
- package/package.json +17 -14
package/dist/src/it-video.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, css, html } from 'lit';
|
|
2
|
-
import {
|
|
2
|
+
import { state, query, property, customElement } from 'lit/decorators.js';
|
|
3
3
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
4
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
5
5
|
import { directive, Directive } from 'lit/directive.js';
|
|
@@ -14720,7 +14720,7 @@ var clockExports = requireClock();
|
|
|
14720
14720
|
|
|
14721
14721
|
/**
|
|
14722
14722
|
* @license
|
|
14723
|
-
* Video.js 8.23.
|
|
14723
|
+
* Video.js 8.23.4 <http://videojs.com/>
|
|
14724
14724
|
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
|
|
14725
14725
|
* Available under Apache License Version 2.0
|
|
14726
14726
|
* <https://github.com/videojs/video.js/blob/main/LICENSE>
|
|
@@ -14731,7 +14731,7 @@ var clockExports = requireClock();
|
|
|
14731
14731
|
*/
|
|
14732
14732
|
|
|
14733
14733
|
|
|
14734
|
-
var version$6 = "8.23.
|
|
14734
|
+
var version$6 = "8.23.4";
|
|
14735
14735
|
|
|
14736
14736
|
/**
|
|
14737
14737
|
* An Object that contains lifecycle hooks as keys which point to an array
|
|
@@ -18829,8 +18829,8 @@ class Component$1 {
|
|
|
18829
18829
|
* Remove a child `Component` from this `Component`s list of children. Also removes
|
|
18830
18830
|
* the child `Component`s element from this `Component`s element.
|
|
18831
18831
|
*
|
|
18832
|
-
* @param {Component} component
|
|
18833
|
-
*
|
|
18832
|
+
* @param {string|Component} component
|
|
18833
|
+
* The name or instance of a child to remove.
|
|
18834
18834
|
*/
|
|
18835
18835
|
removeChild(component) {
|
|
18836
18836
|
if (typeof component === 'string') {
|
|
@@ -42943,7 +42943,7 @@ videojs.registerPlugin('qualityLevels', qualityLevels);
|
|
|
42943
42943
|
// Include the version number.
|
|
42944
42944
|
qualityLevels.VERSION = version$5;
|
|
42945
42945
|
|
|
42946
|
-
/*! @name @videojs/http-streaming @version 3.17.
|
|
42946
|
+
/*! @name @videojs/http-streaming @version 3.17.2 @license Apache-2.0 */
|
|
42947
42947
|
|
|
42948
42948
|
/**
|
|
42949
42949
|
* @file resolve-url.js - Handling how URLs are resolved and manipulated
|
|
@@ -44447,7 +44447,7 @@ const getStreamingNetworkErrorMetadata = ({
|
|
|
44447
44447
|
} else if (request.aborted) {
|
|
44448
44448
|
errorMetadata.errorType = videojs.Error.NetworkRequestAborted;
|
|
44449
44449
|
} else if (request.timedout) {
|
|
44450
|
-
errorMetadata.
|
|
44450
|
+
errorMetadata.errorType = videojs.Error.NetworkRequestTimeout;
|
|
44451
44451
|
} else if (isBadStatusOrParseFailure) {
|
|
44452
44452
|
const errorType = parseFailure ? videojs.Error.NetworkBodyParserFailed : videojs.Error.NetworkBadStatus;
|
|
44453
44453
|
errorMetadata.errorType = errorType;
|
|
@@ -45723,16 +45723,17 @@ class PlaylistLoader extends EventTarget$1 {
|
|
|
45723
45723
|
*/
|
|
45724
45724
|
|
|
45725
45725
|
getKeyIdSet(playlist) {
|
|
45726
|
-
|
|
45727
|
-
|
|
45728
|
-
|
|
45726
|
+
const keyIds = new Set();
|
|
45727
|
+
if (!playlist || !playlist.contentProtection) {
|
|
45728
|
+
return keyIds;
|
|
45729
|
+
}
|
|
45730
|
+
for (const keysystem in playlist.contentProtection) {
|
|
45731
|
+
if (playlist.contentProtection[keysystem] && playlist.contentProtection[keysystem].attributes && playlist.contentProtection[keysystem].attributes.keyId) {
|
|
45729
45732
|
const keyId = playlist.contentProtection[keysystem].attributes.keyId;
|
|
45730
|
-
|
|
45731
|
-
keyIds.add(keyId.toLowerCase());
|
|
45732
|
-
}
|
|
45733
|
+
keyIds.add(keyId.toLowerCase());
|
|
45733
45734
|
}
|
|
45734
|
-
return keyIds;
|
|
45735
45735
|
}
|
|
45736
|
+
return keyIds;
|
|
45736
45737
|
}
|
|
45737
45738
|
}
|
|
45738
45739
|
|
|
@@ -68788,7 +68789,7 @@ const initPlugin = function (player, options) {
|
|
|
68788
68789
|
const reloadSourceOnError = function (options) {
|
|
68789
68790
|
initPlugin(this, options);
|
|
68790
68791
|
};
|
|
68791
|
-
var version$4 = "3.17.
|
|
68792
|
+
var version$4 = "3.17.2";
|
|
68792
68793
|
var version$3 = "7.1.0";
|
|
68793
68794
|
var version$2 = "1.3.1";
|
|
68794
68795
|
var version$1 = "7.2.0";
|
|
@@ -69995,45 +69996,6 @@ if (!videojs.getPlugin || !videojs.getPlugin('reloadSourceOnError')) {
|
|
|
69995
69996
|
videojs.registerPlugin('reloadSourceOnError', reloadSourceOnError);
|
|
69996
69997
|
}
|
|
69997
69998
|
|
|
69998
|
-
/**
|
|
69999
|
-
* @license
|
|
70000
|
-
*
|
|
70001
|
-
* Copyright IBM Corp. 2020, 2022
|
|
70002
|
-
*
|
|
70003
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
70004
|
-
* LICENSE file in the root directory of this source tree.
|
|
70005
|
-
*/
|
|
70006
|
-
/**
|
|
70007
|
-
* Form validation status.
|
|
70008
|
-
*/
|
|
70009
|
-
var VALIDATION_STATUS;
|
|
70010
|
-
(function (VALIDATION_STATUS) {
|
|
70011
|
-
/**
|
|
70012
|
-
* One indicating no validation error.
|
|
70013
|
-
*/
|
|
70014
|
-
VALIDATION_STATUS["NO_ERROR"] = "";
|
|
70015
|
-
/**
|
|
70016
|
-
* One indicating that the value is invalid (generic).
|
|
70017
|
-
*/
|
|
70018
|
-
VALIDATION_STATUS["INVALID"] = "invalid";
|
|
70019
|
-
/**
|
|
70020
|
-
* One indicating missing required value.
|
|
70021
|
-
*/
|
|
70022
|
-
VALIDATION_STATUS["ERROR_REQUIRED"] = "required";
|
|
70023
|
-
/**
|
|
70024
|
-
* One indicating that the value does not match the pattern.
|
|
70025
|
-
*/
|
|
70026
|
-
VALIDATION_STATUS["PATTERN"] = "pattern";
|
|
70027
|
-
/**
|
|
70028
|
-
* One indicating that the value is shorter than the minimum length.
|
|
70029
|
-
*/
|
|
70030
|
-
VALIDATION_STATUS["MINLENGTH"] = "minlength";
|
|
70031
|
-
/**
|
|
70032
|
-
* One indicating that the value is less than the maximum length.
|
|
70033
|
-
*/
|
|
70034
|
-
VALIDATION_STATUS["MAXLENGTH"] = "maxlength";
|
|
70035
|
-
})(VALIDATION_STATUS || (VALIDATION_STATUS = {}));
|
|
70036
|
-
|
|
70037
69999
|
class SetAttributesDirective extends Directive {
|
|
70038
70000
|
update(part, [attributes]) {
|
|
70039
70001
|
const el = part.element;
|
|
@@ -70056,6 +70018,8 @@ class SetAttributesDirective extends Directive {
|
|
|
70056
70018
|
*/
|
|
70057
70019
|
directive(SetAttributesDirective);
|
|
70058
70020
|
|
|
70021
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
70022
|
+
|
|
70059
70023
|
const connectedElements = new Set();
|
|
70060
70024
|
if (window && !window.translations) {
|
|
70061
70025
|
window.translations = new Map();
|
|
@@ -70265,10 +70229,11 @@ const LocalizeMixin = (Base) => class extends Base {
|
|
|
70265
70229
|
constructor() {
|
|
70266
70230
|
super(...arguments);
|
|
70267
70231
|
this.localize = new LocalizeController(this);
|
|
70268
|
-
// Provide default values to avoid definite assignment errors and avoid decorators
|
|
70269
|
-
this.dir = '';
|
|
70270
|
-
this.lang = '';
|
|
70271
70232
|
}
|
|
70233
|
+
// Provide default values to avoid definite assignment errors and avoid decorators
|
|
70234
|
+
// commentati perchè danno problemi su React.js. Sono attributi nativi, e assegnare un valore di default a react da fastidio
|
|
70235
|
+
// dir: string = '';
|
|
70236
|
+
// lang: string = '';
|
|
70272
70237
|
/**
|
|
70273
70238
|
* Restituisce tutta l'utility di traduzione
|
|
70274
70239
|
*
|
|
@@ -70361,9 +70326,21 @@ class Logger {
|
|
|
70361
70326
|
class BaseComponent extends LitElement {
|
|
70362
70327
|
constructor() {
|
|
70363
70328
|
super();
|
|
70364
|
-
this.
|
|
70329
|
+
this.composeClass = clsx;
|
|
70365
70330
|
this.logger = new Logger(this.tagName.toLowerCase());
|
|
70366
70331
|
}
|
|
70332
|
+
get _ariaAttributes() {
|
|
70333
|
+
const attributes = {};
|
|
70334
|
+
for (const attr of this.getAttributeNames()) {
|
|
70335
|
+
if (attr === 'it-role') {
|
|
70336
|
+
attributes.role = this.getAttribute(attr);
|
|
70337
|
+
}
|
|
70338
|
+
else if (attr.startsWith('it-aria-')) {
|
|
70339
|
+
attributes[attr.replace(/^it-/, '')] = this.getAttribute(attr);
|
|
70340
|
+
}
|
|
70341
|
+
}
|
|
70342
|
+
return attributes;
|
|
70343
|
+
}
|
|
70367
70344
|
// eslint-disable-next-line class-methods-use-this
|
|
70368
70345
|
generateId(prefix) {
|
|
70369
70346
|
return `${prefix}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -70373,25 +70350,22 @@ class BaseComponent extends LitElement {
|
|
|
70373
70350
|
// new TrackFocus(element); // per il momento è stato disattivato perchè ci sono le pseudo classi ::focus-visible per fare quello che fa TrackFocus. Si possono aggiungere regole css in bsi-italia 3 dato che stiamo facendo una breaking release di bsi.
|
|
70374
70351
|
}
|
|
70375
70352
|
// eslint-disable-next-line class-methods-use-this
|
|
70376
|
-
|
|
70377
|
-
let
|
|
70378
|
-
|
|
70379
|
-
|
|
70380
|
-
.forEach((newClass) => {
|
|
70381
|
-
composedClass += ` ${newClass}`;
|
|
70382
|
-
});
|
|
70383
|
-
return composedClass.trim();
|
|
70384
|
-
}
|
|
70385
|
-
getAriaAttributes() {
|
|
70386
|
-
for (const attr of this.getAttributeNames()) {
|
|
70387
|
-
if (attr.startsWith('aria-')) {
|
|
70388
|
-
this._ariaAttributes[attr] = this.getAttribute(attr);
|
|
70389
|
-
}
|
|
70353
|
+
getActiveElement() {
|
|
70354
|
+
let active = document.activeElement;
|
|
70355
|
+
while (active && active.shadowRoot && active.shadowRoot.activeElement) {
|
|
70356
|
+
active = active.shadowRoot.activeElement;
|
|
70390
70357
|
}
|
|
70358
|
+
return active;
|
|
70359
|
+
}
|
|
70360
|
+
get focusElement() {
|
|
70361
|
+
return this;
|
|
70362
|
+
}
|
|
70363
|
+
// eslint-disable-next-line class-methods-use-this
|
|
70364
|
+
get prefersReducedMotion() {
|
|
70365
|
+
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
70391
70366
|
}
|
|
70392
70367
|
connectedCallback() {
|
|
70393
|
-
super.connectedCallback
|
|
70394
|
-
this.getAriaAttributes();
|
|
70368
|
+
super.connectedCallback();
|
|
70395
70369
|
// generate internal _id
|
|
70396
70370
|
const prefix = this.id?.length > 0 ? this.id : this.tagName.toLowerCase();
|
|
70397
70371
|
this._id = this.generateId(prefix);
|
|
@@ -70399,6 +70373,625 @@ class BaseComponent extends LitElement {
|
|
|
70399
70373
|
}
|
|
70400
70374
|
const BaseLocalizedComponent = LocalizeMixin(BaseComponent);
|
|
70401
70375
|
|
|
70376
|
+
//
|
|
70377
|
+
// We store a WeakMap of forms + controls so we can keep references to all FormControl within a given form. As
|
|
70378
|
+
// elements connect and disconnect to/from the DOM, their containing form is used as the key and the form control is
|
|
70379
|
+
// added and removed from the form's set, respectively.
|
|
70380
|
+
//
|
|
70381
|
+
const formCollections = new WeakMap();
|
|
70382
|
+
//
|
|
70383
|
+
// We store a WeakMap of reportValidity() overloads so we can override it when form controls connect to the DOM and
|
|
70384
|
+
// restore the original behavior when they disconnect.
|
|
70385
|
+
//
|
|
70386
|
+
const reportValidityOverloads = new WeakMap();
|
|
70387
|
+
const checkValidityOverloads = new WeakMap();
|
|
70388
|
+
//
|
|
70389
|
+
// We store a Set of controls that users have interacted with. This allows us to determine the interaction state
|
|
70390
|
+
// without littering the DOM with additional data attributes.
|
|
70391
|
+
//
|
|
70392
|
+
const userInteractedControls = new WeakSet();
|
|
70393
|
+
//
|
|
70394
|
+
// We store a WeakMap of interactions for each form control so we can track when all conditions are met for validation.
|
|
70395
|
+
//
|
|
70396
|
+
const interactions = new WeakMap();
|
|
70397
|
+
/** A reactive controller to allow form controls to participate in form submission, validation, etc. */
|
|
70398
|
+
class FormControlController {
|
|
70399
|
+
constructor(host, options) {
|
|
70400
|
+
this.handleFormData = (event) => {
|
|
70401
|
+
// console.log('handleFormData');
|
|
70402
|
+
const disabled = this.options.disabled(this.host);
|
|
70403
|
+
const name = this.options.name(this.host);
|
|
70404
|
+
const value = this.options.value(this.host);
|
|
70405
|
+
const tagName = this.host.tagName.toLowerCase();
|
|
70406
|
+
// For buttons, we only submit the value if they were the submitter. This is currently done in doAction() by
|
|
70407
|
+
// injecting the name/value on a temporary button, so we can just skip them here.
|
|
70408
|
+
const isButton = tagName === 'it-button';
|
|
70409
|
+
if (this.host.isConnected &&
|
|
70410
|
+
!disabled &&
|
|
70411
|
+
!isButton &&
|
|
70412
|
+
typeof name === 'string' &&
|
|
70413
|
+
name.length > 0 &&
|
|
70414
|
+
typeof value !== 'undefined') {
|
|
70415
|
+
switch (tagName) {
|
|
70416
|
+
case 'it-radio':
|
|
70417
|
+
if (this.host.checked) {
|
|
70418
|
+
event.formData.append(name, value);
|
|
70419
|
+
}
|
|
70420
|
+
break;
|
|
70421
|
+
default:
|
|
70422
|
+
if (Array.isArray(value)) {
|
|
70423
|
+
value.forEach((val) => {
|
|
70424
|
+
event.formData.append(name, val.toString());
|
|
70425
|
+
});
|
|
70426
|
+
}
|
|
70427
|
+
else {
|
|
70428
|
+
event.formData.append(name, value.toString());
|
|
70429
|
+
}
|
|
70430
|
+
}
|
|
70431
|
+
}
|
|
70432
|
+
};
|
|
70433
|
+
this.handleFormSubmit = (event) => {
|
|
70434
|
+
const disabled = this.options.disabled(this.host);
|
|
70435
|
+
const reportValidity = this.options.reportValidity;
|
|
70436
|
+
// Update the interacted state for all controls when the form is submitted
|
|
70437
|
+
if (this.form && !this.form.noValidate) {
|
|
70438
|
+
formCollections.get(this.form)?.forEach((control) => {
|
|
70439
|
+
this.setUserInteracted(control, true);
|
|
70440
|
+
});
|
|
70441
|
+
}
|
|
70442
|
+
if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
|
|
70443
|
+
event.preventDefault();
|
|
70444
|
+
// event.stopImmediatePropagation(); // se lo attiviamo, valida un campo alla volta
|
|
70445
|
+
}
|
|
70446
|
+
};
|
|
70447
|
+
this.handleFormReset = () => {
|
|
70448
|
+
this.options.setValue(this.host, '');
|
|
70449
|
+
this.setUserInteracted(this.host, false);
|
|
70450
|
+
interactions.set(this.host, []);
|
|
70451
|
+
};
|
|
70452
|
+
this.handleInteraction = (event) => {
|
|
70453
|
+
const emittedEvents = interactions.get(this.host);
|
|
70454
|
+
if (!emittedEvents.includes(event.type)) {
|
|
70455
|
+
emittedEvents.push(event.type);
|
|
70456
|
+
}
|
|
70457
|
+
// Mark it as user-interacted as soon as all associated events have been emitted
|
|
70458
|
+
if (emittedEvents.length === this.options.assumeInteractionOn.length) {
|
|
70459
|
+
this.setUserInteracted(this.host, true);
|
|
70460
|
+
}
|
|
70461
|
+
};
|
|
70462
|
+
this.checkFormValidity = () => {
|
|
70463
|
+
// console.log('checkFormValidity');
|
|
70464
|
+
//
|
|
70465
|
+
// This is very similar to the `reportFormValidity` function, but it does not trigger native constraint validation
|
|
70466
|
+
// Allow the user to simply check if the form is valid and handling validity in their own way.
|
|
70467
|
+
//
|
|
70468
|
+
// We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
|
|
70469
|
+
// validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
|
|
70470
|
+
// be necessary once we can use ElementInternals.
|
|
70471
|
+
//
|
|
70472
|
+
// Note that we're also honoring the form's novalidate attribute.
|
|
70473
|
+
//
|
|
70474
|
+
if (this.form && !this.form.noValidate) {
|
|
70475
|
+
// This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
|
|
70476
|
+
// elements that support the constraint validation API.
|
|
70477
|
+
const elements = this.form.querySelectorAll('*');
|
|
70478
|
+
for (const element of elements) {
|
|
70479
|
+
if (typeof element.checkValidity === 'function') {
|
|
70480
|
+
if (!element.checkValidity()) {
|
|
70481
|
+
return false;
|
|
70482
|
+
}
|
|
70483
|
+
}
|
|
70484
|
+
}
|
|
70485
|
+
}
|
|
70486
|
+
return true;
|
|
70487
|
+
};
|
|
70488
|
+
this.reportFormValidity = () => {
|
|
70489
|
+
// console.log('reportFormValidity');
|
|
70490
|
+
//
|
|
70491
|
+
// FormControl work hard to act like regular form controls. They support the Constraint Validation API
|
|
70492
|
+
// and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also
|
|
70493
|
+
// has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using
|
|
70494
|
+
// ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.
|
|
70495
|
+
//
|
|
70496
|
+
// We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
|
|
70497
|
+
// validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
|
|
70498
|
+
// be necessary once we can use ElementInternals.
|
|
70499
|
+
//
|
|
70500
|
+
// Note that we're also honoring the form's novalidate attribute.
|
|
70501
|
+
//
|
|
70502
|
+
if (this.form && !this.form.noValidate) {
|
|
70503
|
+
// This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
|
|
70504
|
+
// elements that support the constraint validation API.
|
|
70505
|
+
const elements = this.form.querySelectorAll('*');
|
|
70506
|
+
for (const element of elements) {
|
|
70507
|
+
if (typeof element.reportValidity === 'function') {
|
|
70508
|
+
if (!element.reportValidity()) {
|
|
70509
|
+
return false;
|
|
70510
|
+
}
|
|
70511
|
+
}
|
|
70512
|
+
}
|
|
70513
|
+
}
|
|
70514
|
+
return true;
|
|
70515
|
+
};
|
|
70516
|
+
(this.host = host).addController(this);
|
|
70517
|
+
this.options = {
|
|
70518
|
+
form: (input) => {
|
|
70519
|
+
// If there's a form attribute, use it to find the target form by id
|
|
70520
|
+
// Controls may not always reflect the 'form' property. For example, `<it-button>` doesn't reflect.
|
|
70521
|
+
const formId = input.form;
|
|
70522
|
+
if (formId) {
|
|
70523
|
+
const root = input.getRootNode();
|
|
70524
|
+
const form = root.querySelector(`#${formId}`);
|
|
70525
|
+
if (form) {
|
|
70526
|
+
return form;
|
|
70527
|
+
}
|
|
70528
|
+
}
|
|
70529
|
+
return input.closest('form');
|
|
70530
|
+
},
|
|
70531
|
+
name: (input) => input.name,
|
|
70532
|
+
value: (input) => input.value,
|
|
70533
|
+
disabled: (input) => input.disabled ?? false,
|
|
70534
|
+
reportValidity: (input) => typeof input.reportValidity === 'function' ? input.reportValidity() : true,
|
|
70535
|
+
checkValidity: (input) => (typeof input.checkValidity === 'function' ? input.checkValidity() : true),
|
|
70536
|
+
setValue: (input, value) => {
|
|
70537
|
+
// eslint-disable-next-line no-param-reassign
|
|
70538
|
+
input.value = value;
|
|
70539
|
+
},
|
|
70540
|
+
assumeInteractionOn: ['it-input'],
|
|
70541
|
+
...options,
|
|
70542
|
+
};
|
|
70543
|
+
}
|
|
70544
|
+
hostConnected() {
|
|
70545
|
+
const form = this.options.form(this.host);
|
|
70546
|
+
if (form) {
|
|
70547
|
+
this.attachForm(form);
|
|
70548
|
+
}
|
|
70549
|
+
// Listen for interactions
|
|
70550
|
+
interactions.set(this.host, []);
|
|
70551
|
+
this.options.assumeInteractionOn.forEach((event) => {
|
|
70552
|
+
this.host.addEventListener(event, this.handleInteraction);
|
|
70553
|
+
});
|
|
70554
|
+
}
|
|
70555
|
+
hostDisconnected() {
|
|
70556
|
+
this.detachForm();
|
|
70557
|
+
// Clean up interactions
|
|
70558
|
+
interactions.delete(this.host);
|
|
70559
|
+
this.options.assumeInteractionOn.forEach((event) => {
|
|
70560
|
+
this.host.removeEventListener(event, this.handleInteraction);
|
|
70561
|
+
});
|
|
70562
|
+
}
|
|
70563
|
+
hostUpdated() {
|
|
70564
|
+
const form = this.options.form(this.host);
|
|
70565
|
+
// Detach if the form no longer exists
|
|
70566
|
+
if (!form) {
|
|
70567
|
+
this.detachForm();
|
|
70568
|
+
}
|
|
70569
|
+
// If the form has changed, reattach it
|
|
70570
|
+
if (form && this.form !== form) {
|
|
70571
|
+
this.detachForm();
|
|
70572
|
+
this.attachForm(form);
|
|
70573
|
+
}
|
|
70574
|
+
if (this.host.hasUpdated) {
|
|
70575
|
+
this.setValidity(this.host.validity.valid);
|
|
70576
|
+
}
|
|
70577
|
+
}
|
|
70578
|
+
attachForm(form) {
|
|
70579
|
+
if (form) {
|
|
70580
|
+
this.form = form;
|
|
70581
|
+
// Add this element to the form's collection
|
|
70582
|
+
if (formCollections.has(this.form)) {
|
|
70583
|
+
formCollections.get(this.form).add(this.host);
|
|
70584
|
+
}
|
|
70585
|
+
else {
|
|
70586
|
+
formCollections.set(this.form, new Set([this.host]));
|
|
70587
|
+
}
|
|
70588
|
+
this.form.addEventListener('formdata', this.handleFormData);
|
|
70589
|
+
this.form.addEventListener('submit', this.handleFormSubmit);
|
|
70590
|
+
this.form.addEventListener('reset', this.handleFormReset);
|
|
70591
|
+
// Overload the form's reportValidity() method so it looks at FormControl
|
|
70592
|
+
if (!reportValidityOverloads.has(this.form)) {
|
|
70593
|
+
reportValidityOverloads.set(this.form, this.form.reportValidity);
|
|
70594
|
+
this.form.reportValidity = () => this.reportFormValidity();
|
|
70595
|
+
}
|
|
70596
|
+
// Overload the form's checkValidity() method so it looks at FormControl
|
|
70597
|
+
if (!checkValidityOverloads.has(this.form)) {
|
|
70598
|
+
checkValidityOverloads.set(this.form, this.form.checkValidity);
|
|
70599
|
+
this.form.checkValidity = () => this.checkFormValidity();
|
|
70600
|
+
}
|
|
70601
|
+
}
|
|
70602
|
+
else {
|
|
70603
|
+
this.form = undefined;
|
|
70604
|
+
}
|
|
70605
|
+
}
|
|
70606
|
+
detachForm() {
|
|
70607
|
+
if (!this.form)
|
|
70608
|
+
return;
|
|
70609
|
+
const formCollection = formCollections.get(this.form);
|
|
70610
|
+
if (!formCollection) {
|
|
70611
|
+
return;
|
|
70612
|
+
}
|
|
70613
|
+
// Remove this host from the form's collection
|
|
70614
|
+
formCollection.delete(this.host);
|
|
70615
|
+
// Check to make sure there's no other form controls in the collection. If we do this
|
|
70616
|
+
// without checking if any other controls are still in the collection, then we will wipe out the
|
|
70617
|
+
// validity checks for all other elements.
|
|
70618
|
+
// see: https://github.com/shoelace-style/shoelace/issues/1703
|
|
70619
|
+
if (formCollection.size <= 0) {
|
|
70620
|
+
this.form.removeEventListener('formdata', this.handleFormData);
|
|
70621
|
+
this.form.removeEventListener('submit', this.handleFormSubmit);
|
|
70622
|
+
this.form.removeEventListener('reset', this.handleFormReset);
|
|
70623
|
+
// Remove the overload and restore the original method
|
|
70624
|
+
if (reportValidityOverloads.has(this.form)) {
|
|
70625
|
+
this.form.reportValidity = reportValidityOverloads.get(this.form);
|
|
70626
|
+
reportValidityOverloads.delete(this.form);
|
|
70627
|
+
}
|
|
70628
|
+
if (checkValidityOverloads.has(this.form)) {
|
|
70629
|
+
this.form.checkValidity = checkValidityOverloads.get(this.form);
|
|
70630
|
+
checkValidityOverloads.delete(this.form);
|
|
70631
|
+
}
|
|
70632
|
+
// So it looks weird here to not always set the form to undefined. But I _think_ if we unattach this.form here,
|
|
70633
|
+
// we end up in this fun spot where future validity checks don't have a reference to the form validity handler.
|
|
70634
|
+
// First form element in sets the validity handler. So we can't clean up `this.form` until there are no other form elements in the form.
|
|
70635
|
+
this.form = undefined;
|
|
70636
|
+
}
|
|
70637
|
+
}
|
|
70638
|
+
// eslint-disable-next-line class-methods-use-this
|
|
70639
|
+
setUserInteracted(el, hasInteracted) {
|
|
70640
|
+
if (hasInteracted) {
|
|
70641
|
+
userInteractedControls.add(el);
|
|
70642
|
+
}
|
|
70643
|
+
else {
|
|
70644
|
+
userInteractedControls.delete(el);
|
|
70645
|
+
}
|
|
70646
|
+
el.requestUpdate();
|
|
70647
|
+
}
|
|
70648
|
+
doAction(type, submitter) {
|
|
70649
|
+
// console.log('doaction', type);
|
|
70650
|
+
if (this.form) {
|
|
70651
|
+
const button = document.createElement('button');
|
|
70652
|
+
button.type = type;
|
|
70653
|
+
button.style.position = 'absolute';
|
|
70654
|
+
button.style.width = '0';
|
|
70655
|
+
button.style.height = '0';
|
|
70656
|
+
button.style.clipPath = 'inset(50%)';
|
|
70657
|
+
button.style.overflow = 'hidden';
|
|
70658
|
+
button.style.whiteSpace = 'nowrap';
|
|
70659
|
+
// Pass name, value, and form attributes through to the temporary button
|
|
70660
|
+
if (submitter) {
|
|
70661
|
+
button.name = submitter.name;
|
|
70662
|
+
button.value = submitter.value;
|
|
70663
|
+
['formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach((attr) => {
|
|
70664
|
+
if (submitter.hasAttribute(attr)) {
|
|
70665
|
+
button.setAttribute(attr, submitter.getAttribute(attr));
|
|
70666
|
+
}
|
|
70667
|
+
});
|
|
70668
|
+
}
|
|
70669
|
+
this.form.append(button);
|
|
70670
|
+
button.click();
|
|
70671
|
+
button.remove();
|
|
70672
|
+
}
|
|
70673
|
+
}
|
|
70674
|
+
/** Returns the associated `<form>` element, if one exists. */
|
|
70675
|
+
getForm() {
|
|
70676
|
+
return this.form ?? null;
|
|
70677
|
+
}
|
|
70678
|
+
/** Resets the form, restoring all the control to their default value */
|
|
70679
|
+
reset(submitter) {
|
|
70680
|
+
this.doAction('reset', submitter);
|
|
70681
|
+
}
|
|
70682
|
+
/** Submits the form, triggering validation and form data injection. */
|
|
70683
|
+
submit(submitter) {
|
|
70684
|
+
// Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
|
|
70685
|
+
// native submit button into the form, "click" it, then remove it to simulate a standard form submission.
|
|
70686
|
+
this.doAction('submit', submitter);
|
|
70687
|
+
}
|
|
70688
|
+
/**
|
|
70689
|
+
* Synchronously sets the form control's validity. Call this when you know the future validity but need to update
|
|
70690
|
+
* the host element immediately, i.e. before Lit updates the component in the next update.
|
|
70691
|
+
*/
|
|
70692
|
+
setValidity(isValid) {
|
|
70693
|
+
const host = this.host;
|
|
70694
|
+
const hasInteracted = Boolean(userInteractedControls.has(host));
|
|
70695
|
+
const required = Boolean(host.required);
|
|
70696
|
+
//
|
|
70697
|
+
// We're mapping the following "states" to data attributes. In the future, we can use ElementInternals.states to
|
|
70698
|
+
// create a similar mapping, but instead of [data-invalid] it will look like :--invalid.
|
|
70699
|
+
//
|
|
70700
|
+
// See this RFC for more details: https://github.com/shoelace-style/shoelace/issues/1011
|
|
70701
|
+
//
|
|
70702
|
+
host.toggleAttribute('data-required', required);
|
|
70703
|
+
host.toggleAttribute('data-optional', !required);
|
|
70704
|
+
host.toggleAttribute('data-invalid', !isValid);
|
|
70705
|
+
host.toggleAttribute('data-valid', isValid);
|
|
70706
|
+
host.toggleAttribute('data-user-invalid', !isValid && hasInteracted);
|
|
70707
|
+
host.toggleAttribute('data-user-valid', isValid && hasInteracted);
|
|
70708
|
+
}
|
|
70709
|
+
/**
|
|
70710
|
+
* Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
|
|
70711
|
+
* that affects constraint validation changes so the component receives the correct validity states.
|
|
70712
|
+
*/
|
|
70713
|
+
updateValidity() {
|
|
70714
|
+
const host = this.host;
|
|
70715
|
+
this.setValidity(host.validity.valid);
|
|
70716
|
+
}
|
|
70717
|
+
/**
|
|
70718
|
+
* Dispatches a non-bubbling, cancelable custom event of type `it-invalid`.
|
|
70719
|
+
* If the `it-invalid` event will be cancelled then the original `invalid`
|
|
70720
|
+
* event (which may have been passed as argument) will also be cancelled.
|
|
70721
|
+
* If no original `invalid` event has been passed then the `it-invalid`
|
|
70722
|
+
* event will be cancelled before being dispatched.
|
|
70723
|
+
*/
|
|
70724
|
+
emitInvalidEvent(originalInvalidEvent) {
|
|
70725
|
+
const itInvalidEvent = new CustomEvent('it-invalid', {
|
|
70726
|
+
bubbles: false,
|
|
70727
|
+
composed: false,
|
|
70728
|
+
cancelable: true,
|
|
70729
|
+
detail: {},
|
|
70730
|
+
});
|
|
70731
|
+
if (!originalInvalidEvent) {
|
|
70732
|
+
itInvalidEvent.preventDefault();
|
|
70733
|
+
}
|
|
70734
|
+
if (!this.host.dispatchEvent(itInvalidEvent)) {
|
|
70735
|
+
originalInvalidEvent?.preventDefault();
|
|
70736
|
+
}
|
|
70737
|
+
}
|
|
70738
|
+
}
|
|
70739
|
+
|
|
70740
|
+
const translation$2 = {
|
|
70741
|
+
$code: 'it',
|
|
70742
|
+
$name: 'Italiano',
|
|
70743
|
+
$dir: 'ltr',
|
|
70744
|
+
validityRequired: 'Questo campo è obbligatorio.',
|
|
70745
|
+
validityPattern: 'Il valore non corrisponde al formato richiesto.',
|
|
70746
|
+
validityMinlength: 'Il valore deve essere lungo almeno {minlength} caratteri.',
|
|
70747
|
+
validityMaxlength: 'Il valore deve essere lungo al massimo {maxlength} caratteri.',
|
|
70748
|
+
};
|
|
70749
|
+
|
|
70750
|
+
registerTranslation(translation$2);
|
|
70751
|
+
class FormControl extends BaseLocalizedComponent {
|
|
70752
|
+
constructor() {
|
|
70753
|
+
super(...arguments);
|
|
70754
|
+
this.formControlController = new FormControlController(this, {
|
|
70755
|
+
assumeInteractionOn: ['it-input', 'it-blur', 'it-change'],
|
|
70756
|
+
});
|
|
70757
|
+
// TODO: verificare se serve davvero con il fatto che usiamo form-controller
|
|
70758
|
+
// static formAssociated = true;
|
|
70759
|
+
// @property()
|
|
70760
|
+
// internals = this.attachInternals();
|
|
70761
|
+
this._touched = false;
|
|
70762
|
+
/** The name of the input, submitted as a name/value pair with form data. */
|
|
70763
|
+
this.name = '';
|
|
70764
|
+
/** The current value of the input, submitted as a name/value pair with form data. */
|
|
70765
|
+
this.value = '';
|
|
70766
|
+
/** If the input is disabled. */
|
|
70767
|
+
this.disabled = false;
|
|
70768
|
+
/**
|
|
70769
|
+
* By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you
|
|
70770
|
+
* to place the form control outside of a form and associate it with the form that has this `id`. The form must be in
|
|
70771
|
+
* the same document or shadow root for this to work.
|
|
70772
|
+
*/
|
|
70773
|
+
this.form = '';
|
|
70774
|
+
/** If you implement your custom validation and you won't to trigger default validation */
|
|
70775
|
+
this.customValidation = false;
|
|
70776
|
+
/** If your input is invalid from your custom validition, set this attribute with message validation */
|
|
70777
|
+
this.validationText = '';
|
|
70778
|
+
/**
|
|
70779
|
+
* Specifies the granularity that the value must adhere to, or the special value `any` which means no stepping is
|
|
70780
|
+
* implied, allowing any numeric value. Only applies to date and number input types.
|
|
70781
|
+
*/
|
|
70782
|
+
this.step = 'any';
|
|
70783
|
+
/** The input's minimum length. */
|
|
70784
|
+
this.minlength = -1;
|
|
70785
|
+
/** The input's maximum length. */
|
|
70786
|
+
this.maxlength = -1;
|
|
70787
|
+
/** If the input is required. */
|
|
70788
|
+
this.required = false;
|
|
70789
|
+
this.validationMessage = '';
|
|
70790
|
+
}
|
|
70791
|
+
/** Gets the validity state object */
|
|
70792
|
+
get validity() {
|
|
70793
|
+
return this.inputElement?.validity;
|
|
70794
|
+
}
|
|
70795
|
+
// Form validation methods
|
|
70796
|
+
checkValidity() {
|
|
70797
|
+
const inputValid = this.inputElement?.checkValidity() ?? true; // this.inputElement.checkValidity() è la validazione del browser
|
|
70798
|
+
return inputValid;
|
|
70799
|
+
}
|
|
70800
|
+
/** Gets the associated form, if one exists. */
|
|
70801
|
+
getForm() {
|
|
70802
|
+
return this.formControlController.getForm();
|
|
70803
|
+
}
|
|
70804
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
70805
|
+
reportValidity() {
|
|
70806
|
+
const ret = this.inputElement.checkValidity();
|
|
70807
|
+
this.handleValidationMessages();
|
|
70808
|
+
return ret; // this.inputElement.reportValidity();
|
|
70809
|
+
}
|
|
70810
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
70811
|
+
setCustomValidity(message) {
|
|
70812
|
+
this.inputElement.setCustomValidity(message);
|
|
70813
|
+
this.validationMessage = this.inputElement.validationMessage;
|
|
70814
|
+
this.formControlController.updateValidity();
|
|
70815
|
+
}
|
|
70816
|
+
// Handlers
|
|
70817
|
+
_handleReady() {
|
|
70818
|
+
requestAnimationFrame(() => {
|
|
70819
|
+
this.dispatchEvent(new CustomEvent('it-input-ready', { bubbles: true, detail: { el: this.inputElement } }));
|
|
70820
|
+
});
|
|
70821
|
+
}
|
|
70822
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70823
|
+
_handleInput(e) {
|
|
70824
|
+
this.handleValidationMessages();
|
|
70825
|
+
this.dispatchEvent(new CustomEvent('it-input', {
|
|
70826
|
+
detail: { value: this.inputElement.value, el: this.inputElement },
|
|
70827
|
+
bubbles: true,
|
|
70828
|
+
composed: true,
|
|
70829
|
+
}));
|
|
70830
|
+
}
|
|
70831
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70832
|
+
_handleBlur(e) {
|
|
70833
|
+
this._touched = true;
|
|
70834
|
+
this.handleValidationMessages();
|
|
70835
|
+
this.dispatchEvent(new FocusEvent('it-blur', { bubbles: true, composed: true }));
|
|
70836
|
+
}
|
|
70837
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70838
|
+
_handleFocus(e) {
|
|
70839
|
+
this.dispatchEvent(new FocusEvent('it-focus', { bubbles: true, composed: true }));
|
|
70840
|
+
}
|
|
70841
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70842
|
+
_handleClick(e) {
|
|
70843
|
+
this.dispatchEvent(new MouseEvent('it-click', { bubbles: true, composed: true }));
|
|
70844
|
+
}
|
|
70845
|
+
/*
|
|
70846
|
+
Override default browser validation messages
|
|
70847
|
+
*/
|
|
70848
|
+
handleValidationMessages() {
|
|
70849
|
+
if (!this.customValidation) {
|
|
70850
|
+
const _v = this.inputElement.validity;
|
|
70851
|
+
if (_v.valueMissing) {
|
|
70852
|
+
this.setCustomValidity(this.$t('validityRequired'));
|
|
70853
|
+
}
|
|
70854
|
+
else if (_v.patternMismatch) {
|
|
70855
|
+
this.setCustomValidity(this.$t('validityPattern'));
|
|
70856
|
+
}
|
|
70857
|
+
else if (_v.tooShort) {
|
|
70858
|
+
this.setCustomValidity(this.$t('validityMinlength').replace('{minlength}', this.minlength.toString()));
|
|
70859
|
+
}
|
|
70860
|
+
else if (_v.tooLong) {
|
|
70861
|
+
this.setCustomValidity(this.$t('validityMaxlength').replace('{maxlength}', this.maxlength.toString()));
|
|
70862
|
+
}
|
|
70863
|
+
else {
|
|
70864
|
+
/* nothing. Usa il messaggio di errore della validazione
|
|
70865
|
+
di default del browser per altri errori di validità come:
|
|
70866
|
+
- typeMismatch
|
|
70867
|
+
- rangeUnderflow
|
|
70868
|
+
- rangeOverflow
|
|
70869
|
+
- stepMismatch
|
|
70870
|
+
- badInput */
|
|
70871
|
+
const otherConstraintErrors = _v.typeMismatch || _v.rangeUnderflow || _v.rangeOverflow || _v.stepMismatch || _v.badInput;
|
|
70872
|
+
if (!otherConstraintErrors) {
|
|
70873
|
+
this.setCustomValidity('');
|
|
70874
|
+
}
|
|
70875
|
+
}
|
|
70876
|
+
}
|
|
70877
|
+
this.validationMessage = this.inputElement.validationMessage;
|
|
70878
|
+
}
|
|
70879
|
+
_handleInvalid(event) {
|
|
70880
|
+
this.formControlController.setValidity(false);
|
|
70881
|
+
this.formControlController.emitInvalidEvent(event);
|
|
70882
|
+
}
|
|
70883
|
+
_handleChange(e) {
|
|
70884
|
+
const target = e.target;
|
|
70885
|
+
let value;
|
|
70886
|
+
if (target instanceof HTMLInputElement) {
|
|
70887
|
+
switch (target.type) {
|
|
70888
|
+
case 'checkbox':
|
|
70889
|
+
case 'radio':
|
|
70890
|
+
value = target.checked;
|
|
70891
|
+
break;
|
|
70892
|
+
case 'file':
|
|
70893
|
+
value = target.files; // FileList
|
|
70894
|
+
break;
|
|
70895
|
+
default:
|
|
70896
|
+
value = target.value;
|
|
70897
|
+
}
|
|
70898
|
+
}
|
|
70899
|
+
else if (target instanceof HTMLSelectElement) {
|
|
70900
|
+
if (target.multiple) {
|
|
70901
|
+
value = Array.from(target.selectedOptions).map((o) => o.value);
|
|
70902
|
+
}
|
|
70903
|
+
else {
|
|
70904
|
+
value = target.value;
|
|
70905
|
+
}
|
|
70906
|
+
}
|
|
70907
|
+
else {
|
|
70908
|
+
// textarea o altri input con value
|
|
70909
|
+
value = target.value;
|
|
70910
|
+
}
|
|
70911
|
+
this.dispatchEvent(new CustomEvent('it-change', {
|
|
70912
|
+
detail: { value, el: target },
|
|
70913
|
+
bubbles: true,
|
|
70914
|
+
composed: true,
|
|
70915
|
+
}));
|
|
70916
|
+
}
|
|
70917
|
+
updated(changedProperties) {
|
|
70918
|
+
super.updated?.(changedProperties);
|
|
70919
|
+
if (this.customValidation) {
|
|
70920
|
+
this.setCustomValidity(this.validationText ?? '');
|
|
70921
|
+
}
|
|
70922
|
+
else {
|
|
70923
|
+
this.formControlController.updateValidity();
|
|
70924
|
+
}
|
|
70925
|
+
}
|
|
70926
|
+
}
|
|
70927
|
+
__decorate([
|
|
70928
|
+
state(),
|
|
70929
|
+
__metadata("design:type", Object)
|
|
70930
|
+
], FormControl.prototype, "_touched", void 0);
|
|
70931
|
+
__decorate([
|
|
70932
|
+
query('.it-form__control'),
|
|
70933
|
+
__metadata("design:type", HTMLInputElement)
|
|
70934
|
+
], FormControl.prototype, "inputElement", void 0);
|
|
70935
|
+
__decorate([
|
|
70936
|
+
property({ type: String, reflect: true }) // from FormControl
|
|
70937
|
+
,
|
|
70938
|
+
__metadata("design:type", Object)
|
|
70939
|
+
], FormControl.prototype, "name", void 0);
|
|
70940
|
+
__decorate([
|
|
70941
|
+
property({ reflect: true }),
|
|
70942
|
+
__metadata("design:type", Object)
|
|
70943
|
+
], FormControl.prototype, "value", void 0);
|
|
70944
|
+
__decorate([
|
|
70945
|
+
property({ type: Boolean, reflect: true }) // from FormControl
|
|
70946
|
+
,
|
|
70947
|
+
__metadata("design:type", Object)
|
|
70948
|
+
], FormControl.prototype, "disabled", void 0);
|
|
70949
|
+
__decorate([
|
|
70950
|
+
property({ reflect: true, type: String }),
|
|
70951
|
+
__metadata("design:type", Object)
|
|
70952
|
+
], FormControl.prototype, "form", void 0);
|
|
70953
|
+
__decorate([
|
|
70954
|
+
property({ type: Boolean, reflect: true, attribute: 'custom-validation' }),
|
|
70955
|
+
__metadata("design:type", Object)
|
|
70956
|
+
], FormControl.prototype, "customValidation", void 0);
|
|
70957
|
+
__decorate([
|
|
70958
|
+
property({ attribute: 'validity-message', reflect: true }),
|
|
70959
|
+
__metadata("design:type", String)
|
|
70960
|
+
], FormControl.prototype, "validationText", void 0);
|
|
70961
|
+
__decorate([
|
|
70962
|
+
property(),
|
|
70963
|
+
__metadata("design:type", String)
|
|
70964
|
+
], FormControl.prototype, "pattern", void 0);
|
|
70965
|
+
__decorate([
|
|
70966
|
+
property(),
|
|
70967
|
+
__metadata("design:type", Object)
|
|
70968
|
+
], FormControl.prototype, "min", void 0);
|
|
70969
|
+
__decorate([
|
|
70970
|
+
property(),
|
|
70971
|
+
__metadata("design:type", Object)
|
|
70972
|
+
], FormControl.prototype, "max", void 0);
|
|
70973
|
+
__decorate([
|
|
70974
|
+
property(),
|
|
70975
|
+
__metadata("design:type", Object)
|
|
70976
|
+
], FormControl.prototype, "step", void 0);
|
|
70977
|
+
__decorate([
|
|
70978
|
+
property({ type: Number }),
|
|
70979
|
+
__metadata("design:type", Object)
|
|
70980
|
+
], FormControl.prototype, "minlength", void 0);
|
|
70981
|
+
__decorate([
|
|
70982
|
+
property({ type: Number }),
|
|
70983
|
+
__metadata("design:type", Object)
|
|
70984
|
+
], FormControl.prototype, "maxlength", void 0);
|
|
70985
|
+
__decorate([
|
|
70986
|
+
property({ type: Boolean, reflect: true }) // from FormControl
|
|
70987
|
+
,
|
|
70988
|
+
__metadata("design:type", Object)
|
|
70989
|
+
], FormControl.prototype, "required", void 0);
|
|
70990
|
+
__decorate([
|
|
70991
|
+
state(),
|
|
70992
|
+
__metadata("design:type", Object)
|
|
70993
|
+
], FormControl.prototype, "validationMessage", void 0);
|
|
70994
|
+
|
|
70402
70995
|
/**
|
|
70403
70996
|
* --------------------------------------------------------------------------
|
|
70404
70997
|
* Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
|
|
@@ -73576,7 +74169,7 @@ video::-webkit-media-text-track-display {
|
|
|
73576
74169
|
|
|
73577
74170
|
:host {
|
|
73578
74171
|
/*
|
|
73579
|
-
* Regole spostate in
|
|
74172
|
+
* Regole spostate in dev-kit-italia/styles/index.scss
|
|
73580
74173
|
display: block;
|
|
73581
74174
|
min-width: var(--it-videojs-default-width);
|
|
73582
74175
|
*/
|
|
@@ -73756,6 +74349,13 @@ let ItVideo = class ItVideo extends BaseLocalizedComponent {
|
|
|
73756
74349
|
window.VIDEOJS_NO_DYNAMIC_STYLE = true; // Disabilita lo stile dinamico di Video.js
|
|
73757
74350
|
this.initVideoPlayer();
|
|
73758
74351
|
}
|
|
74352
|
+
willUpdate(changedProperties) {
|
|
74353
|
+
super.willUpdate(changedProperties);
|
|
74354
|
+
const changedLang = changedProperties.has('language');
|
|
74355
|
+
if (changedLang && this.player) {
|
|
74356
|
+
this.player.language(this.language);
|
|
74357
|
+
}
|
|
74358
|
+
}
|
|
73759
74359
|
render() {
|
|
73760
74360
|
const needsCookieConsent = this.needsCookieConsent();
|
|
73761
74361
|
return needsCookieConsent
|
|
@@ -73821,7 +74421,7 @@ __decorate([
|
|
|
73821
74421
|
__metadata("design:type", Object)
|
|
73822
74422
|
], ItVideo.prototype, "options", void 0);
|
|
73823
74423
|
__decorate([
|
|
73824
|
-
property({ type: String }),
|
|
74424
|
+
property({ type: String, attribute: 'lang', reflect: true }),
|
|
73825
74425
|
__metadata("design:type", Object)
|
|
73826
74426
|
], ItVideo.prototype, "language", void 0);
|
|
73827
74427
|
__decorate([
|