1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\n/*!\n * (C) Ionic http://ionicframework.com - MIT License\n */\nimport { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';\nconst segmentViewIosCss = \":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}\";\nconst IonSegmentViewIosStyle0 = segmentViewIosCss;\nconst segmentViewMdCss = \":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}\";\nconst IonSegmentViewMdStyle0 = segmentViewMdCss;\nconst SegmentView = /*@__PURE__*/proxyCustomElement(class SegmentView extends HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n this.__attachShadow();\n this.ionSegmentViewScroll = createEvent(this, \"ionSegmentViewScroll\", 7);\n this.scrollEndTimeout = null;\n this.isTouching = false;\n this.disabled = false;\n this.isManualScroll = undefined;\n }\n handleScroll(ev) {\n var _a;\n const {\n scrollLeft,\n scrollWidth,\n clientWidth\n } = ev.target;\n const scrollRatio = scrollLeft / (scrollWidth - clientWidth);\n this.ionSegmentViewScroll.emit({\n scrollRatio,\n isManualScroll: (_a = this.isManualScroll) !== null && _a !== void 0 ? _a : true\n });\n // Reset the timeout to check for scroll end\n this.resetScrollEndTimeout();\n }\n /**\n * Handle touch start event to know when the user is actively dragging the segment view.\n */\n handleScrollStart() {\n if (this.scrollEndTimeout) {\n clearTimeout(this.scrollEndTimeout);\n this.scrollEndTimeout = null;\n }\n this.isTouching = true;\n }\n /**\n * Handle touch end event to know when the user is no longer dragging the segment view.\n */\n handleTouchEnd() {\n this.isTouching = false;\n }\n /**\n * Reset the scroll end detection timer. This is called on every scroll event.\n */\n resetScrollEndTimeout() {\n if (this.scrollEndTimeout) {\n clearTimeout(this.scrollEndTimeout);\n this.scrollEndTimeout = null;\n }\n this.scrollEndTimeout = setTimeout(() => {\n this.checkForScrollEnd();\n },\n // Setting this to a lower value may result in inconsistencies in behavior\n // across browsers (particularly Firefox).\n // Ideally, all of this logic is removed once the scroll end event is\n // supported on all browsers (https://caniuse.com/?search=scrollend)\n 100);\n }\n /**\n * Check if the scroll has ended and the user is not actively touching.\n * If the conditions are met (active content is enabled and no active touch),\n * reset the scroll position and emit the scroll end event.\n */\n checkForScrollEnd() {\n // Only emit scroll end event if the active content is not disabled and\n // the user is not touching the segment view\n if (!this.isTouching) {\n this.isManualScroll = undefined;\n }\n }\n /**\n * @internal\n *\n * This method is used to programmatically set the displayed segment content\n * in the segment view. Calling this method will update the `value` of the\n * corresponding segment button.\n *\n * @param id: The id of the segment content to display.\n * @param smoothScroll: Whether to animate the scroll transition.\n */\n setContent(id, smoothScroll = true) {\n var _this = this;\n return _asyncToGenerator(function* () {\n const contents = _this.getSegmentContents();\n const index = contents.findIndex(content => content.id === id);\n if (index === -1) return;\n _this.isManualScroll = false;\n _this.resetScrollEndTimeout();\n const contentWidth = _this.el.offsetWidth;\n _this.el.scrollTo({\n top: 0,\n left: index * contentWidth,\n behavior: smoothScroll ? 'smooth' : 'instant'\n });\n })();\n }\n getSegmentContents() {\n return Array.from(this.el.querySelectorAll('ion-segment-content'));\n }\n render() {\n const {\n disabled,\n isManualScroll\n } = this;\n return h(Host, {\n key: '9f4f11d31c4db776f077e59ae895b35dd4454717',\n class: {\n 'segment-view-disabled': disabled,\n 'segment-view-scroll-disabled': isManualScroll === false\n }\n }, h(\"slot\", {\n key: 'ea58b21f031cee2ab2b70580f336deaefa364538'\n }));\n }\n get el() {\n return this;\n }\n static get style() {\n return {\n ios: IonSegmentViewIosStyle0,\n md: IonSegmentViewMdStyle0\n };\n }\n}, [33, \"ion-segment-view\", {\n \"disabled\": [4],\n \"isManualScroll\": [32],\n \"setContent\": [64]\n}, [[1, \"scroll\", \"handleScroll\"], [1, \"touchstart\", \"handleScrollStart\"], [1, \"touchend\", \"handleTouchEnd\"]]]);\nfunction defineCustomElement$1() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"ion-segment-view\"];\n components.forEach(tagName => {\n switch (tagName) {\n case \"ion-segment-view\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, SegmentView);\n }\n break;\n }\n });\n}\nconst IonSegmentView = SegmentView;\nconst defineCustomElement = defineCustomElement$1;\nexport { IonSegmentView, defineCustomElement };","map":{"version":3,"names":["proxyCustomElement","HTMLElement","createEvent","h","Host","segmentViewIosCss","IonSegmentViewIosStyle0","segmentViewMdCss","IonSegmentViewMdStyle0","SegmentView","constructor","__registerHost","__attachShadow","ionSegmentViewScroll","scrollEndTimeout","isTouching","disabled","isManualScroll","undefined","handleScroll","ev","_a","scrollLeft","scrollWidth","clientWidth","target","scrollRatio","emit","resetScrollEndTimeout","handleScrollStart","clearTimeout","handleTouchEnd","setTimeout","checkForScrollEnd","setContent","id","smoothScroll","_this","_asyncToGenerator","contents","getSegmentContents","index","findIndex","content","contentWidth","el","offsetWidth","scrollTo","top","left","behavior","Array","from","querySelectorAll","render","key","class","style","ios","md","defineCustomElement$1","customElements","components","forEach","tagName","get","define","IonSegmentView","defineCustomElement"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@ionic/core/components/ion-segment-view.js"],"sourcesContent":["/*!\n * (C) Ionic http://ionicframework.com - MIT License\n */\nimport { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';\n\nconst segmentViewIosCss = \":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}\";\nconst IonSegmentViewIosStyle0 = segmentViewIosCss;\n\nconst segmentViewMdCss = \":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}\";\nconst IonSegmentViewMdStyle0 = segmentViewMdCss;\n\nconst SegmentView = /*@__PURE__*/ proxyCustomElement(class SegmentView extends HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n this.__attachShadow();\n this.ionSegmentViewScroll = createEvent(this, \"ionSegmentViewScroll\", 7);\n this.scrollEndTimeout = null;\n this.isTouching = false;\n this.disabled = false;\n this.isManualScroll = undefined;\n }\n handleScroll(ev) {\n var _a;\n const { scrollLeft, scrollWidth, clientWidth } = ev.target;\n const scrollRatio = scrollLeft / (scrollWidth - clientWidth);\n this.ionSegmentViewScroll.emit({\n scrollRatio,\n isManualScroll: (_a = this.isManualScroll) !== null && _a !== void 0 ? _a : true,\n });\n // Reset the timeout to check for scroll end\n this.resetScrollEndTimeout();\n }\n /**\n * Handle touch start event to know when the user is actively dragging the segment view.\n */\n handleScrollStart() {\n if (this.scrollEndTimeout) {\n clearTimeout(this.scrollEndTimeout);\n this.scrollEndTimeout = null;\n }\n this.isTouching = true;\n }\n /**\n * Handle touch end event to know when the user is no longer dragging the segment view.\n */\n handleTouchEnd() {\n this.isTouching = false;\n }\n /**\n * Reset the scroll end detection timer. This is called on every scroll event.\n */\n resetScrollEndTimeout() {\n if (this.scrollEndTimeout) {\n clearTimeout(this.scrollEndTimeout);\n this.scrollEndTimeout = null;\n }\n this.scrollEndTimeout = setTimeout(() => {\n this.checkForScrollEnd();\n }, \n // Setting this to a lower value may result in inconsistencies in behavior\n // across browsers (particularly Firefox).\n // Ideally, all of this logic is removed once the scroll end event is\n // supported on all browsers (https://caniuse.com/?search=scrollend)\n 100);\n }\n /**\n * Check if the scroll has ended and the user is not actively touching.\n * If the conditions are met (active content is enabled and no active touch),\n * reset the scroll position and emit the scroll end event.\n */\n checkForScrollEnd() {\n // Only emit scroll end event if the active content is not disabled and\n // the user is not touching the segment view\n if (!this.isTouching) {\n this.isManualScroll = undefined;\n }\n }\n /**\n * @internal\n *\n * This method is used to programmatically set the displayed segment content\n * in the segment view. Calling this method will update the `value` of the\n * corresponding segment button.\n *\n * @param id: The id of the segment content to display.\n * @param smoothScroll: Whether to animate the scroll transition.\n */\n async setContent(id, smoothScroll = true) {\n const contents = this.getSegmentContents();\n const index = contents.findIndex((content) => content.id === id);\n if (index === -1)\n return;\n this.isManualScroll = false;\n this.resetScrollEndTimeout();\n const contentWidth = this.el.offsetWidth;\n this.el.scrollTo({\n top: 0,\n left: index * contentWidth,\n behavior: smoothScroll ? 'smooth' : 'instant',\n });\n }\n getSegmentContents() {\n return Array.from(this.el.querySelectorAll('ion-segment-content'));\n }\n render() {\n const { disabled, isManualScroll } = this;\n return (h(Host, { key: '9f4f11d31c4db776f077e59ae895b35dd4454717', class: {\n 'segment-view-disabled': disabled,\n 'segment-view-scroll-disabled': isManualScroll === false,\n } }, h(\"slot\", { key: 'ea58b21f031cee2ab2b70580f336deaefa364538' })));\n }\n get el() { return this; }\n static get style() { return {\n ios: IonSegmentViewIosStyle0,\n md: IonSegmentViewMdStyle0\n }; }\n}, [33, \"ion-segment-view\", {\n \"disabled\": [4],\n \"isManualScroll\": [32],\n \"setContent\": [64]\n }, [[1, \"scroll\", \"handleScroll\"], [1, \"touchstart\", \"handleScrollStart\"], [1, \"touchend\", \"handleTouchEnd\"]]]);\nfunction defineCustomElement$1() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"ion-segment-view\"];\n components.forEach(tagName => { switch (tagName) {\n case \"ion-segment-view\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, SegmentView);\n }\n break;\n } });\n}\n\nconst IonSegmentView = SegmentView;\nconst defineCustomElement = defineCustomElement$1;\n\nexport { IonSegmentView, defineCustomElement };\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,kBAAkB,EAAEC,WAAW,EAAEC,WAAW,EAAEC,CAAC,EAAEC,IAAI,QAAQ,+BAA+B;AAErG,MAAMC,iBAAiB,GAAG,wbAAwb;AACld,MAAMC,uBAAuB,GAAGD,iBAAiB;AAEjD,MAAME,gBAAgB,GAAG,wbAAwb;AACjd,MAAMC,sBAAsB,GAAGD,gBAAgB;AAE/C,MAAME,WAAW,GAAG,aAAcT,kBAAkB,CAAC,MAAMS,WAAW,SAASR,WAAW,CAAC;EACvFS,WAAWA,CAAA,EAAG;IACV,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,cAAc,CAAC,CAAC;IACrB,IAAI,CAACC,cAAc,CAAC,CAAC;IACrB,IAAI,CAACC,oBAAoB,GAAGX,WAAW,CAAC,IAAI,EAAE,sBAAsB,EAAE,CAAC,CAAC;IACxE,IAAI,CAACY,gBAAgB,GAAG,IAAI;IAC5B,IAAI,CAACC,UAAU,GAAG,KAAK;IACvB,IAAI,CAACC,QAAQ,GAAG,KAAK;IACrB,IAAI,CAACC,cAAc,GAAGC,SAAS;EACnC;EACAC,YAAYA,CAACC,EAAE,EAAE;IACb,IAAIC,EAAE;IACN,MAAM;MAAEC,UAAU;MAAEC,WAAW;MAAEC;IAAY,CAAC,GAAGJ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