@zanichelli/albe-web-components 12.3.1-RC → 12.4.0-RC
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-195ca522.js +18 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-app-header.cjs.entry.js +185 -0
- package/dist/cjs/{z-dragdrop-area_2.cjs.entry.js → z-button_6.cjs.entry.js} +259 -2
- package/dist/cjs/z-chip.cjs.entry.js +1 -1
- package/dist/cjs/z-input_2.cjs.entry.js +289 -0
- package/dist/cjs/z-list_3.cjs.entry.js +270 -0
- package/dist/cjs/z-offcanvas_2.cjs.entry.js +281 -0
- package/dist/collection/components/buttons/z-chip/index.js +1 -1
- package/dist/collection/components/file-upload/z-dragdrop-area/styles.css +1 -0
- package/dist/collection/components/file-upload/z-file-upload/index.js +1 -1
- package/dist/collection/components/file-upload/z-file-upload/styles.css +11 -0
- package/dist/esm/index-4968ce56.js +18 -10
- package/dist/esm/{index-4d1853ea.js → index-df06f147.js} +1 -1
- package/dist/esm/{index-fb19ca57.js → index-e44342f3.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-2a4ef29d.js → utils-3d2372eb.js} +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header.entry.js +181 -0
- package/dist/esm/z-book-card.entry.js +1 -1
- package/dist/esm/z-breadcrumb.entry.js +1 -1
- package/dist/esm/{z-dragdrop-area_2.entry.js → z-button_6.entry.js} +258 -5
- package/dist/esm/z-chip.entry.js +1 -1
- package/dist/esm/z-combobox.entry.js +1 -1
- package/dist/esm/z-input_2.entry.js +284 -0
- package/dist/esm/z-list_3.entry.js +264 -0
- package/dist/esm/z-myz-card-info.entry.js +1 -1
- package/dist/esm/z-myz-list-item.entry.js +1 -1
- package/dist/esm/z-offcanvas_2.entry.js +276 -0
- package/dist/esm/z-pocket_3.entry.js +1 -1
- package/dist/esm/z-select.entry.js +1 -1
- package/dist/esm/z-skip-to-content.entry.js +1 -1
- package/dist/esm/z-slideshow.entry.js +1 -1
- package/dist/esm/z-table-deprecated.entry.js +2 -2
- package/dist/esm/z-table-header.entry.js +2 -2
- package/dist/esm/z-table.entry.js +2 -2
- package/dist/esm/z-toggle-switch.entry.js +1 -1
- package/dist/esm/z-tr.entry.js +2 -2
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/{p-100207d8.entry.js → p-0495fb84.entry.js} +1 -1
- package/dist/web-components-library/p-07854026.entry.js +1 -0
- package/dist/web-components-library/p-13762a32.entry.js +1 -0
- package/dist/web-components-library/{p-cc009af8.entry.js → p-17d4f729.entry.js} +1 -1
- package/dist/web-components-library/p-1b342136.entry.js +1 -0
- package/dist/web-components-library/p-1c541078.entry.js +1 -0
- package/dist/web-components-library/p-207467d2.entry.js +1 -0
- package/dist/web-components-library/p-285ec5fc.entry.js +1 -0
- package/dist/web-components-library/{p-98badafc.js → p-28b2868e.js} +1 -1
- package/dist/web-components-library/{p-5944a8f2.entry.js → p-29377b57.entry.js} +1 -1
- package/dist/web-components-library/p-29d45fe5.entry.js +1 -0
- package/dist/web-components-library/p-49d22e92.entry.js +1 -0
- package/dist/web-components-library/p-570e1a2e.entry.js +1 -0
- package/{www/build/p-485fd3db.entry.js → dist/web-components-library/p-6f281905.entry.js} +1 -1
- package/dist/web-components-library/{p-a1663ab1.entry.js → p-76e7d402.entry.js} +1 -1
- package/dist/web-components-library/p-8aaa0c34.entry.js +1 -0
- package/dist/web-components-library/{p-f5bc7dda.entry.js → p-a6af3c1d.entry.js} +1 -1
- package/dist/web-components-library/{p-f3cc3f27.entry.js → p-b0f9cf23.entry.js} +1 -1
- package/dist/web-components-library/{p-a01baa71.js → p-b921dc8d.js} +1 -1
- package/dist/web-components-library/p-d00d2e95.entry.js +1 -0
- package/dist/web-components-library/{p-cd561d69.js → p-d12d4dcd.js} +1 -1
- package/dist/web-components-library/{p-8c31e60b.entry.js → p-d51d7b44.entry.js} +1 -1
- package/dist/web-components-library/p-dc854830.entry.js +1 -0
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/index.esm.js +1 -1
- package/www/build/{p-100207d8.entry.js → p-0495fb84.entry.js} +1 -1
- package/www/build/p-07854026.entry.js +1 -0
- package/www/build/p-13762a32.entry.js +1 -0
- package/www/build/{p-cc009af8.entry.js → p-17d4f729.entry.js} +1 -1
- package/www/build/p-1b342136.entry.js +1 -0
- package/www/build/p-1c541078.entry.js +1 -0
- package/www/build/p-207467d2.entry.js +1 -0
- package/www/build/p-285ec5fc.entry.js +1 -0
- package/www/build/{p-98badafc.js → p-28b2868e.js} +1 -1
- package/www/build/{p-5944a8f2.entry.js → p-29377b57.entry.js} +1 -1
- package/www/build/p-29d45fe5.entry.js +1 -0
- package/www/build/p-49d22e92.entry.js +1 -0
- package/www/build/p-4a7a94e2.css +1576 -0
- package/www/build/p-570e1a2e.entry.js +1 -0
- package/{dist/web-components-library/p-485fd3db.entry.js → www/build/p-6f281905.entry.js} +1 -1
- package/www/build/{p-a1663ab1.entry.js → p-76e7d402.entry.js} +1 -1
- package/www/build/p-8aaa0c34.entry.js +1 -0
- package/www/build/{p-f5bc7dda.entry.js → p-a6af3c1d.entry.js} +1 -1
- package/www/build/{p-f3cc3f27.entry.js → p-b0f9cf23.entry.js} +1 -1
- package/www/build/{p-a01baa71.js → p-b921dc8d.js} +1 -1
- package/www/build/p-ce656c1c.js +129 -0
- package/www/build/p-d00d2e95.entry.js +1 -0
- package/www/build/{p-cd561d69.js → p-d12d4dcd.js} +1 -1
- package/www/build/{p-8c31e60b.entry.js → p-d51d7b44.entry.js} +1 -1
- package/www/build/p-dc854830.entry.js +1 -0
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +10 -1
- package/dist/cjs/z-app-header_11.cjs.entry.js +0 -1077
- package/dist/cjs/z-file-upload.cjs.entry.js +0 -189
- package/dist/esm/z-app-header_11.entry.js +0 -1063
- package/dist/esm/z-file-upload.entry.js +0 -185
- package/dist/web-components-library/p-03b13390.entry.js +0 -1
- package/dist/web-components-library/p-07d0e902.entry.js +0 -1
- package/dist/web-components-library/p-3327e5f0.entry.js +0 -1
- package/dist/web-components-library/p-51bfa8ba.entry.js +0 -1
- package/dist/web-components-library/p-7907bdf7.entry.js +0 -1
- package/dist/web-components-library/p-7c5ddeb0.entry.js +0 -1
- package/dist/web-components-library/p-9b0bcd43.entry.js +0 -1
- package/dist/web-components-library/p-bbd6cbca.entry.js +0 -1
- package/dist/web-components-library/p-ed42ceca.entry.js +0 -1
- package/dist/web-components-library/p-ff5a6e34.entry.js +0 -1
- package/www/build/p-03b13390.entry.js +0 -1
- package/www/build/p-07d0e902.entry.js +0 -1
- package/www/build/p-21a94605.css +0 -3
- package/www/build/p-3327e5f0.entry.js +0 -1
- package/www/build/p-51bfa8ba.entry.js +0 -1
- package/www/build/p-7907bdf7.entry.js +0 -1
- package/www/build/p-7c5ddeb0.entry.js +0 -1
- package/www/build/p-92d5fd28.js +0 -1
- package/www/build/p-9b0bcd43.entry.js +0 -1
- package/www/build/p-bbd6cbca.entry.js +0 -1
- package/www/build/p-ed42ceca.entry.js +0 -1
- package/www/build/p-ff5a6e34.entry.js +0 -1
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-195ca522.js');
|
|
6
|
-
const index$1 = require('./index-cf9497bc.js');
|
|
7
|
-
const utils = require('./utils-ee86db4f.js');
|
|
8
|
-
require('./breakpoints-ebe1a437.js');
|
|
9
|
-
|
|
10
|
-
const stylesCss = ":host{color:var(--color-text01);font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>.container{display:flex;flex-direction:column}:host .modal-wrapper{display:flex;align-items:center;justify-content:center}:host .modal-wrapper>.files-wrapper{display:flex;flex-direction:column;margin:calc(var(--space-unit) * 4);gap:var(--space-unit)}:host .text-container{display:flex;flex-direction:column;margin:auto}:host .text-container .body-1{text-align:center}:host .text-container .upload-link{color:var(--color-link-primary);cursor:pointer}:host .text-container .upload-link-text{margin-bottom:var(--space-unit)}input#file-elem{display:none}#title{display:inline-block;margin:calc(var(--space-unit) * 2.5) 0 calc(var(--space-unit) * 4);font-size:calc(var(--space-unit) * 3);font-weight:var(--font-sb)}:host>.container>z-button{display:inline-block;margin-top:calc(var(--space-unit) * 3)}:host>.container>.files-container.hidden{display:none}:host>.container>.files-container>.heading-4-sb{display:inline-block;margin:calc(var(--space-unit) * 3) 0;font-size:calc(var(--space-unit) * 2);font-weight:var(--font-sb)}:host([type=\"dragdrop\"])>.container>.files-container>.heading-4-sb{margin-top:0;margin-bottom:calc(var(--space-unit) * 3)}:host>.container>.files-container>.files-wrapper{display:flex;flex-wrap:wrap;column-gap:calc(var(--space-unit) * 2);row-gap:calc(var(--space-unit) * 2)}:host>.container>.files-container>z-divider{margin-top:calc(var(--space-unit) * 3);margin-bottom:0}:host([type=\"dragdrop\"])>.container>.files-container>z-divider{margin:calc(var(--space-unit) * 3) 0}@media only screen and (min-width: 768px){:host>.container>z-button{align-self:flex-start}}";
|
|
11
|
-
|
|
12
|
-
const ZFileUpload = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
index.registerInstance(this, hostRef);
|
|
15
|
-
this.fileInput = index.createEvent(this, "fileInput", 7);
|
|
16
|
-
/** Prop indicating the file upload type - can be default or dragdrop */
|
|
17
|
-
this.type = index$1.ZFileUploadType.DEFAULT;
|
|
18
|
-
/** Files added by the user */
|
|
19
|
-
this.files = [];
|
|
20
|
-
/** upoload button label */
|
|
21
|
-
this.uploadBtnLabel = "allega";
|
|
22
|
-
/** drag & drop button label */
|
|
23
|
-
this.dragAndDropLabel = "Rilascia i file in questa area per allegarli.";
|
|
24
|
-
this.inputAttributes = {
|
|
25
|
-
type: "file",
|
|
26
|
-
id: "file-elem",
|
|
27
|
-
multiple: true,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/** Listen removeFile event sent from z-file component */
|
|
31
|
-
removeFileListener(e) {
|
|
32
|
-
const files = this.files;
|
|
33
|
-
const file = files.find((file) => file.name === e.detail.fileName);
|
|
34
|
-
if (file) {
|
|
35
|
-
const index = files.indexOf(file);
|
|
36
|
-
if (index >= 0) {
|
|
37
|
-
files.splice(index, 1);
|
|
38
|
-
this.files = [...files];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/** Listen fileDropped event sent from z-dragdrop-area component */
|
|
43
|
-
fileDroppedListener(e) {
|
|
44
|
-
this.input.files = e.detail;
|
|
45
|
-
this.fileInputHandler();
|
|
46
|
-
}
|
|
47
|
-
componentDidUpdate() {
|
|
48
|
-
this.handleAccessibility();
|
|
49
|
-
this.invalidFiles.size && this.errorModal.focus();
|
|
50
|
-
}
|
|
51
|
-
componentWillLoad() {
|
|
52
|
-
this.invalidFiles = new Map();
|
|
53
|
-
}
|
|
54
|
-
fileInputHandler() {
|
|
55
|
-
if (this.input.files.length) {
|
|
56
|
-
this.invalidFiles = this.checkFiles(Array.from(this.input.files));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/** get array of uploaded files */
|
|
60
|
-
async getFiles() {
|
|
61
|
-
return this.files;
|
|
62
|
-
}
|
|
63
|
-
getType() {
|
|
64
|
-
if (utils.getDevice() !== index$1.Device.DESKTOP && utils.getDevice() !== index$1.Device.DESKTOP_WIDE) {
|
|
65
|
-
return index$1.ZFileUploadType.DEFAULT;
|
|
66
|
-
}
|
|
67
|
-
return this.type;
|
|
68
|
-
}
|
|
69
|
-
handleAccessibility() {
|
|
70
|
-
const lastFile = this.el.querySelector("z-file:last-child z-chip button");
|
|
71
|
-
if (this.files.length > 0 && lastFile) {
|
|
72
|
-
lastFile.focus();
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.getType() === index$1.ZFileUploadType.DEFAULT
|
|
76
|
-
? this.button.querySelector("button").focus()
|
|
77
|
-
: this.uploadLink.focus();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
checkFiles(files) {
|
|
81
|
-
const errors = new Map();
|
|
82
|
-
const sizeErrorString = `supera i ${this.fileMaxSize}MB`;
|
|
83
|
-
const formatErrorString = " ha un'estensione non prevista";
|
|
84
|
-
files.forEach((file) => {
|
|
85
|
-
const fileSize = file.size / 1024 / 1024;
|
|
86
|
-
const fileFormatOk = this.acceptedFormat
|
|
87
|
-
.split(",")
|
|
88
|
-
.some((ext) => file.name.toLowerCase().endsWith(ext.trim()));
|
|
89
|
-
const fileSizeOk = fileSize <= this.fileMaxSize;
|
|
90
|
-
if (fileSizeOk && fileFormatOk) {
|
|
91
|
-
if (!this.files.find((f) => f.name === file.name)) {
|
|
92
|
-
this.files.push(file);
|
|
93
|
-
this.fileInput.emit(file);
|
|
94
|
-
this.input.value = "";
|
|
95
|
-
}
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
errors.set(file.name, []);
|
|
99
|
-
if (!fileSizeOk) {
|
|
100
|
-
errors.get(file.name).push(sizeErrorString);
|
|
101
|
-
}
|
|
102
|
-
if (!fileFormatOk) {
|
|
103
|
-
errors.get(file.name).push(formatErrorString);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
return errors;
|
|
107
|
-
}
|
|
108
|
-
renderTitle() {
|
|
109
|
-
return index.h("span", { id: "title" }, this.mainTitle);
|
|
110
|
-
}
|
|
111
|
-
renderDescription(cssClass) {
|
|
112
|
-
return index.h("span", { class: cssClass }, this.description);
|
|
113
|
-
}
|
|
114
|
-
renderAllowedFileExtensions() {
|
|
115
|
-
let fileFormatString = "";
|
|
116
|
-
let fileWeightString = "";
|
|
117
|
-
if (this.acceptedFormat) {
|
|
118
|
-
const fileFormat = this.acceptedFormat
|
|
119
|
-
.split(", ")
|
|
120
|
-
.map((string) => string.substring(1).toUpperCase())
|
|
121
|
-
.join(", ");
|
|
122
|
-
fileFormatString = ` nei formati ${fileFormat}`;
|
|
123
|
-
}
|
|
124
|
-
if (this.fileMaxSize) {
|
|
125
|
-
fileWeightString = ` per un massimo di ${this.fileMaxSize}MB di peso`;
|
|
126
|
-
}
|
|
127
|
-
const finalString = `Puoi allegare file${fileFormatString}${fileWeightString}.`;
|
|
128
|
-
return index.h("span", { class: "body-3" }, fileFormatString || fileWeightString ? finalString : null);
|
|
129
|
-
}
|
|
130
|
-
renderFileSection() {
|
|
131
|
-
return (index.h("section", { class: `files-container ${!this.files.length ? "hidden" : ""}` }, index.h("span", { class: "heading-4-sb" }, "File appena caricati"), index.h("div", { class: "files-wrapper" }, index.h("slot", { name: "files" })), index.h("z-divider", { size: index$1.DividerSize.MEDIUM })));
|
|
132
|
-
}
|
|
133
|
-
renderInput() {
|
|
134
|
-
return (index.h("input", Object.assign({}, this.inputAttributes, { onChange: () => this.fileInputHandler(), accept: this.acceptedFormat, ref: (val) => (this.input = val) })));
|
|
135
|
-
}
|
|
136
|
-
renderUploadButton() {
|
|
137
|
-
return [
|
|
138
|
-
this.renderInput(),
|
|
139
|
-
index.h("z-button", { onClick: () => this.input.click(), onKeyPress: (e) => {
|
|
140
|
-
if (e.code == "Space" || e.code == "Enter") {
|
|
141
|
-
e.preventDefault();
|
|
142
|
-
this.input.click();
|
|
143
|
-
}
|
|
144
|
-
}, id: "fileSelect", variant: this.buttonVariant, icon: "upload", ref: (val) => (this.button = val) }, this.uploadBtnLabel),
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
renderUploadLink() {
|
|
148
|
-
return [
|
|
149
|
-
this.renderInput(),
|
|
150
|
-
index.h("span", { class: "body-1 upload-link-text" }, "Trascina o", " ", index.h("span", { tabIndex: 0, class: "body-1-sb upload-link", onClick: () => this.input.click(), onKeyPress: (e) => {
|
|
151
|
-
if (e.code == "Space" || e.code == "Enter") {
|
|
152
|
-
e.preventDefault();
|
|
153
|
-
this.input.click();
|
|
154
|
-
}
|
|
155
|
-
}, ref: (val) => (this.uploadLink = val) }, "carica"), " ", "dal tuo computer"),
|
|
156
|
-
];
|
|
157
|
-
}
|
|
158
|
-
renderDefaultMode() {
|
|
159
|
-
return [
|
|
160
|
-
this.renderDescription("body-3-sb"),
|
|
161
|
-
this.renderAllowedFileExtensions(),
|
|
162
|
-
this.renderFileSection(),
|
|
163
|
-
this.renderUploadButton(),
|
|
164
|
-
];
|
|
165
|
-
}
|
|
166
|
-
renderDragDropMode() {
|
|
167
|
-
return [
|
|
168
|
-
this.renderFileSection(),
|
|
169
|
-
index.h("z-dragdrop-area", { "drag-and-drop-label": this.dragAndDropLabel }, index.h("div", { class: "text-container" }, this.renderDescription("body-1"), this.renderUploadLink(), this.renderAllowedFileExtensions())),
|
|
170
|
-
];
|
|
171
|
-
}
|
|
172
|
-
formatErrorString(key, value) {
|
|
173
|
-
var _a, _b;
|
|
174
|
-
const bothErrors = value[0] && value[1] ? ", " : "";
|
|
175
|
-
return `Il file ${key} ${(_a = value[0]) !== null && _a !== void 0 ? _a : ""}${bothErrors} ${(_b = value[1]) !== null && _b !== void 0 ? _b : ""} e non può quindi essere caricato.`;
|
|
176
|
-
}
|
|
177
|
-
handleErrorModalContent() {
|
|
178
|
-
return (index.h("div", { slot: "modalContent" }, index.h("div", { class: "modal-wrapper" }, index.h("div", { class: "files" }, Array.from(this.invalidFiles).map(([key, value]) => {
|
|
179
|
-
return index.h("span", { class: "body-3" }, this.formatErrorString(key, value));
|
|
180
|
-
})))));
|
|
181
|
-
}
|
|
182
|
-
render() {
|
|
183
|
-
return (index.h(index.Host, null, index.h("div", { tabIndex: 0, class: `container ${this.getType()}` }, this.mainTitle && this.renderTitle(), this.getType() == index$1.ZFileUploadType.DEFAULT ? this.renderDefaultMode() : this.renderDragDropMode()), !!this.invalidFiles.size && (index.h("z-modal", { tabIndex: 0, ref: (val) => (this.errorModal = val), modaltitle: "Attenzione", onModalClose: () => (this.invalidFiles = new Map()), onModalBackgroundClick: () => (this.invalidFiles = new Map()) }, this.handleErrorModalContent()))));
|
|
184
|
-
}
|
|
185
|
-
get el() { return index.getElement(this); }
|
|
186
|
-
};
|
|
187
|
-
ZFileUpload.style = stylesCss;
|
|
188
|
-
|
|
189
|
-
exports.z_file_upload = ZFileUpload;
|