"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent")),_classNames2=_interopRequireDefault(require("../helpers/libs/classNames")),_warning=_interopRequireDefault(require("../helpers/libs/warning")),_styleToCssString=_interopRequireDefault(require("../helpers/libs/styleToCssString")),_useNativeAPI=require("../helpers/hooks/useNativeAPI"),_useDOM=require("../helpers/hooks/useDOM");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;tt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.top-r})[0]};(0,_baseComponent.default)({useExport:!0,relations:{"../index-item/index":{type:"child",observer:function(){this.callDebounceFn(this.updated)}}},properties:{prefixCls:{type:String,value:"wux-index"},height:{type:[String,Number],value:300,observer:"updateStyle"},showIndicator:{type:Boolean,value:!0},indicatorPosition:{type:String,value:"center"},parentOffsetTop:{type:Number,value:0}},data:{colHight:0,points:[],scrollTop:0,children:[],moving:!1,current:0,currentName:"",currentBrief:"",extStyle:"",indicatorStyle:""},computed:{classes:["prefixCls, indicatorPosition",function(t,e){return{wrap:(0,_classNames2.default)(t),nav:"".concat(t,"__nav"),navRow:"".concat(t,"__nav-row"),navCol:"".concat(t,"__nav-col"),navItem:"".concat(t,"__nav-item"),indicator:(0,_classNames2.default)("".concat(t,"__indicator"),_defineProperty({},"".concat(t,"__indicator--").concat(e),e))}}]},methods:{updateStyle:function(){var t=0. Should not call directly."),null)},expose:function(){var r=this;return{scrollTo:function(e){var t=r.data.children,t=("number"==typeof e?t.filter(function(t){return t.index===e}):t.filter(function(t){return t.name===e}))[0];t&&(r.setData({moving:!0}),r.setActive(t.index,t.name),setTimeout(function(){return r.setData({moving:!1})},300))},getInternalHooks:this.getInternalHooks.bind(this)}}},created:function(){var i=this,t=this.useThrottleFn(function(t,e){var r,n,e=findActiveByPosition(e.detail.scrollTop,t.parentOffsetTop,t.children);void 0!==e&&(r=e.index,n=e.name,e=e.brief,r===t.current&&n===t.currentName||(i.setData({current:r,currentName:n,currentBrief:e}),i.triggerEvent("change",{index:r,name:n,brief:e})))},50,{trailing:!0,leading:!0}).run,t=(this.checkActiveIndex=t,this.useThrottleFn(function(){var t=i.getRelationsByName("../index-item/index").map(function(t){return{name:(t=t.data).name,index:t.index,top:t.top,height:t.height,brief:t.brief}});i.setData({children:t})},50,{trailing:!0,leading:!0}).run);this.updateChildren=t},ready:function(){this.updateStyle(),this.getNavPoints(),this.updateChildren()}});