UNPKG

@aurigma/ui-framework

Version:

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

1 lines 6.8 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[10],{423:function(e,t,n){n.d(t,"a",function(){return i});r.prototype.equals=function(e){return this.id===e.id&&this.title===e.title&&this.price===e.price},Object.defineProperty(r.prototype,"value",{get:function(){return this.optionValue},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"id",{get:function(){return this.optionValue.id},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"title",{get:function(){return null==this._title&&(this._title=this._getParsedTitle()),this._title},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"price",{get:function(){return this.optionValue.price},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"color",{get:function(){return this.optionValue.color},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"imageUrl",{get:function(){return this.optionValue.imageUrl},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"props",{get:function(){return this.optionValue.props},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"shownPrice",{get:function(){return this.optionValue.shownPrice},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"preselected",{get:function(){return this.optionValue.preselected},enumerable:!1,configurable:!0}),r.prototype._getParsedTitle=function(){try{return(new DOMParser).parseFromString(this.optionValue.title,"text/html").body.innerText}catch(e){}return this.optionValue.title};var i=r;function r(e,t){void 0===t&&(t=!1),this._title=null,this.optionValue=e,this.disabled=t}},431:function(e,t,n){n.d(t,"a",function(){return u});var r,i=n(0),t=n(2),o=n(1),l=n(448),a=n(423),u=(r=l.a,Object(i.d)(p,r),p.prototype.init=function(n){var i=this,e=(r.prototype.init.call(this,n),this._copySelection());this.items=n.values.map(function(e,t){return!o.a.isNullOrUndefined(e.id)&&-1!==e.id||(e.id=t),"image"!==n.type&&e.imageUrl&&(e.imageUrl=null),new a.a(e,e.disabled)}),o.a.isNotNullOrUndefined(e)&&this._restoreSelection(e),this.enableFilter=o.a.isNotNullOrUndefined(n.props)&&n.props.enableFilter||!1,n.onAvailableOptionValueChange&&n.onAvailableOptionValueChange.subscribe(function(e,t){return i.updateItemsAvailability(t)}),n.onOptionValueChange&&n.onOptionValueChange.subscribe(function(e,t){return i.updateSelectedValue(t)})},p.prototype._copySelection=function(){return o.a.isNotNullOrUndefined(this.value)?Object(i.a)({},this.value):void 0},p.prototype._restoreSelection=function(t){this.value=this.items.find(function(e){return e.equals(t)})},p.prototype._isArrayEqual=function(e,n){return e.length===n.length&&e.every(function(e,t){return e===n[t]})},p.prototype._getItemPriceTitle=function(e){function t(e){return e&&0!==e?" (+"+n.driver.cart.formatPrice(e)+")":""}var n=this,i=t(e.price);return null!=e.shownPrice&&(i=t(e.shownPrice*(this.driver.orders.current._priceMultiplier||1))),e.title+i},p.prototype._isOptionDisabled=function(e){return this.disabled||e},p.prototype.updateItemsAvailability=function(n){for(var i=this,r=this,e=0;e<this.items.length;e++)(t=>{var e=n.every(function(e){return e.id!==i.items[t].id});r.set("items.".concat(t,".disabled"),e)})(e)},p.prototype._disabledClass=function(e){return e?"item-disabled":""},Object(i.c)([Object(t.c)(),Object(i.g)("design:type",Array)],p.prototype,"items",void 0),Object(i.c)([Object(t.c)({notify:!0}),Object(i.g)("design:type",Boolean)],p.prototype,"enableFilter",void 0),p);function p(){return null!==r&&r.apply(this,arguments)||this}},461:function(e,t,n){n.d(t,"a",function(){return l});var i,t=n(0),r=n(431),o=n(423),n=n(2),l=(i=r.a,Object(t.d)(a,i),a.prototype.init=function(e){i.prototype.init.call(this,e),0!==this.items.length&&(e=(e=(e=this.items.find(function(e){return e.optionValue.preselected}))||this.items.find(function(e){return 0===e.price}))||this.items[0],this.value=e)},a.prototype._selectedChange=function(t){0<this.items.length&&(this.value=this.items.find(function(e){return e.id===t}))},a.prototype._valueChange=function(e){e&&0<this.items.length&&this._selectedId!==e.id&&(this._selectedId=e.id),this._onOptionChange()},a.prototype.updateSelectedValue=function(t){if(1<t.length)throw new Error("Multiple option value is not available");var e=t.length?this.items.find(function(e){return e.id===t[0].id}):null;(this.value&&!e||!this.value&&e||this.value&&e&&this.value.id!==e.id)&&(this.value=e)},Object(t.c)([Object(n.c)({notify:!0}),Object(t.g)("design:type",Number)],a.prototype,"_selectedId",void 0),Object(t.c)([Object(n.b)("_selectedId"),Object(t.g)("design:type",Function),Object(t.g)("design:paramtypes",[Number]),Object(t.g)("design:returntype",void 0)],a.prototype,"_selectedChange",null),Object(t.c)([Object(n.b)("value"),Object(t.g)("design:type",Function),Object(t.g)("design:paramtypes",[o.a]),Object(t.g)("design:returntype",void 0)],a.prototype,"_valueChange",null),a);function a(){return null!==i&&i.apply(this,arguments)||this}},877: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>'},917:function(e,t,n){n.r(t),n.d(t,"AuOptionRadioGroup",function(){return l}),n.d(t,"option",function(){return l});var i,t=n(0),r=n(877),o=n(461),n=n(2),l=(i=o.a,Object(t.d)(a,i),Object(t.c)([Object(n.a)("au-option-radio-group",r)],a));function a(){return null!==i&&i.apply(this,arguments)||this}}}]);