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.
- package/bundles/raise-common-lib.umd.js +204 -10
- package/bundles/raise-common-lib.umd.js.map +1 -1
- package/bundles/raise-common-lib.umd.min.js +1 -1
- package/bundles/raise-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/layout/rs-stepper/index.component.js +175 -9
- package/esm5/lib/layout/rs-stepper/index.component.js +206 -12
- package/fesm2015/raise-common-lib.js +173 -7
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +204 -10
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/layout/rs-stepper/index.component.d.ts +17 -4
- package/package.json +1 -1
- package/raise-common-lib.metadata.json +1 -1
|
@@ -21927,20 +21927,21 @@
|
|
|
21927
21927
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
21928
21928
|
*/
|
|
21929
21929
|
var RSStepperComponent = /** @class */ (function () {
|
|
21930
|
-
function RSStepperComponent(cf) {
|
|
21930
|
+
function RSStepperComponent(cf, ref) {
|
|
21931
21931
|
this.cf = cf;
|
|
21932
|
+
this.ref = ref;
|
|
21932
21933
|
this.steps = [];
|
|
21933
21934
|
this.currentStep = 0;
|
|
21934
21935
|
this.stepClick = new core.EventEmitter();
|
|
21935
21936
|
this.unlockedStep = 0; //已解锁的最大步骤
|
|
21937
|
+
this.showBtn = false;
|
|
21938
|
+
this.isAtStart = true;
|
|
21939
|
+
this.isAtEnd = false;
|
|
21936
21940
|
}
|
|
21937
|
-
//已解锁的最大步骤
|
|
21938
21941
|
/**
|
|
21939
21942
|
* @return {?}
|
|
21940
21943
|
*/
|
|
21941
|
-
RSStepperComponent.prototype.ngOnInit =
|
|
21942
|
-
//已解锁的最大步骤
|
|
21943
|
-
/**
|
|
21944
|
+
RSStepperComponent.prototype.ngOnInit = /**
|
|
21944
21945
|
* @return {?}
|
|
21945
21946
|
*/
|
|
21946
21947
|
function () {
|
|
@@ -21954,6 +21955,19 @@
|
|
|
21954
21955
|
}));
|
|
21955
21956
|
this.syncUnlockedStep();
|
|
21956
21957
|
};
|
|
21958
|
+
/**
|
|
21959
|
+
* @return {?}
|
|
21960
|
+
*/
|
|
21961
|
+
RSStepperComponent.prototype.ngAfterViewInit = /**
|
|
21962
|
+
* @return {?}
|
|
21963
|
+
*/
|
|
21964
|
+
function () {
|
|
21965
|
+
var _this = this;
|
|
21966
|
+
setTimeout((/**
|
|
21967
|
+
* @return {?}
|
|
21968
|
+
*/
|
|
21969
|
+
function () { return _this.checkBtnShow(true); }));
|
|
21970
|
+
};
|
|
21957
21971
|
/**
|
|
21958
21972
|
* @param {?} changes
|
|
21959
21973
|
* @return {?}
|
|
@@ -21963,8 +21977,21 @@
|
|
|
21963
21977
|
* @return {?}
|
|
21964
21978
|
*/
|
|
21965
21979
|
function (changes) {
|
|
21980
|
+
var _this = this;
|
|
21966
21981
|
if (changes["currentStep"] && !changes["currentStep"].firstChange) {
|
|
21967
21982
|
this.syncUnlockedStep();
|
|
21983
|
+
// 当外部传入的 currentStep 变化时,滚动到对应步骤
|
|
21984
|
+
setTimeout((/**
|
|
21985
|
+
* @return {?}
|
|
21986
|
+
*/
|
|
21987
|
+
function () { return _this.scrollToStep(); }));
|
|
21988
|
+
}
|
|
21989
|
+
if ((changes["steps"] && changes["steps"].currentValue) ||
|
|
21990
|
+
changes["currentStep"]) {
|
|
21991
|
+
setTimeout((/**
|
|
21992
|
+
* @return {?}
|
|
21993
|
+
*/
|
|
21994
|
+
function () { return _this.checkBtnShow(); }));
|
|
21968
21995
|
}
|
|
21969
21996
|
};
|
|
21970
21997
|
// 同步unlockedStep的最大值
|
|
@@ -21986,38 +22013,192 @@
|
|
|
21986
22013
|
};
|
|
21987
22014
|
/**
|
|
21988
22015
|
* @param {?} step
|
|
22016
|
+
* @param {?=} index
|
|
21989
22017
|
* @return {?}
|
|
21990
22018
|
*/
|
|
21991
22019
|
RSStepperComponent.prototype.onStepClick = /**
|
|
21992
22020
|
* @param {?} step
|
|
22021
|
+
* @param {?=} index
|
|
21993
22022
|
* @return {?}
|
|
21994
22023
|
*/
|
|
21995
|
-
function (step) {
|
|
22024
|
+
function (step, index) {
|
|
22025
|
+
var _this = this;
|
|
21996
22026
|
if (step.step <= this.unlockedStep) {
|
|
21997
22027
|
this.currentStep = step.step;
|
|
21998
22028
|
this.stepClick.emit(step);
|
|
22029
|
+
setTimeout((/**
|
|
22030
|
+
* @return {?}
|
|
22031
|
+
*/
|
|
22032
|
+
function () { return _this.scrollToStep(index); }));
|
|
21999
22033
|
}
|
|
22000
22034
|
};
|
|
22035
|
+
/**
|
|
22036
|
+
* @private
|
|
22037
|
+
* @param {?=} index
|
|
22038
|
+
* @return {?}
|
|
22039
|
+
*/
|
|
22040
|
+
RSStepperComponent.prototype.scrollToStep = /**
|
|
22041
|
+
* @private
|
|
22042
|
+
* @param {?=} index
|
|
22043
|
+
* @return {?}
|
|
22044
|
+
*/
|
|
22045
|
+
function (index) {
|
|
22046
|
+
var _this = this;
|
|
22047
|
+
if (!this.menu || !this.menu.nativeElement)
|
|
22048
|
+
return;
|
|
22049
|
+
/** @type {?} */
|
|
22050
|
+
var menuEl = this.menu.nativeElement;
|
|
22051
|
+
/** @type {?} */
|
|
22052
|
+
var items = menuEl.querySelectorAll(".step");
|
|
22053
|
+
/** @type {?} */
|
|
22054
|
+
var targetIndex = typeof index === "number"
|
|
22055
|
+
? index
|
|
22056
|
+
: this.steps.findIndex((/**
|
|
22057
|
+
* @param {?} s
|
|
22058
|
+
* @return {?}
|
|
22059
|
+
*/
|
|
22060
|
+
function (s) { return s.step === _this.currentStep; }));
|
|
22061
|
+
if (targetIndex < 0 || targetIndex >= items.length)
|
|
22062
|
+
return;
|
|
22063
|
+
/** @type {?} */
|
|
22064
|
+
var targetEl = (/** @type {?} */ (items[targetIndex]));
|
|
22065
|
+
//获取相对位置
|
|
22066
|
+
/** @type {?} */
|
|
22067
|
+
var containerRect = menuEl.getBoundingClientRect();
|
|
22068
|
+
/** @type {?} */
|
|
22069
|
+
var elementRect = targetEl.getBoundingClientRect();
|
|
22070
|
+
// 计算元素相对于容器的位置
|
|
22071
|
+
/** @type {?} */
|
|
22072
|
+
var elementRelativeLeft = elementRect.left - containerRect.left + menuEl.scrollLeft;
|
|
22073
|
+
/** @type {?} */
|
|
22074
|
+
var elementWidth = elementRect.width;
|
|
22075
|
+
/** @type {?} */
|
|
22076
|
+
var containerWidth = menuEl.clientWidth;
|
|
22077
|
+
// 计算元素中心点相对于容器的位置
|
|
22078
|
+
/** @type {?} */
|
|
22079
|
+
var elementCenter = elementRelativeLeft + elementWidth / 2;
|
|
22080
|
+
// 目标滚动位置:让元素中心出现在可视区域中心
|
|
22081
|
+
/** @type {?} */
|
|
22082
|
+
var scrollTarget = elementCenter - containerWidth / 2;
|
|
22083
|
+
// 限制在有效滚动范围内
|
|
22084
|
+
/** @type {?} */
|
|
22085
|
+
var maxScroll = Math.max(0, menuEl.scrollWidth - containerWidth);
|
|
22086
|
+
/** @type {?} */
|
|
22087
|
+
var finalTarget = Math.max(0, Math.min(scrollTarget, maxScroll));
|
|
22088
|
+
menuEl.scrollTo({ left: finalTarget, behavior: "smooth" });
|
|
22089
|
+
this.onScroll();
|
|
22090
|
+
};
|
|
22091
|
+
/**
|
|
22092
|
+
* @param {?} event
|
|
22093
|
+
* @return {?}
|
|
22094
|
+
*/
|
|
22095
|
+
RSStepperComponent.prototype.onResize = /**
|
|
22096
|
+
* @param {?} event
|
|
22097
|
+
* @return {?}
|
|
22098
|
+
*/
|
|
22099
|
+
function (event) {
|
|
22100
|
+
this.checkBtnShow();
|
|
22101
|
+
};
|
|
22102
|
+
/**
|
|
22103
|
+
* @param {?=} init
|
|
22104
|
+
* @return {?}
|
|
22105
|
+
*/
|
|
22106
|
+
RSStepperComponent.prototype.checkBtnShow = /**
|
|
22107
|
+
* @param {?=} init
|
|
22108
|
+
* @return {?}
|
|
22109
|
+
*/
|
|
22110
|
+
function (init) {
|
|
22111
|
+
var _this = this;
|
|
22112
|
+
if (!this.menu || !this.menu.nativeElement)
|
|
22113
|
+
return;
|
|
22114
|
+
/** @type {?} */
|
|
22115
|
+
var menuEl = this.menu.nativeElement;
|
|
22116
|
+
var scrollWidth = menuEl.scrollWidth, clientWidth = menuEl.clientWidth;
|
|
22117
|
+
// 判断是否需要显示滚动按钮
|
|
22118
|
+
/** @type {?} */
|
|
22119
|
+
var threshold = clientWidth;
|
|
22120
|
+
if (this.containerRefId) {
|
|
22121
|
+
/** @type {?} */
|
|
22122
|
+
var containerRef = document.getElementById(this.containerRefId);
|
|
22123
|
+
if (containerRef) {
|
|
22124
|
+
threshold = Math.max(containerRef.offsetWidth * 0.8, 400);
|
|
22125
|
+
}
|
|
22126
|
+
}
|
|
22127
|
+
this.showBtn = scrollWidth > threshold;
|
|
22128
|
+
// 初始化时滚动到当前步骤
|
|
22129
|
+
if (init) {
|
|
22130
|
+
setTimeout((/**
|
|
22131
|
+
* @return {?}
|
|
22132
|
+
*/
|
|
22133
|
+
function () { return _this.scrollToStep(); }), 0);
|
|
22134
|
+
}
|
|
22135
|
+
this.onScroll();
|
|
22136
|
+
this.ref.markForCheck();
|
|
22137
|
+
};
|
|
22138
|
+
/**
|
|
22139
|
+
* @return {?}
|
|
22140
|
+
*/
|
|
22141
|
+
RSStepperComponent.prototype.scrollLeft = /**
|
|
22142
|
+
* @return {?}
|
|
22143
|
+
*/
|
|
22144
|
+
function () {
|
|
22145
|
+
var scrollLeft = this.menu.nativeElement.scrollLeft;
|
|
22146
|
+
/** @type {?} */
|
|
22147
|
+
var dis = scrollLeft / 100 < 2 ? scrollLeft + 10 : 100;
|
|
22148
|
+
this.menu.nativeElement.scrollBy({ left: -dis, behavior: "smooth" });
|
|
22149
|
+
};
|
|
22150
|
+
/**
|
|
22151
|
+
* @return {?}
|
|
22152
|
+
*/
|
|
22153
|
+
RSStepperComponent.prototype.scrollRight = /**
|
|
22154
|
+
* @return {?}
|
|
22155
|
+
*/
|
|
22156
|
+
function () {
|
|
22157
|
+
var _a = this.menu.nativeElement, scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
22158
|
+
/** @type {?} */
|
|
22159
|
+
var rest = scrollWidth - clientWidth - scrollLeft;
|
|
22160
|
+
/** @type {?} */
|
|
22161
|
+
var dis = rest / 100 < 2 ? rest + 10 : 100;
|
|
22162
|
+
this.menu.nativeElement.scrollBy({ left: dis, behavior: "smooth" });
|
|
22163
|
+
};
|
|
22164
|
+
/**
|
|
22165
|
+
* @return {?}
|
|
22166
|
+
*/
|
|
22167
|
+
RSStepperComponent.prototype.onScroll = /**
|
|
22168
|
+
* @return {?}
|
|
22169
|
+
*/
|
|
22170
|
+
function () {
|
|
22171
|
+
var _a = this.menu.nativeElement, scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
22172
|
+
this.isAtStart = scrollLeft <= 1;
|
|
22173
|
+
this.isAtEnd = scrollLeft + clientWidth >= scrollWidth - 1;
|
|
22174
|
+
this.ref.markForCheck();
|
|
22175
|
+
};
|
|
22001
22176
|
RSStepperComponent.decorators = [
|
|
22002
22177
|
{ type: core.Component, args: [{
|
|
22003
22178
|
selector: "rs-stepper",
|
|
22004
|
-
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
|
|
22005
|
-
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:
|
|
22179
|
+
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",
|
|
22180
|
+
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}"]
|
|
22006
22181
|
}] }
|
|
22007
22182
|
];
|
|
22008
22183
|
/** @nocollapse */
|
|
22009
22184
|
RSStepperComponent.ctorParameters = function () { return [
|
|
22010
|
-
{ type: CommonFunctionService }
|
|
22185
|
+
{ type: CommonFunctionService },
|
|
22186
|
+
{ type: core.ChangeDetectorRef }
|
|
22011
22187
|
]; };
|
|
22012
22188
|
RSStepperComponent.propDecorators = {
|
|
22189
|
+
menu: [{ type: core.ViewChild, args: ["menu", { static: false },] }],
|
|
22013
22190
|
steps: [{ type: core.Input }],
|
|
22014
22191
|
currentStep: [{ type: core.Input }],
|
|
22015
22192
|
stepClick: [{ type: core.Output }],
|
|
22016
|
-
unlockedStep: [{ type: core.Input }]
|
|
22193
|
+
unlockedStep: [{ type: core.Input }],
|
|
22194
|
+
containerRefId: [{ type: core.Input }],
|
|
22195
|
+
onResize: [{ type: core.HostListener, args: ["window:resize", ["$event"],] }]
|
|
22017
22196
|
};
|
|
22018
22197
|
return RSStepperComponent;
|
|
22019
22198
|
}());
|
|
22020
22199
|
if (false) {
|
|
22200
|
+
/** @type {?} */
|
|
22201
|
+
RSStepperComponent.prototype.menu;
|
|
22021
22202
|
/** @type {?} */
|
|
22022
22203
|
RSStepperComponent.prototype.steps;
|
|
22023
22204
|
/** @type {?} */
|
|
@@ -22027,7 +22208,20 @@
|
|
|
22027
22208
|
/** @type {?} */
|
|
22028
22209
|
RSStepperComponent.prototype.unlockedStep;
|
|
22029
22210
|
/** @type {?} */
|
|
22211
|
+
RSStepperComponent.prototype.containerRefId;
|
|
22212
|
+
/** @type {?} */
|
|
22213
|
+
RSStepperComponent.prototype.showBtn;
|
|
22214
|
+
/** @type {?} */
|
|
22215
|
+
RSStepperComponent.prototype.isAtStart;
|
|
22216
|
+
/** @type {?} */
|
|
22217
|
+
RSStepperComponent.prototype.isAtEnd;
|
|
22218
|
+
/** @type {?} */
|
|
22030
22219
|
RSStepperComponent.prototype.cf;
|
|
22220
|
+
/**
|
|
22221
|
+
* @type {?}
|
|
22222
|
+
* @private
|
|
22223
|
+
*/
|
|
22224
|
+
RSStepperComponent.prototype.ref;
|
|
22031
22225
|
}
|
|
22032
22226
|
|
|
22033
22227
|
/**
|