@salla.sa/twilight-components 2.11.2 → 2.11.4
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/loader.cjs.js +1 -1
- package/dist/cjs/salla-button_37.cjs.entry.js +856 -346
- package/dist/cjs/salla-installment.cjs.entry.js +2 -2
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +48 -20
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +278 -678
- package/dist/collection/components/salla-gifting/salla-gifting.js +24 -43
- package/dist/collection/components/salla-installment/salla-installment.js +2 -2
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +21 -39
- package/dist/collection/components/salla-product-options/salla-product-options.js +27 -42
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +1 -0
- package/dist/components/salla-datetime-picker2.js +8 -12
- package/dist/components/salla-file-upload2.js +783 -214
- package/dist/components/salla-gifting.js +22 -41
- package/dist/components/salla-installment.js +2 -2
- package/dist/components/salla-login-modal.js +21 -39
- package/dist/components/salla-product-options.js +26 -41
- package/dist/components/salla-user-menu.js +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-button_37.entry.js +856 -346
- package/dist/esm/salla-installment.entry.js +2 -2
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-button_37.entry.js +11 -5
- package/dist/esm-es5/salla-installment.entry.js +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/p-0a16e246.system.js +1 -1
- package/dist/twilight/p-2e7701fe.entry.js +36 -0
- package/dist/twilight/{p-5ca2cbe3.system.entry.js → p-3db06115.system.entry.js} +11 -5
- package/dist/twilight/{p-82931e46.entry.js → p-7e9e675f.entry.js} +1 -1
- package/dist/twilight/{p-21aa165d.system.entry.js → p-a6821ab8.system.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-datetime-picker/salla-datetime-picker.d.ts +9 -3
- package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +52 -104
- package/dist/types/components/salla-gifting/salla-gifting.d.ts +13 -13
- package/dist/types/components/salla-product-options/interfaces.d.ts +1 -0
- package/dist/types/components/salla-product-options/salla-product-options.d.ts +3 -4
- package/dist/types/components.d.ts +81 -217
- package/package.json +5 -4
- package/dist/twilight/p-cfe3a7ef.entry.js +0 -30
|
@@ -5326,7 +5326,7 @@ const SallaDatetimePicker = class {
|
|
|
5326
5326
|
/**
|
|
5327
5327
|
* Allows the user to enter a date directly into the input field. By default, direct entry is disabled.
|
|
5328
5328
|
*/
|
|
5329
|
-
this.allowInput =
|
|
5329
|
+
this.allowInput = true;
|
|
5330
5330
|
/**
|
|
5331
5331
|
* Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
|
|
5332
5332
|
*/
|
|
@@ -5484,14 +5484,10 @@ const SallaDatetimePicker = class {
|
|
|
5484
5484
|
*/
|
|
5485
5485
|
this.wrap = false;
|
|
5486
5486
|
}
|
|
5487
|
-
|
|
5488
|
-
this.value
|
|
5489
|
-
this.picked.emit(this.value);
|
|
5487
|
+
render() {
|
|
5488
|
+
return index.h("div", { class: "s-datetime-picker" }, index.h("input", { type: "datetime", name: this.name, value: this.value, required: this.required, placeholder: this.placeholder, class: "s-datetime-picker-input", ref: (el) => this.dateInput = el }));
|
|
5490
5489
|
}
|
|
5491
5490
|
componentDidLoad() {
|
|
5492
|
-
this.initPicker();
|
|
5493
|
-
}
|
|
5494
|
-
initPicker() {
|
|
5495
5491
|
let options = {
|
|
5496
5492
|
allowInput: this.allowInput,
|
|
5497
5493
|
allowInvalidPreload: this.allowInvalidPreload,
|
|
@@ -5537,15 +5533,13 @@ const SallaDatetimePicker = class {
|
|
|
5537
5533
|
time_24hr: this.time_24hr,
|
|
5538
5534
|
weekNumbers: this.weekNumbers,
|
|
5539
5535
|
wrap: this.wrap,
|
|
5540
|
-
//
|
|
5536
|
+
// @ts-ignore
|
|
5537
|
+
onChange: (selectedDates, dateStr) => this.picked.emit(this.value = dateStr)
|
|
5541
5538
|
// onOpen: this.handleOnOpen(selectedDates, dateStr, instance)
|
|
5542
5539
|
// onClose: this.handleOnClose(selectedDates, dateStr, instance)
|
|
5543
5540
|
};
|
|
5544
5541
|
flatpickr(this.dateInput, options);
|
|
5545
5542
|
}
|
|
5546
|
-
render() {
|
|
5547
|
-
return (index.h("div", { class: "s-datetime-picker" }, index.h("input", { type: "datetime", class: "s-datetime-picker-input", ref: (el) => this.dateInput = el, value: this.value, placeholder: this.placeholder, onInput: this.onInputChange.bind(this) })));
|
|
5548
|
-
}
|
|
5549
5543
|
};
|
|
5550
5544
|
SallaDatetimePicker.style = sallaDatetimePickerCss;
|
|
5551
5545
|
|
|
@@ -20022,156 +20016,697 @@ var filepondPluginFileValidateType = _commonjsHelpers.createCommonjsModule(funct
|
|
|
20022
20016
|
});
|
|
20023
20017
|
});
|
|
20024
20018
|
|
|
20025
|
-
const sallaFileUploadCss = "/*!\n * FilePond 4.30.4\n * Licensed under MIT, https://opensource.org/licenses/MIT/\n * Please visit https://pqina.nl/filepond/ for details.\n */.filepond--assistant{position:absolute;overflow:hidden;height:1px;width:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);white-space:nowrap}.filepond--browser.filepond--browser{position:absolute;margin:0;padding:0;left:1em;top:1.75em;width:calc(100% - 2em);opacity:0;font-size:0}.filepond--data{position:absolute;width:0;height:0;padding:0;margin:0;border:none;visibility:hidden;pointer-events:none;contain:strict}.filepond--drip{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;opacity:.1;pointer-events:none;border-radius:.5em;background:rgba(0,0,0,.01)}.filepond--drip-blob{-webkit-transform-origin:center center;transform-origin:center center;width:8em;height:8em;margin-left:-4em;margin-top:-4em;background:#292625;border-radius:50%}.filepond--drip-blob,.filepond--drop-label{position:absolute;top:0;left:0;will-change:transform,opacity}.filepond--drop-label{right:0;margin:0;color:#4f4f4f;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--drop-label.filepond--drop-label label{display:block;margin:0;padding:.5em}.filepond--drop-label label{cursor:default;font-size:.875em;font-weight:400;text-align:center;line-height:1.5}.filepond--label-action{text-decoration:underline;-webkit-text-decoration-skip:ink;text-decoration-skip-ink:auto;-webkit-text-decoration-color:#a7a4a4;text-decoration-color:#a7a4a4;cursor:pointer}.filepond--root[data-disabled] .filepond--drop-label label{opacity:.5}.filepond--file-action-button.filepond--file-action-button{font-size:1em;width:1.625em;height:1.625em;font-family:inherit;line-height:inherit;margin:0;padding:0;border:none;outline:none;will-change:transform,opacity}.filepond--file-action-button.filepond--file-action-button span{position:absolute;overflow:hidden;height:1px;width:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);white-space:nowrap}.filepond--file-action-button.filepond--file-action-button svg{width:100%;height:100%}.filepond--file-action-button.filepond--file-action-button:after{position:absolute;left:-.75em;right:-.75em;top:-.75em;bottom:-.75em;content:\"\"}.filepond--file-action-button{cursor:auto;color:#fff;border-radius:50%;background-color:rgba(0,0,0,.5);background-image:none;-webkit-box-shadow:0 0 0 0 hsla(0,0%,100%,0);box-shadow:0 0 0 0 hsla(0,0%,100%,0);-webkit-transition:-webkit-box-shadow .25s ease-in;transition:-webkit-box-shadow .25s ease-in;transition:box-shadow .25s ease-in;transition:box-shadow .25s ease-in, -webkit-box-shadow .25s ease-in}.filepond--file-action-button:focus,.filepond--file-action-button:hover{-webkit-box-shadow:0 0 0 .125em hsla(0,0%,100%,.9);box-shadow:0 0 0 .125em hsla(0,0%,100%,.9)}.filepond--file-action-button[disabled]{color:hsla(0,0%,100%,.5);background-color:rgba(0,0,0,.25)}.filepond--file-action-button[hidden]{display:none}.filepond--action-edit-item.filepond--action-edit-item{width:2em;height:2em;padding:.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*=center]{margin-left:-.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*=bottom]{margin-bottom:-.1875em}.filepond--action-edit-item-alt{border:none;line-height:inherit;background:transparent;font-family:inherit;color:inherit;outline:none;padding:0;margin:0 0 0 .25em;pointer-events:all;position:absolute}.filepond--action-edit-item-alt svg{width:1.3125em;height:1.3125em}.filepond--action-edit-item-alt span{font-size:0;opacity:0}.filepond--file-info{position:static;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start;-ms-flex:1;flex:1;margin:0 .5em 0 0;min-width:0;will-change:transform,opacity;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--file-info *{margin:0}.filepond--file-info .filepond--file-info-main{font-size:.75em;line-height:1.2;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%}.filepond--file-info .filepond--file-info-sub{font-size:.625em;opacity:.5;-webkit-transition:opacity .25s ease-in-out;transition:opacity .25s ease-in-out;white-space:nowrap}.filepond--file-info .filepond--file-info-sub:empty{display:none}.filepond--file-status{position:static;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:end;align-items:flex-end;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;margin:0;min-width:2.25em;text-align:right;will-change:transform,opacity;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--file-status *{margin:0;white-space:nowrap}.filepond--file-status .filepond--file-status-main{font-size:.75em;line-height:1.2}.filepond--file-status .filepond--file-status-sub{font-size:.625em;opacity:.5;-webkit-transition:opacity .25s ease-in-out;transition:opacity .25s ease-in-out}.filepond--file-wrapper.filepond--file-wrapper{border:none;margin:0;padding:0;min-width:0;height:100%}.filepond--file-wrapper.filepond--file-wrapper>legend{position:absolute;overflow:hidden;height:1px;width:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);white-space:nowrap}.filepond--file{position:static;display:-ms-flexbox;display:flex;height:100%;-ms-flex-align:start;align-items:flex-start;padding:.5625em;color:#fff;border-radius:.5em}.filepond--file .filepond--file-status{margin-left:auto;margin-right:2.25em}.filepond--file .filepond--processing-complete-indicator{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:3}.filepond--file .filepond--file-action-button,.filepond--file .filepond--processing-complete-indicator,.filepond--file .filepond--progress-indicator{position:absolute}.filepond--file [data-align*=left]{left:.5625em}.filepond--file [data-align*=right]{right:.5625em}.filepond--file [data-align*=center]{left:calc(50% - .8125em)}.filepond--file [data-align*=bottom]{bottom:1.125em}.filepond--file [data-align=center]{top:calc(50% - .8125em)}.filepond--file .filepond--progress-indicator{margin-top:.1875em}.filepond--file .filepond--progress-indicator[data-align*=right]{margin-right:.1875em}.filepond--file .filepond--progress-indicator[data-align*=left]{margin-left:.1875em}[data-filepond-item-state*=error] .filepond--file-info,[data-filepond-item-state*=invalid] .filepond--file-info,[data-filepond-item-state=cancelled] .filepond--file-info{margin-right:2.25em}[data-filepond-item-state~=processing] .filepond--file-status-sub{opacity:0}[data-filepond-item-state~=processing] .filepond--action-abort-item-processing~.filepond--file-status .filepond--file-status-sub{opacity:.5}[data-filepond-item-state=processing-error] .filepond--file-status-sub{opacity:0}[data-filepond-item-state=processing-error] .filepond--action-retry-item-processing~.filepond--file-status .filepond--file-status-sub{opacity:.5}[data-filepond-item-state=processing-complete] .filepond--action-revert-item-processing svg{-webkit-animation:fall .5s linear .125s both;animation:fall .5s linear .125s both}[data-filepond-item-state=processing-complete] .filepond--file-status-sub{opacity:.5}[data-filepond-item-state=processing-complete] .filepond--file-info-sub,[data-filepond-item-state=processing-complete] .filepond--processing-complete-indicator:not([style*=hidden])~.filepond--file-status .filepond--file-status-sub{opacity:0}[data-filepond-item-state=processing-complete] .filepond--action-revert-item-processing~.filepond--file-info .filepond--file-info-sub{opacity:.5}[data-filepond-item-state*=error] .filepond--file-wrapper,[data-filepond-item-state*=error] .filepond--panel,[data-filepond-item-state*=invalid] .filepond--file-wrapper,[data-filepond-item-state*=invalid] .filepond--panel{-webkit-animation:shake .65s linear both;animation:shake .65s linear both}[data-filepond-item-state*=busy] .filepond--progress-indicator svg{-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes shake{10%,90%{-webkit-transform:translateX(-.0625em);transform:translateX(-.0625em)}20%,80%{-webkit-transform:translateX(.125em);transform:translateX(.125em)}30%,50%,70%{-webkit-transform:translateX(-.25em);transform:translateX(-.25em)}40%,60%{-webkit-transform:translateX(.25em);transform:translateX(.25em)}}@keyframes shake{10%,90%{-webkit-transform:translateX(-.0625em);transform:translateX(-.0625em)}20%,80%{-webkit-transform:translateX(.125em);transform:translateX(.125em)}30%,50%,70%{-webkit-transform:translateX(-.25em);transform:translateX(-.25em)}40%,60%{-webkit-transform:translateX(.25em);transform:translateX(.25em)}}@-webkit-keyframes fall{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}70%{opacity:1;-webkit-transform:scale(1.1);transform:scale(1.1);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}to{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes fall{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}70%{opacity:1;-webkit-transform:scale(1.1);transform:scale(1.1);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}to{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.filepond--hopper[data-hopper-state=drag-over]>*{pointer-events:none}.filepond--hopper[data-hopper-state=drag-over]:after{content:\"\";position:absolute;left:0;top:0;right:0;bottom:0;z-index:100}.filepond--progress-indicator{z-index:103}.filepond--file-action-button{z-index:102}.filepond--file-status{z-index:101}.filepond--file-info{z-index:100}.filepond--item{position:absolute;top:0;left:0;right:0;z-index:1;padding:0;margin:.25em;will-change:transform,opacity}.filepond--item>.filepond--panel{z-index:-1}.filepond--item>.filepond--panel .filepond--panel-bottom{-webkit-box-shadow:0 .0625em .125em -.0625em rgba(0,0,0,.25);box-shadow:0 .0625em .125em -.0625em rgba(0,0,0,.25)}.filepond--item>.filepond--file-wrapper,.filepond--item>.filepond--panel{-webkit-transition:opacity .15s ease-out;transition:opacity .15s ease-out}.filepond--item[data-drag-state]{cursor:-webkit-grab;cursor:grab}.filepond--item[data-drag-state]>.filepond--panel{-webkit-transition:-webkit-box-shadow .125s ease-in-out;transition:-webkit-box-shadow .125s ease-in-out;transition:box-shadow .125s ease-in-out;transition:box-shadow .125s ease-in-out, -webkit-box-shadow .125s ease-in-out;-webkit-box-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent}.filepond--item[data-drag-state=drag]{cursor:-webkit-grabbing;cursor:grabbing}.filepond--item[data-drag-state=drag]>.filepond--panel{-webkit-box-shadow:0 .125em .3125em rgba(0,0,0,.325);box-shadow:0 .125em .3125em rgba(0,0,0,.325)}.filepond--item[data-drag-state]:not([data-drag-state=idle]){z-index:2}.filepond--item-panel{background-color:#64605e}[data-filepond-item-state=processing-complete] .filepond--item-panel{background-color:#369763}[data-filepond-item-state*=error] .filepond--item-panel,[data-filepond-item-state*=invalid] .filepond--item-panel{background-color:#c44e47}.filepond--item-panel{border-radius:.5em;-webkit-transition:background-color .25s;transition:background-color .25s}.filepond--list-scroller{position:absolute;top:0;left:0;right:0;margin:0;will-change:transform}.filepond--list-scroller[data-state=overflow] .filepond--list{bottom:0;right:0}.filepond--list-scroller[data-state=overflow]{overflow-y:scroll;overflow-x:hidden;-webkit-overflow-scrolling:touch;-webkit-mask:-webkit-gradient(linear,left top, left bottom,from(#000),to(transparent));-webkit-mask:linear-gradient(180deg,#000 calc(100% - .5em),transparent);mask:-webkit-gradient(linear,left top, left bottom,from(#000),to(transparent));mask:linear-gradient(180deg,#000 calc(100% - .5em),transparent)}.filepond--list-scroller::-webkit-scrollbar{background:transparent}.filepond--list-scroller::-webkit-scrollbar:vertical{width:1em}.filepond--list-scroller::-webkit-scrollbar:horizontal{height:0}.filepond--list-scroller::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.3);border-radius:99999px;border:.3125em solid transparent;background-clip:content-box}.filepond--list.filepond--list{position:absolute;top:0;margin:0;padding:0;list-style-type:none;will-change:transform}.filepond--list{left:.75em;right:.75em}.filepond--root[data-style-panel-layout~=integrated]{width:100%;height:100%;max-width:none;margin:0}.filepond--root[data-style-panel-layout~=circle] .filepond--panel-root,.filepond--root[data-style-panel-layout~=integrated] .filepond--panel-root{border-radius:0}.filepond--root[data-style-panel-layout~=circle] .filepond--panel-root>*,.filepond--root[data-style-panel-layout~=integrated] .filepond--panel-root>*{display:none}.filepond--root[data-style-panel-layout~=circle] .filepond--drop-label,.filepond--root[data-style-panel-layout~=integrated] .filepond--drop-label{bottom:0;height:auto;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:7}.filepond--root[data-style-panel-layout~=circle] .filepond--item-panel,.filepond--root[data-style-panel-layout~=integrated] .filepond--item-panel{display:none}.filepond--root[data-style-panel-layout~=compact] .filepond--list-scroller,.filepond--root[data-style-panel-layout~=integrated] .filepond--list-scroller{overflow:hidden;height:100%;margin-top:0;margin-bottom:0}.filepond--root[data-style-panel-layout~=compact] .filepond--list,.filepond--root[data-style-panel-layout~=integrated] .filepond--list{left:0;right:0;height:100%}.filepond--root[data-style-panel-layout~=compact] .filepond--item,.filepond--root[data-style-panel-layout~=integrated] .filepond--item{margin:0}.filepond--root[data-style-panel-layout~=compact] .filepond--file-wrapper,.filepond--root[data-style-panel-layout~=integrated] .filepond--file-wrapper{height:100%}.filepond--root[data-style-panel-layout~=compact] .filepond--drop-label,.filepond--root[data-style-panel-layout~=integrated] .filepond--drop-label{z-index:7}.filepond--root[data-style-panel-layout~=circle]{border-radius:99999rem;overflow:hidden}.filepond--root[data-style-panel-layout~=circle]>.filepond--panel{border-radius:inherit}.filepond--root[data-style-panel-layout~=circle]>.filepond--panel>*{display:none}.filepond--root[data-style-panel-layout~=circle] .filepond--file-info,.filepond--root[data-style-panel-layout~=circle] .filepond--file-status{display:none}.filepond--root[data-style-panel-layout~=circle] .filepond--action-edit-item{opacity:1!important;visibility:visible!important}@media not all and (-webkit-min-device-pixel-ratio:0), not all and (min-resolution:0.001dpcm){@supports (-webkit-appearance:none) and (stroke-color:transparent){.filepond--root[data-style-panel-layout~=circle]{will-change:transform}}}.filepond--panel-root{border-radius:.5em;background-color:#f1f0ef}.filepond--panel{position:absolute;left:0;top:0;right:0;margin:0;height:100%!important;pointer-events:none}.filepond-panel:not([data-scalable=false]){height:auto!important}.filepond--panel[data-scalable=false]>div{display:none}.filepond--panel[data-scalable=true]{-webkit-transform-style:preserve-3d;transform-style:preserve-3d;background-color:transparent!important;border:none!important}.filepond--panel-bottom,.filepond--panel-center,.filepond--panel-top{position:absolute;left:0;top:0;right:0;margin:0;padding:0}.filepond--panel-bottom,.filepond--panel-top{height:.5em}.filepond--panel-top{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important;border-bottom:none!important}.filepond--panel-top:after{content:\"\";position:absolute;height:2px;left:0;right:0;bottom:-1px;background-color:inherit}.filepond--panel-bottom,.filepond--panel-center{will-change:transform;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:translate3d(0,.5em,0);transform:translate3d(0,.5em,0)}.filepond--panel-bottom{border-top-left-radius:0!important;border-top-right-radius:0!important;border-top:none!important}.filepond--panel-bottom:before{content:\"\";position:absolute;height:2px;left:0;right:0;top:-1px;background-color:inherit}.filepond--panel-center{height:100px!important;border-top:none!important;border-bottom:none!important;border-radius:0!important}.filepond--panel-center:not([style]){visibility:hidden}.filepond--progress-indicator{position:static;width:1.25em;height:1.25em;color:#fff;margin:0;pointer-events:none;will-change:transform,opacity}.filepond--progress-indicator svg{width:100%;height:100%;vertical-align:top;transform-box:fill-box}.filepond--progress-indicator path{fill:none;stroke:currentColor}.filepond--list-scroller{z-index:6}.filepond--drop-label{z-index:5}.filepond--drip{z-index:3}.filepond--root>.filepond--panel{z-index:2}.filepond--browser{z-index:1}.filepond--root{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;margin-bottom:1em;font-size:1rem;line-height:normal;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-weight:450;text-align:left;text-rendering:optimizeLegibility;direction:ltr;contain:layout style size}.filepond--root *{-webkit-box-sizing:inherit;box-sizing:inherit;line-height:inherit}.filepond--root :not(text){font-size:inherit}.filepond--root[data-disabled]{pointer-events:none}.filepond--root[data-disabled] .filepond--list-scroller{pointer-events:all}.filepond--root[data-disabled] .filepond--list{pointer-events:none}.filepond--root .filepond--drop-label{min-height:4.75em}.filepond--root .filepond--list-scroller{margin-top:1em;margin-bottom:1em}.filepond--root .filepond--credits{position:absolute;right:0;opacity:.175;line-height:.85;font-size:11px;color:inherit;text-decoration:none;z-index:3;bottom:-14px}.filepond--root .filepond--credits[style]{top:0;bottom:auto;margin-top:14px}/*!\n * FilePondPluginImagePreview 4.6.11\n * Licensed under MIT, https://opensource.org/licenses/MIT/\n * Please visit https://pqina.nl/filepond/ for details.\n */.filepond--image-preview-markup{position:absolute;left:0;top:0}.filepond--image-preview-wrapper{z-index:2}.filepond--image-preview-overlay{display:block;position:absolute;left:0;top:0;width:100%;min-height:5rem;max-height:7rem;margin:0;opacity:0;z-index:2;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--image-preview-overlay svg{width:100%;height:auto;color:inherit;max-height:inherit}.filepond--image-preview-overlay-idle{mix-blend-mode:multiply;color:rgba(40, 40, 40, 0.85)}.filepond--image-preview-overlay-success{mix-blend-mode:normal;color:rgba(54, 151, 99, 1)}.filepond--image-preview-overlay-failure{mix-blend-mode:normal;color:rgba(196, 78, 71, 1)}@supports (-webkit-marquee-repetition: infinite) and\n ((-o-object-fit: fill) or (object-fit: fill)){.filepond--image-preview-overlay-idle{mix-blend-mode:normal}}.filepond--image-preview-wrapper{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:absolute;left:0;top:0;right:0;height:100%;margin:0;border-radius:0.45em;overflow:hidden;background:rgba(0, 0, 0, 0.01)}.filepond--image-preview{position:absolute;left:0;top:0;z-index:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:100%;width:100%;pointer-events:none;background:#222;will-change:transform, opacity}.filepond--image-clip{position:relative;overflow:hidden;margin:0 auto;}.filepond--image-clip[data-transparency-indicator='grid'] img,.filepond--image-clip[data-transparency-indicator='grid'] canvas{background-color:#fff;background-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg' fill='%23eee'%3E%3Cpath d='M0 0 H50 V50 H0'/%3E%3Cpath d='M50 50 H100 V100 H50'/%3E%3C/svg%3E\");background-size:1.25em 1.25em}.filepond--image-bitmap,.filepond--image-vector{position:absolute;left:0;top:0;will-change:transform}.filepond--root[data-style-panel-layout~='integrated'] .filepond--image-preview-wrapper{border-radius:0}.filepond--root[data-style-panel-layout~='integrated'] .filepond--image-preview{height:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.filepond--root[data-style-panel-layout~='circle'] .filepond--image-preview-wrapper{border-radius:99999rem}.filepond--root[data-style-panel-layout~='circle'] .filepond--image-preview-overlay{top:auto;bottom:0;-webkit-transform:scaleY(-1);transform:scaleY(-1)}.filepond--root[data-style-panel-layout~='circle'] .filepond--file .filepond--file-action-button[data-align*='bottom']:not([data-align*='center']){margin-bottom:0.325em}.filepond--root[data-style-panel-layout~='circle'] .filepond--file [data-align*='left']{left:calc(50% - 3em)}.filepond--root[data-style-panel-layout~='circle'] .filepond--file [data-align*='right']{right:calc(50% - 3em)}.filepond--root[data-style-panel-layout~='circle'] .filepond--progress-indicator[data-align*='bottom'][data-align*='left'],.filepond--root[data-style-panel-layout~='circle'] .filepond--progress-indicator[data-align*='bottom'][data-align*='right']{margin-bottom:calc(0.325em + 0.1875em)}.filepond--root[data-style-panel-layout~='circle'] .filepond--progress-indicator[data-align*='bottom'][data-align*='center']{margin-top:0;margin-bottom:0.1875em;margin-left:0.1875em}/*!\n * FilePondPluginImageEdit 1.6.3\n * Licensed under MIT, https://opensource.org/licenses/MIT/\n * Please visit https://pqina.nl/filepond/ for details.\n */.filepond--action-edit-item.filepond--action-edit-item{width:2em;height:2em;padding:0.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*='center']{margin-left:-0.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*='bottom']{margin-bottom:-0.1875em}.filepond--action-edit-item-alt{border:none;line-height:inherit;background:transparent;font-family:inherit;color:inherit;outline:none;padding:0;margin:0 0 0 0.25em;pointer-events:all;position:absolute}.filepond--action-edit-item-alt svg{width:1.3125em;height:1.3125em}.filepond--action-edit-item-alt span{font-size:0;opacity:0}.filepond--root[data-style-panel-layout~='circle'] .filepond--action-edit-item{opacity:1 !important;visibility:visible !important}";
|
|
20019
|
+
var filepondPluginFilePoster = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
20020
|
+
/*!
|
|
20021
|
+
* FilePondPluginFilePoster 2.5.1
|
|
20022
|
+
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
|
20023
|
+
* Please visit https://pqina.nl/filepond/ for details.
|
|
20024
|
+
*/
|
|
20025
|
+
|
|
20026
|
+
/* eslint-disable */
|
|
20027
|
+
|
|
20028
|
+
(function(global, factory) {
|
|
20029
|
+
(module.exports = factory())
|
|
20030
|
+
;
|
|
20031
|
+
})(_commonjsHelpers.commonjsGlobal, function() {
|
|
20032
|
+
|
|
20033
|
+
var IMAGE_SCALE_SPRING_PROPS = {
|
|
20034
|
+
type: 'spring',
|
|
20035
|
+
stiffness: 0.5,
|
|
20036
|
+
damping: 0.45,
|
|
20037
|
+
mass: 10
|
|
20038
|
+
};
|
|
20039
|
+
|
|
20040
|
+
var createPosterView = function createPosterView(_) {
|
|
20041
|
+
return _.utils.createView({
|
|
20042
|
+
name: 'file-poster',
|
|
20043
|
+
tag: 'div',
|
|
20044
|
+
ignoreRect: true,
|
|
20045
|
+
create: function create(_ref) {
|
|
20046
|
+
var root = _ref.root;
|
|
20047
|
+
root.ref.image = document.createElement('img');
|
|
20048
|
+
root.element.appendChild(root.ref.image);
|
|
20049
|
+
},
|
|
20050
|
+
write: _.utils.createRoute({
|
|
20051
|
+
DID_FILE_POSTER_LOAD: function DID_FILE_POSTER_LOAD(_ref2) {
|
|
20052
|
+
var root = _ref2.root,
|
|
20053
|
+
props = _ref2.props;
|
|
20054
|
+
var id = props.id;
|
|
20055
|
+
|
|
20056
|
+
// get item
|
|
20057
|
+
var item = root.query('GET_ITEM', { id: props.id });
|
|
20058
|
+
if (!item) return;
|
|
20059
|
+
|
|
20060
|
+
// get poster
|
|
20061
|
+
var poster = item.getMetadata('poster');
|
|
20062
|
+
root.ref.image.src = poster;
|
|
20063
|
+
|
|
20064
|
+
// let others know of our fabulous achievement (so the image can be faded in)
|
|
20065
|
+
root.dispatch('DID_FILE_POSTER_DRAW', { id: id });
|
|
20066
|
+
}
|
|
20067
|
+
}),
|
|
20068
|
+
|
|
20069
|
+
mixins: {
|
|
20070
|
+
styles: ['scaleX', 'scaleY', 'opacity'],
|
|
20071
|
+
animations: {
|
|
20072
|
+
scaleX: IMAGE_SCALE_SPRING_PROPS,
|
|
20073
|
+
scaleY: IMAGE_SCALE_SPRING_PROPS,
|
|
20074
|
+
opacity: { type: 'tween', duration: 750 }
|
|
20075
|
+
}
|
|
20076
|
+
}
|
|
20077
|
+
});
|
|
20078
|
+
};
|
|
20079
|
+
|
|
20080
|
+
var applyTemplate = function applyTemplate(source, target) {
|
|
20081
|
+
// copy width and height
|
|
20082
|
+
target.width = source.width;
|
|
20083
|
+
target.height = source.height;
|
|
20084
|
+
|
|
20085
|
+
// draw the template
|
|
20086
|
+
var ctx = target.getContext('2d');
|
|
20087
|
+
ctx.drawImage(source, 0, 0);
|
|
20088
|
+
};
|
|
20089
|
+
|
|
20090
|
+
var createPosterOverlayView = function createPosterOverlayView(fpAPI) {
|
|
20091
|
+
return fpAPI.utils.createView({
|
|
20092
|
+
name: 'file-poster-overlay',
|
|
20093
|
+
tag: 'canvas',
|
|
20094
|
+
ignoreRect: true,
|
|
20095
|
+
create: function create(_ref) {
|
|
20096
|
+
var root = _ref.root,
|
|
20097
|
+
props = _ref.props;
|
|
20098
|
+
applyTemplate(props.template, root.element);
|
|
20099
|
+
},
|
|
20100
|
+
mixins: {
|
|
20101
|
+
styles: ['opacity'],
|
|
20102
|
+
animations: {
|
|
20103
|
+
opacity: { type: 'spring', mass: 25 }
|
|
20104
|
+
}
|
|
20105
|
+
}
|
|
20106
|
+
});
|
|
20107
|
+
};
|
|
20108
|
+
|
|
20109
|
+
var getImageSize = function getImageSize(url, cb) {
|
|
20110
|
+
var image = new Image();
|
|
20111
|
+
image.onload = function() {
|
|
20112
|
+
var width = image.naturalWidth;
|
|
20113
|
+
var height = image.naturalHeight;
|
|
20114
|
+
image = null;
|
|
20115
|
+
cb(width, height);
|
|
20116
|
+
};
|
|
20117
|
+
image.src = url;
|
|
20118
|
+
};
|
|
20119
|
+
|
|
20120
|
+
var easeInOutSine = function easeInOutSine(t) {
|
|
20121
|
+
return -0.5 * (Math.cos(Math.PI * t) - 1);
|
|
20122
|
+
};
|
|
20123
|
+
|
|
20124
|
+
var addGradientSteps = function addGradientSteps(gradient, color) {
|
|
20125
|
+
var alpha =
|
|
20126
|
+
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
20127
|
+
var easeFn =
|
|
20128
|
+
arguments.length > 3 && arguments[3] !== undefined
|
|
20129
|
+
? arguments[3]
|
|
20130
|
+
: easeInOutSine;
|
|
20131
|
+
var steps =
|
|
20132
|
+
arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 10;
|
|
20133
|
+
var offset =
|
|
20134
|
+
arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
20135
|
+
var range = 1 - offset;
|
|
20136
|
+
var rgb = color.join(',');
|
|
20137
|
+
for (var i = 0; i <= steps; i++) {
|
|
20138
|
+
var p = i / steps;
|
|
20139
|
+
var stop = offset + range * p;
|
|
20140
|
+
gradient.addColorStop(
|
|
20141
|
+
stop,
|
|
20142
|
+
'rgba('.concat(rgb, ', ').concat(easeFn(p) * alpha, ')')
|
|
20143
|
+
);
|
|
20144
|
+
}
|
|
20145
|
+
};
|
|
20146
|
+
|
|
20147
|
+
var MAX_WIDTH = 10;
|
|
20148
|
+
var MAX_HEIGHT = 10;
|
|
20149
|
+
|
|
20150
|
+
var calculateAverageColor = function calculateAverageColor(image) {
|
|
20151
|
+
var scalar = Math.min(MAX_WIDTH / image.width, MAX_HEIGHT / image.height);
|
|
20152
|
+
|
|
20153
|
+
var canvas = document.createElement('canvas');
|
|
20154
|
+
var ctx = canvas.getContext('2d');
|
|
20155
|
+
var width = (canvas.width = Math.ceil(image.width * scalar));
|
|
20156
|
+
var height = (canvas.height = Math.ceil(image.height * scalar));
|
|
20157
|
+
ctx.drawImage(image, 0, 0, width, height);
|
|
20158
|
+
var data = null;
|
|
20159
|
+
try {
|
|
20160
|
+
data = ctx.getImageData(0, 0, width, height).data;
|
|
20161
|
+
} catch (e) {
|
|
20162
|
+
return null;
|
|
20163
|
+
}
|
|
20164
|
+
var l = data.length;
|
|
20165
|
+
|
|
20166
|
+
var r = 0;
|
|
20167
|
+
var g = 0;
|
|
20168
|
+
var b = 0;
|
|
20169
|
+
var i = 0;
|
|
20170
|
+
|
|
20171
|
+
for (; i < l; i += 4) {
|
|
20172
|
+
r += data[i] * data[i];
|
|
20173
|
+
g += data[i + 1] * data[i + 1];
|
|
20174
|
+
b += data[i + 2] * data[i + 2];
|
|
20175
|
+
}
|
|
20176
|
+
|
|
20177
|
+
r = averageColor(r, l);
|
|
20178
|
+
g = averageColor(g, l);
|
|
20179
|
+
b = averageColor(b, l);
|
|
20180
|
+
|
|
20181
|
+
return { r: r, g: g, b: b };
|
|
20182
|
+
};
|
|
20183
|
+
|
|
20184
|
+
var averageColor = function averageColor(c, l) {
|
|
20185
|
+
return Math.floor(Math.sqrt(c / (l / 4)));
|
|
20186
|
+
};
|
|
20187
|
+
|
|
20188
|
+
var drawTemplate = function drawTemplate(
|
|
20189
|
+
canvas,
|
|
20190
|
+
width,
|
|
20191
|
+
height,
|
|
20192
|
+
color,
|
|
20193
|
+
alphaTarget
|
|
20194
|
+
) {
|
|
20195
|
+
canvas.width = width;
|
|
20196
|
+
canvas.height = height;
|
|
20197
|
+
var ctx = canvas.getContext('2d');
|
|
20198
|
+
|
|
20199
|
+
var horizontalCenter = width * 0.5;
|
|
20200
|
+
|
|
20201
|
+
var grad = ctx.createRadialGradient(
|
|
20202
|
+
horizontalCenter,
|
|
20203
|
+
height + 110,
|
|
20204
|
+
height - 100,
|
|
20205
|
+
horizontalCenter,
|
|
20206
|
+
height + 110,
|
|
20207
|
+
height + 100
|
|
20208
|
+
);
|
|
20209
|
+
|
|
20210
|
+
addGradientSteps(grad, color, alphaTarget, undefined, 8, 0.4);
|
|
20211
|
+
|
|
20212
|
+
ctx.save();
|
|
20213
|
+
ctx.translate(-width * 0.5, 0);
|
|
20214
|
+
ctx.scale(2, 1);
|
|
20215
|
+
ctx.fillStyle = grad;
|
|
20216
|
+
ctx.fillRect(0, 0, width, height);
|
|
20217
|
+
ctx.restore();
|
|
20218
|
+
};
|
|
20219
|
+
|
|
20220
|
+
var hasNavigator = typeof navigator !== 'undefined';
|
|
20221
|
+
|
|
20222
|
+
var width = 500;
|
|
20223
|
+
var height = 200;
|
|
20224
|
+
|
|
20225
|
+
var overlayTemplateShadow = hasNavigator && document.createElement('canvas');
|
|
20226
|
+
var overlayTemplateError = hasNavigator && document.createElement('canvas');
|
|
20227
|
+
var overlayTemplateSuccess = hasNavigator && document.createElement('canvas');
|
|
20228
|
+
|
|
20229
|
+
var itemShadowColor = [40, 40, 40];
|
|
20230
|
+
var itemErrorColor = [196, 78, 71];
|
|
20231
|
+
var itemSuccessColor = [54, 151, 99];
|
|
20232
|
+
|
|
20233
|
+
if (hasNavigator) {
|
|
20234
|
+
drawTemplate(overlayTemplateShadow, width, height, itemShadowColor, 0.85);
|
|
20235
|
+
drawTemplate(overlayTemplateError, width, height, itemErrorColor, 1);
|
|
20236
|
+
drawTemplate(overlayTemplateSuccess, width, height, itemSuccessColor, 1);
|
|
20237
|
+
}
|
|
20238
|
+
|
|
20239
|
+
var loadImage = function loadImage(url, crossOriginValue) {
|
|
20240
|
+
return new Promise(function(resolve, reject) {
|
|
20241
|
+
var img = new Image();
|
|
20242
|
+
if (typeof crossOrigin === 'string') {
|
|
20243
|
+
img.crossOrigin = crossOriginValue;
|
|
20244
|
+
}
|
|
20245
|
+
img.onload = function() {
|
|
20246
|
+
resolve(img);
|
|
20247
|
+
};
|
|
20248
|
+
img.onerror = function(e) {
|
|
20249
|
+
reject(e);
|
|
20250
|
+
};
|
|
20251
|
+
img.src = url;
|
|
20252
|
+
});
|
|
20253
|
+
};
|
|
20254
|
+
|
|
20255
|
+
var createPosterWrapperView = function createPosterWrapperView(_) {
|
|
20256
|
+
// create overlay view
|
|
20257
|
+
var overlay = createPosterOverlayView(_);
|
|
20026
20258
|
|
|
20027
|
-
const SallaFileUpload = class {
|
|
20028
|
-
constructor(hostRef) {
|
|
20029
|
-
index.registerInstance(this, hostRef);
|
|
20030
|
-
this.uploaded = index.createEvent(this, "uploaded", 7);
|
|
20031
|
-
this.remove = index.createEvent(this, "remove", 7);
|
|
20032
|
-
/**
|
|
20033
|
-
* The uploaded image link or URL
|
|
20034
|
-
*/
|
|
20035
|
-
this.uploadedImage = undefined;
|
|
20036
|
-
/**
|
|
20037
|
-
* Sets the required attribute to the output field
|
|
20038
|
-
*/
|
|
20039
|
-
this.required = false;
|
|
20040
|
-
/**
|
|
20041
|
-
* Sets the disabled attribute to the output field
|
|
20042
|
-
*/
|
|
20043
|
-
this.disabled = false;
|
|
20044
|
-
/**
|
|
20045
|
-
* Enable or disable drag n' drop
|
|
20046
|
-
*/
|
|
20047
|
-
this.allowDrop = true;
|
|
20048
|
-
/**
|
|
20049
|
-
* Enable or disable file browser
|
|
20050
|
-
*/
|
|
20051
|
-
this.allowBrowse = true;
|
|
20052
|
-
/**
|
|
20053
|
-
* Enable or disable pasting of files. Pasting files is not supported on all browesrs.
|
|
20054
|
-
*/
|
|
20055
|
-
this.allowPaste = true;
|
|
20056
|
-
/**
|
|
20057
|
-
* Enable or disable adding multiple files
|
|
20058
|
-
*/
|
|
20059
|
-
this.allowMultiple = false;
|
|
20060
|
-
/**
|
|
20061
|
-
* Allow drop to replace a file, only works when allowMultiple is false
|
|
20062
|
-
*/
|
|
20063
|
-
this.allowReplace = true;
|
|
20064
|
-
/**
|
|
20065
|
-
* Enable or disable the revert processing button
|
|
20066
|
-
*/
|
|
20067
|
-
this.allowRevert = true;
|
|
20068
|
-
/**
|
|
20069
|
-
* When set to false the remove button is hidden and disabled
|
|
20070
|
-
*/
|
|
20071
|
-
this.allowRemove = true;
|
|
20072
|
-
/**
|
|
20073
|
-
* Enable or disable the process button
|
|
20074
|
-
*/
|
|
20075
|
-
this.allowProcess = true;
|
|
20076
|
-
/**
|
|
20077
|
-
* Allow users to reorder files with drag and drop interaction.
|
|
20078
|
-
* Note that this only works in single column mode.
|
|
20079
|
-
* It also only works on browsers that support pointer events.
|
|
20080
|
-
*/
|
|
20081
|
-
this.allowReorder = false;
|
|
20082
20259
|
/**
|
|
20083
|
-
*
|
|
20084
|
-
* This only works if the browser supports the DataTransfer constructor (https://caniuse.com/mdn-api_datatransfer_datatransfer),
|
|
20085
|
-
* this is the case on Firefox, Chrome, Chromium powered browsers and Safari version 14.1 and higher.
|
|
20260
|
+
* Write handler for when preview container has been created
|
|
20086
20261
|
*/
|
|
20087
|
-
|
|
20262
|
+
var didCreatePreviewContainer = function didCreatePreviewContainer(_ref) {
|
|
20263
|
+
var root = _ref.root,
|
|
20264
|
+
props = _ref.props;
|
|
20265
|
+
var id = props.id;
|
|
20266
|
+
|
|
20267
|
+
// we need to get the file data to determine the eventual image size
|
|
20268
|
+
var item = root.query('GET_ITEM', id);
|
|
20269
|
+
if (!item) return;
|
|
20270
|
+
|
|
20271
|
+
// get url to file
|
|
20272
|
+
var fileURL = item.getMetadata('poster');
|
|
20273
|
+
|
|
20274
|
+
// image is now ready
|
|
20275
|
+
var previewImageLoaded = function previewImageLoaded(data) {
|
|
20276
|
+
// calculate average image color, is in try catch to circumvent any cors errors
|
|
20277
|
+
var averageColor = root.query(
|
|
20278
|
+
'GET_FILE_POSTER_CALCULATE_AVERAGE_IMAGE_COLOR'
|
|
20279
|
+
)
|
|
20280
|
+
? calculateAverageColor(data)
|
|
20281
|
+
: null;
|
|
20282
|
+
item.setMetadata('color', averageColor, true);
|
|
20283
|
+
|
|
20284
|
+
// the preview is now ready to be drawn
|
|
20285
|
+
root.dispatch('DID_FILE_POSTER_LOAD', {
|
|
20286
|
+
id: id,
|
|
20287
|
+
data: data
|
|
20288
|
+
});
|
|
20289
|
+
};
|
|
20290
|
+
|
|
20291
|
+
// determine image size of this item
|
|
20292
|
+
getImageSize(fileURL, function(width, height) {
|
|
20293
|
+
// we can now scale the panel to the final size
|
|
20294
|
+
root.dispatch('DID_FILE_POSTER_CALCULATE_SIZE', {
|
|
20295
|
+
id: id,
|
|
20296
|
+
width: width,
|
|
20297
|
+
height: height
|
|
20298
|
+
});
|
|
20299
|
+
|
|
20300
|
+
// create fallback preview
|
|
20301
|
+
loadImage(
|
|
20302
|
+
fileURL,
|
|
20303
|
+
root.query('GET_FILE_POSTER_CROSS_ORIGIN_ATTRIBUTE_VALUE')
|
|
20304
|
+
).then(previewImageLoaded);
|
|
20305
|
+
});
|
|
20306
|
+
};
|
|
20307
|
+
|
|
20088
20308
|
/**
|
|
20089
|
-
*
|
|
20309
|
+
* Write handler for when the preview has been loaded
|
|
20090
20310
|
*/
|
|
20091
|
-
|
|
20311
|
+
var didLoadPreview = function didLoadPreview(_ref2) {
|
|
20312
|
+
var root = _ref2.root;
|
|
20313
|
+
root.ref.overlayShadow.opacity = 1;
|
|
20314
|
+
};
|
|
20315
|
+
|
|
20092
20316
|
/**
|
|
20093
|
-
*
|
|
20317
|
+
* Write handler for when the preview image is ready to be animated
|
|
20094
20318
|
*/
|
|
20095
|
-
|
|
20319
|
+
var didDrawPreview = function didDrawPreview(_ref3) {
|
|
20320
|
+
var root = _ref3.root;
|
|
20321
|
+
var image = root.ref.image;
|
|
20322
|
+
|
|
20323
|
+
// reveal image
|
|
20324
|
+
image.scaleX = 1.0;
|
|
20325
|
+
image.scaleY = 1.0;
|
|
20326
|
+
image.opacity = 1;
|
|
20327
|
+
};
|
|
20328
|
+
|
|
20096
20329
|
/**
|
|
20097
|
-
*
|
|
20330
|
+
* Write handler for when the preview has been loaded
|
|
20098
20331
|
*/
|
|
20099
|
-
|
|
20332
|
+
var restoreOverlay = function restoreOverlay(_ref4) {
|
|
20333
|
+
var root = _ref4.root;
|
|
20334
|
+
root.ref.overlayShadow.opacity = 1;
|
|
20335
|
+
root.ref.overlayError.opacity = 0;
|
|
20336
|
+
root.ref.overlaySuccess.opacity = 0;
|
|
20337
|
+
};
|
|
20338
|
+
|
|
20339
|
+
var didThrowError = function didThrowError(_ref5) {
|
|
20340
|
+
var root = _ref5.root;
|
|
20341
|
+
root.ref.overlayShadow.opacity = 0.25;
|
|
20342
|
+
root.ref.overlayError.opacity = 1;
|
|
20343
|
+
};
|
|
20344
|
+
|
|
20345
|
+
var didCompleteProcessing = function didCompleteProcessing(_ref6) {
|
|
20346
|
+
var root = _ref6.root;
|
|
20347
|
+
root.ref.overlayShadow.opacity = 0.25;
|
|
20348
|
+
root.ref.overlaySuccess.opacity = 1;
|
|
20349
|
+
};
|
|
20350
|
+
|
|
20100
20351
|
/**
|
|
20101
|
-
*
|
|
20102
|
-
* FilePond will throw an error when a parent form is submitted and it contains invalid files.
|
|
20352
|
+
* Constructor
|
|
20103
20353
|
*/
|
|
20104
|
-
|
|
20105
|
-
|
|
20106
|
-
|
|
20107
|
-
|
|
20108
|
-
|
|
20354
|
+
var create = function create(_ref7) {
|
|
20355
|
+
var root = _ref7.root,
|
|
20356
|
+
props = _ref7.props;
|
|
20357
|
+
// test if colors aren't default item overlay colors
|
|
20358
|
+
var itemShadowColorProp = root.query(
|
|
20359
|
+
'GET_FILE_POSTER_ITEM_OVERLAY_SHADOW_COLOR'
|
|
20360
|
+
);
|
|
20361
|
+
|
|
20362
|
+
var itemErrorColorProp = root.query(
|
|
20363
|
+
'GET_FILE_POSTER_ITEM_OVERLAY_ERROR_COLOR'
|
|
20364
|
+
);
|
|
20365
|
+
|
|
20366
|
+
var itemSuccessColorProp = root.query(
|
|
20367
|
+
'GET_FILE_POSTER_ITEM_OVERLAY_SUCCESS_COLOR'
|
|
20368
|
+
);
|
|
20369
|
+
|
|
20370
|
+
if (itemShadowColorProp && itemShadowColorProp !== itemShadowColor) {
|
|
20371
|
+
itemShadowColor = itemShadowColorProp;
|
|
20372
|
+
drawTemplate(
|
|
20373
|
+
overlayTemplateShadow,
|
|
20374
|
+
width,
|
|
20375
|
+
height,
|
|
20376
|
+
itemShadowColor,
|
|
20377
|
+
0.85
|
|
20378
|
+
);
|
|
20379
|
+
}
|
|
20380
|
+
if (itemErrorColorProp && itemErrorColorProp !== itemErrorColor) {
|
|
20381
|
+
itemErrorColor = itemErrorColorProp;
|
|
20382
|
+
drawTemplate(overlayTemplateError, width, height, itemErrorColor, 1);
|
|
20383
|
+
}
|
|
20384
|
+
if (itemSuccessColorProp && itemSuccessColorProp !== itemSuccessColor) {
|
|
20385
|
+
itemSuccessColor = itemSuccessColorProp;
|
|
20386
|
+
drawTemplate(
|
|
20387
|
+
overlayTemplateSuccess,
|
|
20388
|
+
width,
|
|
20389
|
+
height,
|
|
20390
|
+
itemSuccessColor,
|
|
20391
|
+
1
|
|
20392
|
+
);
|
|
20393
|
+
}
|
|
20394
|
+
|
|
20395
|
+
// image view
|
|
20396
|
+
var image = createPosterView(_);
|
|
20397
|
+
|
|
20398
|
+
// append image presenter
|
|
20399
|
+
root.ref.image = root.appendChildView(
|
|
20400
|
+
root.createChildView(image, {
|
|
20401
|
+
id: props.id,
|
|
20402
|
+
scaleX: 1.25,
|
|
20403
|
+
scaleY: 1.25,
|
|
20404
|
+
opacity: 0
|
|
20405
|
+
})
|
|
20406
|
+
);
|
|
20407
|
+
|
|
20408
|
+
// image overlays
|
|
20409
|
+
root.ref.overlayShadow = root.appendChildView(
|
|
20410
|
+
root.createChildView(overlay, {
|
|
20411
|
+
template: overlayTemplateShadow,
|
|
20412
|
+
opacity: 0
|
|
20413
|
+
})
|
|
20414
|
+
);
|
|
20415
|
+
|
|
20416
|
+
root.ref.overlaySuccess = root.appendChildView(
|
|
20417
|
+
root.createChildView(overlay, {
|
|
20418
|
+
template: overlayTemplateSuccess,
|
|
20419
|
+
opacity: 0
|
|
20420
|
+
})
|
|
20421
|
+
);
|
|
20422
|
+
|
|
20423
|
+
root.ref.overlayError = root.appendChildView(
|
|
20424
|
+
root.createChildView(overlay, {
|
|
20425
|
+
template: overlayTemplateError,
|
|
20426
|
+
opacity: 0
|
|
20427
|
+
})
|
|
20428
|
+
);
|
|
20429
|
+
};
|
|
20430
|
+
|
|
20431
|
+
return _.utils.createView({
|
|
20432
|
+
name: 'file-poster-wrapper',
|
|
20433
|
+
create: create,
|
|
20434
|
+
write: _.utils.createRoute({
|
|
20435
|
+
// image preview stated
|
|
20436
|
+
DID_FILE_POSTER_LOAD: didLoadPreview,
|
|
20437
|
+
DID_FILE_POSTER_DRAW: didDrawPreview,
|
|
20438
|
+
DID_FILE_POSTER_CONTAINER_CREATE: didCreatePreviewContainer,
|
|
20439
|
+
|
|
20440
|
+
// file states
|
|
20441
|
+
DID_THROW_ITEM_LOAD_ERROR: didThrowError,
|
|
20442
|
+
DID_THROW_ITEM_PROCESSING_ERROR: didThrowError,
|
|
20443
|
+
DID_THROW_ITEM_INVALID: didThrowError,
|
|
20444
|
+
DID_COMPLETE_ITEM_PROCESSING: didCompleteProcessing,
|
|
20445
|
+
DID_START_ITEM_PROCESSING: restoreOverlay,
|
|
20446
|
+
DID_REVERT_ITEM_PROCESSING: restoreOverlay
|
|
20447
|
+
})
|
|
20448
|
+
});
|
|
20449
|
+
};
|
|
20450
|
+
|
|
20451
|
+
/**
|
|
20452
|
+
* File Poster Plugin
|
|
20453
|
+
*/
|
|
20454
|
+
var plugin = function plugin(fpAPI) {
|
|
20455
|
+
var addFilter = fpAPI.addFilter,
|
|
20456
|
+
utils = fpAPI.utils;
|
|
20457
|
+
var Type = utils.Type,
|
|
20458
|
+
createRoute = utils.createRoute;
|
|
20459
|
+
|
|
20460
|
+
// filePosterView
|
|
20461
|
+
var filePosterView = createPosterWrapperView(fpAPI);
|
|
20462
|
+
|
|
20463
|
+
// called for each view that is created right after the 'create' method
|
|
20464
|
+
addFilter('CREATE_VIEW', function(viewAPI) {
|
|
20465
|
+
// get reference to created view
|
|
20466
|
+
var is = viewAPI.is,
|
|
20467
|
+
view = viewAPI.view,
|
|
20468
|
+
query = viewAPI.query;
|
|
20469
|
+
|
|
20470
|
+
// only hook up to item view and only if is enabled for this cropper
|
|
20471
|
+
if (!is('file') || !query('GET_ALLOW_FILE_POSTER')) return;
|
|
20472
|
+
|
|
20473
|
+
// create the file poster plugin, but only do so if the item is an image
|
|
20474
|
+
var didLoadItem = function didLoadItem(_ref) {
|
|
20475
|
+
var root = _ref.root,
|
|
20476
|
+
props = _ref.props;
|
|
20477
|
+
updateItemPoster(root, props);
|
|
20478
|
+
};
|
|
20479
|
+
|
|
20480
|
+
var didUpdateItemMetadata = function didUpdateItemMetadata(_ref2) {
|
|
20481
|
+
var root = _ref2.root,
|
|
20482
|
+
props = _ref2.props,
|
|
20483
|
+
action = _ref2.action;
|
|
20484
|
+
if (!/poster/.test(action.change.key)) return;
|
|
20485
|
+
updateItemPoster(root, props);
|
|
20486
|
+
};
|
|
20487
|
+
|
|
20488
|
+
var updateItemPoster = function updateItemPoster(root, props) {
|
|
20489
|
+
var id = props.id;
|
|
20490
|
+
var item = query('GET_ITEM', id);
|
|
20491
|
+
|
|
20492
|
+
// item could theoretically have been removed in the mean time
|
|
20493
|
+
if (!item || !item.getMetadata('poster') || item.archived) return;
|
|
20494
|
+
|
|
20495
|
+
// don't update if is the same poster
|
|
20496
|
+
if (root.ref.previousPoster === item.getMetadata('poster')) return;
|
|
20497
|
+
root.ref.previousPoster = item.getMetadata('poster');
|
|
20498
|
+
|
|
20499
|
+
// test if is filtered
|
|
20500
|
+
if (!query('GET_FILE_POSTER_FILTER_ITEM')(item)) return;
|
|
20501
|
+
|
|
20502
|
+
if (root.ref.filePoster) {
|
|
20503
|
+
view.removeChildView(root.ref.filePoster);
|
|
20504
|
+
}
|
|
20505
|
+
|
|
20506
|
+
// set preview view
|
|
20507
|
+
root.ref.filePoster = view.appendChildView(
|
|
20508
|
+
view.createChildView(filePosterView, { id: id })
|
|
20509
|
+
);
|
|
20510
|
+
|
|
20511
|
+
// now ready
|
|
20512
|
+
root.dispatch('DID_FILE_POSTER_CONTAINER_CREATE', { id: id });
|
|
20513
|
+
};
|
|
20514
|
+
|
|
20515
|
+
var didCalculatePreviewSize = function didCalculatePreviewSize(_ref3) {
|
|
20516
|
+
var root = _ref3.root,
|
|
20517
|
+
action = _ref3.action;
|
|
20518
|
+
// no poster set
|
|
20519
|
+
if (!root.ref.filePoster) return;
|
|
20520
|
+
|
|
20521
|
+
// remember dimensions
|
|
20522
|
+
root.ref.imageWidth = action.width;
|
|
20523
|
+
root.ref.imageHeight = action.height;
|
|
20524
|
+
|
|
20525
|
+
root.ref.shouldUpdatePanelHeight = true;
|
|
20526
|
+
|
|
20527
|
+
root.dispatch('KICK');
|
|
20528
|
+
};
|
|
20529
|
+
|
|
20530
|
+
var getPosterHeight = function getPosterHeight(_ref4) {
|
|
20531
|
+
var root = _ref4.root;
|
|
20532
|
+
var fixedPosterHeight = root.query('GET_FILE_POSTER_HEIGHT');
|
|
20533
|
+
|
|
20534
|
+
// if fixed height: return fixed immediately
|
|
20535
|
+
if (fixedPosterHeight) {
|
|
20536
|
+
return fixedPosterHeight;
|
|
20537
|
+
}
|
|
20538
|
+
|
|
20539
|
+
var minPosterHeight = root.query('GET_FILE_POSTER_MIN_HEIGHT');
|
|
20540
|
+
var maxPosterHeight = root.query('GET_FILE_POSTER_MAX_HEIGHT');
|
|
20541
|
+
|
|
20542
|
+
// if natural height is smaller than minHeight: return min height
|
|
20543
|
+
if (minPosterHeight && root.ref.imageHeight < minPosterHeight) {
|
|
20544
|
+
return minPosterHeight;
|
|
20545
|
+
}
|
|
20546
|
+
|
|
20547
|
+
var height =
|
|
20548
|
+
root.rect.element.width *
|
|
20549
|
+
(root.ref.imageHeight / root.ref.imageWidth);
|
|
20550
|
+
|
|
20551
|
+
if (minPosterHeight && height < minPosterHeight) {
|
|
20552
|
+
return minPosterHeight;
|
|
20553
|
+
}
|
|
20554
|
+
if (maxPosterHeight && height > maxPosterHeight) {
|
|
20555
|
+
return maxPosterHeight;
|
|
20556
|
+
}
|
|
20557
|
+
|
|
20558
|
+
return height;
|
|
20559
|
+
};
|
|
20560
|
+
|
|
20561
|
+
// start writing
|
|
20562
|
+
view.registerWriter(
|
|
20563
|
+
createRoute(
|
|
20564
|
+
{
|
|
20565
|
+
DID_LOAD_ITEM: didLoadItem,
|
|
20566
|
+
DID_FILE_POSTER_CALCULATE_SIZE: didCalculatePreviewSize,
|
|
20567
|
+
DID_UPDATE_ITEM_METADATA: didUpdateItemMetadata
|
|
20568
|
+
},
|
|
20569
|
+
|
|
20570
|
+
function(_ref5) {
|
|
20571
|
+
var root = _ref5.root,
|
|
20572
|
+
props = _ref5.props;
|
|
20573
|
+
// don't run without poster
|
|
20574
|
+
if (!root.ref.filePoster) return;
|
|
20575
|
+
|
|
20576
|
+
// don't do anything while hidden
|
|
20577
|
+
if (root.rect.element.hidden) return;
|
|
20578
|
+
|
|
20579
|
+
// should we redraw
|
|
20580
|
+
if (root.ref.shouldUpdatePanelHeight) {
|
|
20581
|
+
// time to resize the parent panel
|
|
20582
|
+
root.dispatch('DID_UPDATE_PANEL_HEIGHT', {
|
|
20583
|
+
id: props.id,
|
|
20584
|
+
height: getPosterHeight({ root: root })
|
|
20585
|
+
});
|
|
20586
|
+
|
|
20587
|
+
// done!
|
|
20588
|
+
root.ref.shouldUpdatePanelHeight = false;
|
|
20589
|
+
}
|
|
20590
|
+
}
|
|
20591
|
+
)
|
|
20592
|
+
);
|
|
20593
|
+
});
|
|
20594
|
+
|
|
20595
|
+
// expose plugin
|
|
20596
|
+
return {
|
|
20597
|
+
options: {
|
|
20598
|
+
// Enable or disable file poster
|
|
20599
|
+
allowFilePoster: [true, Type.BOOLEAN],
|
|
20600
|
+
|
|
20601
|
+
// Fixed preview height
|
|
20602
|
+
filePosterHeight: [null, Type.INT],
|
|
20603
|
+
|
|
20604
|
+
// Min image height
|
|
20605
|
+
filePosterMinHeight: [null, Type.INT],
|
|
20606
|
+
|
|
20607
|
+
// Max image height
|
|
20608
|
+
filePosterMaxHeight: [null, Type.INT],
|
|
20609
|
+
|
|
20610
|
+
// filters file items to determine which are shown as poster
|
|
20611
|
+
filePosterFilterItem: [
|
|
20612
|
+
function() {
|
|
20613
|
+
return true;
|
|
20614
|
+
},
|
|
20615
|
+
Type.FUNCTION
|
|
20616
|
+
],
|
|
20617
|
+
|
|
20618
|
+
// Enables or disables reading average image color
|
|
20619
|
+
filePosterCalculateAverageImageColor: [false, Type.BOOLEAN],
|
|
20620
|
+
|
|
20621
|
+
// Allows setting the value of the CORS attribute (null is don't set attribute)
|
|
20622
|
+
filePosterCrossOriginAttributeValue: ['Anonymous', Type.STRING],
|
|
20623
|
+
|
|
20624
|
+
// Colors used for item overlay gradient
|
|
20625
|
+
filePosterItemOverlayShadowColor: [null, Type.ARRAY],
|
|
20626
|
+
filePosterItemOverlayErrorColor: [null, Type.ARRAY],
|
|
20627
|
+
filePosterItemOverlaySuccessColor: [null, Type.ARRAY]
|
|
20628
|
+
}
|
|
20629
|
+
};
|
|
20630
|
+
};
|
|
20631
|
+
|
|
20632
|
+
// fire pluginloaded event if running in browser, this allows registering the plugin when using async script tags
|
|
20633
|
+
var isBrowser =
|
|
20634
|
+
typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
20635
|
+
if (isBrowser) {
|
|
20636
|
+
document.dispatchEvent(
|
|
20637
|
+
new CustomEvent('FilePond:pluginloaded', { detail: plugin })
|
|
20638
|
+
);
|
|
20639
|
+
}
|
|
20640
|
+
|
|
20641
|
+
return plugin;
|
|
20642
|
+
});
|
|
20643
|
+
});
|
|
20644
|
+
|
|
20645
|
+
const sallaFileUploadCss = "/*!\n * FilePond 4.30.4\n * Licensed under MIT, https://opensource.org/licenses/MIT/\n * Please visit https://pqina.nl/filepond/ for details.\n */.filepond--assistant{position:absolute;overflow:hidden;height:1px;width:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);white-space:nowrap}.filepond--browser.filepond--browser{position:absolute;margin:0;padding:0;left:1em;top:1.75em;width:calc(100% - 2em);opacity:0;font-size:0}.filepond--data{position:absolute;width:0;height:0;padding:0;margin:0;border:none;visibility:hidden;pointer-events:none;contain:strict}.filepond--drip{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;opacity:.1;pointer-events:none;border-radius:.5em;background:rgba(0,0,0,.01)}.filepond--drip-blob{-webkit-transform-origin:center center;transform-origin:center center;width:8em;height:8em;margin-left:-4em;margin-top:-4em;background:#292625;border-radius:50%}.filepond--drip-blob,.filepond--drop-label{position:absolute;top:0;left:0;will-change:transform,opacity}.filepond--drop-label{right:0;margin:0;color:#4f4f4f;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--drop-label.filepond--drop-label label{display:block;margin:0;padding:.5em}.filepond--drop-label label{cursor:default;font-size:.875em;font-weight:400;text-align:center;line-height:1.5}.filepond--label-action{text-decoration:underline;-webkit-text-decoration-skip:ink;text-decoration-skip-ink:auto;-webkit-text-decoration-color:#a7a4a4;text-decoration-color:#a7a4a4;cursor:pointer}.filepond--root[data-disabled] .filepond--drop-label label{opacity:.5}.filepond--file-action-button.filepond--file-action-button{font-size:1em;width:1.625em;height:1.625em;font-family:inherit;line-height:inherit;margin:0;padding:0;border:none;outline:none;will-change:transform,opacity}.filepond--file-action-button.filepond--file-action-button span{position:absolute;overflow:hidden;height:1px;width:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);white-space:nowrap}.filepond--file-action-button.filepond--file-action-button svg{width:100%;height:100%}.filepond--file-action-button.filepond--file-action-button:after{position:absolute;left:-.75em;right:-.75em;top:-.75em;bottom:-.75em;content:\"\"}.filepond--file-action-button{cursor:auto;color:#fff;border-radius:50%;background-color:rgba(0,0,0,.5);background-image:none;-webkit-box-shadow:0 0 0 0 hsla(0,0%,100%,0);box-shadow:0 0 0 0 hsla(0,0%,100%,0);-webkit-transition:-webkit-box-shadow .25s ease-in;transition:-webkit-box-shadow .25s ease-in;transition:box-shadow .25s ease-in;transition:box-shadow .25s ease-in, -webkit-box-shadow .25s ease-in}.filepond--file-action-button:focus,.filepond--file-action-button:hover{-webkit-box-shadow:0 0 0 .125em hsla(0,0%,100%,.9);box-shadow:0 0 0 .125em hsla(0,0%,100%,.9)}.filepond--file-action-button[disabled]{color:hsla(0,0%,100%,.5);background-color:rgba(0,0,0,.25)}.filepond--file-action-button[hidden]{display:none}.filepond--action-edit-item.filepond--action-edit-item{width:2em;height:2em;padding:.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*=center]{margin-left:-.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*=bottom]{margin-bottom:-.1875em}.filepond--action-edit-item-alt{border:none;line-height:inherit;background:transparent;font-family:inherit;color:inherit;outline:none;padding:0;margin:0 0 0 .25em;pointer-events:all;position:absolute}.filepond--action-edit-item-alt svg{width:1.3125em;height:1.3125em}.filepond--action-edit-item-alt span{font-size:0;opacity:0}.filepond--file-info{position:static;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start;-ms-flex:1;flex:1;margin:0 .5em 0 0;min-width:0;will-change:transform,opacity;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--file-info *{margin:0}.filepond--file-info .filepond--file-info-main{font-size:.75em;line-height:1.2;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:100%}.filepond--file-info .filepond--file-info-sub{font-size:.625em;opacity:.5;-webkit-transition:opacity .25s ease-in-out;transition:opacity .25s ease-in-out;white-space:nowrap}.filepond--file-info .filepond--file-info-sub:empty{display:none}.filepond--file-status{position:static;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:end;align-items:flex-end;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;margin:0;min-width:2.25em;text-align:right;will-change:transform,opacity;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--file-status *{margin:0;white-space:nowrap}.filepond--file-status .filepond--file-status-main{font-size:.75em;line-height:1.2}.filepond--file-status .filepond--file-status-sub{font-size:.625em;opacity:.5;-webkit-transition:opacity .25s ease-in-out;transition:opacity .25s ease-in-out}.filepond--file-wrapper.filepond--file-wrapper{border:none;margin:0;padding:0;min-width:0;height:100%}.filepond--file-wrapper.filepond--file-wrapper>legend{position:absolute;overflow:hidden;height:1px;width:1px;padding:0;border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);white-space:nowrap}.filepond--file{position:static;display:-ms-flexbox;display:flex;height:100%;-ms-flex-align:start;align-items:flex-start;padding:.5625em;color:#fff;border-radius:.5em}.filepond--file .filepond--file-status{margin-left:auto;margin-right:2.25em}.filepond--file .filepond--processing-complete-indicator{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:3}.filepond--file .filepond--file-action-button,.filepond--file .filepond--processing-complete-indicator,.filepond--file .filepond--progress-indicator{position:absolute}.filepond--file [data-align*=left]{left:.5625em}.filepond--file [data-align*=right]{right:.5625em}.filepond--file [data-align*=center]{left:calc(50% - .8125em)}.filepond--file [data-align*=bottom]{bottom:1.125em}.filepond--file [data-align=center]{top:calc(50% - .8125em)}.filepond--file .filepond--progress-indicator{margin-top:.1875em}.filepond--file .filepond--progress-indicator[data-align*=right]{margin-right:.1875em}.filepond--file .filepond--progress-indicator[data-align*=left]{margin-left:.1875em}[data-filepond-item-state*=error] .filepond--file-info,[data-filepond-item-state*=invalid] .filepond--file-info,[data-filepond-item-state=cancelled] .filepond--file-info{margin-right:2.25em}[data-filepond-item-state~=processing] .filepond--file-status-sub{opacity:0}[data-filepond-item-state~=processing] .filepond--action-abort-item-processing~.filepond--file-status .filepond--file-status-sub{opacity:.5}[data-filepond-item-state=processing-error] .filepond--file-status-sub{opacity:0}[data-filepond-item-state=processing-error] .filepond--action-retry-item-processing~.filepond--file-status .filepond--file-status-sub{opacity:.5}[data-filepond-item-state=processing-complete] .filepond--action-revert-item-processing svg{-webkit-animation:fall .5s linear .125s both;animation:fall .5s linear .125s both}[data-filepond-item-state=processing-complete] .filepond--file-status-sub{opacity:.5}[data-filepond-item-state=processing-complete] .filepond--file-info-sub,[data-filepond-item-state=processing-complete] .filepond--processing-complete-indicator:not([style*=hidden])~.filepond--file-status .filepond--file-status-sub{opacity:0}[data-filepond-item-state=processing-complete] .filepond--action-revert-item-processing~.filepond--file-info .filepond--file-info-sub{opacity:.5}[data-filepond-item-state*=error] .filepond--file-wrapper,[data-filepond-item-state*=error] .filepond--panel,[data-filepond-item-state*=invalid] .filepond--file-wrapper,[data-filepond-item-state*=invalid] .filepond--panel{-webkit-animation:shake .65s linear both;animation:shake .65s linear both}[data-filepond-item-state*=busy] .filepond--progress-indicator svg{-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes shake{10%,90%{-webkit-transform:translateX(-.0625em);transform:translateX(-.0625em)}20%,80%{-webkit-transform:translateX(.125em);transform:translateX(.125em)}30%,50%,70%{-webkit-transform:translateX(-.25em);transform:translateX(-.25em)}40%,60%{-webkit-transform:translateX(.25em);transform:translateX(.25em)}}@keyframes shake{10%,90%{-webkit-transform:translateX(-.0625em);transform:translateX(-.0625em)}20%,80%{-webkit-transform:translateX(.125em);transform:translateX(.125em)}30%,50%,70%{-webkit-transform:translateX(-.25em);transform:translateX(-.25em)}40%,60%{-webkit-transform:translateX(.25em);transform:translateX(.25em)}}@-webkit-keyframes fall{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}70%{opacity:1;-webkit-transform:scale(1.1);transform:scale(1.1);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}to{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes fall{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}70%{opacity:1;-webkit-transform:scale(1.1);transform:scale(1.1);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}to{-webkit-transform:scale(1);transform:scale(1);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.filepond--hopper[data-hopper-state=drag-over]>*{pointer-events:none}.filepond--hopper[data-hopper-state=drag-over]:after{content:\"\";position:absolute;left:0;top:0;right:0;bottom:0;z-index:100}.filepond--progress-indicator{z-index:103}.filepond--file-action-button{z-index:102}.filepond--file-status{z-index:101}.filepond--file-info{z-index:100}.filepond--item{position:absolute;top:0;left:0;right:0;z-index:1;padding:0;margin:.25em;will-change:transform,opacity}.filepond--item>.filepond--panel{z-index:-1}.filepond--item>.filepond--panel .filepond--panel-bottom{-webkit-box-shadow:0 .0625em .125em -.0625em rgba(0,0,0,.25);box-shadow:0 .0625em .125em -.0625em rgba(0,0,0,.25)}.filepond--item>.filepond--file-wrapper,.filepond--item>.filepond--panel{-webkit-transition:opacity .15s ease-out;transition:opacity .15s ease-out}.filepond--item[data-drag-state]{cursor:-webkit-grab;cursor:grab}.filepond--item[data-drag-state]>.filepond--panel{-webkit-transition:-webkit-box-shadow .125s ease-in-out;transition:-webkit-box-shadow .125s ease-in-out;transition:box-shadow .125s ease-in-out;transition:box-shadow .125s ease-in-out, -webkit-box-shadow .125s ease-in-out;-webkit-box-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent}.filepond--item[data-drag-state=drag]{cursor:-webkit-grabbing;cursor:grabbing}.filepond--item[data-drag-state=drag]>.filepond--panel{-webkit-box-shadow:0 .125em .3125em rgba(0,0,0,.325);box-shadow:0 .125em .3125em rgba(0,0,0,.325)}.filepond--item[data-drag-state]:not([data-drag-state=idle]){z-index:2}.filepond--item-panel{background-color:#64605e}[data-filepond-item-state=processing-complete] .filepond--item-panel{background-color:#369763}[data-filepond-item-state*=error] .filepond--item-panel,[data-filepond-item-state*=invalid] .filepond--item-panel{background-color:#c44e47}.filepond--item-panel{border-radius:.5em;-webkit-transition:background-color .25s;transition:background-color .25s}.filepond--list-scroller{position:absolute;top:0;left:0;right:0;margin:0;will-change:transform}.filepond--list-scroller[data-state=overflow] .filepond--list{bottom:0;right:0}.filepond--list-scroller[data-state=overflow]{overflow-y:scroll;overflow-x:hidden;-webkit-overflow-scrolling:touch;-webkit-mask:-webkit-gradient(linear,left top, left bottom,from(#000),to(transparent));-webkit-mask:linear-gradient(180deg,#000 calc(100% - .5em),transparent);mask:-webkit-gradient(linear,left top, left bottom,from(#000),to(transparent));mask:linear-gradient(180deg,#000 calc(100% - .5em),transparent)}.filepond--list-scroller::-webkit-scrollbar{background:transparent}.filepond--list-scroller::-webkit-scrollbar:vertical{width:1em}.filepond--list-scroller::-webkit-scrollbar:horizontal{height:0}.filepond--list-scroller::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.3);border-radius:99999px;border:.3125em solid transparent;background-clip:content-box}.filepond--list.filepond--list{position:absolute;top:0;margin:0;padding:0;list-style-type:none;will-change:transform}.filepond--list{left:.75em;right:.75em}.filepond--root[data-style-panel-layout~=integrated]{width:100%;height:100%;max-width:none;margin:0}.filepond--root[data-style-panel-layout~=circle] .filepond--panel-root,.filepond--root[data-style-panel-layout~=integrated] .filepond--panel-root{border-radius:0}.filepond--root[data-style-panel-layout~=circle] .filepond--panel-root>*,.filepond--root[data-style-panel-layout~=integrated] .filepond--panel-root>*{display:none}.filepond--root[data-style-panel-layout~=circle] .filepond--drop-label,.filepond--root[data-style-panel-layout~=integrated] .filepond--drop-label{bottom:0;height:auto;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;z-index:7}.filepond--root[data-style-panel-layout~=circle] .filepond--item-panel,.filepond--root[data-style-panel-layout~=integrated] .filepond--item-panel{display:none}.filepond--root[data-style-panel-layout~=compact] .filepond--list-scroller,.filepond--root[data-style-panel-layout~=integrated] .filepond--list-scroller{overflow:hidden;height:100%;margin-top:0;margin-bottom:0}.filepond--root[data-style-panel-layout~=compact] .filepond--list,.filepond--root[data-style-panel-layout~=integrated] .filepond--list{left:0;right:0;height:100%}.filepond--root[data-style-panel-layout~=compact] .filepond--item,.filepond--root[data-style-panel-layout~=integrated] .filepond--item{margin:0}.filepond--root[data-style-panel-layout~=compact] .filepond--file-wrapper,.filepond--root[data-style-panel-layout~=integrated] .filepond--file-wrapper{height:100%}.filepond--root[data-style-panel-layout~=compact] .filepond--drop-label,.filepond--root[data-style-panel-layout~=integrated] .filepond--drop-label{z-index:7}.filepond--root[data-style-panel-layout~=circle]{border-radius:99999rem;overflow:hidden}.filepond--root[data-style-panel-layout~=circle]>.filepond--panel{border-radius:inherit}.filepond--root[data-style-panel-layout~=circle]>.filepond--panel>*{display:none}.filepond--root[data-style-panel-layout~=circle] .filepond--file-info,.filepond--root[data-style-panel-layout~=circle] .filepond--file-status{display:none}.filepond--root[data-style-panel-layout~=circle] .filepond--action-edit-item{opacity:1!important;visibility:visible!important}@media not all and (-webkit-min-device-pixel-ratio:0), not all and (min-resolution:0.001dpcm){@supports (-webkit-appearance:none) and (stroke-color:transparent){.filepond--root[data-style-panel-layout~=circle]{will-change:transform}}}.filepond--panel-root{border-radius:.5em;background-color:#f1f0ef}.filepond--panel{position:absolute;left:0;top:0;right:0;margin:0;height:100%!important;pointer-events:none}.filepond-panel:not([data-scalable=false]){height:auto!important}.filepond--panel[data-scalable=false]>div{display:none}.filepond--panel[data-scalable=true]{-webkit-transform-style:preserve-3d;transform-style:preserve-3d;background-color:transparent!important;border:none!important}.filepond--panel-bottom,.filepond--panel-center,.filepond--panel-top{position:absolute;left:0;top:0;right:0;margin:0;padding:0}.filepond--panel-bottom,.filepond--panel-top{height:.5em}.filepond--panel-top{border-bottom-left-radius:0!important;border-bottom-right-radius:0!important;border-bottom:none!important}.filepond--panel-top:after{content:\"\";position:absolute;height:2px;left:0;right:0;bottom:-1px;background-color:inherit}.filepond--panel-bottom,.filepond--panel-center{will-change:transform;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:translate3d(0,.5em,0);transform:translate3d(0,.5em,0)}.filepond--panel-bottom{border-top-left-radius:0!important;border-top-right-radius:0!important;border-top:none!important}.filepond--panel-bottom:before{content:\"\";position:absolute;height:2px;left:0;right:0;top:-1px;background-color:inherit}.filepond--panel-center{height:100px!important;border-top:none!important;border-bottom:none!important;border-radius:0!important}.filepond--panel-center:not([style]){visibility:hidden}.filepond--progress-indicator{position:static;width:1.25em;height:1.25em;color:#fff;margin:0;pointer-events:none;will-change:transform,opacity}.filepond--progress-indicator svg{width:100%;height:100%;vertical-align:top;transform-box:fill-box}.filepond--progress-indicator path{fill:none;stroke:currentColor}.filepond--list-scroller{z-index:6}.filepond--drop-label{z-index:5}.filepond--drip{z-index:3}.filepond--root>.filepond--panel{z-index:2}.filepond--browser{z-index:1}.filepond--root{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;margin-bottom:1em;font-size:1rem;line-height:normal;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-weight:450;text-align:left;text-rendering:optimizeLegibility;direction:ltr;contain:layout style size}.filepond--root *{-webkit-box-sizing:inherit;box-sizing:inherit;line-height:inherit}.filepond--root :not(text){font-size:inherit}.filepond--root[data-disabled]{pointer-events:none}.filepond--root[data-disabled] .filepond--list-scroller{pointer-events:all}.filepond--root[data-disabled] .filepond--list{pointer-events:none}.filepond--root .filepond--drop-label{min-height:4.75em}.filepond--root .filepond--list-scroller{margin-top:1em;margin-bottom:1em}.filepond--root .filepond--credits{position:absolute;right:0;opacity:.175;line-height:.85;font-size:11px;color:inherit;text-decoration:none;z-index:3;bottom:-14px}.filepond--root .filepond--credits[style]{top:0;bottom:auto;margin-top:14px}/*!\n * FilePondPluginImagePreview 4.6.11\n * Licensed under MIT, https://opensource.org/licenses/MIT/\n * Please visit https://pqina.nl/filepond/ for details.\n */.filepond--image-preview-markup{position:absolute;left:0;top:0}.filepond--image-preview-wrapper{z-index:2}.filepond--image-preview-overlay{display:block;position:absolute;left:0;top:0;width:100%;min-height:5rem;max-height:7rem;margin:0;opacity:0;z-index:2;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.filepond--image-preview-overlay svg{width:100%;height:auto;color:inherit;max-height:inherit}.filepond--image-preview-overlay-idle{mix-blend-mode:multiply;color:rgba(40, 40, 40, 0.85)}.filepond--image-preview-overlay-success{mix-blend-mode:normal;color:rgba(54, 151, 99, 1)}.filepond--image-preview-overlay-failure{mix-blend-mode:normal;color:rgba(196, 78, 71, 1)}@supports (-webkit-marquee-repetition: infinite) and\n ((-o-object-fit: fill) or (object-fit: fill)){.filepond--image-preview-overlay-idle{mix-blend-mode:normal}}.filepond--image-preview-wrapper{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:absolute;left:0;top:0;right:0;height:100%;margin:0;border-radius:0.45em;overflow:hidden;background:rgba(0, 0, 0, 0.01)}.filepond--image-preview{position:absolute;left:0;top:0;z-index:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:100%;width:100%;pointer-events:none;background:#222;will-change:transform, opacity}.filepond--image-clip{position:relative;overflow:hidden;margin:0 auto;}.filepond--image-clip[data-transparency-indicator='grid'] img,.filepond--image-clip[data-transparency-indicator='grid'] canvas{background-color:#fff;background-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg' fill='%23eee'%3E%3Cpath d='M0 0 H50 V50 H0'/%3E%3Cpath d='M50 50 H100 V100 H50'/%3E%3C/svg%3E\");background-size:1.25em 1.25em}.filepond--image-bitmap,.filepond--image-vector{position:absolute;left:0;top:0;will-change:transform}.filepond--root[data-style-panel-layout~='integrated'] .filepond--image-preview-wrapper{border-radius:0}.filepond--root[data-style-panel-layout~='integrated'] .filepond--image-preview{height:100%;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.filepond--root[data-style-panel-layout~='circle'] .filepond--image-preview-wrapper{border-radius:99999rem}.filepond--root[data-style-panel-layout~='circle'] .filepond--image-preview-overlay{top:auto;bottom:0;-webkit-transform:scaleY(-1);transform:scaleY(-1)}.filepond--root[data-style-panel-layout~='circle'] .filepond--file .filepond--file-action-button[data-align*='bottom']:not([data-align*='center']){margin-bottom:0.325em}.filepond--root[data-style-panel-layout~='circle'] .filepond--file [data-align*='left']{left:calc(50% - 3em)}.filepond--root[data-style-panel-layout~='circle'] .filepond--file [data-align*='right']{right:calc(50% - 3em)}.filepond--root[data-style-panel-layout~='circle'] .filepond--progress-indicator[data-align*='bottom'][data-align*='left'],.filepond--root[data-style-panel-layout~='circle'] .filepond--progress-indicator[data-align*='bottom'][data-align*='right']{margin-bottom:calc(0.325em + 0.1875em)}.filepond--root[data-style-panel-layout~='circle'] .filepond--progress-indicator[data-align*='bottom'][data-align*='center']{margin-top:0;margin-bottom:0.1875em;margin-left:0.1875em}/*!\n * FilePondPluginImageEdit 1.6.3\n * Licensed under MIT, https://opensource.org/licenses/MIT/\n * Please visit https://pqina.nl/filepond/ for details.\n */.filepond--action-edit-item.filepond--action-edit-item{width:2em;height:2em;padding:0.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*='center']{margin-left:-0.1875em}.filepond--action-edit-item.filepond--action-edit-item[data-align*='bottom']{margin-bottom:-0.1875em}.filepond--action-edit-item-alt{border:none;line-height:inherit;background:transparent;font-family:inherit;color:inherit;outline:none;padding:0;margin:0 0 0 0.25em;pointer-events:all;position:absolute}.filepond--action-edit-item-alt svg{width:1.3125em;height:1.3125em}.filepond--action-edit-item-alt span{font-size:0;opacity:0}.filepond--root[data-style-panel-layout~='circle'] .filepond--action-edit-item{opacity:1 !important;visibility:visible !important}";
|
|
20646
|
+
|
|
20647
|
+
const SallaFileUpload = class {
|
|
20648
|
+
constructor(hostRef) {
|
|
20649
|
+
index.registerInstance(this, hostRef);
|
|
20650
|
+
this.uploaded = index.createEvent(this, "uploaded", 7);
|
|
20651
|
+
this.removed = index.createEvent(this, "removed", 7);
|
|
20652
|
+
/**
|
|
20653
|
+
* File input name for the native formData
|
|
20109
20654
|
*/
|
|
20110
|
-
this.
|
|
20655
|
+
this.name = 'file';
|
|
20111
20656
|
/**
|
|
20112
|
-
* The
|
|
20657
|
+
* The submit request method.
|
|
20113
20658
|
*/
|
|
20114
|
-
this.
|
|
20659
|
+
this.method = 'POST';
|
|
20115
20660
|
/**
|
|
20116
|
-
*
|
|
20117
|
-
* Structure is like [{label,url}]
|
|
20661
|
+
* json formData to be injected in the submit request
|
|
20118
20662
|
*/
|
|
20119
|
-
this.
|
|
20120
|
-
/// DRAG and DROP Props
|
|
20663
|
+
this.formData = "{}";
|
|
20121
20664
|
/**
|
|
20122
|
-
*
|
|
20665
|
+
* Enable or disable drag n' drop
|
|
20123
20666
|
*/
|
|
20124
|
-
this.
|
|
20667
|
+
this.allowDrop = true;
|
|
20125
20668
|
/**
|
|
20126
|
-
*
|
|
20669
|
+
* Enable or disable file browser
|
|
20127
20670
|
*/
|
|
20128
|
-
this.
|
|
20671
|
+
this.allowBrowse = true;
|
|
20129
20672
|
/**
|
|
20130
|
-
*
|
|
20673
|
+
* Allow drop to replace a file, only works when allowMultiple is false
|
|
20131
20674
|
*/
|
|
20132
|
-
this.
|
|
20675
|
+
this.allowReplace = true;
|
|
20133
20676
|
/**
|
|
20134
|
-
*
|
|
20677
|
+
* Enable or disable the revert processing button
|
|
20135
20678
|
*/
|
|
20136
|
-
this.
|
|
20137
|
-
/// SERVER Configuration props
|
|
20679
|
+
this.allowRevert = true;
|
|
20138
20680
|
/**
|
|
20139
|
-
*
|
|
20681
|
+
* When set to false the remove button is hidden and disabled
|
|
20140
20682
|
*/
|
|
20141
|
-
this.
|
|
20142
|
-
|
|
20143
|
-
|
|
20144
|
-
|
|
20145
|
-
|
|
20146
|
-
|
|
20147
|
-
|
|
20148
|
-
|
|
20149
|
-
|
|
20150
|
-
|
|
20151
|
-
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
abort: () => {
|
|
20157
|
-
abort();
|
|
20158
|
-
},
|
|
20159
|
-
};
|
|
20160
|
-
});
|
|
20161
|
-
}
|
|
20162
|
-
};
|
|
20683
|
+
this.allowRemove = true;
|
|
20684
|
+
/**
|
|
20685
|
+
* The maximum number of files that the pond can handle
|
|
20686
|
+
*/
|
|
20687
|
+
this.maxFilesCount = null;
|
|
20688
|
+
/**
|
|
20689
|
+
* The maxmimum number of files that can be uploaded in parallel
|
|
20690
|
+
*/
|
|
20691
|
+
this.maxParallelUploads = 2;
|
|
20692
|
+
/**
|
|
20693
|
+
* Set to 'after' to add files to end of list (when dropped at the top of the list or added using browse or paste),
|
|
20694
|
+
* set to 'before' to add files at start of list.
|
|
20695
|
+
* Set to a compare function to automatically sort items when added
|
|
20696
|
+
*/
|
|
20697
|
+
this.itemInsertLocation = 'after';
|
|
20163
20698
|
/**
|
|
20164
|
-
*
|
|
20699
|
+
* The interval to use before showing each item being added to the list
|
|
20165
20700
|
*/
|
|
20166
|
-
this.
|
|
20701
|
+
this.itemInsertInterval = 75;
|
|
20167
20702
|
/**
|
|
20168
|
-
*
|
|
20703
|
+
* Require drop on the FilePond element itself to catch the file.
|
|
20169
20704
|
*/
|
|
20170
|
-
this.
|
|
20705
|
+
this.dropOnElement = true;
|
|
20171
20706
|
/**
|
|
20172
|
-
*
|
|
20707
|
+
* Ignored file names when handling dropped directories. Dropping directories is not supported on all browsers.
|
|
20173
20708
|
*/
|
|
20174
|
-
this.
|
|
20709
|
+
this.ignoredFiles = ['.ds_store', 'thumbs.db', 'desktop.ini'];
|
|
20175
20710
|
/**
|
|
20176
20711
|
* The size of a chunk in bytes
|
|
20177
20712
|
*/
|
|
@@ -20195,131 +20730,125 @@ const SallaFileUpload = class {
|
|
|
20195
20730
|
* @default `${salla.lang.get('common.uploader.drag_and_drop')}<span class="filepond--label-action"> ${salla.lang.get('common.uploader.browse')} </span>`
|
|
20196
20731
|
*/
|
|
20197
20732
|
this.labelIdle = this.getLabel();
|
|
20733
|
+
/// SVG Icons
|
|
20198
20734
|
/**
|
|
20199
|
-
*
|
|
20735
|
+
* The icon used for remove actions
|
|
20200
20736
|
*/
|
|
20201
|
-
this.
|
|
20737
|
+
this.iconRemove = '<svg>...</svg>';
|
|
20202
20738
|
/**
|
|
20203
|
-
*
|
|
20739
|
+
* The icon used for process actions
|
|
20204
20740
|
*/
|
|
20205
|
-
this.
|
|
20741
|
+
this.iconProcess = '<svg>...</svg>';
|
|
20206
20742
|
/**
|
|
20207
|
-
*
|
|
20743
|
+
* The icon used for retry actions
|
|
20208
20744
|
*/
|
|
20209
|
-
this.
|
|
20745
|
+
this.iconRetry = '<svg>...</svg>';
|
|
20210
20746
|
/**
|
|
20211
|
-
*
|
|
20747
|
+
* The icon used for undo actions
|
|
20212
20748
|
*/
|
|
20213
|
-
this.
|
|
20749
|
+
this.iconUndo = '<svg>...</svg>';
|
|
20750
|
+
/// STATES
|
|
20214
20751
|
/**
|
|
20215
|
-
*
|
|
20752
|
+
* The array of file references
|
|
20216
20753
|
*/
|
|
20217
|
-
this.
|
|
20754
|
+
this.files = [];
|
|
20218
20755
|
/**
|
|
20219
|
-
*
|
|
20756
|
+
* Translations
|
|
20220
20757
|
*/
|
|
20758
|
+
this.labelInvalidField = salla.lang.get("common.uploader.invalid_field");
|
|
20759
|
+
this.labelFileWaitingForSize = salla.lang.get('common.uploader.waiting_file_info');
|
|
20760
|
+
this.labelFileSizeNotAvailable = salla.lang.get('common.uploader.size_not_available');
|
|
20761
|
+
this.labelFileLoading = salla.lang.get('common.elements.loading');
|
|
20762
|
+
this.labelFileLoadError = salla.lang.get('common.uploader.failed_to_load');
|
|
20221
20763
|
this.labelFileProcessing = salla.lang.get('common.uploader.uploading');
|
|
20222
|
-
/**
|
|
20223
|
-
* Label used when file upload has completed
|
|
20224
|
-
*/
|
|
20225
20764
|
this.labelFileProcessingComplete = salla.lang.get('common.uploader.upload_completed');
|
|
20226
|
-
/**
|
|
20227
|
-
* Label used when upload was cancelled
|
|
20228
|
-
*/
|
|
20229
20765
|
this.labelFileProcessingAborted = salla.lang.get('common.uploader.upload_cancelled');
|
|
20230
|
-
/**
|
|
20231
|
-
* Label used when something went wrong during file upload
|
|
20232
|
-
*/
|
|
20233
20766
|
this.labelFileProcessingError = salla.lang.get('common.uploader.error_uploading');
|
|
20234
|
-
/**
|
|
20235
|
-
* Label used when something went wrong during reverting the file upload
|
|
20236
|
-
*/
|
|
20237
20767
|
this.labelFileProcessingRevertError = salla.lang.get('common.uploader.error_reverting');
|
|
20238
|
-
/**
|
|
20239
|
-
* Label used to indicate something went wrong when removing the file
|
|
20240
|
-
*/
|
|
20241
20768
|
this.labelFileRemoveError = salla.lang.get('common.uploader.error_removing');
|
|
20242
|
-
/**
|
|
20243
|
-
* Label used to indicate to the user that an action can be cancelled.
|
|
20244
|
-
*/
|
|
20245
20769
|
this.labelTapToCancel = salla.lang.get("common.elements.cancel");
|
|
20246
|
-
/**
|
|
20247
|
-
* Label used to indicate to the user that an action can be retried.
|
|
20248
|
-
*/
|
|
20249
20770
|
this.labelTapToRetry = salla.lang.get("common.elements.retry");
|
|
20250
|
-
/**
|
|
20251
|
-
* Label used to indicate to the user that an action can be undone.
|
|
20252
|
-
*/
|
|
20253
20771
|
this.labelTapToUndo = salla.lang.get("common.uploader.revert");
|
|
20254
|
-
/**
|
|
20255
|
-
* Label used for remove button
|
|
20256
|
-
*/
|
|
20257
20772
|
this.labelButtonRemoveItem = salla.lang.get("common.elements.remove");
|
|
20258
|
-
/**
|
|
20259
|
-
* Label used for abort load button
|
|
20260
|
-
*/
|
|
20261
20773
|
this.labelButtonAbortItemLoad = salla.lang.get("common.elements.abort");
|
|
20262
|
-
/**
|
|
20263
|
-
* Label used for retry load button
|
|
20264
|
-
*/
|
|
20265
20774
|
this.labelButtonRetryItemLoad = salla.lang.get("common.elements.retry");
|
|
20266
|
-
/**
|
|
20267
|
-
* Label used for abort upload button
|
|
20268
|
-
*/
|
|
20269
20775
|
this.labelButtonAbortItemProcessing = salla.lang.get("common.uploader.abort_upload");
|
|
20270
|
-
/**
|
|
20271
|
-
* Label used for undo upload button
|
|
20272
|
-
*/
|
|
20273
20776
|
this.labelButtonUndoItemProcessing = salla.lang.get("common.elements.undo");
|
|
20274
|
-
/**
|
|
20275
|
-
* Label used for retry upload button
|
|
20276
|
-
*/
|
|
20277
20777
|
this.labelButtonRetryItemProcessing = `${salla.lang.get("common.elements.retry")} ${salla.lang.get("common.uploader.upload")}`;
|
|
20278
|
-
/**
|
|
20279
|
-
* Label used for upload button
|
|
20280
|
-
*/
|
|
20281
20778
|
this.labelButtonProcessItem = salla.lang.get("common.uploader.upload");
|
|
20282
|
-
|
|
20283
|
-
/**
|
|
20284
|
-
* The icon used for remove actions
|
|
20285
|
-
*/
|
|
20286
|
-
this.iconRemove = '<svg>...</svg>';
|
|
20287
|
-
/**
|
|
20288
|
-
* The icon used for process actions
|
|
20289
|
-
*/
|
|
20290
|
-
this.iconProcess = '<svg>...</svg>';
|
|
20291
|
-
/**
|
|
20292
|
-
* The icon used for retry actions
|
|
20293
|
-
*/
|
|
20294
|
-
this.iconRetry = '<svg>...</svg>';
|
|
20295
|
-
/**
|
|
20296
|
-
* The icon used for undo actions
|
|
20297
|
-
*/
|
|
20298
|
-
this.iconUndo = '<svg>...</svg>';
|
|
20299
|
-
/**
|
|
20300
|
-
* The array of file references
|
|
20301
|
-
*/
|
|
20302
|
-
this.files = [];
|
|
20779
|
+
filepond.registerPlugin(FilePondPluginImagePreview, filepondPluginImageExifOrientation, filepondPluginFileValidateSize, filepondPluginImageEdit, filepondPluginFileValidateType, filepondPluginFilePoster);
|
|
20303
20780
|
salla.lang.onLoaded(() => {
|
|
20304
20781
|
this.host.querySelectorAll('.filepond--drop-label>label').forEach(label => label.innerHTML = this.getLabel());
|
|
20782
|
+
this.labelInvalidField = salla.lang.get("common.uploader.invalid_field");
|
|
20783
|
+
this.labelFileWaitingForSize = salla.lang.get('common.uploader.waiting_file_info');
|
|
20784
|
+
this.labelFileSizeNotAvailable = salla.lang.get('common.uploader.size_not_available');
|
|
20785
|
+
this.labelFileLoading = salla.lang.get('common.elements.loading');
|
|
20786
|
+
this.labelFileLoadError = salla.lang.get('common.uploader.failed_to_load');
|
|
20787
|
+
this.labelFileProcessing = salla.lang.get('common.uploader.uploading');
|
|
20788
|
+
this.labelFileProcessingComplete = salla.lang.get('common.uploader.upload_completed');
|
|
20789
|
+
this.labelFileProcessingAborted = salla.lang.get('common.uploader.upload_cancelled');
|
|
20790
|
+
this.labelFileProcessingError = salla.lang.get('common.uploader.error_uploading');
|
|
20791
|
+
this.labelFileProcessingRevertError = salla.lang.get('common.uploader.error_reverting');
|
|
20792
|
+
this.labelFileRemoveError = salla.lang.get('common.uploader.error_removing');
|
|
20793
|
+
this.labelTapToCancel = salla.lang.get("common.elements.cancel");
|
|
20794
|
+
this.labelTapToRetry = salla.lang.get("common.elements.retry");
|
|
20795
|
+
this.labelTapToUndo = salla.lang.get("common.uploader.revert");
|
|
20796
|
+
this.labelButtonRemoveItem = salla.lang.get("common.elements.remove");
|
|
20797
|
+
this.labelButtonAbortItemLoad = salla.lang.get("common.elements.abort");
|
|
20798
|
+
this.labelButtonRetryItemLoad = salla.lang.get("common.elements.retry");
|
|
20799
|
+
this.labelButtonAbortItemProcessing = salla.lang.get("common.uploader.abort_upload");
|
|
20800
|
+
this.labelButtonUndoItemProcessing = salla.lang.get("common.elements.undo");
|
|
20801
|
+
this.labelButtonRetryItemProcessing = `${salla.lang.get("common.elements.retry")} ${salla.lang.get("common.uploader.upload")}`;
|
|
20802
|
+
this.labelButtonProcessItem = salla.lang.get("common.uploader.upload");
|
|
20305
20803
|
});
|
|
20306
20804
|
}
|
|
20805
|
+
getLabel() {
|
|
20806
|
+
return this.host.getAttribute('label-idle') || `${salla.lang.get('common.uploader.drag_and_drop')}<span class="filepond--label-action"> ${salla.lang.get('common.uploader.browse')} </span>`;
|
|
20807
|
+
}
|
|
20307
20808
|
/**
|
|
20308
|
-
*
|
|
20809
|
+
*
|
|
20810
|
+
* This method will fire head request to get the file size, it's head request,so it will be too fast.
|
|
20309
20811
|
*/
|
|
20310
|
-
|
|
20311
|
-
|
|
20812
|
+
getFileSize(url) {
|
|
20813
|
+
let http = new XMLHttpRequest();
|
|
20814
|
+
http.open('HEAD', url, false); // false = Synchronous
|
|
20815
|
+
http.send(null); // it will stop here until this http request is complete
|
|
20816
|
+
return http.status === 200 ? http.getResponseHeader('content-length') : '';
|
|
20312
20817
|
}
|
|
20313
|
-
|
|
20314
|
-
|
|
20818
|
+
getFiles() {
|
|
20819
|
+
if (!this.value) {
|
|
20820
|
+
return [];
|
|
20821
|
+
}
|
|
20822
|
+
try {
|
|
20823
|
+
let files = [this.value];
|
|
20824
|
+
return files.map(file => {
|
|
20825
|
+
let metadata = { poster: file, name: file };
|
|
20826
|
+
return {
|
|
20827
|
+
source: this.fileId ? `${this.fileId}` : this.value,
|
|
20828
|
+
options: {
|
|
20829
|
+
type: 'local',
|
|
20830
|
+
file: {
|
|
20831
|
+
name: this.value.substring(this.value.lastIndexOf('/') + 1),
|
|
20832
|
+
size: this.getFileSize(this.value)
|
|
20833
|
+
},
|
|
20834
|
+
metadata: metadata,
|
|
20835
|
+
},
|
|
20836
|
+
};
|
|
20837
|
+
});
|
|
20838
|
+
}
|
|
20839
|
+
catch (e) {
|
|
20840
|
+
salla.log('failed To get files from: ' + (this.value || this.fileId));
|
|
20841
|
+
}
|
|
20842
|
+
return [];
|
|
20315
20843
|
}
|
|
20316
|
-
|
|
20317
|
-
this.
|
|
20844
|
+
render() {
|
|
20845
|
+
return (index.h(index.Host, { class: "s-file-upload" }, index.h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: "image/png, image/jpeg, image/jpg, image/gif" })));
|
|
20318
20846
|
}
|
|
20319
|
-
|
|
20320
|
-
filepond.
|
|
20321
|
-
|
|
20322
|
-
|
|
20847
|
+
componentDidLoad() {
|
|
20848
|
+
this.pond = filepond.create(this.fileUploader, {
|
|
20849
|
+
name: this.payloadName || this.name,
|
|
20850
|
+
//@ts-ignore
|
|
20851
|
+
files: this.getFiles(),
|
|
20323
20852
|
required: this.required,
|
|
20324
20853
|
disabled: this.disabled,
|
|
20325
20854
|
allowDrop: this.allowDrop,
|
|
@@ -20342,7 +20871,43 @@ const SallaFileUpload = class {
|
|
|
20342
20871
|
dropOnElement: this.dropOnElement,
|
|
20343
20872
|
dropValidation: this.dropValidation,
|
|
20344
20873
|
ignoredFiles: this.ignoredFiles,
|
|
20345
|
-
server:
|
|
20874
|
+
server: {
|
|
20875
|
+
url: this.url,
|
|
20876
|
+
method: this.method,
|
|
20877
|
+
// @ts-ignore
|
|
20878
|
+
process: {
|
|
20879
|
+
onload: response => {
|
|
20880
|
+
let url = JSON.parse(response).data;
|
|
20881
|
+
this.uploaded.emit(this.value = url.filePath || url.url);
|
|
20882
|
+
return this.value;
|
|
20883
|
+
},
|
|
20884
|
+
headers: salla.api.getHeaders(),
|
|
20885
|
+
onerror: response => {
|
|
20886
|
+
try {
|
|
20887
|
+
let field = JSON.parse(response).error.fields;
|
|
20888
|
+
field = field[this.payloadName || this.name];
|
|
20889
|
+
return (field && field[0]) || salla.lang.get('common.errors.error_occurred');
|
|
20890
|
+
}
|
|
20891
|
+
catch (e) {
|
|
20892
|
+
salla.log('FileUpload:: Error', e);
|
|
20893
|
+
return salla.lang.get('common.errors.error_occurred');
|
|
20894
|
+
}
|
|
20895
|
+
},
|
|
20896
|
+
ondata: formData => {
|
|
20897
|
+
if (this.payloadName && this.payloadName != this.name) {
|
|
20898
|
+
formData.append(this.payloadName, this.pond.getFile(0).file);
|
|
20899
|
+
formData.delete(this.name);
|
|
20900
|
+
}
|
|
20901
|
+
try {
|
|
20902
|
+
Object.entries(JSON.parse(this.formData)).forEach((value) => value[1] && formData.append(value[0], value[1]));
|
|
20903
|
+
}
|
|
20904
|
+
catch (e) {
|
|
20905
|
+
salla.log('Error to inject formData', e);
|
|
20906
|
+
}
|
|
20907
|
+
return formData;
|
|
20908
|
+
}
|
|
20909
|
+
},
|
|
20910
|
+
},
|
|
20346
20911
|
instantUpload: this.instantUpload,
|
|
20347
20912
|
chunkUploads: this.chunkUploads,
|
|
20348
20913
|
chunkForce: this.chunkForce,
|
|
@@ -20351,22 +20916,17 @@ const SallaFileUpload = class {
|
|
|
20351
20916
|
labelDecimalSeparator: this.labelDecimalSeparator,
|
|
20352
20917
|
labelThousandsSeparator: this.labelThousandsSeparator,
|
|
20353
20918
|
labelIdle: this.labelIdle,
|
|
20919
|
+
//todo:: pass support types from props
|
|
20354
20920
|
acceptedFileTypes: ['image/jpg', 'image/png', 'image/jpeg', 'image/gif', 'video/*'],
|
|
20355
20921
|
labelInvalidField: this.labelInvalidField,
|
|
20356
20922
|
labelFileWaitingForSize: this.labelFileWaitingForSize,
|
|
20923
|
+
// onprocessfile: (error, file) =>salla.log(error, JSON.parse(file.serverId)),
|
|
20357
20924
|
beforeRemoveFile: (file_deleted) => new Promise((resolve) => {
|
|
20358
|
-
this.
|
|
20359
|
-
setTimeout(() => {
|
|
20360
|
-
// TODO: needs a better way
|
|
20361
|
-
this.host.style.height = '120px !important';
|
|
20362
|
-
}, 1000);
|
|
20925
|
+
this.removed.emit(file_deleted);
|
|
20363
20926
|
resolve(true);
|
|
20364
20927
|
}),
|
|
20365
20928
|
});
|
|
20366
20929
|
}
|
|
20367
|
-
render() {
|
|
20368
|
-
return (index.h(index.Host, { class: "s-file-upload" }, index.h("input", { type: "file", name: "filepond", ref: ele => this.fileUploader = ele, class: "s-file-upload-wrapper s-file-upload-input", accept: "image/png, image/jpeg, image/jpg, image/gif" })));
|
|
20369
|
-
}
|
|
20370
20930
|
get host() { return index.getElement(this); }
|
|
20371
20931
|
};
|
|
20372
20932
|
SallaFileUpload.style = sallaFileUploadCss;
|
|
@@ -20466,15 +21026,15 @@ const SallaGifting = class {
|
|
|
20466
21026
|
.finally(() => this.modal.stopLoading());
|
|
20467
21027
|
}
|
|
20468
21028
|
/**
|
|
20469
|
-
|
|
20470
|
-
|
|
20471
|
-
|
|
21029
|
+
*
|
|
21030
|
+
* Hide / close the gifting modal window
|
|
21031
|
+
*/
|
|
20472
21032
|
async close() {
|
|
20473
21033
|
return this.modal.close();
|
|
20474
21034
|
}
|
|
20475
21035
|
/**
|
|
20476
|
-
|
|
20477
|
-
|
|
21036
|
+
* Update the modal height based on the changes on the inner elements height for a specific step OR just a pass a new fixed height
|
|
21037
|
+
*/
|
|
20478
21038
|
async setWrapperHeight(asStep = 1, delay = 250, additionSpace = 0, newHeight = 0) {
|
|
20479
21039
|
let currentStep = document.querySelector(`.gift-step-${asStep}`);
|
|
20480
21040
|
setTimeout(() => {
|
|
@@ -20511,9 +21071,9 @@ const SallaGifting = class {
|
|
|
20511
21071
|
}
|
|
20512
21072
|
}
|
|
20513
21073
|
/**
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
21074
|
+
*
|
|
21075
|
+
* Go to the step 2
|
|
21076
|
+
*/
|
|
20517
21077
|
async goToStep2() {
|
|
20518
21078
|
if (!this.selectedGiftTextOption) {
|
|
20519
21079
|
this.textSelect.classList.add('s-form-has-error');
|
|
@@ -20561,9 +21121,9 @@ const SallaGifting = class {
|
|
|
20561
21121
|
this.parentClass = `is-current-step-${this.currentStep}`;
|
|
20562
21122
|
}
|
|
20563
21123
|
/**
|
|
20564
|
-
|
|
20565
|
-
|
|
20566
|
-
|
|
21124
|
+
*
|
|
21125
|
+
* Go to the step 1
|
|
21126
|
+
*/
|
|
20567
21127
|
goToStep1(e) {
|
|
20568
21128
|
e.preventDefault();
|
|
20569
21129
|
let stepBackAnime = new anime.timeline({
|
|
@@ -20633,6 +21193,12 @@ const SallaGifting = class {
|
|
|
20633
21193
|
handleReceiverName(event) {
|
|
20634
21194
|
this.receiverName = event.target.value;
|
|
20635
21195
|
}
|
|
21196
|
+
handleUploadImage(img) {
|
|
21197
|
+
this.uploadedImage = img;
|
|
21198
|
+
if (!!this.gift && this.gift.gift_images.length) {
|
|
21199
|
+
this.setWrapperHeight(1, 150, 0);
|
|
21200
|
+
}
|
|
21201
|
+
}
|
|
20636
21202
|
handleRemoveImage() {
|
|
20637
21203
|
this.uploadedImage = '';
|
|
20638
21204
|
if (!!this.gift && this.gift.gift_images.length) {
|
|
@@ -20660,34 +21226,6 @@ const SallaGifting = class {
|
|
|
20660
21226
|
"s-form-has-error": !!this.errors && this.errors['deliver_at']
|
|
20661
21227
|
};
|
|
20662
21228
|
}
|
|
20663
|
-
// TODO: make it default server config --> add it to file-upload
|
|
20664
|
-
getServerConfig() {
|
|
20665
|
-
return {
|
|
20666
|
-
process: async (_fieldName, file, _metadata, load, error, _progress, abort, _transfer, _options) => {
|
|
20667
|
-
const formData = new FormData();
|
|
20668
|
-
formData.append("image_url", file, file.name);
|
|
20669
|
-
return await salla.product.uploadGiftImage(formData)
|
|
20670
|
-
.then((resp) => {
|
|
20671
|
-
this.uploadedImage = resp.data.url;
|
|
20672
|
-
load('success');
|
|
20673
|
-
file.metadata = `_${new Date().getTime()}`;
|
|
20674
|
-
if (!!this.gift && this.gift.gift_images.length) {
|
|
20675
|
-
this.setWrapperHeight(1, 150, 0);
|
|
20676
|
-
}
|
|
20677
|
-
}).catch(e => {
|
|
20678
|
-
console.log(e);
|
|
20679
|
-
error('error');
|
|
20680
|
-
})
|
|
20681
|
-
.finally(() => {
|
|
20682
|
-
return {
|
|
20683
|
-
abort: () => {
|
|
20684
|
-
abort();
|
|
20685
|
-
},
|
|
20686
|
-
};
|
|
20687
|
-
});
|
|
20688
|
-
}
|
|
20689
|
-
};
|
|
20690
|
-
}
|
|
20691
21229
|
async submitForm() {
|
|
20692
21230
|
var _a;
|
|
20693
21231
|
this.calendarFormGroup.classList.remove('s-form-has-error');
|
|
@@ -20732,10 +21270,13 @@ const SallaGifting = class {
|
|
|
20732
21270
|
:
|
|
20733
21271
|
[
|
|
20734
21272
|
index.h("div", { class: "s-gifting-modal-header" }, index.h("span", { class: "s-gifting-modal-icon" }, index.h("span", { innerHTML: GiftSharing })), index.h("h2", { class: "s-gifting-modal-title" }, index.h("div", { class: "s-gifting-modal-badge-wrapper" }, index.h("div", { class: "s-gifting-modal-badge" }, index.h("span", null, index.h("span", null, this.currentStep), "/2")), index.h("span", null, this.giftDetails)))),
|
|
20735
|
-
index.h("div", { class: "s-gifting-steps-wrapper " + this.parentClass, ref: el => this.stepsWrapper = el }, index.h("div", { class: "s-gifting-step-one gift-step-1", ref: el => this.step1Elems = el }, index.h("div", { class: "s-gifting-modal-uploader-title anime-item" }, this.selectImageForYourGift), index.h("div", { class: "s-gifting-modal-uploader anime-item", ref: el => this.uploader = el }, index.h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }), this.selectImageOrUpload && index.h("salla-file-upload", { "instant-upload": true,
|
|
21273
|
+
index.h("div", { class: "s-gifting-steps-wrapper " + this.parentClass, ref: el => this.stepsWrapper = el }, index.h("div", { class: "s-gifting-step-one gift-step-1", ref: el => this.step1Elems = el }, index.h("div", { class: "s-gifting-modal-uploader-title anime-item" }, this.selectImageForYourGift), index.h("div", { class: "s-gifting-modal-uploader anime-item", ref: el => this.uploader = el }, index.h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }), this.selectImageOrUpload && index.h("salla-file-upload", { "instant-upload": true, name: "image_url", url: salla.url.api(salla.product.api.getUrl('giftImage')), onUploaded: event => this.handleUploadImage(event.detail), labelIdle: this.getFilepondPlaceholder(), onRemoved: () => this.handleRemoveImage() })), index.h("div", { class: "anime-item" }, !this.uploadedImage && !!this.gift && this.gift.gift_images.length > 0 ?
|
|
20736
21274
|
index.h("salla-slider", { id: "gifting-slider", loop: false, "controls-outer": true, class: "s-gifting-slider", type: "carousel" }, index.h("div", { slot: "items" }, (_a = this.gift) === null || _a === void 0 ? void 0 : _a.gift_images.map((item) => index.h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` }))))
|
|
20737
21275
|
: ""), index.h("div", { class: "anime-item" }, index.h("div", { class: "s-form-group s-gifting-selectText", ref: el => this.textSelect = el }, index.h("label", { htmlFor: "gift-text-selection", class: "s-form-label" }, this.selectGiftMessage), index.h("select", { id: "gift-text-selection", name: "gift-text-selection", class: "s-form-control s-gifting-select", onChange: e => this.toggleGiftText(e) }, index.h("option", { "data-id": null, selected: true }, this.selectGiftMessage), (_b = this.gift) === null || _b === void 0 ? void 0 :
|
|
20738
|
-
_b.gift_texts.map((txt) => index.h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), index.h("option", { "data-id": "custom" }, this.giftCustomText))), index.h("div", { class: this.showGiftText ? "s-form-group s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide", ref: (el) => this.customTextArea = el }, index.h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), index.h("div", { class: "mt-1" }, index.h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, ref: (el) => this.textArea = el, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" })))), index.h("div", { class: "anime-item" }, index.h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, index.h("span", null, this.nextStep)))), index.h("div", { class: "s-gifting-step-two gift-step-2", ref: el => this.step2Elems = el }, index.h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index.h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), index.h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ?
|
|
21276
|
+
_b.gift_texts.map((txt) => index.h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), index.h("option", { "data-id": "custom" }, this.giftCustomText))), index.h("div", { class: this.showGiftText ? "s-form-group s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide", ref: (el) => this.customTextArea = el }, index.h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), index.h("div", { class: "mt-1" }, index.h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, ref: (el) => this.textArea = el, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" })))), index.h("div", { class: "anime-item" }, index.h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, index.h("span", null, this.nextStep)))), index.h("div", { class: "s-gifting-step-two gift-step-2", ref: el => this.step2Elems = el }, index.h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index.h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), index.h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ?
|
|
21277
|
+
index.h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), index.h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index.h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), index.h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ?
|
|
21278
|
+
index.h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), index.h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index.h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), index.h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ?
|
|
21279
|
+
index.h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), index.h("div", { class: "anime-item opacity-0" }, index.h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, index.h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), index.h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), index.h("div", { class: this.getCalendarClasses(), ref: (el) => this.calendarFormGroup = el }, index.h("label", { class: "s-form-label" }, this.selectSendDateAndTime), index.h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d h:i K", onPicked: (event) => this.handleDateTimePicker(event) }), index.h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), index.h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, index.h("a", { href: "#!", innerHTML: LeftArrow, onClick: (e) => this.goToStep1(e) }), index.h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, index.h("span", null, this.sendGift)))))
|
|
20739
21280
|
], index.h("slot", { name: "footer" })))
|
|
20740
21281
|
];
|
|
20741
21282
|
}
|
|
@@ -21113,7 +21654,7 @@ const SallaLoginModal = class {
|
|
|
21113
21654
|
const error = e.target.nextElementSibling;
|
|
21114
21655
|
e.target.classList.remove('s-has-error');
|
|
21115
21656
|
(error === null || error === void 0 ? void 0 : error.classList.contains('s-login-modal-error-message')) && (error.innerText = '');
|
|
21116
|
-
//it was sending two requests for send two verification requests
|
|
21657
|
+
//it was sending two requests for send two verification requests
|
|
21117
21658
|
submitMethod && e.key == 'Enter' && submitMethod();
|
|
21118
21659
|
};
|
|
21119
21660
|
this.loginBySMS = async (event = null) => {
|
|
@@ -21269,36 +21810,23 @@ const SallaLoginModal = class {
|
|
|
21269
21810
|
const isLogByPhone = this.regType == "phone", isLogByEmail = this.regType == "email", emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value), isEmailValid = Helper$1.isValidEmail(emailValue), isFirstNameValid = this.firstName.value.length > 0, isLastNameValid = this.lastName.value.length > 0, isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(), emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);
|
|
21270
21811
|
// Custom Fields Validation
|
|
21271
21812
|
var isCustomFieldValid = true;
|
|
21272
|
-
|
|
21273
|
-
|
|
21274
|
-
|
|
21275
|
-
|
|
21276
|
-
|
|
21277
|
-
|
|
21278
|
-
isCustomFieldValid = false;
|
|
21279
|
-
const errorMsg = salla.lang.get('common.errors.field_required', { attribute: fileUploader.title });
|
|
21280
|
-
this.validateField(fileUploader, errorMsg);
|
|
21281
|
-
}
|
|
21282
|
-
}
|
|
21283
|
-
}
|
|
21284
|
-
if (item.tagName == "INPUT") {
|
|
21285
|
-
const inputItem = item;
|
|
21286
|
-
this.customFieldsValues[inputItem.id] = inputItem.value;
|
|
21287
|
-
if (inputItem.required) {
|
|
21288
|
-
if (inputItem.value.length == 0) {
|
|
21289
|
-
isCustomFieldValid = false;
|
|
21290
|
-
const errorMsg = salla.lang.get('common.errors.field_required', { attribute: inputItem.title });
|
|
21291
|
-
this.validateField(inputItem, errorMsg);
|
|
21292
|
-
}
|
|
21293
|
-
}
|
|
21813
|
+
//we should make sure that there is text nodes between children
|
|
21814
|
+
this.customFieldsWrapper.childNodes
|
|
21815
|
+
.forEach((field) => {
|
|
21816
|
+
this.customFieldsValues[field.id] = field['value'];
|
|
21817
|
+
if (!field.required || this.customFieldsValues[field.id].length) {
|
|
21818
|
+
return;
|
|
21294
21819
|
}
|
|
21295
|
-
|
|
21820
|
+
isCustomFieldValid = false;
|
|
21821
|
+
const errorMsg = salla.lang.get('common.errors.field_required', { attribute: field.title });
|
|
21822
|
+
this.validateField(field, errorMsg);
|
|
21823
|
+
});
|
|
21296
21824
|
if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid && isCustomFieldValid)
|
|
21297
21825
|
return;
|
|
21298
21826
|
!isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);
|
|
21299
21827
|
!isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);
|
|
21300
21828
|
!isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);
|
|
21301
|
-
throw
|
|
21829
|
+
throw 'Please insert required fields';
|
|
21302
21830
|
}
|
|
21303
21831
|
getFilepondPlaceholder() {
|
|
21304
21832
|
return `<div class="s-login-modal-filepond-placeholder"><span class="s-login-modal-filepond-placeholder-icon">${CameraIcon}</span><p class="s-login-modal-filepond-placeholder-text">${this.dragAndDrop}</p> <span class="filepond--label-action">${this.browseFromFiles}</span></div>`;
|
|
@@ -21333,20 +21861,15 @@ const SallaLoginModal = class {
|
|
|
21333
21861
|
index.h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_email')) : '', index.h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
|
|
21334
21862
|
index.h("div", { class: this.generateTabClasses('login-email'), "data-name": "login-email", ref: tab => this.emailTab = tab }, index.h("slot", { name: "before-login-email" }), index.h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), index.h("form", { onSubmit: () => this.loginByEmail(event), method: "POST" }, index.h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e), placeholder: "your@email.com", enterkeyhint: "next", class: "s-login-modal-input s-ltr" }), index.h("span", { class: "s-login-modal-error-message" }), index.h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, salla.lang.get('blocks.header.enter'))), this.isMobileAllowed ?
|
|
21335
21863
|
index.h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_sms'))
|
|
21336
|
-
: '', index.h("slot", { name: "after-login-email" })) : '', index.h("salla-verify", { display: "inline", "support-web-auth": this.supportWebAuth ? 'true' : 'false', class: this.generateTabClasses('otp'), "data-name": "otp", ref: tab => this.verifyTab = tab, autoReload: false }, index.h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-back", innerHTML: ArrowRightIcon, slot: "after-footer", href: "#" })), index.h("div", { "data-name": "registration", class: this.generateTabClasses('registration'), ref: tab => this.registrationTab = tab }, index.h("slot", { name: "before-registration" }), index.h("div", null, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('blocks.header.your_name')), index.h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", null, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('pages.profile.last_name')), index.h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", { class: this.generateRegClasses('phone') }, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), index.h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), index.h("div", { class: this.generateRegClasses('email') }, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), index.h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", { class: "s-login-modal-custom-fields", ref: el => this.customFieldsWrapper = el }, this.customFields.map((field) =>
|
|
21337
|
-
|
|
21338
|
-
|
|
21339
|
-
|
|
21340
|
-
|
|
21341
|
-
|
|
21342
|
-
|
|
21343
|
-
}
|
|
21344
|
-
|
|
21345
|
-
index.h("label", { class: "s-login-modal-label" }, field.label),
|
|
21346
|
-
index.h("input", { type: "text", onKeyDown: e => this.typing(e, this.newUser), onInput: el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}, placeholder: field.description, required: field.required, title: field.label, id: `${field.id}`, class: "s-login-modal-input s-ltr" }),
|
|
21347
|
-
index.h("span", { class: "s-login-modal-error-message" })
|
|
21348
|
-
];
|
|
21349
|
-
})), index.h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')), index.h("slot", { name: "after-registration" })))));
|
|
21864
|
+
: '', index.h("slot", { name: "after-login-email" })) : '', index.h("salla-verify", { display: "inline", "support-web-auth": this.supportWebAuth ? 'true' : 'false', class: this.generateTabClasses('otp'), "data-name": "otp", ref: tab => this.verifyTab = tab, autoReload: false }, index.h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-back", innerHTML: ArrowRightIcon, slot: "after-footer", href: "#" })), index.h("div", { "data-name": "registration", class: this.generateTabClasses('registration'), ref: tab => this.registrationTab = tab }, index.h("slot", { name: "before-registration" }), index.h("div", null, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('blocks.header.your_name')), index.h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", null, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('pages.profile.last_name')), index.h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", { class: this.generateRegClasses('phone') }, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), index.h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), index.h("div", { class: this.generateRegClasses('email') }, index.h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), index.h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), index.h("span", { class: "s-login-modal-error-message" })), index.h("div", { class: "s-login-modal-custom-fields", ref: el => this.customFieldsWrapper = el }, this.customFields.map((field) => [
|
|
21865
|
+
index.h("label", { class: "s-login-modal-label" }, field.label),
|
|
21866
|
+
field.type === CustomFieldType.PHOTO
|
|
21867
|
+
? index.h("salla-file-upload", { name: "image", "instant-upload": true, id: `${field.id}`, title: field.label, required: field.required, url: salla.url.get('upload-image'),
|
|
21868
|
+
// onUploaded={}
|
|
21869
|
+
labelIdle: this.getFilepondPlaceholder() })
|
|
21870
|
+
: index.h("input", { type: "text", onKeyDown: e => this.typing(e, this.newUser), onInput: el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}, placeholder: field.description, required: field.required, title: field.label, id: `${field.id}`, class: "s-login-modal-input s-ltr" }),
|
|
21871
|
+
index.h("span", { class: "s-login-modal-error-message" })
|
|
21872
|
+
])), index.h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')), index.h("slot", { name: "after-registration" })))));
|
|
21350
21873
|
}
|
|
21351
21874
|
get host() { return index.getElement(this); }
|
|
21352
21875
|
};
|
|
@@ -22759,7 +23282,6 @@ const SallaProductOptions = class {
|
|
|
22759
23282
|
this.dateTimeSelected = index.createEvent(this, "dateTimeSelected", 7);
|
|
22760
23283
|
this.dateSelected = index.createEvent(this, "dateSelected", 7);
|
|
22761
23284
|
this.timeSelected = index.createEvent(this, "timeSelected", 7);
|
|
22762
|
-
this.uploadedImage = undefined;
|
|
22763
23285
|
this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
|
|
22764
23286
|
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
22765
23287
|
/**
|
|
@@ -22820,54 +23342,39 @@ const SallaProductOptions = class {
|
|
|
22820
23342
|
}
|
|
22821
23343
|
//@ts-ignore
|
|
22822
23344
|
donationOption(option) {
|
|
22823
|
-
return index.h("div", { class: "s-product-options-donation-wrapper" }, index.h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.donationMoneyEntered.emit(e) }), index.h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
|
|
23345
|
+
return index.h("div", { class: "s-product-options-donation-wrapper" }, index.h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", value: option.value, placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.donationMoneyEntered.emit(e) }), index.h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
|
|
22824
23346
|
}
|
|
22825
23347
|
getFilepondPlaceholder() {
|
|
23348
|
+
//todo:: add translatable string
|
|
22826
23349
|
return `<div class="s-product-options-filepond-placeholder"><span class="s-product-options-filepond-placeholder-icon">${CameraIcon}</span><p class="s-product-options-filepond-placeholder-text">اسحب او افلت الصورة هنا</p> <span class="filepond--label-action">او تصفح من جهازك</span></div>`;
|
|
22827
23350
|
}
|
|
22828
|
-
|
|
22829
|
-
|
|
22830
|
-
|
|
22831
|
-
|
|
23351
|
+
handleOnImageRemoved(event) {
|
|
23352
|
+
//todo:: add on remove from cartitem images
|
|
23353
|
+
// use salla.url.is_page('cart')
|
|
23354
|
+
// call salla.cart.api.deleteImage(file('id'))
|
|
23355
|
+
//@ts-ignore
|
|
23356
|
+
setTimeout(() => event.target.querySelector('.filepond--root').style.height = '120px', 1000);
|
|
23357
|
+
}
|
|
23358
|
+
handleOnImageUploaded(event) {
|
|
23359
|
+
//todo:: fire imageUploaded from salla-product-options
|
|
23360
|
+
event.target.querySelector('.filepond--data input[type="hidden"]').dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
22832
23361
|
}
|
|
22833
23362
|
//todo:: why we need this way, use the native way!!
|
|
22834
23363
|
//@ts-ignore
|
|
22835
23364
|
selectThumbnail(e, value) {
|
|
22836
23365
|
this.thumbnailSelected.emit(e);
|
|
22837
23366
|
}
|
|
22838
|
-
//todo:: move it to another place, create component if there is no component
|
|
22839
|
-
//@ts-ignore
|
|
22840
|
-
getServerConfig(url, option_id) {
|
|
22841
|
-
return {
|
|
22842
|
-
process: async (_fieldName, file, _metadata, load, error, _progress, abort, _transfer, _options) => {
|
|
22843
|
-
const formData = new FormData();
|
|
22844
|
-
formData.append("image_url", file, file.name);
|
|
22845
|
-
return await salla.product.uploadGiftImage(formData)
|
|
22846
|
-
.then((resp) => {
|
|
22847
|
-
this.uploadedImage = resp.data.url;
|
|
22848
|
-
load('success');
|
|
22849
|
-
file.metadata = `_${new Date().getTime()}`;
|
|
22850
|
-
}).catch(e => {
|
|
22851
|
-
console.log(e);
|
|
22852
|
-
error('error');
|
|
22853
|
-
})
|
|
22854
|
-
.finally(() => {
|
|
22855
|
-
return {
|
|
22856
|
-
abort: () => {
|
|
22857
|
-
abort();
|
|
22858
|
-
},
|
|
22859
|
-
};
|
|
22860
|
-
});
|
|
22861
|
-
}
|
|
22862
|
-
};
|
|
22863
|
-
}
|
|
22864
23367
|
//@ts-ignore
|
|
22865
23368
|
imageOption(option) {
|
|
22866
|
-
return index.h("salla-file-upload", { "instant-upload": true,
|
|
23369
|
+
return index.h("salla-file-upload", { "instant-upload": true, name: `options[${option.id}]`, "payload-name": "file", "data-item-id": salla.url.is_page('cart') ? option.id : '', class: { "s-product-options-image-input": true, required: option.required }, labelIdle: this.getFilepondPlaceholder(), onRemoved: event => this.handleOnImageRemoved(event), onUploaded: event => this.handleOnImageUploaded(event), value: option.value, url: salla.cart.api.getUploadImageEndpoint(), "form-data": {
|
|
23370
|
+
_token: salla.config.get('_token'),
|
|
23371
|
+
cart_item_id: this.productId,
|
|
23372
|
+
product_id: this.productId,
|
|
23373
|
+
} });
|
|
22867
23374
|
}
|
|
22868
23375
|
//@ts-ignore
|
|
22869
23376
|
numberOption(option) {
|
|
22870
|
-
return index.h("input", {
|
|
23377
|
+
return index.h("input", { type: "text", value: option.value, class: "s-form-control", required: option.required, name: `options[${option.id}]`, placeholder: option.placeholder, onBlur: e => this.numberOptionEntered.emit(e), onInput: e => salla.helpers.inputDigitsOnly(e.target) });
|
|
22871
23378
|
}
|
|
22872
23379
|
//@ts-ignore
|
|
22873
23380
|
splitterOption() {
|
|
@@ -22875,28 +23382,29 @@ const SallaProductOptions = class {
|
|
|
22875
23382
|
}
|
|
22876
23383
|
//@ts-ignore
|
|
22877
23384
|
textOption(option) {
|
|
22878
|
-
return index.h("div", { class: "s-product-options-text" }, index.h("input", {
|
|
23385
|
+
return index.h("div", { class: "s-product-options-text" }, index.h("input", { type: "text", value: option.value, class: 's-form-control', required: option.required, name: `options[${option.id}]`, placeholder: option.placeholder, onInput: e => this.textOptionEntered.emit(e) }));
|
|
22879
23386
|
}
|
|
22880
23387
|
//@ts-ignore
|
|
22881
23388
|
textareaOption(option) {
|
|
22882
|
-
|
|
23389
|
+
//todo::remove mt-1 class, and if it's okay to remove the tag itself will be great
|
|
23390
|
+
return index.h("div", { class: "s-product-options-textarea" }, index.h("div", { class: "mt-1" }, index.h("textarea", { rows: 4, value: option.value, class: "s-form-control", required: option.required, id: `options[${option.id}]`, name: `options[${option.id}]`, placeholder: option.placeholder, onInput: (e) => this.textareaOptionEntered.emit(e) })));
|
|
22883
23391
|
}
|
|
22884
23392
|
/**
|
|
22885
23393
|
* ============= Date Time options =============
|
|
22886
23394
|
*/
|
|
22887
23395
|
//@ts-ignore
|
|
22888
23396
|
timeOption(option) {
|
|
22889
|
-
return index.h("salla-datetime-picker", {
|
|
23397
|
+
return index.h("salla-datetime-picker", { noCalendar: true, enableTime: true, dateFormat: "h:i K", value: option.value, placeholder: option.name, required: option.required, name: `options[${option.id}]`, class: "s-product-options-time-element", onPicked: e => this.timeSelected.emit(e) });
|
|
22890
23398
|
}
|
|
22891
23399
|
//@ts-ignore
|
|
22892
23400
|
dateOption(option) {
|
|
22893
23401
|
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
22894
|
-
return index.h("div", { class: "s-product-options-date-element" }, index.h("salla-datetime-picker", { onPicked: e => this.dateSelected.emit(e)
|
|
23402
|
+
return index.h("div", { class: "s-product-options-date-element" }, index.h("salla-datetime-picker", { value: option.value, placeholder: option.name, required: option.required, name: `options[${option.id}]`, onPicked: e => this.dateSelected.emit(e) }));
|
|
22895
23403
|
}
|
|
22896
23404
|
//@ts-ignore
|
|
22897
23405
|
datetimeOption(option) {
|
|
22898
23406
|
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
22899
|
-
return index.h("div", { class: "s-product-options-datetime-element" }, index.h("salla-datetime-picker", {
|
|
23407
|
+
return index.h("div", { class: "s-product-options-datetime-element" }, index.h("salla-datetime-picker", { enableTime: true, value: option.value, dateFormat: "Y-m-d G:i:K", placeholder: option.name, required: option.required, name: `options[${option.id}]`, maxDate: option.to_date_time, minDate: option.from_date_time, onPicked: e => this.dateTimeSelected.emit(e) }));
|
|
22900
23408
|
}
|
|
22901
23409
|
/**
|
|
22902
23410
|
* ============= Advanced options =============
|
|
@@ -22914,7 +23422,7 @@ const SallaProductOptions = class {
|
|
|
22914
23422
|
}
|
|
22915
23423
|
multipleOptions(option) {
|
|
22916
23424
|
return index.h("div", { ref: element => this.multipleOptionDom = element, class: { "s-product-options-multiple-options-wrapper": true, 'required': option.required } }, option === null || option === void 0 ? void 0 : option.details.map((detail) => {
|
|
22917
|
-
return index.h("div", null, index.h("input", { type: "checkbox", value: detail.id, disabled: detail.is_out, checked: detail.is_selected, name: `options[${option.id}]`, id: `field-${option.id}-${detail.id}`, onChange: () => this.handleMultiSelectFieldInput(), "aria-describedby": `options[${option.id}]-description` }), index.h("label", { htmlFor: `field-${option.id}-${detail.id}` }, this.getOptionDetailName(detail)));
|
|
23425
|
+
return index.h("div", null, index.h("input", { type: "checkbox", value: detail.id, disabled: detail.is_out, checked: detail.is_selected, name: `options[${option.id}][]`, id: `field-${option.id}-${detail.id}`, onChange: () => this.handleMultiSelectFieldInput(), "aria-describedby": `options[${option.id}]-description` }), index.h("label", { htmlFor: `field-${option.id}-${detail.id}` }, this.getOptionDetailName(detail)));
|
|
22918
23426
|
}));
|
|
22919
23427
|
}
|
|
22920
23428
|
//@ts-ignore
|
|
@@ -22929,6 +23437,7 @@ const SallaProductOptions = class {
|
|
|
22929
23437
|
: '');
|
|
22930
23438
|
}));
|
|
22931
23439
|
}
|
|
23440
|
+
get host() { return index.getElement(this); }
|
|
22932
23441
|
};
|
|
22933
23442
|
SallaProductOptions.style = sallaProductOptionsCss;
|
|
22934
23443
|
|
|
@@ -26127,6 +26636,7 @@ const SallaUserMenu = class {
|
|
|
26127
26636
|
* - is profile page, if user changed his name or avatar, we need to update it
|
|
26128
26637
|
* - half hour is passed than last user data fetched
|
|
26129
26638
|
*/
|
|
26639
|
+
//todo:: cover sending two requests in profile page, this may cause auto logout issues🤔
|
|
26130
26640
|
if (salla.url.is_page('customer.notifications')
|
|
26131
26641
|
|| salla.url.is_page('customer.orders.index.pending')
|
|
26132
26642
|
|| salla.url.is_page('customer.profile')
|