raise-common-lib 0.0.205 → 0.0.206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21735,20 +21735,21 @@ if (false) {
21735
21735
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
21736
21736
  */
21737
21737
  var RSStepperComponent = /** @class */ (function () {
21738
- function RSStepperComponent(cf) {
21738
+ function RSStepperComponent(cf, ref) {
21739
21739
  this.cf = cf;
21740
+ this.ref = ref;
21740
21741
  this.steps = [];
21741
21742
  this.currentStep = 0;
21742
21743
  this.stepClick = new EventEmitter();
21743
21744
  this.unlockedStep = 0; //已解锁的最大步骤
21745
+ this.showBtn = false;
21746
+ this.isAtStart = true;
21747
+ this.isAtEnd = false;
21744
21748
  }
21745
- //已解锁的最大步骤
21746
21749
  /**
21747
21750
  * @return {?}
21748
21751
  */
21749
- RSStepperComponent.prototype.ngOnInit =
21750
- //已解锁的最大步骤
21751
- /**
21752
+ RSStepperComponent.prototype.ngOnInit = /**
21752
21753
  * @return {?}
21753
21754
  */
21754
21755
  function () {
@@ -21762,6 +21763,19 @@ var RSStepperComponent = /** @class */ (function () {
21762
21763
  }));
21763
21764
  this.syncUnlockedStep();
21764
21765
  };
21766
+ /**
21767
+ * @return {?}
21768
+ */
21769
+ RSStepperComponent.prototype.ngAfterViewInit = /**
21770
+ * @return {?}
21771
+ */
21772
+ function () {
21773
+ var _this = this;
21774
+ setTimeout((/**
21775
+ * @return {?}
21776
+ */
21777
+ function () { return _this.checkBtnShow(true); }));
21778
+ };
21765
21779
  /**
21766
21780
  * @param {?} changes
21767
21781
  * @return {?}
@@ -21771,8 +21785,21 @@ var RSStepperComponent = /** @class */ (function () {
21771
21785
  * @return {?}
21772
21786
  */
21773
21787
  function (changes) {
21788
+ var _this = this;
21774
21789
  if (changes["currentStep"] && !changes["currentStep"].firstChange) {
21775
21790
  this.syncUnlockedStep();
21791
+ // 当外部传入的 currentStep 变化时,滚动到对应步骤
21792
+ setTimeout((/**
21793
+ * @return {?}
21794
+ */
21795
+ function () { return _this.scrollToStep(); }));
21796
+ }
21797
+ if ((changes["steps"] && changes["steps"].currentValue) ||
21798
+ changes["currentStep"]) {
21799
+ setTimeout((/**
21800
+ * @return {?}
21801
+ */
21802
+ function () { return _this.checkBtnShow(); }));
21776
21803
  }
21777
21804
  };
21778
21805
  // 同步unlockedStep的最大值
@@ -21794,38 +21821,192 @@ var RSStepperComponent = /** @class */ (function () {
21794
21821
  };
21795
21822
  /**
21796
21823
  * @param {?} step
21824
+ * @param {?=} index
21797
21825
  * @return {?}
21798
21826
  */
21799
21827
  RSStepperComponent.prototype.onStepClick = /**
21800
21828
  * @param {?} step
21829
+ * @param {?=} index
21801
21830
  * @return {?}
21802
21831
  */
21803
- function (step) {
21832
+ function (step, index) {
21833
+ var _this = this;
21804
21834
  if (step.step <= this.unlockedStep) {
21805
21835
  this.currentStep = step.step;
21806
21836
  this.stepClick.emit(step);
21837
+ setTimeout((/**
21838
+ * @return {?}
21839
+ */
21840
+ function () { return _this.scrollToStep(index); }));
21807
21841
  }
21808
21842
  };
21843
+ /**
21844
+ * @private
21845
+ * @param {?=} index
21846
+ * @return {?}
21847
+ */
21848
+ RSStepperComponent.prototype.scrollToStep = /**
21849
+ * @private
21850
+ * @param {?=} index
21851
+ * @return {?}
21852
+ */
21853
+ function (index) {
21854
+ var _this = this;
21855
+ if (!this.menu || !this.menu.nativeElement)
21856
+ return;
21857
+ /** @type {?} */
21858
+ var menuEl = this.menu.nativeElement;
21859
+ /** @type {?} */
21860
+ var items = menuEl.querySelectorAll(".step");
21861
+ /** @type {?} */
21862
+ var targetIndex = typeof index === "number"
21863
+ ? index
21864
+ : this.steps.findIndex((/**
21865
+ * @param {?} s
21866
+ * @return {?}
21867
+ */
21868
+ function (s) { return s.step === _this.currentStep; }));
21869
+ if (targetIndex < 0 || targetIndex >= items.length)
21870
+ return;
21871
+ /** @type {?} */
21872
+ var targetEl = (/** @type {?} */ (items[targetIndex]));
21873
+ //获取相对位置
21874
+ /** @type {?} */
21875
+ var containerRect = menuEl.getBoundingClientRect();
21876
+ /** @type {?} */
21877
+ var elementRect = targetEl.getBoundingClientRect();
21878
+ // 计算元素相对于容器的位置
21879
+ /** @type {?} */
21880
+ var elementRelativeLeft = elementRect.left - containerRect.left + menuEl.scrollLeft;
21881
+ /** @type {?} */
21882
+ var elementWidth = elementRect.width;
21883
+ /** @type {?} */
21884
+ var containerWidth = menuEl.clientWidth;
21885
+ // 计算元素中心点相对于容器的位置
21886
+ /** @type {?} */
21887
+ var elementCenter = elementRelativeLeft + elementWidth / 2;
21888
+ // 目标滚动位置:让元素中心出现在可视区域中心
21889
+ /** @type {?} */
21890
+ var scrollTarget = elementCenter - containerWidth / 2;
21891
+ // 限制在有效滚动范围内
21892
+ /** @type {?} */
21893
+ var maxScroll = Math.max(0, menuEl.scrollWidth - containerWidth);
21894
+ /** @type {?} */
21895
+ var finalTarget = Math.max(0, Math.min(scrollTarget, maxScroll));
21896
+ menuEl.scrollTo({ left: finalTarget, behavior: "smooth" });
21897
+ this.onScroll();
21898
+ };
21899
+ /**
21900
+ * @param {?} event
21901
+ * @return {?}
21902
+ */
21903
+ RSStepperComponent.prototype.onResize = /**
21904
+ * @param {?} event
21905
+ * @return {?}
21906
+ */
21907
+ function (event) {
21908
+ this.checkBtnShow();
21909
+ };
21910
+ /**
21911
+ * @param {?=} init
21912
+ * @return {?}
21913
+ */
21914
+ RSStepperComponent.prototype.checkBtnShow = /**
21915
+ * @param {?=} init
21916
+ * @return {?}
21917
+ */
21918
+ function (init) {
21919
+ var _this = this;
21920
+ if (!this.menu || !this.menu.nativeElement)
21921
+ return;
21922
+ /** @type {?} */
21923
+ var menuEl = this.menu.nativeElement;
21924
+ var scrollWidth = menuEl.scrollWidth, clientWidth = menuEl.clientWidth;
21925
+ // 判断是否需要显示滚动按钮
21926
+ /** @type {?} */
21927
+ var threshold = clientWidth;
21928
+ if (this.containerRefId) {
21929
+ /** @type {?} */
21930
+ var containerRef = document.getElementById(this.containerRefId);
21931
+ if (containerRef) {
21932
+ threshold = Math.max(containerRef.offsetWidth * 0.8, 400);
21933
+ }
21934
+ }
21935
+ this.showBtn = scrollWidth > threshold;
21936
+ // 初始化时滚动到当前步骤
21937
+ if (init) {
21938
+ setTimeout((/**
21939
+ * @return {?}
21940
+ */
21941
+ function () { return _this.scrollToStep(); }), 0);
21942
+ }
21943
+ this.onScroll();
21944
+ this.ref.markForCheck();
21945
+ };
21946
+ /**
21947
+ * @return {?}
21948
+ */
21949
+ RSStepperComponent.prototype.scrollLeft = /**
21950
+ * @return {?}
21951
+ */
21952
+ function () {
21953
+ var scrollLeft = this.menu.nativeElement.scrollLeft;
21954
+ /** @type {?} */
21955
+ var dis = scrollLeft / 100 < 2 ? scrollLeft + 10 : 100;
21956
+ this.menu.nativeElement.scrollBy({ left: -dis, behavior: "smooth" });
21957
+ };
21958
+ /**
21959
+ * @return {?}
21960
+ */
21961
+ RSStepperComponent.prototype.scrollRight = /**
21962
+ * @return {?}
21963
+ */
21964
+ function () {
21965
+ var _a = this.menu.nativeElement, scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
21966
+ /** @type {?} */
21967
+ var rest = scrollWidth - clientWidth - scrollLeft;
21968
+ /** @type {?} */
21969
+ var dis = rest / 100 < 2 ? rest + 10 : 100;
21970
+ this.menu.nativeElement.scrollBy({ left: dis, behavior: "smooth" });
21971
+ };
21972
+ /**
21973
+ * @return {?}
21974
+ */
21975
+ RSStepperComponent.prototype.onScroll = /**
21976
+ * @return {?}
21977
+ */
21978
+ function () {
21979
+ var _a = this.menu.nativeElement, scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
21980
+ this.isAtStart = scrollLeft <= 1;
21981
+ this.isAtEnd = scrollLeft + clientWidth >= scrollWidth - 1;
21982
+ this.ref.markForCheck();
21983
+ };
21809
21984
  RSStepperComponent.decorators = [
21810
21985
  { type: Component, args: [{
21811
21986
  selector: "rs-stepper",
21812
- template: "<div class=\"rs-stepper\">\r\n <div class=\"steps-wrap\">\r\n <ng-container *ngFor=\"let item of steps; let i = index\">\r\n <div\r\n class=\"step\"\r\n [ngClass]=\"{\r\n done: item.step <= unlockedStep,\r\n active: item.step === currentStep\r\n }\"\r\n (click)=\"onStepClick(item)\"\r\n >\r\n <div\r\n class=\"step-label\"\r\n [matTooltip]=\"item.label !== item.displayTitle ? item.label : ''\"\r\n matTooltipPosition=\"above\"\r\n >\r\n {{ item.displayTitle }}\r\n </div>\r\n </div>\r\n <div class=\"step-arrow\" *ngIf=\"i < steps.length - 1\">\r\n <img src=\"/assets/img/step-arrow.svg\" />\r\n </div>\r\n </ng-container>\r\n </div>\r\n</div>\r\n",
21813
- styles: [".rs-stepper{font-family:Arial;width:100%;border-bottom:1px solid var(--rs-border-color)}.rs-stepper .steps-wrap{display:flex;align-items:center;justify-content:space-between;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;margin:0 auto;gap:8px}.rs-stepper .steps-wrap .step{flex:1}.rs-stepper .steps-wrap .step .step-label{color:var(--rs-labels-color);font-size:12px;font-weight:400;line-height:22px;text-align:center;white-space:nowrap;padding:0 12px 12px;display:flex;align-items:center}.rs-stepper .steps-wrap .step.done{cursor:pointer}.rs-stepper .steps-wrap .step.done .step-label{color:var(--rs-active-labels-color)}.rs-stepper .steps-wrap .step.active .step-label{color:var(--rs-active-labels-color);font-weight:700;border-bottom:1px solid var(--rs-active-labels-color)}.rs-stepper .steps-wrap .step-arrow{padding:0 12px 12px;display:flex;align-items:center}"]
21987
+ template: "<div class=\"rs-stepper\">\r\n <div class=\"steps-wrap\">\r\n <div\r\n class=\"row-btn\"\r\n [class.hidden]=\"isAtStart || !showBtn\"\r\n (click)=\"scrollLeft()\"\r\n >\r\n <div class=\"hover\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"17\"\r\n height=\"16\"\r\n viewBox=\"0 0 17 16\"\r\n fill=\"none\"\r\n >\r\n <path\r\n d=\"M10.4995 3.99955L7.24219 8.24219L10.4995 12.4848\"\r\n stroke=\"#1F7BFF\"\r\n />\r\n </svg>\r\n </div>\r\n <div class=\"normal\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"17\"\r\n height=\"16\"\r\n viewBox=\"0 0 17 16\"\r\n fill=\"none\"\r\n >\r\n <path\r\n d=\"M10.4995 3.99955L7.24219 8.24219L10.4995 12.4848\"\r\n stroke=\"#6B6B6B\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n <div\r\n class=\"steps-content\"\r\n [ngClass]=\"{\r\n leftMask: showBtn && !isAtStart,\r\n rightMask: showBtn && !isAtEnd,\r\n bothMask: showBtn && !isAtStart && showBtn && !isAtEnd\r\n }\"\r\n #menu\r\n (scroll)=\"onScroll()\"\r\n >\r\n <ng-container *ngFor=\"let item of steps; let i = index\">\r\n <div\r\n class=\"step\"\r\n [ngClass]=\"{\r\n done: item.step <= unlockedStep,\r\n active: item.step === currentStep\r\n }\"\r\n (click)=\"onStepClick(item, i)\"\r\n >\r\n <div\r\n class=\"step-label\"\r\n [matTooltip]=\"item.label !== item.displayTitle ? item.label : ''\"\r\n matTooltipPosition=\"above\"\r\n >\r\n {{ item.displayTitle }}\r\n </div>\r\n </div>\r\n <div class=\"step-arrow\" *ngIf=\"i < steps.length - 1\">\r\n <img src=\"/assets/img/step-arrow.svg\" />\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div\r\n class=\"row-btn\"\r\n [class.hidden]=\"isAtEnd || !showBtn\"\r\n (click)=\"scrollRight()\"\r\n >\r\n <div class=\"hover\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"17\"\r\n height=\"16\"\r\n viewBox=\"0 0 17 16\"\r\n fill=\"none\"\r\n >\r\n <path\r\n d=\"M7.50045 3.99955L10.7578 8.24219L7.50045 12.4848\"\r\n stroke=\"#1F7BFF\"\r\n />\r\n </svg>\r\n </div>\r\n <div class=\"normal\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"17\"\r\n height=\"16\"\r\n viewBox=\"0 0 17 16\"\r\n fill=\"none\"\r\n >\r\n <path\r\n d=\"M7.50045 3.99955L10.7578 8.24219L7.50045 12.4848\"\r\n stroke=\"#6B6B6B\"\r\n />\r\n </svg>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n",
21988
+ styles: [".rs-stepper{font-family:Arial;width:100%;border-bottom:1px solid var(--rs-border-color)}.rs-stepper .steps-wrap{display:flex;align-items:center;justify-content:center;gap:12px;margin:0 auto}.rs-stepper .steps-wrap .steps-content{display:flex;align-items:center;flex-wrap:nowrap;min-width:0;overflow-x:auto;overflow-y:hidden;gap:8px}.rs-stepper .steps-wrap .steps-content.leftMask{-webkit-mask-image:linear-gradient(90deg,transparent,#fff 10%,#d8d3d3 100%);mask-image:linear-gradient(90deg,transparent,#fff 10%,#d8d3d3 100%)}.rs-stepper .steps-wrap .steps-content.rightMask{-webkit-mask-image:linear-gradient(90deg,#fff 0,#fff 90%,transparent);mask-image:linear-gradient(90deg,#fff 0,#fff 90%,transparent)}.rs-stepper .steps-wrap .steps-content.bothMask{-webkit-mask-image:linear-gradient(90deg,transparent,#fff 10%,#fff 90%,transparent)!important;mask-image:linear-gradient(90deg,transparent,#fff 10%,#fff 90%,transparent)!important}.rs-stepper .steps-wrap .steps-content::-webkit-scrollbar{width:0;height:0}.rs-stepper .steps-wrap .step{flex:0 0 auto}.rs-stepper .steps-wrap .step .step-label{color:var(--rs-labels-color);font-size:12px;font-weight:400;line-height:22px;text-align:center;white-space:nowrap;padding:0 12px 12px;display:flex;align-items:center}.rs-stepper .steps-wrap .step.done{cursor:pointer}.rs-stepper .steps-wrap .step.done .step-label{color:var(--rs-active-labels-color)}.rs-stepper .steps-wrap .step.active .step-label{color:var(--rs-active-labels-color);font-weight:700;border-bottom:1px solid var(--rs-active-labels-color)}.rs-stepper .steps-wrap .step-arrow{flex:0 0 auto;padding:0 12px 12px;display:flex;align-items:center}.rs-stepper .row-btn{margin-bottom:12px;display:flex;width:20px;height:20px;align-items:center;justify-content:center;border-radius:4px;border:1px solid #bdc4ca;flex-shrink:0;cursor:pointer;visibility:visible}.rs-stepper .row-btn .hover{display:none}.rs-stepper .row-btn .normal{display:flex}.rs-stepper .row-btn:hover{background-color:rgba(31,123,255,.04)}.rs-stepper .row-btn:hover .normal{display:none}.rs-stepper .row-btn:hover .hover{display:flex}.rs-stepper .row-btn.hidden{visibility:hidden}"]
21814
21989
  }] }
21815
21990
  ];
21816
21991
  /** @nocollapse */
21817
21992
  RSStepperComponent.ctorParameters = function () { return [
21818
- { type: CommonFunctionService }
21993
+ { type: CommonFunctionService },
21994
+ { type: ChangeDetectorRef }
21819
21995
  ]; };
21820
21996
  RSStepperComponent.propDecorators = {
21997
+ menu: [{ type: ViewChild, args: ["menu", { static: false },] }],
21821
21998
  steps: [{ type: Input }],
21822
21999
  currentStep: [{ type: Input }],
21823
22000
  stepClick: [{ type: Output }],
21824
- unlockedStep: [{ type: Input }]
22001
+ unlockedStep: [{ type: Input }],
22002
+ containerRefId: [{ type: Input }],
22003
+ onResize: [{ type: HostListener, args: ["window:resize", ["$event"],] }]
21825
22004
  };
21826
22005
  return RSStepperComponent;
21827
22006
  }());
21828
22007
  if (false) {
22008
+ /** @type {?} */
22009
+ RSStepperComponent.prototype.menu;
21829
22010
  /** @type {?} */
21830
22011
  RSStepperComponent.prototype.steps;
21831
22012
  /** @type {?} */
@@ -21835,7 +22016,20 @@ if (false) {
21835
22016
  /** @type {?} */
21836
22017
  RSStepperComponent.prototype.unlockedStep;
21837
22018
  /** @type {?} */
22019
+ RSStepperComponent.prototype.containerRefId;
22020
+ /** @type {?} */
22021
+ RSStepperComponent.prototype.showBtn;
22022
+ /** @type {?} */
22023
+ RSStepperComponent.prototype.isAtStart;
22024
+ /** @type {?} */
22025
+ RSStepperComponent.prototype.isAtEnd;
22026
+ /** @type {?} */
21838
22027
  RSStepperComponent.prototype.cf;
22028
+ /**
22029
+ * @type {?}
22030
+ * @private
22031
+ */
22032
+ RSStepperComponent.prototype.ref;
21839
22033
  }
21840
22034
 
21841
22035
  /**