1 line
27 KiB
Plaintext
1 line
27 KiB
Plaintext
{"version":3,"sources":["./node_modules/@ionic/core/dist/esm/ion-select_3.entry.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA6G;AAChD;AACsB;AACvC;AACqF;AACxD;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,iCAAiC,2BAA2B,kCAAkC,iCAAiC,+BAA+B,qCAAqC,oBAAoB,aAAa,kBAAkB,sBAAsB,mBAAmB,4CAA4C,gBAAgB,UAAU,+FAA+F,MAAM,mBAAmB,oBAAoB,2CAA2C,0CAA0C,uCAAuC,uCAAuC,gBAAgB,gBAAgB,cAAc,wBAAwB,YAAY,oBAAoB,2BAA2B,yBAAyB,oBAAoB,+BAA+B,mCAAmC,OAAO,OAAO,MAAM,cAAc,eAAe,aAAa,gBAAgB,kBAAkB,WAAW,YAAY,SAAS,uBAAuB,eAAe,wBAAwB,qBAAqB,gBAAgB,aAAa,iDAAiD,WAAW,YAAY,QAAQ,yBAAyB,SAAS,aAAa,kBAAkB,aAAa,aAAa,WAAW,OAAO,eAAe,kBAAkB,uBAAuB,mBAAmB,gBAAgB,mBAAmB,SAAS,QAAQ,gBAAgB,kBAAkB,QAAQ,SAAS,qBAAqB,mCAAmC,kCAAkC,mBAAmB,oBAAoB,yEAAyE,WAAW,YAAY,UAAU,MAAM,mBAAmB,mBAAmB,sBAAsB,qBAAqB,aAAa,WAAW,YAAY;;AAEr2D,2BAA2B,iCAAiC,2BAA2B,kCAAkC,iCAAiC,+BAA+B,qCAAqC,oBAAoB,aAAa,kBAAkB,sBAAsB,mBAAmB,4CAA4C,gBAAgB,UAAU,+FAA+F,MAAM,mBAAmB,oBAAoB,2CAA2C,0CAA0C,uCAAuC,uCAAuC,gBAAgB,gBAAgB,cAAc,wBAAwB,YAAY,oBAAoB,2BAA2B,yBAAyB,oBAAoB,+BAA+B,mCAAmC,OAAO,OAAO,MAAM,cAAc,eAAe,aAAa,gBAAgB,kBAAkB,WAAW,YAAY,SAAS,uBAAuB,eAAe,wBAAwB,qBAAqB,gBAAgB,aAAa,iDAAiD,WAAW,YAAY,QAAQ,yBAAyB,SAAS,aAAa,kBAAkB,aAAa,aAAa,WAAW,OAAO,eAAe,kBAAkB,uBAAuB,mBAAmB,gBAAgB,mBAAmB,SAAS,QAAQ,gBAAgB,kBAAkB,QAAQ,SAAS,qBAAqB,mCAAmC,kCAAkC,mBAAmB,oBAAoB,yEAAyE,WAAW,YAAY,UAAU,MAAM,mBAAmB,gBAAgB,sBAAsB,qBAAqB,aAAa,WAAW,YAAY;;AAEj2D;AACA;AACA,QAAQ,4DAAgB;AACxB,yBAAyB,4DAAW;AACpC,yBAAyB,4DAAW;AACpC,wBAAwB,4DAAW;AACnC,uBAAuB,4DAAW;AAClC,wBAAwB,4DAAW;AACnC,kCAAkC,YAAY;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,gBAAgB;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,aAAa,GAAG,YAAY;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,aAAa,GAAG,YAAY;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,aAAa,GAAG,YAAY;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,qBAAqB,mEAAU;AAC/B;AACA,yDAAyD,OAAO,sBAAsB;AACtF;AACA;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,eAAe,uDAAiB;AAChC;AACA;AACA,qBAAqB,mEAAU;AAC/B;AACA,6DAA6D,OAAO,sBAAsB,mIAAmI;AAC7N,eAAe,uDAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,mEAAU;AAC/B,uDAAuD,OAAO,sBAAsB;AACpF;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAoF;AACpF,eAAe,uDAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,8DAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,eAAe,qDAAqD;AACpE,qBAAqB,mEAAU;AAC/B;AACA,sBAAsB,8DAAa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,8DAAiB;AACzB;AACA;AACA;AACA;AACA;AACA,gBAAgB,4DAAC,CAAC,oDAAI,GAAG,mIAAmI,WAAW;AACvK;AACA,2BAA2B,4DAAW;AACtC;AACA,aAAa,EAAE,EAAE,4DAAC,SAAS,2CAA2C,eAAe,4DAAC,SAAS,2DAA2D,EAAE,4DAAC,SAAS,6BAA6B,IAAI,4DAAC,YAAY,wHAAwH;AAC5U;AACA,cAAc,QAAQ,4DAAU,OAAO;AACvC,2BAA2B;AAC3B;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,aAAa;;AAE5C;AACA;AACA,QAAQ,4DAAgB;AACxB,qCAAqC,kBAAkB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,4DAAC,CAAC,oDAAI,GAAG,0CAA0C,mEAAU,QAAQ;AACrF;AACA,cAAc,QAAQ,4DAAU,OAAO;AACvC;AACA;AACA;;AAEA,kFAAkF,cAAc,eAAe,gBAAgB,mBAAmB,wHAAwH,cAAc,eAAe,aAAa,gBAAgB;;AAEpU;AACA;AACA,QAAQ,4DAAgB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,+DAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,gBAAgB,4DAAC,CAAC,oDAAI,GAAG,QAAQ,mEAAU,QAAQ,EAAE,4DAAC,gDAAgD,4DAAC;AACvG,YAAY,4DAAC,mBAAmB,4DAAC,eAAe,yBAAyB,kCAAkC,4DAAC,4DAA4D,4DAAC,6BAA6B,4DAAC,qBAAqB,sBAAsB,6BAA6B,4DAAC,cAAc,QAAQ,4DAAW,mBAAmB,EAAE,4DAAC,kCAAkC,4DAAC,eAAe,iDAAiD;AAC1a;AACA;AACA;;AAEwG","file":"32-es2015.js","sourcesContent":["import { r as registerInstance, e as createEvent, h, H as Host, i as getElement } from './index-92848855.js';\nimport { b as getIonMode } from './ionic-global-23e7365a.js';\nimport { f as findItemLabel, a as renderHiddenInput } from './helpers-5c745fbd.js';\nimport './hardware-back-button-7b6ede21.js';\nimport { c as popoverController, b as actionSheetController, a as alertController, s as safeCall } from './overlays-c5d9d644.js';\nimport { h as hostContext, g as getClassMap } from './theme-5641d27f.js';\n\nconst watchForOptions = (containerEl, tagName, onChange) => {\n /* tslint:disable-next-line */\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n const mutation = new MutationObserver(mutationList => {\n onChange(getSelectedOption(mutationList, tagName));\n });\n mutation.observe(containerEl, {\n childList: true,\n subtree: true\n });\n return mutation;\n};\nconst getSelectedOption = (mutationList, tagName) => {\n let newOption;\n mutationList.forEach(mut => {\n // tslint:disable-next-line: prefer-for-of\n for (let i = 0; i < mut.addedNodes.length; i++) {\n newOption = findCheckedOption(mut.addedNodes[i], tagName) || newOption;\n }\n });\n return newOption;\n};\nconst findCheckedOption = (el, tagName) => {\n if (el.nodeType !== 1) {\n return undefined;\n }\n const options = (el.tagName === tagName.toUpperCase())\n ? [el]\n : Array.from(el.querySelectorAll(tagName));\n return options.find((o) => o.value === el.value);\n};\n\nconst selectIosCss = \":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}[dir=rtl] button,:host-context([dir=rtl]) button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.select-icon{position:relative;opacity:0.33}.select-text{-ms-flex:1;flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-3px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:10px;--padding-bottom:10px;--padding-start:20px}.select-icon{width:12px;height:18px}\";\n\nconst selectMdCss = \":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}[dir=rtl] button,:host-context([dir=rtl]) button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.select-icon{position:relative;opacity:0.33}.select-text{-ms-flex:1;flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-3px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:0;--padding-bottom:11px;--padding-start:16px}.select-icon{width:19px;height:19px}\";\n\nconst Select = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionChange = createEvent(this, \"ionChange\", 7);\n this.ionCancel = createEvent(this, \"ionCancel\", 7);\n this.ionFocus = createEvent(this, \"ionFocus\", 7);\n this.ionBlur = createEvent(this, \"ionBlur\", 7);\n this.ionStyle = createEvent(this, \"ionStyle\", 7);\n this.inputId = `ion-sel-${selectIds++}`;\n this.didInit = false;\n this.isExpanded = false;\n /**\n * If `true`, the user cannot interact with the select.\n */\n this.disabled = false;\n /**\n * The text to display on the cancel button.\n */\n this.cancelText = 'Cancel';\n /**\n * The text to display on the ok button.\n */\n this.okText = 'OK';\n /**\n * The name of the control, which is submitted with the form data.\n */\n this.name = this.inputId;\n /**\n * If `true`, the select can accept multiple values.\n */\n this.multiple = false;\n /**\n * The interface the select should use: `action-sheet`, `popover` or `alert`.\n */\n this.interface = 'alert';\n /**\n * Any additional options that the `alert`, `action-sheet` or `popover` interface\n * can take. See the [ion-alert docs](../alert), the\n * [ion-action-sheet docs](../action-sheet) and the\n * [ion-popover docs](../popover) for the\n * create options for each interface.\n *\n * Note: `interfaceOptions` will not override `inputs` or `buttons` with the `alert` interface.\n */\n this.interfaceOptions = {};\n this.onClick = (ev) => {\n this.setFocus();\n this.open(ev);\n };\n this.onFocus = () => {\n this.ionFocus.emit();\n };\n this.onBlur = () => {\n this.ionBlur.emit();\n };\n }\n disabledChanged() {\n this.emitStyle();\n }\n valueChanged() {\n this.emitStyle();\n if (this.didInit) {\n this.ionChange.emit({\n value: this.value,\n });\n }\n }\n async connectedCallback() {\n this.updateOverlayOptions();\n this.emitStyle();\n this.mutationO = watchForOptions(this.el, 'ion-select-option', async () => {\n this.updateOverlayOptions();\n });\n }\n disconnectedCallback() {\n if (this.mutationO) {\n this.mutationO.disconnect();\n this.mutationO = undefined;\n }\n }\n componentDidLoad() {\n this.didInit = true;\n }\n /**\n * Open the select overlay. The overlay is either an alert, action sheet, or popover,\n * depending on the `interface` property on the `ion-select`.\n *\n * @param event The user interface event that called the open.\n */\n async open(event) {\n if (this.disabled || this.isExpanded) {\n return undefined;\n }\n const overlay = this.overlay = await this.createOverlay(event);\n this.isExpanded = true;\n overlay.onDidDismiss().then(() => {\n this.overlay = undefined;\n this.isExpanded = false;\n this.setFocus();\n });\n await overlay.present();\n return overlay;\n }\n createOverlay(ev) {\n let selectInterface = this.interface;\n if ((selectInterface === 'action-sheet' || selectInterface === 'popover') && this.multiple) {\n console.warn(`Select interface cannot be \"${selectInterface}\" with a multi-value select. Using the \"alert\" interface instead.`);\n selectInterface = 'alert';\n }\n if (selectInterface === 'popover' && !ev) {\n console.warn('Select interface cannot be a \"popover\" without passing an event. Using the \"alert\" interface instead.');\n selectInterface = 'alert';\n }\n if (selectInterface === 'popover') {\n return this.openPopover(ev);\n }\n if (selectInterface === 'action-sheet') {\n return this.openActionSheet();\n }\n return this.openAlert();\n }\n updateOverlayOptions() {\n const overlay = this.overlay;\n if (!overlay) {\n return;\n }\n const childOpts = this.childOpts;\n const value = this.value;\n switch (this.interface) {\n case 'action-sheet':\n overlay.buttons = this.createActionSheetButtons(childOpts, value);\n break;\n case 'popover':\n const popover = overlay.querySelector('ion-select-popover');\n if (popover) {\n popover.options = this.createPopoverOptions(childOpts, value);\n }\n break;\n case 'alert':\n const inputType = (this.multiple ? 'checkbox' : 'radio');\n overlay.inputs = this.createAlertInputs(childOpts, inputType, value);\n break;\n }\n }\n createActionSheetButtons(data, selectValue) {\n const actionSheetButtons = data.map(option => {\n const value = getOptionValue(option);\n // Remove hydrated before copying over classes\n const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' ');\n const optClass = `${OPTION_CLASS} ${copyClasses}`;\n return {\n role: (isOptionSelected(value, selectValue, this.compareWith) ? 'selected' : ''),\n text: option.textContent,\n cssClass: optClass,\n handler: () => {\n this.value = value;\n }\n };\n });\n // Add \"cancel\" button\n actionSheetButtons.push({\n text: this.cancelText,\n role: 'cancel',\n handler: () => {\n this.ionCancel.emit();\n }\n });\n return actionSheetButtons;\n }\n createAlertInputs(data, inputType, selectValue) {\n const alertInputs = data.map(option => {\n const value = getOptionValue(option);\n // Remove hydrated before copying over classes\n const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' ');\n const optClass = `${OPTION_CLASS} ${copyClasses}`;\n return {\n type: inputType,\n cssClass: optClass,\n label: option.textContent || '',\n value,\n checked: isOptionSelected(value, selectValue, this.compareWith),\n disabled: option.disabled\n };\n });\n return alertInputs;\n }\n createPopoverOptions(data, selectValue) {\n const popoverOptions = data.map(option => {\n const value = getOptionValue(option);\n // Remove hydrated before copying over classes\n const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' ');\n const optClass = `${OPTION_CLASS} ${copyClasses}`;\n return {\n text: option.textContent || '',\n cssClass: optClass,\n value,\n checked: isOptionSelected(value, selectValue, this.compareWith),\n disabled: option.disabled,\n handler: () => {\n this.value = value;\n this.close();\n }\n };\n });\n return popoverOptions;\n }\n async openPopover(ev) {\n const interfaceOptions = this.interfaceOptions;\n const mode = getIonMode(this);\n const value = this.value;\n const popoverOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { component: 'ion-select-popover', cssClass: ['select-popover', interfaceOptions.cssClass], event: ev, componentProps: {\n header: interfaceOptions.header,\n subHeader: interfaceOptions.subHeader,\n message: interfaceOptions.message,\n value,\n options: this.createPopoverOptions(this.childOpts, value)\n } });\n return popoverController.create(popoverOpts);\n }\n async openActionSheet() {\n const mode = getIonMode(this);\n const interfaceOptions = this.interfaceOptions;\n const actionSheetOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { buttons: this.createActionSheetButtons(this.childOpts, this.value), cssClass: ['select-action-sheet', interfaceOptions.cssClass] });\n return actionSheetController.create(actionSheetOpts);\n }\n async openAlert() {\n const label = this.getLabel();\n const labelText = (label) ? label.textContent : null;\n const interfaceOptions = this.interfaceOptions;\n const inputType = (this.multiple ? 'checkbox' : 'radio');\n const mode = getIonMode(this);\n const alertOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { header: interfaceOptions.header ? interfaceOptions.header : labelText, inputs: this.createAlertInputs(this.childOpts, inputType, this.value), buttons: [\n {\n text: this.cancelText,\n role: 'cancel',\n handler: () => {\n this.ionCancel.emit();\n }\n },\n {\n text: this.okText,\n handler: (selectedValues) => {\n this.value = selectedValues;\n }\n }\n ], cssClass: ['select-alert', interfaceOptions.cssClass,\n (this.multiple ? 'multiple-select-alert' : 'single-select-alert')] });\n return alertController.create(alertOpts);\n }\n /**\n * Close the select interface.\n */\n close() {\n // TODO check !this.overlay || !this.isFocus()\n if (!this.overlay) {\n return Promise.resolve(false);\n }\n return this.overlay.dismiss();\n }\n getLabel() {\n return findItemLabel(this.el);\n }\n hasValue() {\n return this.getText() !== '';\n }\n get childOpts() {\n return Array.from(this.el.querySelectorAll('ion-select-option'));\n }\n getText() {\n const selectedText = this.selectedText;\n if (selectedText != null && selectedText !== '') {\n return selectedText;\n }\n return generateText(this.childOpts, this.value, this.compareWith);\n }\n setFocus() {\n if (this.buttonEl) {\n this.buttonEl.focus();\n }\n }\n emitStyle() {\n this.ionStyle.emit({\n 'interactive': true,\n 'select': true,\n 'has-placeholder': this.placeholder != null,\n 'has-value': this.hasValue(),\n 'interactive-disabled': this.disabled,\n 'select-disabled': this.disabled\n });\n }\n render() {\n const { placeholder, name, disabled, isExpanded, value, el } = this;\n const mode = getIonMode(this);\n const labelId = this.inputId + '-lbl';\n const label = findItemLabel(el);\n if (label) {\n label.id = labelId;\n }\n let addPlaceholderClass = false;\n let selectText = this.getText();\n if (selectText === '' && placeholder != null) {\n selectText = placeholder;\n addPlaceholderClass = true;\n }\n renderHiddenInput(true, el, name, parseValue(value), disabled);\n const selectTextClasses = {\n 'select-text': true,\n 'select-placeholder': addPlaceholderClass\n };\n const textPart = addPlaceholderClass ? 'placeholder' : 'text';\n return (h(Host, { onClick: this.onClick, role: \"listbox\", \"aria-haspopup\": \"dialog\", \"aria-disabled\": disabled ? 'true' : null, \"aria-expanded\": `${isExpanded}`, \"aria-labelledby\": labelId, class: {\n [mode]: true,\n 'in-item': hostContext('ion-item', el),\n 'select-disabled': disabled,\n } }, h(\"div\", { class: selectTextClasses, part: textPart }, selectText), h(\"div\", { class: \"select-icon\", role: \"presentation\", part: \"icon\" }, h(\"div\", { class: \"select-icon-inner\" })), h(\"button\", { type: \"button\", onFocus: this.onFocus, onBlur: this.onBlur, disabled: disabled, ref: (btnEl => this.buttonEl = btnEl) })));\n }\n get el() { return getElement(this); }\n static get watchers() { return {\n \"disabled\": [\"disabledChanged\"],\n \"placeholder\": [\"disabledChanged\"],\n \"value\": [\"valueChanged\"]\n }; }\n};\nconst isOptionSelected = (currentValue, compareValue, compareWith) => {\n if (currentValue === undefined) {\n return false;\n }\n if (Array.isArray(currentValue)) {\n return currentValue.some(val => compareOptions(val, compareValue, compareWith));\n }\n else {\n return compareOptions(currentValue, compareValue, compareWith);\n }\n};\nconst getOptionValue = (el) => {\n const value = el.value;\n return (value === undefined)\n ? el.textContent || ''\n : value;\n};\nconst parseValue = (value) => {\n if (value == null) {\n return undefined;\n }\n if (Array.isArray(value)) {\n return value.join(',');\n }\n return value.toString();\n};\nconst compareOptions = (currentValue, compareValue, compareWith) => {\n if (typeof compareWith === 'function') {\n return compareWith(currentValue, compareValue);\n }\n else if (typeof compareWith === 'string') {\n return currentValue[compareWith] === compareValue[compareWith];\n }\n else {\n return Array.isArray(compareValue) ? compareValue.includes(currentValue) : currentValue === compareValue;\n }\n};\nconst generateText = (opts, value, compareWith) => {\n if (value === undefined) {\n return '';\n }\n if (Array.isArray(value)) {\n return value\n .map(v => textForValue(opts, v, compareWith))\n .filter(opt => opt !== null)\n .join(', ');\n }\n else {\n return textForValue(opts, value, compareWith) || '';\n }\n};\nconst textForValue = (opts, value, compareWith) => {\n const selectOpt = opts.find(opt => {\n return compareOptions(getOptionValue(opt), value, compareWith);\n });\n return selectOpt\n ? selectOpt.textContent\n : null;\n};\nlet selectIds = 0;\nconst OPTION_CLASS = 'select-interface-option';\nSelect.style = {\n ios: selectIosCss,\n md: selectMdCss\n};\n\nconst selectOptionCss = \":host{display:none}\";\n\nconst SelectOption = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.inputId = `ion-selopt-${selectOptionIds++}`;\n /**\n * If `true`, the user cannot interact with the select option. This property does not apply when `interface=\"action-sheet\"` as `ion-action-sheet` does not allow for disabled buttons.\n */\n this.disabled = false;\n }\n render() {\n return (h(Host, { role: \"option\", id: this.inputId, class: getIonMode(this) }));\n }\n get el() { return getElement(this); }\n};\nlet selectOptionIds = 0;\nSelectOption.style = selectOptionCss;\n\nconst selectPopoverCss = \".sc-ion-select-popover-h ion-list.sc-ion-select-popover{margin-left:0;margin-right:0;margin-top:-1px;margin-bottom:-1px}.sc-ion-select-popover-h ion-list-header.sc-ion-select-popover,.sc-ion-select-popover-h ion-label.sc-ion-select-popover{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}\";\n\nconst SelectPopover = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n /** Array of options for the popover */\n this.options = [];\n }\n onSelect(ev) {\n const option = this.options.find(o => o.value === ev.target.value);\n if (option) {\n safeCall(option.handler);\n }\n }\n render() {\n const checkedOption = this.options.find(o => o.checked);\n const checkedValue = checkedOption ? checkedOption.value : undefined;\n return (h(Host, { class: getIonMode(this) }, h(\"ion-list\", null, this.header !== undefined && h(\"ion-list-header\", null, this.header), (this.subHeader !== undefined || this.message !== undefined) &&\n h(\"ion-item\", null, h(\"ion-label\", { class: \"ion-text-wrap\" }, this.subHeader !== undefined && h(\"h3\", null, this.subHeader), this.message !== undefined && h(\"p\", null, this.message))), h(\"ion-radio-group\", { value: checkedValue }, this.options.map(option => h(\"ion-item\", { class: getClassMap(option.cssClass) }, h(\"ion-label\", null, option.text), h(\"ion-radio\", { value: option.value, disabled: option.disabled })))))));\n }\n};\nSelectPopover.style = selectPopoverCss;\n\nexport { Select as ion_select, SelectOption as ion_select_option, SelectPopover as ion_select_popover };\n"],"sourceRoot":"webpack:///"} |