@oiz/stzh-components 1.4.0-npmjstest → 1.5.0-alpha
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/README.md +1 -56
- package/dist/cjs/{app-globals-e07b8f5f.js → app-globals-3b6f75bd.js} +5 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stzh-actions.cjs.entry.js +1 -1
- package/dist/cjs/stzh-appnav.cjs.entry.js +1 -1
- package/dist/cjs/stzh-badge_3.cjs.entry.js +1 -1
- package/dist/cjs/stzh-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/stzh-checkboxgroup.cjs.entry.js +2 -4
- package/dist/cjs/stzh-components.cjs.js +2 -2
- package/dist/cjs/stzh-cspace.cjs.entry.js +1 -1
- package/dist/cjs/stzh-datepicker_4.cjs.entry.js +2 -4
- package/dist/cjs/stzh-dialog.cjs.entry.js +2 -2
- package/dist/cjs/stzh-dropdown.cjs.entry.js +30 -3
- package/dist/cjs/stzh-figure.cjs.entry.js +1 -1
- package/dist/cjs/stzh-footer.cjs.entry.js +1 -1
- package/dist/cjs/stzh-ghettobox_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-header.cjs.entry.js +1 -1
- package/dist/cjs/stzh-input.cjs.entry.js +9 -4
- package/dist/cjs/stzh-link.cjs.entry.js +1 -1
- package/dist/cjs/stzh-menu_2.cjs.entry.js +1 -1
- package/dist/cjs/stzh-pagetitle.cjs.entry.js +1 -1
- package/dist/cjs/stzh-portal-mitwirken.cjs.entry.js +1 -1
- package/dist/cjs/stzh-readspeaker.cjs.entry.js +1 -1
- package/dist/cjs/stzh-servicecard-list.cjs.entry.js +20 -3
- package/dist/cjs/stzh-servicecard.cjs.entry.js +26 -4
- package/dist/cjs/stzh-sortable.cjs.entry.js +3214 -2441
- package/dist/cjs/stzh-table.cjs.entry.js +1 -1
- package/dist/cjs/stzh-toggle.cjs.entry.js +1 -1
- package/dist/cjs/stzh-upload.cjs.entry.js +44 -11
- package/dist/cjs/utils-8dc66449.js +76 -0
- package/dist/collection/assets/fonts.css +5 -5
- package/dist/collection/components/stzh-checkboxgroup/stzh-checkboxgroup.js +1 -3
- package/dist/collection/components/stzh-cspace/stzh-cspace.css +6 -0
- package/dist/collection/components/stzh-dialog/stzh-dialog.css +9 -1
- package/dist/collection/components/stzh-dialog/stzh-dialog.stories.js +18 -8
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.css +2 -4
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.js +79 -1
- package/dist/collection/components/stzh-dropdown/stzh-dropdown.stories.js +3328 -0
- package/dist/collection/components/stzh-input/stzh-input.css +13 -4
- package/dist/collection/components/stzh-input/stzh-input.js +79 -4
- package/dist/collection/components/stzh-portal-mitwirken/stzh-portal-mitwirken.css +0 -9
- package/dist/collection/components/stzh-radiogroup/stzh-radiogroup.js +1 -3
- package/dist/collection/components/stzh-servicecard/stzh-servicecard.css +4 -4
- package/dist/collection/components/stzh-servicecard/stzh-servicecard.js +24 -2
- package/dist/collection/components/stzh-servicecard-list/stzh-servicecard-list.js +54 -11
- package/dist/collection/components/stzh-servicecard-list/stzh-servicecard-list.stories.js +2 -1
- package/dist/collection/components/stzh-sortable/stzh-sortable.js +37 -8
- package/dist/collection/components/stzh-upload/stzh-upload.css +3 -0
- package/dist/collection/components/stzh-upload/stzh-upload.js +43 -10
- package/dist/collection/components/stzh-upload/stzh-upload.stories.js +10 -8
- package/dist/collection/global/js/helpers/autofocus.js +3 -1
- package/dist/collection/global/js/script.js +1 -1
- package/dist/collection/libraries/sortable.js +3791 -0
- package/dist/collection/utils/utils.js +39 -0
- package/dist/components/index.js +5 -3
- package/dist/components/stzh-checkboxgroup.js +1 -3
- package/dist/components/stzh-cspace.js +1 -1
- package/dist/components/stzh-dialog.js +1 -1
- package/dist/components/stzh-dropdown2.js +33 -3
- package/dist/components/stzh-input2.js +12 -3
- package/dist/components/stzh-portal-mitwirken.js +1 -1
- package/dist/components/stzh-radiogroup2.js +1 -3
- package/dist/components/stzh-servicecard-list.js +22 -4
- package/dist/components/stzh-servicecard.js +25 -3
- package/dist/components/stzh-sortable2.js +3216 -2442
- package/dist/components/stzh-upload.js +43 -10
- package/dist/components/utils.js +40 -1
- package/dist/esm/{app-globals-70c229e3.js → app-globals-c42494e9.js} +5 -3
- package/dist/esm/loader.js +2 -2
- package/dist/esm/stzh-actions.entry.js +1 -1
- package/dist/esm/stzh-appnav.entry.js +1 -1
- package/dist/esm/stzh-badge_3.entry.js +1 -1
- package/dist/esm/stzh-checkbox.entry.js +1 -1
- package/dist/esm/stzh-checkboxgroup.entry.js +2 -4
- package/dist/esm/stzh-components.js +2 -2
- package/dist/esm/stzh-cspace.entry.js +1 -1
- package/dist/esm/stzh-datepicker_4.entry.js +2 -4
- package/dist/esm/stzh-dialog.entry.js +2 -2
- package/dist/esm/stzh-dropdown.entry.js +30 -3
- package/dist/esm/stzh-figure.entry.js +1 -1
- package/dist/esm/stzh-footer.entry.js +1 -1
- package/dist/esm/stzh-ghettobox_2.entry.js +1 -1
- package/dist/esm/stzh-header.entry.js +1 -1
- package/dist/esm/stzh-input.entry.js +9 -4
- package/dist/esm/stzh-link.entry.js +1 -1
- package/dist/esm/stzh-menu_2.entry.js +1 -1
- package/dist/esm/stzh-pagetitle.entry.js +1 -1
- package/dist/esm/stzh-portal-mitwirken.entry.js +1 -1
- package/dist/esm/stzh-readspeaker.entry.js +1 -1
- package/dist/esm/stzh-servicecard-list.entry.js +20 -3
- package/dist/esm/stzh-servicecard.entry.js +26 -4
- package/dist/esm/stzh-sortable.entry.js +3214 -2441
- package/dist/esm/stzh-table.entry.js +1 -1
- package/dist/esm/stzh-toggle.entry.js +1 -1
- package/dist/esm/stzh-upload.entry.js +44 -11
- package/dist/esm/utils-68a28fce.js +72 -0
- package/dist/esm-es5/app-globals-c42494e9.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/stzh-actions.entry.js +1 -1
- package/dist/esm-es5/stzh-appnav.entry.js +1 -1
- package/dist/esm-es5/stzh-badge_3.entry.js +1 -1
- package/dist/esm-es5/stzh-checkbox.entry.js +1 -1
- package/dist/esm-es5/stzh-checkboxgroup.entry.js +1 -1
- package/dist/esm-es5/stzh-components.js +1 -1
- package/dist/esm-es5/stzh-cspace.entry.js +1 -1
- package/dist/esm-es5/stzh-datepicker_4.entry.js +1 -1
- package/dist/esm-es5/stzh-dialog.entry.js +1 -1
- package/dist/esm-es5/stzh-dropdown.entry.js +1 -1
- package/dist/esm-es5/stzh-figure.entry.js +1 -1
- package/dist/esm-es5/stzh-footer.entry.js +1 -1
- package/dist/esm-es5/stzh-ghettobox_2.entry.js +1 -1
- package/dist/esm-es5/stzh-header.entry.js +1 -1
- package/dist/esm-es5/stzh-input.entry.js +1 -1
- package/dist/esm-es5/stzh-link.entry.js +1 -1
- package/dist/esm-es5/stzh-menu_2.entry.js +1 -1
- package/dist/esm-es5/stzh-pagetitle.entry.js +1 -1
- package/dist/esm-es5/stzh-portal-mitwirken.entry.js +1 -1
- package/dist/esm-es5/stzh-readspeaker.entry.js +1 -1
- package/dist/esm-es5/stzh-servicecard-list.entry.js +1 -1
- package/dist/esm-es5/stzh-servicecard.entry.js +1 -1
- package/dist/esm-es5/stzh-sortable.entry.js +2 -2
- package/dist/esm-es5/stzh-table.entry.js +1 -1
- package/dist/esm-es5/stzh-toggle.entry.js +1 -1
- package/dist/esm-es5/stzh-upload.entry.js +1 -1
- package/dist/esm-es5/utils-68a28fce.js +1 -0
- package/dist/stzh-components/assets/fonts.css +5 -5
- package/dist/stzh-components/{p-30cb8bc0.system.entry.js → p-006135ed.system.entry.js} +1 -1
- package/dist/stzh-components/p-0230004d.system.js +1 -0
- package/dist/stzh-components/{p-c6ad1a8c.entry.js → p-03e2634c.entry.js} +1 -1
- package/dist/stzh-components/{p-6ec17efc.entry.js → p-04d7b18f.entry.js} +1 -1
- package/dist/stzh-components/{p-60b4f34c.system.entry.js → p-07772cd7.system.entry.js} +1 -1
- package/dist/stzh-components/{p-82d85c3a.system.entry.js → p-1c88ceff.system.entry.js} +1 -1
- package/dist/stzh-components/p-1f57d28e.js +1 -0
- package/dist/stzh-components/p-2b11d549.system.entry.js +1 -0
- package/dist/stzh-components/{p-07f16263.entry.js → p-32988d74.entry.js} +1 -1
- package/dist/stzh-components/{p-cb4a91b7.system.entry.js → p-33946fed.system.entry.js} +1 -1
- package/dist/stzh-components/{p-1d914f6c.entry.js → p-34190502.entry.js} +1 -1
- package/dist/stzh-components/{p-9e6c25ed.system.entry.js → p-370b82e7.system.entry.js} +1 -1
- package/dist/stzh-components/p-3ebd2c03.js +1 -0
- package/dist/stzh-components/{p-f544cf3d.entry.js → p-3ed69b16.entry.js} +1 -1
- package/dist/stzh-components/{p-e58d3bc7.entry.js → p-409c0d50.entry.js} +1 -1
- package/dist/stzh-components/{p-19344366.system.entry.js → p-4a398453.system.entry.js} +1 -1
- package/dist/stzh-components/{p-49e37004.entry.js → p-586cae98.entry.js} +1 -1
- package/dist/stzh-components/p-5e0cccc9.system.entry.js +1 -0
- package/dist/stzh-components/{p-2990206c.system.entry.js → p-5ea652ae.system.entry.js} +1 -1
- package/dist/stzh-components/{p-634095bd.system.entry.js → p-68a8b7b7.system.entry.js} +1 -1
- package/dist/stzh-components/{p-2f2cb544.system.entry.js → p-6c3b2508.system.entry.js} +1 -1
- package/dist/stzh-components/{p-a4100bd8.system.entry.js → p-6fc271d0.system.entry.js} +1 -1
- package/dist/stzh-components/p-7921db30.system.entry.js +1 -0
- package/dist/stzh-components/p-79bfc485.entry.js +1 -0
- package/dist/stzh-components/{p-4cfe83b5.system.entry.js → p-87ab53c4.system.entry.js} +1 -1
- package/dist/stzh-components/{p-b1976630.entry.js → p-8a60addb.entry.js} +1 -1
- package/dist/stzh-components/{p-298276e4.entry.js → p-8bd3ba06.entry.js} +1 -1
- package/dist/stzh-components/{p-0c92ee26.system.entry.js → p-90a10825.system.entry.js} +1 -1
- package/dist/stzh-components/{p-c2d58384.entry.js → p-95a297aa.entry.js} +1 -1
- package/dist/stzh-components/{p-86d3ce62.entry.js → p-95eb03b2.entry.js} +1 -1
- package/dist/stzh-components/p-983f6070.entry.js +1 -0
- package/dist/stzh-components/p-a7253852.entry.js +1 -0
- package/dist/stzh-components/{p-f8d9411d.system.entry.js → p-a760352a.system.entry.js} +1 -1
- package/dist/stzh-components/p-aaa2e48f.system.js +1 -0
- package/dist/stzh-components/p-b281b653.entry.js +8 -0
- package/dist/stzh-components/p-b35b0270.entry.js +1 -0
- package/dist/stzh-components/p-b4fc71ff.system.entry.js +1 -0
- package/dist/stzh-components/{p-79ca1ba6.entry.js → p-bb2e1dda.entry.js} +1 -1
- package/dist/stzh-components/{p-55188328.entry.js → p-bdba7714.entry.js} +1 -1
- package/dist/stzh-components/p-c581e798.system.entry.js +1 -0
- package/dist/stzh-components/p-c7c17bb7.system.entry.js +7 -0
- package/dist/stzh-components/{p-1ccbd2d6.system.entry.js → p-c863ffd0.system.entry.js} +1 -1
- package/dist/stzh-components/{p-3c4478b0.entry.js → p-d8471675.entry.js} +1 -1
- package/dist/stzh-components/{p-0433fff9.system.entry.js → p-da063c7e.system.entry.js} +1 -1
- package/dist/stzh-components/p-e12db90a.entry.js +1 -0
- package/dist/stzh-components/{p-2d0685e3.entry.js → p-ec3d4dd4.entry.js} +1 -1
- package/dist/stzh-components/p-ee5ceac4.entry.js +1 -0
- package/dist/stzh-components/p-f0ca6848.system.entry.js +1 -0
- package/dist/stzh-components/{p-bba52769.system.entry.js → p-f1a58a7c.system.entry.js} +1 -1
- package/dist/stzh-components/{p-1bfc1097.entry.js → p-f2050d1e.entry.js} +1 -1
- package/dist/stzh-components/{p-ff8a3e96.entry.js → p-f610f725.entry.js} +1 -1
- package/dist/stzh-components/p-faf20030.system.js +1 -0
- package/dist/stzh-components/{p-f9dc7a9b.entry.js → p-fba76dba.entry.js} +1 -1
- package/dist/stzh-components/{p-e987954a.system.entry.js → p-fce0e218.system.entry.js} +1 -1
- package/dist/stzh-components/{p-a6486f64.system.entry.js → p-fd16e20e.system.entry.js} +1 -1
- package/dist/stzh-components/stzh-components.css +1 -1
- package/dist/stzh-components/stzh-components.esm.js +1 -1
- package/dist/stzh-components/stzh-components.js +1 -1
- package/dist/types/components.d.ts +68 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/dist/vscode-data.json +20 -1
- package/package.json +1 -1
- package/dist/cjs/utils-d327c19d.js +0 -36
- package/dist/esm/utils-904416df.js +0 -33
- package/dist/esm-es5/app-globals-70c229e3.js +0 -1
- package/dist/esm-es5/utils-904416df.js +0 -1
- package/dist/stzh-components/p-043ab41e.system.entry.js +0 -1
- package/dist/stzh-components/p-323fdc2f.entry.js +0 -1
- package/dist/stzh-components/p-49ea222f.system.entry.js +0 -1
- package/dist/stzh-components/p-5f7b72c8.entry.js +0 -1
- package/dist/stzh-components/p-5f856307.system.js +0 -1
- package/dist/stzh-components/p-6c502e6e.js +0 -1
- package/dist/stzh-components/p-6ea5c23d.system.entry.js +0 -7
- package/dist/stzh-components/p-7279af4a.system.entry.js +0 -1
- package/dist/stzh-components/p-8462ba57.entry.js +0 -1
- package/dist/stzh-components/p-88bef2cd.entry.js +0 -1
- package/dist/stzh-components/p-a7c3b41a.entry.js +0 -1
- package/dist/stzh-components/p-aa4e28cc.system.js +0 -1
- package/dist/stzh-components/p-ac1da083.system.js +0 -1
- package/dist/stzh-components/p-b63d6ded.system.entry.js +0 -1
- package/dist/stzh-components/p-bcade28e.entry.js +0 -1
- package/dist/stzh-components/p-be21cebd.js +0 -1
- package/dist/stzh-components/p-d04e8743.system.entry.js +0 -1
- package/dist/stzh-components/p-d8819b74.system.entry.js +0 -1
- package/dist/stzh-components/p-e048de42.entry.js +0 -8
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
/* Styles for floating label */
|
|
123
123
|
/* Button Right Variant */
|
|
124
124
|
/* Size variants */
|
|
125
|
+
/* Spin button */
|
|
125
126
|
/* Invalid */
|
|
126
127
|
/* Readonly / Disabled */
|
|
127
128
|
}
|
|
@@ -265,8 +266,8 @@
|
|
|
265
266
|
font-family: var(--stzh-font-family-heavy);
|
|
266
267
|
font-weight: var(--stzh-font-weight-heavy);
|
|
267
268
|
font-style: normal;
|
|
268
|
-
font-size: var(--stzh-font-
|
|
269
|
-
line-height: var(--stzh-font-
|
|
269
|
+
font-size: var(--stzh-font-nano-font-size);
|
|
270
|
+
line-height: var(--stzh-font-nano-text-line-height);
|
|
270
271
|
text-overflow: ellipsis;
|
|
271
272
|
white-space: nowrap;
|
|
272
273
|
overflow: hidden;
|
|
@@ -319,8 +320,6 @@
|
|
|
319
320
|
pointer-events: initial;
|
|
320
321
|
}
|
|
321
322
|
.stzh-input:not(.stzh-input--is-readonly):not(.stzh-input--is-disabled) .stzh-input__input:focus + .stzh-input__label, .stzh-input--has-fixed-label .stzh-input__label, .stzh-input--is-filled .stzh-input__label, .stzh-input--is-readonly .stzh-input__label, .stzh-input--is-disabled .stzh-input__label, .stzh-input--has-placeholder .stzh-input__label, .stzh-input--is-invalid .stzh-input__label {
|
|
322
|
-
font-size: var(--stzh-font-nano-font-size);
|
|
323
|
-
line-height: var(--stzh-font-nano-text-line-height);
|
|
324
323
|
display: block;
|
|
325
324
|
top: 0;
|
|
326
325
|
left: calc(var(--stzh-space-medium) - var(--stzh-space-xxsmall));
|
|
@@ -371,6 +370,16 @@
|
|
|
371
370
|
.stzh-input--size-small.stzh-input--has-button-right.stzh-input:not(.stzh-input--is-readonly):not(.stzh-input--is-disabled) .stzh-input__input:focus + .stzh-input__label, .stzh-input--size-small.stzh-input--has-button-right.stzh-input--has-fixed-label .stzh-input__label, .stzh-input--size-small.stzh-input--has-button-right.stzh-input--is-filled .stzh-input__label, .stzh-input--size-small.stzh-input--has-button-right.stzh-input--is-readonly .stzh-input__label, .stzh-input--size-small.stzh-input--has-button-right.stzh-input--is-disabled .stzh-input__label, .stzh-input--size-small.stzh-input--has-button-right.stzh-input--has-placeholder .stzh-input__label, .stzh-input--size-small.stzh-input--has-button-right.stzh-input--is-invalid .stzh-input__label {
|
|
372
371
|
max-width: calc(100% - var(--stzh-space-medium) - var(--stzh-space-xxsmall) - 0.0625rem + var(--stzh-space-xsmall) - var(--stzh-form-input-small-height));
|
|
373
372
|
}
|
|
373
|
+
.stzh-input:not(.stzh-input--has-spin) .stzh-input__input::-webkit-outer-spin-button, .stzh-input:not(.stzh-input--has-spin) .stzh-input__input::-webkit-inner-spin-button {
|
|
374
|
+
-webkit-appearance: none;
|
|
375
|
+
appearance: none;
|
|
376
|
+
margin: 0;
|
|
377
|
+
}
|
|
378
|
+
.stzh-input:not(.stzh-input--has-spin) .stzh-input__input[type=number] {
|
|
379
|
+
-webkit-appearance: textfield;
|
|
380
|
+
-moz-appearance: textfield;
|
|
381
|
+
appearance: textfield;
|
|
382
|
+
}
|
|
374
383
|
.stzh-input--is-invalid .stzh-input__input, .stzh-input--is-invalid .stzh-input__label, .stzh-input--is-invalid .stzh-input__input + .stzh-input__label {
|
|
375
384
|
color: var(--stzh-color-error);
|
|
376
385
|
}
|
|
@@ -16,6 +16,10 @@ export class StzhInput {
|
|
|
16
16
|
this.multiline = false;
|
|
17
17
|
/** If input field, this defines the type (if `search`, a search icon will be displayed) */
|
|
18
18
|
this.type = "text";
|
|
19
|
+
/** If input type is number, this will be the step size */
|
|
20
|
+
this.step = 1;
|
|
21
|
+
/** If input type is number and this property is true, this will show the spin buttons on hover/focus */
|
|
22
|
+
this.showSpin = false;
|
|
19
23
|
/** Whether the element is readonly or not */
|
|
20
24
|
this.readonly = false;
|
|
21
25
|
/** Whether the element is disabled or not */
|
|
@@ -119,7 +123,7 @@ export class StzhInput {
|
|
|
119
123
|
}
|
|
120
124
|
typeWatcher(newValue) {
|
|
121
125
|
const types = [
|
|
122
|
-
"text", "search", "password", "email", "url", "tel"
|
|
126
|
+
"text", "search", "password", "email", "url", "tel", "number"
|
|
123
127
|
];
|
|
124
128
|
if (!this.multiline && !types.includes(newValue)) {
|
|
125
129
|
throw new Error(`Type ${newValue} not supported`);
|
|
@@ -129,7 +133,7 @@ export class StzhInput {
|
|
|
129
133
|
return (h("textarea", { class: "stzh-input__input stzh-input__input--textarea", ref: (el) => (this.input = el), id: this.inputId, name: this.name, rows: this.rows, placeholder: this.placeholder, disabled: this.disabled, readonly: this.readonly, minlength: this.minlength, maxlength: this.maxlength, "aria-describedby": `${this.inputId}-description ${this.a11yDescribedby}`, "aria-required": this.required ? "true" : "false", "aria-invalid": this.invalid ? "true" : "false", onInput: this.onInput, onFocus: this.onFocus, onBlur: this.onBlur }, this.value));
|
|
130
134
|
}
|
|
131
135
|
renderInput() {
|
|
132
|
-
return (h("input", { class: "stzh-input__input stzh-input__input--input", ref: (el) => (this.input = el), id: this.inputId, type: this.type, name: this.name, value: this.value, placeholder: this.placeholder, inputmode: this.inputmode, disabled: this.disabled, readonly: this.readonly, minlength: this.minlength, maxlength: this.maxlength, autocomplete: this.noAutocomplete ? "off" : this.autocomplete, "aria-autocomplete": this.noAutocomplete ? "none" : undefined, "aria-describedby": `${this.inputId}-description ${this.a11yDescribedby}`, "aria-required": this.required ? "true" : "false", "aria-invalid": this.invalid ? "true" : "false", onInput: this.onInput, onFocus: this.onFocus, onBlur: this.onBlur }));
|
|
136
|
+
return (h("input", { class: "stzh-input__input stzh-input__input--input", ref: (el) => (this.input = el), id: this.inputId, type: this.type, name: this.name, value: this.value, min: this.min, max: this.max, step: this.step, placeholder: this.placeholder, inputmode: this.inputmode, disabled: this.disabled, readonly: this.readonly, minlength: this.minlength, maxlength: this.maxlength, autocomplete: this.noAutocomplete ? "off" : this.autocomplete, "aria-autocomplete": this.noAutocomplete ? "none" : undefined, "aria-describedby": `${this.inputId}-description ${this.a11yDescribedby}`, "aria-required": this.required ? "true" : "false", "aria-invalid": this.invalid ? "true" : "false", onInput: this.onInput, onFocus: this.onFocus, onBlur: this.onBlur }));
|
|
133
137
|
}
|
|
134
138
|
async componentWillLoad() {
|
|
135
139
|
this.inputId = `stzh-input-${inputCounter++}`;
|
|
@@ -154,6 +158,7 @@ export class StzhInput {
|
|
|
154
158
|
"stzh-input--has-description": descriptionUsed,
|
|
155
159
|
"stzh-input--has-description-long": descriptionLongUsed,
|
|
156
160
|
"stzh-input--has-error": errorUsed,
|
|
161
|
+
"stzh-input--has-spin": this.showSpin,
|
|
157
162
|
"stzh-input--is-invalid": this.invalid,
|
|
158
163
|
"stzh-input--is-disabled": this.disabled,
|
|
159
164
|
"stzh-input--is-readonly": this.readonly,
|
|
@@ -249,8 +254,8 @@ export class StzhInput {
|
|
|
249
254
|
"type": "string",
|
|
250
255
|
"mutable": false,
|
|
251
256
|
"complexType": {
|
|
252
|
-
"original": "\"text\" | \"search\" | \"password\" | \"email\" | \"url\" | \"tel\"",
|
|
253
|
-
"resolved": "\"email\" | \"password\" | \"search\" | \"tel\" | \"text\" | \"url\"",
|
|
257
|
+
"original": "\"text\" | \"search\" | \"password\" | \"email\" | \"url\" | \"tel\" | \"number\"",
|
|
258
|
+
"resolved": "\"email\" | \"number\" | \"password\" | \"search\" | \"tel\" | \"text\" | \"url\"",
|
|
254
259
|
"references": {}
|
|
255
260
|
},
|
|
256
261
|
"required": false,
|
|
@@ -263,6 +268,76 @@ export class StzhInput {
|
|
|
263
268
|
"reflect": false,
|
|
264
269
|
"defaultValue": "\"text\""
|
|
265
270
|
},
|
|
271
|
+
"step": {
|
|
272
|
+
"type": "number",
|
|
273
|
+
"mutable": false,
|
|
274
|
+
"complexType": {
|
|
275
|
+
"original": "number",
|
|
276
|
+
"resolved": "number",
|
|
277
|
+
"references": {}
|
|
278
|
+
},
|
|
279
|
+
"required": false,
|
|
280
|
+
"optional": false,
|
|
281
|
+
"docs": {
|
|
282
|
+
"tags": [],
|
|
283
|
+
"text": "If input type is number, this will be the step size"
|
|
284
|
+
},
|
|
285
|
+
"attribute": "step",
|
|
286
|
+
"reflect": false,
|
|
287
|
+
"defaultValue": "1"
|
|
288
|
+
},
|
|
289
|
+
"min": {
|
|
290
|
+
"type": "number",
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"complexType": {
|
|
293
|
+
"original": "number",
|
|
294
|
+
"resolved": "number",
|
|
295
|
+
"references": {}
|
|
296
|
+
},
|
|
297
|
+
"required": false,
|
|
298
|
+
"optional": false,
|
|
299
|
+
"docs": {
|
|
300
|
+
"tags": [],
|
|
301
|
+
"text": "If input type is number, this will be the minimum step number"
|
|
302
|
+
},
|
|
303
|
+
"attribute": "min",
|
|
304
|
+
"reflect": false
|
|
305
|
+
},
|
|
306
|
+
"max": {
|
|
307
|
+
"type": "number",
|
|
308
|
+
"mutable": false,
|
|
309
|
+
"complexType": {
|
|
310
|
+
"original": "number",
|
|
311
|
+
"resolved": "number",
|
|
312
|
+
"references": {}
|
|
313
|
+
},
|
|
314
|
+
"required": false,
|
|
315
|
+
"optional": false,
|
|
316
|
+
"docs": {
|
|
317
|
+
"tags": [],
|
|
318
|
+
"text": "If input type is number, this will be the maximum step number"
|
|
319
|
+
},
|
|
320
|
+
"attribute": "max",
|
|
321
|
+
"reflect": false
|
|
322
|
+
},
|
|
323
|
+
"showSpin": {
|
|
324
|
+
"type": "boolean",
|
|
325
|
+
"mutable": false,
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "boolean",
|
|
328
|
+
"resolved": "boolean",
|
|
329
|
+
"references": {}
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"optional": false,
|
|
333
|
+
"docs": {
|
|
334
|
+
"tags": [],
|
|
335
|
+
"text": "If input type is number and this property is true, this will show the spin buttons on hover/focus"
|
|
336
|
+
},
|
|
337
|
+
"attribute": "show-spin",
|
|
338
|
+
"reflect": true,
|
|
339
|
+
"defaultValue": "false"
|
|
340
|
+
},
|
|
266
341
|
"readonly": {
|
|
267
342
|
"type": "boolean",
|
|
268
343
|
"mutable": false,
|
|
@@ -646,15 +646,6 @@ the .has-focus class is used by the focus target */
|
|
|
646
646
|
|
|
647
647
|
.stzh-theme-ma {
|
|
648
648
|
background-color: var(--stzh-color-grey5);
|
|
649
|
-
|
|
650
|
-
/* overwrite p1 and p2 font curves to be always the same size */
|
|
651
|
-
--stzh-font-curve-p1-medium-font-size: var(--stzh-font-milli-font-size);
|
|
652
|
-
--stzh-font-curve-p1-medium-text-line-height: var(--stzh-font-milli-text-line-height);
|
|
653
|
-
--stzh-font-curve-p1-medium-heading-line-height: var(--stzh-font-milli-heading-line-height);
|
|
654
|
-
--stzh-font-curve-p2-medium-font-size: var(--stzh-font-micro-font-size);
|
|
655
|
-
--stzh-font-curve-p2-medium-text-line-height: var(--stzh-font-micro-text-line-height);
|
|
656
|
-
--stzh-font-curve-p2-medium-heading-line-height: var(--stzh-font-micro-heading-line-height);
|
|
657
|
-
--stzh-font-curve-p2-medium-heading-letter-spacing: var(--stzh-font-micro-heading-letter-spacing);
|
|
658
649
|
}
|
|
659
650
|
|
|
660
651
|
:host {
|
|
@@ -84,9 +84,7 @@ export class StzhRadiogroup {
|
|
|
84
84
|
}
|
|
85
85
|
updateRadiosProperty(prop, value) {
|
|
86
86
|
this.radios.forEach((radio) => {
|
|
87
|
-
if (prop === "name"
|
|
88
|
-
|| (this.preventUpdateProperties.indexOf(prop) === -1
|
|
89
|
-
&& radio.getAttribute(prop) === null)) {
|
|
87
|
+
if (prop === "name" || (this.preventUpdateProperties.indexOf(prop) === -1)) {
|
|
90
88
|
radio[camelCase(prop)] = value;
|
|
91
89
|
}
|
|
92
90
|
});
|
|
@@ -103,18 +103,18 @@
|
|
|
103
103
|
position: relative;
|
|
104
104
|
border-radius: var(--border-radius);
|
|
105
105
|
}
|
|
106
|
-
:host.is-ghost::after {
|
|
106
|
+
:host.is-ghost::after, .is-ghost :host::after {
|
|
107
107
|
border-radius: var(--border-radius);
|
|
108
108
|
}
|
|
109
|
-
:host.is-selected, :host.is-chosen {
|
|
109
|
+
:host.is-selected, :host.is-chosen, .is-selected :host, .is-chosen :host {
|
|
110
110
|
--box-shadow: var(--stzh-box-shadow-overlay);
|
|
111
111
|
}
|
|
112
|
-
:host.is-ghost {
|
|
112
|
+
:host.is-ghost, .is-ghost :host {
|
|
113
113
|
--box-shadow: none;
|
|
114
114
|
--border: 0.0625rem solid transparent;
|
|
115
115
|
overflow: hidden;
|
|
116
116
|
}
|
|
117
|
-
:host.is-drag, :host.is-chosen, :host.is-ghost, :host.is-selected {
|
|
117
|
+
:host.is-drag, :host.is-chosen, :host.is-ghost, :host.is-selected, .is-drag :host, .is-chosen :host, .is-ghost :host, .is-selected :host {
|
|
118
118
|
--dnd-visibility: visible;
|
|
119
119
|
--dnd-opacity: 1;
|
|
120
120
|
}
|
|
@@ -50,6 +50,9 @@ export class StzhServicecard {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
this.update = () => {
|
|
53
|
+
if (!this.mainElement) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
53
56
|
this.mainElement.classList.remove("stzh-servicecard--has-collapsed-header");
|
|
54
57
|
if (media('medium').matches) {
|
|
55
58
|
const headerWidth = this.headerElement.clientWidth;
|
|
@@ -97,13 +100,15 @@ export class StzhServicecard {
|
|
|
97
100
|
this.arrowUpClick = () => {
|
|
98
101
|
const sortable = this.element.closest("stzh-sortable");
|
|
99
102
|
if (sortable) {
|
|
100
|
-
|
|
103
|
+
const element = this.findSortableChildElement();
|
|
104
|
+
sortable.moveItem(element, "up");
|
|
101
105
|
}
|
|
102
106
|
};
|
|
103
107
|
this.arrowDownClick = () => {
|
|
104
108
|
const sortable = this.element.closest("stzh-sortable");
|
|
105
109
|
if (sortable) {
|
|
106
|
-
|
|
110
|
+
const element = this.findSortableChildElement();
|
|
111
|
+
sortable.moveItem(element, "down");
|
|
107
112
|
}
|
|
108
113
|
};
|
|
109
114
|
}
|
|
@@ -134,6 +139,23 @@ export class StzhServicecard {
|
|
|
134
139
|
this._actions = newValue;
|
|
135
140
|
}
|
|
136
141
|
}
|
|
142
|
+
findSortableChildElement() {
|
|
143
|
+
const sortable = this.element.closest("stzh-sortable");
|
|
144
|
+
if (sortable) {
|
|
145
|
+
let element = this.element;
|
|
146
|
+
let sortableContainer = null;
|
|
147
|
+
if (typeof sortable.container === "function") {
|
|
148
|
+
sortableContainer = sortable.container();
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
sortableContainer = sortable.container;
|
|
152
|
+
}
|
|
153
|
+
while (element.parentElement !== sortableContainer) {
|
|
154
|
+
element = element.parentElement;
|
|
155
|
+
}
|
|
156
|
+
return element;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
137
159
|
async componentWillLoad() {
|
|
138
160
|
this.subtitleWatcher(this.subtitle);
|
|
139
161
|
this.actionsWatcher(this.actions);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { cloneElement } from "../../utils/utils";
|
|
2
3
|
import { fetchTranslations } from "../../utils/translation-utils";
|
|
3
4
|
/**
|
|
4
5
|
* @slot - Slot for `stzh-servicecard` elements
|
|
@@ -6,12 +7,28 @@ import { fetchTranslations } from "../../utils/translation-utils";
|
|
|
6
7
|
*/
|
|
7
8
|
export class StzhServicecardList {
|
|
8
9
|
constructor() {
|
|
9
|
-
/** Whether sorting should be disabled */
|
|
10
|
-
this.sortableDisabled = false;
|
|
11
10
|
/** Whether collapse/expand toggle link */
|
|
12
11
|
this.showToggleLink = false;
|
|
12
|
+
/** Whether sorting should be disabled */
|
|
13
|
+
this.sortableDisabled = false;
|
|
13
14
|
/** HTML attribute that is used by the `toArray()` of sortable method */
|
|
14
15
|
this.sortableDataIdAttribute = "data-id";
|
|
16
|
+
/** Algorithm how the ghost element will be cloned */
|
|
17
|
+
this.sortableGhostClone = (dragElement) => {
|
|
18
|
+
const [clonedElement, clonedStzhElement, originalStzhElement] = cloneElement(dragElement);
|
|
19
|
+
if (clonedStzhElement
|
|
20
|
+
&& originalStzhElement
|
|
21
|
+
&& clonedStzhElement.tagName.toLowerCase() === 'stzh-servicecard') {
|
|
22
|
+
const clonedStzhElementCard = clonedStzhElement;
|
|
23
|
+
const originalStzhElementCard = originalStzhElement;
|
|
24
|
+
// copy every property that is not reflected to its attribute
|
|
25
|
+
clonedStzhElementCard.heading = originalStzhElementCard.heading;
|
|
26
|
+
clonedStzhElementCard.subtitle = originalStzhElementCard.subtitle;
|
|
27
|
+
clonedStzhElementCard.actions = originalStzhElementCard.actions;
|
|
28
|
+
clonedStzhElementCard.hideMovementActions = originalStzhElementCard.hideMovementActions;
|
|
29
|
+
}
|
|
30
|
+
return clonedElement;
|
|
31
|
+
};
|
|
15
32
|
this.allCollapsed = false;
|
|
16
33
|
this.collapseClick = () => {
|
|
17
34
|
const cards = Array.from(this.element.querySelectorAll("stzh-servicecard"));
|
|
@@ -43,7 +60,7 @@ export class StzhServicecardList {
|
|
|
43
60
|
"stzh-servicecard-list": true
|
|
44
61
|
};
|
|
45
62
|
return (h(Host, null, h("div", { class: classes }, h("div", { class: "stzh-servicecard-list__header" }, h("div", { class: "stzh-servicecard-list__description" }, h("slot", { name: "description" })), this.showToggleLink &&
|
|
46
|
-
h("stzh-link", { class: "stzh-servicecard-list__switch", icon: this.allCollapsed ? "list-expanded" : "list-shrinked", label: this.allCollapsed ? this.localization.expandAll : this.localization.collapseAll, onClick: this.collapseClick })), h("stzh-sortable", { disabled: this.sortableDisabled, dataIdAttribute: this.sortableDataIdAttribute }, h("div", { class: "stzh-servicecard-list__cards", role: "list" }, h("slot", null))))));
|
|
63
|
+
h("stzh-link", { class: "stzh-servicecard-list__switch", icon: this.allCollapsed ? "list-expanded" : "list-shrinked", label: this.allCollapsed ? this.localization.expandAll : this.localization.collapseAll, onClick: this.collapseClick })), h("stzh-sortable", { disabled: this.sortableDisabled, dataIdAttribute: this.sortableDataIdAttribute, ghostClone: this.sortableGhostClone }, h("div", { class: "stzh-servicecard-list__cards", role: "list" }, h("slot", null))))));
|
|
47
64
|
}
|
|
48
65
|
static get is() { return "stzh-servicecard-list"; }
|
|
49
66
|
static get encapsulation() { return "scoped"; }
|
|
@@ -79,7 +96,7 @@ export class StzhServicecardList {
|
|
|
79
96
|
"text": "Translation strings"
|
|
80
97
|
}
|
|
81
98
|
},
|
|
82
|
-
"
|
|
99
|
+
"showToggleLink": {
|
|
83
100
|
"type": "boolean",
|
|
84
101
|
"mutable": false,
|
|
85
102
|
"complexType": {
|
|
@@ -91,13 +108,13 @@ export class StzhServicecardList {
|
|
|
91
108
|
"optional": false,
|
|
92
109
|
"docs": {
|
|
93
110
|
"tags": [],
|
|
94
|
-
"text": "Whether
|
|
111
|
+
"text": "Whether collapse/expand toggle link"
|
|
95
112
|
},
|
|
96
|
-
"attribute": "
|
|
97
|
-
"reflect":
|
|
113
|
+
"attribute": "show-toggle-link",
|
|
114
|
+
"reflect": true,
|
|
98
115
|
"defaultValue": "false"
|
|
99
116
|
},
|
|
100
|
-
"
|
|
117
|
+
"sortableDisabled": {
|
|
101
118
|
"type": "boolean",
|
|
102
119
|
"mutable": false,
|
|
103
120
|
"complexType": {
|
|
@@ -109,10 +126,10 @@ export class StzhServicecardList {
|
|
|
109
126
|
"optional": false,
|
|
110
127
|
"docs": {
|
|
111
128
|
"tags": [],
|
|
112
|
-
"text": "Whether
|
|
129
|
+
"text": "Whether sorting should be disabled"
|
|
113
130
|
},
|
|
114
|
-
"attribute": "
|
|
115
|
-
"reflect":
|
|
131
|
+
"attribute": "sortable-disabled",
|
|
132
|
+
"reflect": false,
|
|
116
133
|
"defaultValue": "false"
|
|
117
134
|
},
|
|
118
135
|
"sortableDataIdAttribute": {
|
|
@@ -132,6 +149,32 @@ export class StzhServicecardList {
|
|
|
132
149
|
"attribute": "sortable-data-id-attribute",
|
|
133
150
|
"reflect": false,
|
|
134
151
|
"defaultValue": "\"data-id\""
|
|
152
|
+
},
|
|
153
|
+
"sortableGhostClone": {
|
|
154
|
+
"type": "unknown",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "Function",
|
|
158
|
+
"resolved": "Function",
|
|
159
|
+
"references": {
|
|
160
|
+
"Function": {
|
|
161
|
+
"location": "global"
|
|
162
|
+
},
|
|
163
|
+
"HTMLElement": {
|
|
164
|
+
"location": "global"
|
|
165
|
+
},
|
|
166
|
+
"HTMLStzhServicecardElement": {
|
|
167
|
+
"location": "global"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": false,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": "Algorithm how the ghost element will be cloned"
|
|
176
|
+
},
|
|
177
|
+
"defaultValue": "(dragElement: HTMLElement) => {\n const [clonedElement, clonedStzhElement, originalStzhElement] = cloneElement(dragElement);\n\n if (\n clonedStzhElement\n && originalStzhElement\n && clonedStzhElement.tagName.toLowerCase() === 'stzh-servicecard'\n ) {\n const clonedStzhElementCard: HTMLStzhServicecardElement = clonedStzhElement as HTMLStzhServicecardElement;\n const originalStzhElementCard: HTMLStzhServicecardElement = originalStzhElement as HTMLStzhServicecardElement;\n\n // copy every property that is not reflected to its attribute\n clonedStzhElementCard.heading = originalStzhElementCard.heading;\n clonedStzhElementCard.subtitle = originalStzhElementCard.subtitle;\n clonedStzhElementCard.actions = originalStzhElementCard.actions;\n clonedStzhElementCard.hideMovementActions = originalStzhElementCard.hideMovementActions;\n }\n\n return clonedElement;\n }"
|
|
135
178
|
}
|
|
136
179
|
};
|
|
137
180
|
}
|
|
@@ -102,7 +102,8 @@ const Template = (args) => (
|
|
|
102
102
|
Content Middle Section 1
|
|
103
103
|
</stzh-section>
|
|
104
104
|
<stzh-section slot="middle">
|
|
105
|
-
Content Middle Section 2
|
|
105
|
+
Content Middle Section 2 with Input:
|
|
106
|
+
<stzh-input></stzh-input>
|
|
106
107
|
</stzh-section>
|
|
107
108
|
<stzh-button label="Button Right" slot="right" fullwidth></stzh-button>
|
|
108
109
|
</stzh-servicecard>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
3
|
-
import Sortable from "
|
|
3
|
+
import Sortable from "../../libraries/sortable";
|
|
4
|
+
import { cloneElement } from "../../utils/utils";
|
|
4
5
|
import { fetchTranslations } from "../../utils/translation-utils";
|
|
5
6
|
const CLASS_ITEM = 'is-sortable-item';
|
|
6
7
|
const CLASS_GHOST = "is-ghost";
|
|
@@ -23,6 +24,11 @@ export class StzhSortable {
|
|
|
23
24
|
var _a;
|
|
24
25
|
return (_a = this.containerElement) === null || _a === void 0 ? void 0 : _a.firstElementChild;
|
|
25
26
|
};
|
|
27
|
+
/** Algorithm how the ghost element will be cloned */
|
|
28
|
+
this.ghostClone = (dragElement) => {
|
|
29
|
+
const [clonedElement] = cloneElement(dragElement);
|
|
30
|
+
return clonedElement;
|
|
31
|
+
};
|
|
26
32
|
/** Filtered elements that should prevent dragging inside the drag item elements */
|
|
27
33
|
this.filterElements = [
|
|
28
34
|
"[data-stzh-sortable-filtered]",
|
|
@@ -78,17 +84,13 @@ export class StzhSortable {
|
|
|
78
84
|
};
|
|
79
85
|
this.onKeydown = (event) => {
|
|
80
86
|
const currentTarget = event.currentTarget;
|
|
87
|
+
const target = event.target;
|
|
81
88
|
if (!this.getContainer() || this.disabled) {
|
|
82
89
|
return;
|
|
83
90
|
}
|
|
84
|
-
|
|
85
|
-
|| (event.key === "Tab"
|
|
86
|
-
&& this.selectedItem
|
|
87
|
-
&& this.selectedItem === event.currentTarget)) {
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
}
|
|
90
|
-
const isFilteredElement = currentTarget.matches(this._filterElements.join(', '));
|
|
91
|
+
const isFilteredElement = target.matches(this._filterElements.join(', '));
|
|
91
92
|
if (event.key === " " && !isFilteredElement) {
|
|
93
|
+
event.preventDefault();
|
|
92
94
|
if (!this.selectedItem) {
|
|
93
95
|
this.selectedItem = currentTarget;
|
|
94
96
|
this.selectedItem.parentElement.classList.add(CLASS_PARENT_SELECTED);
|
|
@@ -104,6 +106,9 @@ export class StzhSortable {
|
|
|
104
106
|
this.resetActiveItem();
|
|
105
107
|
}
|
|
106
108
|
}
|
|
109
|
+
else if (event.key === "Tab" && this.selectedItem && this.selectedItem === event.currentTarget) {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
}
|
|
107
112
|
else if (event.key === "Escape" && this.selectedItem) {
|
|
108
113
|
this.resetItemOnBlur = false;
|
|
109
114
|
this.updateAriaLive(this.localization.canceled);
|
|
@@ -260,6 +265,7 @@ export class StzhSortable {
|
|
|
260
265
|
delay: 200,
|
|
261
266
|
delayOnTouchOnly: true,
|
|
262
267
|
disabled: this.disabled,
|
|
268
|
+
ghostClone: this.ghostClone,
|
|
263
269
|
// changed sorting within list
|
|
264
270
|
onUpdate: this.updated
|
|
265
271
|
});
|
|
@@ -378,6 +384,29 @@ export class StzhSortable {
|
|
|
378
384
|
},
|
|
379
385
|
"defaultValue": "() => {\n return this.containerElement?.firstElementChild;\n }"
|
|
380
386
|
},
|
|
387
|
+
"ghostClone": {
|
|
388
|
+
"type": "unknown",
|
|
389
|
+
"mutable": false,
|
|
390
|
+
"complexType": {
|
|
391
|
+
"original": "Function",
|
|
392
|
+
"resolved": "Function",
|
|
393
|
+
"references": {
|
|
394
|
+
"Function": {
|
|
395
|
+
"location": "global"
|
|
396
|
+
},
|
|
397
|
+
"HTMLElement": {
|
|
398
|
+
"location": "global"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"required": false,
|
|
403
|
+
"optional": false,
|
|
404
|
+
"docs": {
|
|
405
|
+
"tags": [],
|
|
406
|
+
"text": "Algorithm how the ghost element will be cloned"
|
|
407
|
+
},
|
|
408
|
+
"defaultValue": "(dragElement: HTMLElement) => {\n const [clonedElement] = cloneElement(dragElement);\n return clonedElement;\n }"
|
|
409
|
+
},
|
|
381
410
|
"filterElements": {
|
|
382
411
|
"type": "string",
|
|
383
412
|
"mutable": false,
|
|
@@ -386,6 +386,9 @@ stzh-upload *::after {
|
|
|
386
386
|
.stzh-upload.dz-started .stzh-upload__clickarea {
|
|
387
387
|
margin-bottom: var(--stzh-space-small);
|
|
388
388
|
}
|
|
389
|
+
.stzh-upload:has(.stzh-upload__preview) .stzh-upload__clickarea {
|
|
390
|
+
margin-bottom: var(--stzh-space-small);
|
|
391
|
+
}
|
|
389
392
|
.stzh-upload.dz-drag-hover .stzh-upload__clickarea {
|
|
390
393
|
background-color: var(--stzh-color-primary4);
|
|
391
394
|
}
|
|
@@ -18,7 +18,11 @@ let uploadCounter = 0;
|
|
|
18
18
|
*/
|
|
19
19
|
export class StzhUpload {
|
|
20
20
|
constructor() {
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Initially pre existing files (e.g. already uploaded by the user).
|
|
23
|
+
* Array of objects that must at least include `name` and `size` attribute:
|
|
24
|
+
* `[{"name":"file1.txt", "size": 12345}, {"name":"file2.txt", "size": 12345}]`
|
|
25
|
+
*/
|
|
22
26
|
this.existingFiles = [];
|
|
23
27
|
this._existingFiles = [];
|
|
24
28
|
/** Label */
|
|
@@ -224,6 +228,7 @@ export class StzhUpload {
|
|
|
224
228
|
if (this.dropzone) {
|
|
225
229
|
return;
|
|
226
230
|
}
|
|
231
|
+
const self = this;
|
|
227
232
|
this.dropzone = new Dropzone(this.dropzoneElement, {
|
|
228
233
|
url: this.url,
|
|
229
234
|
method: this.method,
|
|
@@ -258,7 +263,35 @@ export class StzhUpload {
|
|
|
258
263
|
dictResponseError: this.localization.responseError,
|
|
259
264
|
dictInvalidFileType: this.localization.invalidFileType,
|
|
260
265
|
dictFileTooBig: this.localization.fileTooBig,
|
|
261
|
-
|
|
266
|
+
// When the upload is finished, either with success or an error.
|
|
267
|
+
// Taken from https://github.com/dropzone/dropzone/blob/v5.9.3/src/options.js#L752
|
|
268
|
+
complete(file) {
|
|
269
|
+
for (let node of file.previewElement.querySelectorAll("[data-dz-remove]")) {
|
|
270
|
+
node.setAttribute('title', this.options.dictRemoveFile);
|
|
271
|
+
node.setAttribute('aria-label', this.options.dictRemoveFile);
|
|
272
|
+
}
|
|
273
|
+
// move file uploads with errors to another element, so they are grouped together
|
|
274
|
+
if (file.status === "error") {
|
|
275
|
+
self.errorsElement.appendChild(file.previewElement);
|
|
276
|
+
}
|
|
277
|
+
if (file._removeLink) {
|
|
278
|
+
file._removeLink.innerHTML = this.options.dictRemoveFile;
|
|
279
|
+
}
|
|
280
|
+
if (file.previewElement) {
|
|
281
|
+
return file.previewElement.classList.add("dz-complete");
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
// Called whenever a file is removed.
|
|
285
|
+
// Taken fom https://github.com/dropzone/dropzone/blob/v5.9.3/src/options.js#L649
|
|
286
|
+
removedfile(file) {
|
|
287
|
+
if (file.previewElement != null && file.previewElement.parentNode != null) {
|
|
288
|
+
file.previewElement.parentNode.removeChild(file.previewElement);
|
|
289
|
+
}
|
|
290
|
+
// set focus to upload
|
|
291
|
+
self.buttonElement.setFocus();
|
|
292
|
+
return this._updateMaxFilesReachedClass();
|
|
293
|
+
},
|
|
294
|
+
error(file, message, xhr) {
|
|
262
295
|
if (file.previewElement) {
|
|
263
296
|
file.previewElement.classList.add("dz-error");
|
|
264
297
|
if (typeof message !== "string" && message.error) {
|
|
@@ -266,19 +299,19 @@ export class StzhUpload {
|
|
|
266
299
|
}
|
|
267
300
|
else if (xhr) {
|
|
268
301
|
if (xhr.status === 401 || xhr.status === 403) {
|
|
269
|
-
message =
|
|
302
|
+
message = self.localization.accessError;
|
|
270
303
|
}
|
|
271
304
|
else if (xhr.status === 413) {
|
|
272
|
-
message =
|
|
305
|
+
message = self.localization.fileTooBigServer;
|
|
273
306
|
}
|
|
274
307
|
else if (xhr.status === 415) {
|
|
275
|
-
message =
|
|
308
|
+
message = self.localization.invalidFileType;
|
|
276
309
|
}
|
|
277
310
|
else if (xhr.status >= 500) {
|
|
278
|
-
message =
|
|
311
|
+
message = self.localization.serverError;
|
|
279
312
|
}
|
|
280
313
|
else {
|
|
281
|
-
const defaultError =
|
|
314
|
+
const defaultError = self.localization.responseError
|
|
282
315
|
.replace("{{statusCode}}", xhr.status);
|
|
283
316
|
message = defaultError;
|
|
284
317
|
}
|
|
@@ -323,7 +356,7 @@ export class StzhUpload {
|
|
|
323
356
|
</div>
|
|
324
357
|
</div>
|
|
325
358
|
<div class="stzh-upload__actions">
|
|
326
|
-
<button class="stzh-upload__delete" data-dz-remove title="${this.localization.cancelUpload}">
|
|
359
|
+
<button class="stzh-upload__delete" data-dz-remove aria-label="${this.localization.cancelUpload}" title="${this.localization.cancelUpload}">
|
|
327
360
|
<stzh-icon class="stzh-upload__delete-icon" name="delete"></stzh-icon>
|
|
328
361
|
<stzh-icon class="stzh-upload__delete-icon-error" name="close"></stzh-icon>
|
|
329
362
|
</button>
|
|
@@ -420,7 +453,7 @@ export class StzhUpload {
|
|
|
420
453
|
"stzh-upload--has-error": errorUsed,
|
|
421
454
|
"stzh-upload--has-instructions": !!this.description || !!this.localization.description
|
|
422
455
|
};
|
|
423
|
-
return (h(Host, null, h("div", { class: classes, ref: (el) => (this.dropzoneElement = el) }, this.label && h("div", { class: "stzh-upload__label" }, this.label), h("div", { class: "stzh-upload__clickarea", ref: (el) => (this.clickareaElement = el) }, h("div", { class: "stzh-upload__instructions", id: `${this.uploadId}-instruction` }, this.description ? this.description : this.localization.description), h("stzh-button", { size: "small", class: "stzh-upload__button", "aria-describedby": `${this.uploadId}-instruction ${this.uploadId}-description`, disabled: this.disabled }, this.button ? this.button : this.localization.button)), h(StzhInputDescription, { classPrefix: "stzh-upload", id: `${this.uploadId}-description`, error: this._error }))));
|
|
456
|
+
return (h(Host, null, h("div", { class: classes, ref: (el) => (this.dropzoneElement = el) }, this.label && h("div", { class: "stzh-upload__label" }, this.label), h("div", { class: "stzh-upload__clickarea", ref: (el) => (this.clickareaElement = el) }, h("div", { class: "stzh-upload__instructions", id: `${this.uploadId}-instruction` }, this.description ? this.description : this.localization.description), h("stzh-button", { size: "small", class: "stzh-upload__button", ref: (el) => (this.buttonElement = el), "aria-describedby": `${this.uploadId}-instruction ${this.uploadId}-description`, disabled: this.disabled }, this.button ? this.button : this.localization.button)), h(StzhInputDescription, { classPrefix: "stzh-upload", id: `${this.uploadId}-description`, error: this._error }), h("div", { class: "stzh-upload__errors", ref: (el) => (this.errorsElement = el) }))));
|
|
424
457
|
}
|
|
425
458
|
static get is() { return "stzh-upload"; }
|
|
426
459
|
static get originalStyleUrls() {
|
|
@@ -452,7 +485,7 @@ export class StzhUpload {
|
|
|
452
485
|
"optional": false,
|
|
453
486
|
"docs": {
|
|
454
487
|
"tags": [],
|
|
455
|
-
"text": ""
|
|
488
|
+
"text": "Initially pre existing files (e.g. already uploaded by the user).\nArray of objects that must at least include `name` and `size` attribute:\n`[{\"name\":\"file1.txt\", \"size\": 12345}, {\"name\":\"file2.txt\", \"size\": 12345}]`"
|
|
456
489
|
},
|
|
457
490
|
"attribute": "existing-files",
|
|
458
491
|
"reflect": false,
|
|
@@ -11,20 +11,22 @@ export default {
|
|
|
11
11
|
actions: {
|
|
12
12
|
handles: [
|
|
13
13
|
'stzhFileAdded',
|
|
14
|
-
'
|
|
15
|
-
'
|
|
14
|
+
'stzhFilesAdded',
|
|
15
|
+
'stzhFileRemoved',
|
|
16
|
+
'stzhSending',
|
|
17
|
+
'stzhSendingMultiple',
|
|
16
18
|
'stzhProcessing',
|
|
17
19
|
'stzhProcessingMultiple',
|
|
18
20
|
'stzhProgress',
|
|
19
21
|
'stzhProgressTotal',
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
+
'stzhCanceled',
|
|
23
|
+
'stzhCanceledMultiple',
|
|
22
24
|
'stzhSuccess',
|
|
23
25
|
'stzhSuccessMultiple',
|
|
24
26
|
'stzhError',
|
|
25
27
|
'stzhErrorMultiple',
|
|
26
28
|
'stzhComplete',
|
|
27
|
-
'stzhCompleteMultiple'
|
|
29
|
+
'stzhCompleteMultiple'
|
|
28
30
|
]
|
|
29
31
|
},
|
|
30
32
|
docs: {
|
|
@@ -62,8 +64,8 @@ ExistingFiles.args = {
|
|
|
62
64
|
description: 'To upload files drag & drop them in this area. Allowed file formats: [txt, pdf, docx] (max. 25 MB)',
|
|
63
65
|
'accepted-files': '.txt,.pdf,.docs',
|
|
64
66
|
'existing-files': `[
|
|
65
|
-
{ "name": "Filename.pdf", "size": 12345 },
|
|
66
|
-
{ "name": "Filename2.pdf", "size": 22345 },
|
|
67
|
-
{ "name": "Filename3.pdf", "size": 32345 }
|
|
67
|
+
{ "name": "Filename.pdf", "size": 12345, "id": "upload-1" },
|
|
68
|
+
{ "name": "Filename2.pdf", "size": 22345, "id": "upload-2" },
|
|
69
|
+
{ "name": "Filename3.pdf", "size": 32345, "id": "upload-3" }
|
|
68
70
|
]`
|
|
69
71
|
};
|