UNPKG

@aurigma/ui-framework

Version:

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

1 lines 6.99 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[10],{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 l}));var i=n(0),r=n(2),o=n(1),u=n(441),a=n(424),l=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 a.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}(u.a)},455:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var i=n(0),r=n(429),o=n(424),u=n(2),a=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),0!==this.items.length){var n=this.items.find((function(e){return e.optionValue.preselected}));n||(n=this.items.find((function(e){return 0===e.price}))),n||(n=this.items[0]),this.value=n}},t.prototype._selectedChange=function(e){this.items.length>0&&(this.value=this.items.find((function(t){return t.id===e})))},t.prototype._valueChange=function(e){e&&this.items.length>0&&this._selectedId!==e.id&&(this._selectedId=e.id),this._onOptionChange()},t.prototype.updateSelectedValue=function(e){if(e.length>1)throw new Error("Multiple option value is not available");var t=e.length?this.items.find((function(t){return t.id===e[0].id})):null;(this.value&&!t||!this.value&&t||this.value&&t&&this.value.id!==t.id)&&(this.value=t)},Object(i.c)([Object(u.c)({notify:!0}),Object(i.g)("design:type",Number)],t.prototype,"_selectedId",void 0),Object(i.c)([Object(u.b)("_selectedId"),Object(i.g)("design:type",Function),Object(i.g)("design:paramtypes",[Number]),Object(i.g)("design:returntype",void 0)],t.prototype,"_selectedChange",null),Object(i.c)([Object(u.b)("value"),Object(i.g)("design:type",Function),Object(i.g)("design:paramtypes",[o.a]),Object(i.g)("design:returntype",void 0)],t.prototype,"_valueChange",null),t}(r.a)},878: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 paper-radio-group {\n display: inline-flex;\n flex-direction: column;\n\n /* margin-left: -12px;\n margin-right: -12px; */\n --paper-radio-group-item-padding: 0 0 12px;\n --paper-radio-button-unchecked-background-color: #9999999;\n --primary-text-color: #999999;\n --paper-radio-button-label-color: #000000;\n\n --paper-radio-button-radio-container: {\n vertical-align: top;\n margin-top: 2px;\n }\n\n --paper-radio-button-label: {\n width: calc(100% - var(--paper-radio-button-label-spacing, 10px) - var(--calculated-paper-radio-button-size, 10px));\n }\n }\n\n .text {\n @apply --au-body2-font;\n }\n</style>\n\n<paper-radio-group noink id="[[id]]" class="option-radio-container" attr-for-selected="name" selected="{{_selectedId}}"\n selected-attribute="checked">\n <dom-repeat items="[[items]]">\n <template>\n <paper-radio-button noink type="value" disabled$="[[_isOptionDisabled(item.disabled)]]" name="[[item.id]]">\n <div noink class="text">\n {{_getItemPriceTitle(item)}}\n </div>\n </paper-radio-button>\n </template>\n </dom-repeat>\n</paper-radio-group>'},916:function(e,t,n){"use strict";n.r(t),n.d(t,"AuOptionRadioGroup",(function(){return a})),n.d(t,"option",(function(){return a}));var i=n(0),r=n(878),o=n(455),u=n(2),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.d)(t,e),Object(i.c)([Object(u.a)("au-option-radio-group",r)],t)}(o.a)}}]);