UNPKG

@aurigma/ui-framework

Version:

A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.

1 lines 8.85 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[5],{424:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var i=function(){function e(e,t){void 0===t&&(t=!1),this._title=null,this.optionValue=e,this.disabled=t}return e.prototype.equals=function(e){return this.id===e.id&&this.title===e.title&&this.price===e.price},Object.defineProperty(e.prototype,"value",{get:function(){return this.optionValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this.optionValue.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return null==this._title&&(this._title=this._getParsedTitle()),this._title},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"price",{get:function(){return this.optionValue.price},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this.optionValue.color},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this.optionValue.imageUrl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"props",{get:function(){return this.optionValue.props},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shownPrice",{get:function(){return this.optionValue.shownPrice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"preselected",{get:function(){return this.optionValue.preselected},enumerable:!1,configurable:!0}),e.prototype._getParsedTitle=function(){try{return(new DOMParser).parseFromString(this.optionValue.title,"text/html").body.innerText}catch(e){}return this.optionValue.title},e}()},429:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var i=n(0),r=n(2),o=n(1),c=n(441),s=n(424),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.d)(t,e),t.prototype.init=function(t){var n=this;e.prototype.init.call(this,t);var i=this._copySelection();this.items=t.values.map((function(e,n){return(o.a.isNullOrUndefined(e.id)||-1===e.id)&&(e.id=n),"image"!==t.type&&e.imageUrl&&(e.imageUrl=null),new s.a(e,e.disabled)})),o.a.isNotNullOrUndefined(i)&&this._restoreSelection(i),this.enableFilter=o.a.isNotNullOrUndefined(t.props)&&t.props.enableFilter||!1,t.onAvailableOptionValueChange&&t.onAvailableOptionValueChange.subscribe((function(e,t){return n.updateItemsAvailability(t)})),t.onOptionValueChange&&t.onOptionValueChange.subscribe((function(e,t){return n.updateSelectedValue(t)}))},t.prototype._copySelection=function(){return o.a.isNotNullOrUndefined(this.value)?Object(i.a)({},this.value):void 0},t.prototype._restoreSelection=function(e){this.value=this.items.find((function(t){return t.equals(e)}))},t.prototype._isArrayEqual=function(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))},t.prototype._getItemPriceTitle=function(e){var t=this,n=function(e){return e&&0!==e?" (+"+t.driver.cart.formatPrice(e)+")":""},i=n(e.price);return null!==e.shownPrice&&void 0!==e.shownPrice&&(i=n(e.shownPrice*(this.driver.orders.current._priceMultiplier||1))),e.title+i},t.prototype._isOptionDisabled=function(e){return this.disabled||e},t.prototype.updateItemsAvailability=function(e){for(var t=this,n=function(n){var r=e.every((function(e){return e.id!==t.items[n].id}));i.set("items.".concat(n,".disabled"),r)},i=this,r=0;r<this.items.length;r++)n(r)},t.prototype._disabledClass=function(e){return e?"item-disabled":""},Object(i.c)([Object(r.c)(),Object(i.g)("design:type",Array)],t.prototype,"items",void 0),Object(i.c)([Object(r.c)({notify:!0}),Object(i.g)("design:type",Boolean)],t.prototype,"enableFilter",void 0),t}(c.a)},597:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var i=n(0),r=n(18),o=n(34),c=n(2),s=n(1),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.d)(t,e),t.prototype.init=function(t){if(e.prototype.init.call(this,t),this.maxSelectedItems=s.a.objectDeepValue(t,"props.maxCount")?t.props.maxCount:-1,0!==this.items.length&&s.a.isNullOrUndefined(this.value)){var n=this.items.filter((function(e){return e.optionValue.preselected}));if(0===n.length){var i=this.items.find((function(e){return 0===e.price}));n=i?[i]:[]}0===n.length&&(n=[this.items[0]]),this.value=n}},t.prototype.updateSelectedValue=function(e){var t=this.value.filter((function(t){return e.some((function(e){return t.value&&e.id===t.value.id}))}));(function(e,t){return e.length!==t.length||e.some((function(e){return t.every((function(t){return t.id!==e.optionValue.id}))}))})(t,this.value)&&(this.deselect(this.value),this.select(t),this.value=t)},t.prototype._copySelection=function(){return s.a.isNotNullOrUndefined(this.value)?Array.from(this.value):void 0},t.prototype._restoreSelection=function(e){var t=this.items.filter((function(t){return e.some((function(e){return e.equals(t)}))}));this.select(t)},t.prototype._maxSelectionItemsChanged=function(){this.maxSelectedItems>-1&&this.value.length>this.maxSelectedItems&&this.deselect(Array.of(this.getLastSelectedItem()))},t.prototype._valueChange=function(e){this._valueObserver(this.value)},t.prototype._valueObserver=function(e){var t=this;this._debouncerValueObserver=o.a.debounce(this._debouncerValueObserver,r.d.after(20),(function(){t._maxSelectionItemsChanged(),t._onOptionChange()}))},Object(i.c)([Object(c.b)("maxSelectedItems"),Object(i.g)("design:type",Function),Object(i.g)("design:paramtypes",[]),Object(i.g)("design:returntype",void 0)],t.prototype,"_maxSelectionItemsChanged",null),Object(i.c)([Object(c.b)("value.splices"),Object(i.g)("design:type",Function),Object(i.g)("design:paramtypes",[Object]),Object(i.g)("design:returntype",void 0)],t.prototype,"_valueChange",null),Object(i.c)([Object(c.c)(),Object(i.g)("design:type",Array)],t.prototype,"value",void 0),Object(i.c)([Object(c.b)("value"),Object(i.g)("design:type",Function),Object(i.g)("design:paramtypes",[Object]),Object(i.g)("design:returntype",void 0)],t.prototype,"_valueObserver",null),Object(i.c)([Object(c.c)(),Object(i.g)("design:type",Object)],t.prototype,"maxSelectedItems",void 0),t}(n(429).a)},880:function(e,t){e.exports='<style>\n :host {\n display: inline-flex;\n width: 100%;\n overflow: hidden;\n flex-direction: column;\n }\n\n iron-selector {\n display: inline-flex;\n flex-direction: column;\n margin-left: -12px;\n margin-right: -12px;\n }\n\n .text {\n @apply --au-body2-font;\n }\n\n paper-checkbox {\n padding: 12px;\n --paper-checkbox-checked-color: var(--theme-primary-color);\n }\n</style>\n<iron-selector noink name="option" class="option-checkbox-container" attr-for-selected="name" multi="true"\n selected-values="{{_selectedIds}}" on-selected-changed="_onOptionChange" selected-attribute="checked">\n <template is="dom-repeat" items="[[items]]">\n <paper-checkbox noink type="value" disabled$="[[_isOptionDisabled(item.disabled)]]" checked="[[item.preselected]]" name="[[item.id]]">\n <span noink class="text">\n [[_getItemPriceTitle(item)]]\n </span>\n </paper-checkbox>\n </template>\n</iron-selector>'},918:function(e,t,n){"use strict";n.r(t),n.d(t,"AuCheckBoxGroup",(function(){return s})),n.d(t,"option",(function(){return s}));var i=n(0),r=n(2),o=n(597),c=n(880),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.d)(t,e),t.prototype.init=function(t){e.prototype.init.call(this,t),this._selectedIds=this.items.filter((function(e){return e.preselected})).map((function(e){return e.id}))},t.prototype.getLastSelectedItem=function(){var e=this;return this.value.find((function(t){return t.id===e._selectedIds[0]}))},t.prototype.select=function(e){var t=this;e.forEach((function(e){t.push("_selectedIds",e.id)}))},t.prototype.deselect=function(e){var t=this;e.forEach((function(e){var n=t._selectedIds.indexOf(e.id);n>=0&&t.splice("_selectedIds",n,1)}))},t.prototype._valueChange=function(){this.value&&this.value.length>0&&(this._selectedIds=this.value.map((function(e){var t;return null===(t=e.optionValue)||void 0===t?void 0:t.id})))},t.prototype._selectedIdsChange=function(e){var t=this;e&&this.items.length>0&&(this.value=this.items.filter((function(e){return t._selectedIds.indexOf(e.id)>-1})))},Object(i.c)([Object(r.b)("value.splices"),Object(i.g)("design:type",Function),Object(i.g)("design:paramtypes",[]),Object(i.g)("design:returntype",void 0)],t.prototype,"_valueChange",null),Object(i.c)([Object(r.b)("_selectedIds.splices"),Object(i.g)("design:type",Function),Object(i.g)("design:paramtypes",[Object]),Object(i.g)("design:returntype",void 0)],t.prototype,"_selectedIdsChange",null),Object(i.c)([Object(r.a)("au-option-checkbox-group",c)],t)}(o.a)}}]);