fantasy-ngzorro 1.3.32 → 1.3.34
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/fantasy-ngzorro.umd.js +279 -101
- package/bundles/fantasy-ngzorro.umd.js.map +1 -1
- package/bundles/fantasy-ngzorro.umd.min.js +2 -2
- package/bundles/fantasy-ngzorro.umd.min.js.map +1 -1
- package/esm2015/hd-filter/hd-filter.component.js +2 -2
- package/esm2015/hd-filter/hd-filter.service.js +6 -3
- package/esm2015/utils.js +192 -101
- package/esm5/hd-filter/hd-filter.component.js +2 -2
- package/esm5/hd-filter/hd-filter.service.js +4 -2
- package/esm5/utils.js +278 -101
- package/fantasy-ngzorro.metadata.json +1 -1
- package/fesm2015/fantasy-ngzorro.js +196 -102
- package/fesm2015/fantasy-ngzorro.js.map +1 -1
- package/fesm5/fantasy-ngzorro.js +279 -101
- package/fesm5/fantasy-ngzorro.js.map +1 -1
- package/hd-filter/hd-filter.service.d.ts +2 -1
- package/package.json +1 -1
- package/utils.d.ts +29 -5
package/fesm5/fantasy-ngzorro.js
CHANGED
|
@@ -1122,7 +1122,7 @@ var HdFilterComponent = /** @class */ (function () {
|
|
|
1122
1122
|
HdFilterComponent.decorators = [
|
|
1123
1123
|
{ type: Component, args: [{
|
|
1124
1124
|
selector: 'hd-filter',
|
|
1125
|
-
template: "<form nz-form [formGroup]=\"validateFilterForm\" class=\"ant-advanced-search-form hd-filter-container\">\n <!-- \u6574\u4F53\u7ED3\u6784 -->\n <div nz-row [nzGutter]=\"24\">\n <!-- \u5BF9\u7EC4\u4EF6\u5217\u8868\u5FAA\u73AF\u5904\u7406 -->\n <ng-container *ngFor=\"let filter of filterList\">\n <div nz-col [nzSpan]=\"6\" [hidden]=\"!filter.show\">\n <nz-form-item nzFlex>\n <nz-form-label class=\"hd-filter-label\"><span class=\"hd-red\" *ngIf=\"filter.require\">*</span>{{filter.label}}\n </nz-form-label>\n <nz-form-control class=\"hd-filter-control\">\n <ng-container [ngSwitch]=\"filter.type\">\n <!-- \u8FD9\u91CC\u6570\u5B57\u5BF9\u5E94\u679A\u4E3E\u7C7B\u578B\uFF0C\u53EF\u5728hd-filter.service.ts\u6587\u4EF6\u4E2D\u67E5\u770B\u5BF9\u5E94\u5173\u7CFB -->\n <ng-container *ngSwitchCase=\"0\">\n <nz-input-group [nzSuffix]=\"inputCleanTemplate\">\n <input nz-input [placeholder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u8F93\u5165' + filter.label\"\n
|
|
1125
|
+
template: "<form nz-form [formGroup]=\"validateFilterForm\" class=\"ant-advanced-search-form hd-filter-container\">\n <!-- \u6574\u4F53\u7ED3\u6784 -->\n <div nz-row [nzGutter]=\"24\">\n <!-- \u5BF9\u7EC4\u4EF6\u5217\u8868\u5FAA\u73AF\u5904\u7406 -->\n <ng-container *ngFor=\"let filter of filterList\">\n <div nz-col [nzSpan]=\"6\" [hidden]=\"!filter.show\">\n <nz-form-item nzFlex>\n <nz-form-label class=\"hd-filter-label\"><span class=\"hd-red\" *ngIf=\"filter.require\">*</span>{{ filter.label }}\n </nz-form-label>\n <nz-form-control class=\"hd-filter-control\">\n <ng-container [ngSwitch]=\"filter.type\">\n <!-- \u8FD9\u91CC\u6570\u5B57\u5BF9\u5E94\u679A\u4E3E\u7C7B\u578B\uFF0C\u53EF\u5728hd-filter.service.ts\u6587\u4EF6\u4E2D\u67E5\u770B\u5BF9\u5E94\u5173\u7CFB -->\n <ng-container *ngSwitchCase=\"0\">\n <nz-input-group [nzSuffix]=\"inputCleanTemplate\">\n <input nz-input [placeholder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u8F93\u5165' + filter.label\"\n [formControlName]=\"filter.name\"\n (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\"/>\n </nz-input-group>\n <ng-template #inputCleanTemplate><i nz-icon nz-tooltip class=\"ant-input-clear-icon\" nzTheme=\"fill\"\n nzType=\"close-circle\"\n *ngIf=\"validateFilterForm.get(filter.name).value\"\n (click)=\"inputClean(filter)\"></i></ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"1\">\n <nz-select\n [nzShowSearch]=\"filter.selectOption.hdShowSearch != null ? filter.selectOption.hdShowSearch : true\"\n [nzAllowClear]=\"filter.selectOption.hdAllowClear != null ? filter.selectOption.hdAllowClear : true\"\n [nzServerSearch]=\"filter.selectOption.hdServerSearch || false\"\n [nzDropdownMatchSelectWidth]=\"filter.selectOption.hdDropdownMatchSelectWidth ? filter.selectOption.hdDropdownMatchSelectWidth : false\"\n (nzOnSearch)=\"triggerEvent(filter.onSearchEvent || null, $event, filter.selectOption)\"\n [nzPlaceHolder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u9009\u62E9' + filter.label\"\n [formControlName]=\"filter.name\" (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\">\n <nz-option *ngFor=\"let selectItem of filter.selectOption.selectList\"\n [nzValue]=\"selectItem[filter.selectOption.value]\" [nzLabel]=\"filter.selectOption.showLabelAndValue ? '['+ selectItem[filter.selectOption.value] +']' +\n selectItem[filter.selectOption.label] : selectItem[filter.selectOption.label]\"></nz-option>\n </nz-select>\n </ng-container>\n <ng-container *ngSwitchCase=\"2\">\n <nz-date-picker *ngIf=\"filter.showTime\"\n [nzPlaceHolder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u9009\u62E9' + filter.label\"\n [formControlName]=\"filter.name\" [nzDisabledDate]=\"filter.hdDisabledDate\"\n (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\" nzShowTime\n nzFormat=\"yyyy-MM-dd HH:mm:ss\">\n </nz-date-picker>\n <nz-date-picker *ngIf=\"!filter.showTime\"\n [nzPlaceHolder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u9009\u62E9' + filter.label\"\n [formControlName]=\"filter.name\" [nzDisabledDate]=\"filter.hdDisabledDate\"\n (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\">\n </nz-date-picker>\n </ng-container>\n <ng-container *ngSwitchCase=\"3\">\n <nz-range-picker [nzPlaceHolder]=\"['\u5F00\u59CB\u65E5\u671F','\u7ED3\u675F\u65E5\u671F']\" [formControlName]=\"filter.name\">\n (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\"\n </nz-range-picker>\n </ng-container>\n <!-- \u591A\u9879\u9009\u62E9\u5668 -->\n <ng-container *ngSwitchCase=\"4\">\n <nz-select\n [nzDropdownMatchSelectWidth]=\"filter.selectOption.hdDropdownMatchSelectWidth ? filter.selectOption.hdDropdownMatchSelectWidth : false\"\n nzMode=\"multiple\"\n [nzShowSearch]=\"filter.selectOption.hdShowSearch != null ? filter.selectOption.hdShowSearch : true\"\n [nzAllowClear]=\"filter.selectOption.hdAllowClear != null ? filter.selectOption.hdAllowClear : true\"\n [nzPlaceHolder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u9009\u62E9' + filter.label\"\n [formControlName]=\"filter.name\" [nzServerSearch]=\"filter.selectOption.hdServerSearch || false\"\n (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\"\n (nzOnSearch)=\"triggerEvent(filter.onSearchEvent || null, $event)\">\n <nz-option *ngFor=\"let selectItem of filter.selectOption.selectList\"\n [nzValue]=\"selectItem[filter.selectOption.value]\" [nzLabel]=\"filter.selectOption.showLabelAndValue ? '['+ selectItem[filter.selectOption.value] +']' +\n selectItem[filter.selectOption.label] : selectItem[filter.selectOption.label]\"></nz-option>\n </nz-select>\n </ng-container>\n <ng-container *ngSwitchCase=\"5\">\n <nz-cascader [nzOptions]=\"filter.cascaderOption.options\" [formControlName]=\"filter.name\"\n [nzPlaceHolder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u9009\u62E9' + filter.label\"\n (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\">\n </nz-cascader>\n </ng-container>\n <ng-container *ngSwitchCase=\"6\">\n <nz-month-picker [formControlName]=\"filter.name\"\n [nzPlaceHolder]=\"filter.placeholder ? filter.placeholder : '\u8BF7\u9009\u62E9' + filter.label\"\n (ngModelChange)=\"triggerEvent(filter.onChangeEvent || null, $event)\"></nz-month-picker>\n </ng-container>\n </ng-container>\n </nz-form-control>\n </nz-form-item>\n </div>\n </ng-container>\n\n <div class=\"hd-filter-btn\" nz-col [nzSpan]=\"6\" [nzOffset]=\"computeOffset()\">\n <a *ngIf=\"filterList.length > 7\" class=\"hd-filter-more\" (click)=\"showMore()\">\n {{ isShowMore ? '\u5C55\u5F00' : '\u6536\u8D77' }}\n <i nz-icon [nzType]=\"isShowMore ? 'down' : 'up'\"></i>\n </a>\n <hd-button type=\"primary\" (click)=\"submitForm()\">\u67E5\u8BE2</hd-button>\n <hd-button type=\"reset\" (click)=\"resetForm()\">\u91CD\u7F6E</hd-button>\n </div>\n </div>\n</form>\n",
|
|
1126
1126
|
styles: ["::ng-deep .common-btn-group>a{font-size:12px;font-weight:400;color:#12a34f!important;white-space:nowrap}::ng-deep .common-btn-group .common-danger-btn:hover{color:#f05b24!important}::ng-deep .common-btn-group>a:hover{color:#20bd62!important}::ng-deep .common-btn-group>a:not(:last-child)::after{content:'';margin:0 2px}::ng-deep .common-billNumber>a{color:#3b77e3}button{box-shadow:unset;text-shadow:unset}::ng-deep .ant-form-item-label>label{color:#4b504e}::ng-deep .ant-input-number-input{height:28px}::ng-deep .ant-input-number{height:28px}textarea.ant-input{height:auto;min-height:28px}::ng-deep .ant-select-selection--multiple{min-height:28px}::ng-deep .ant-select-selection__rendered>ul>li{height:22px!important;margin-top:3px!important;line-height:22px!important}::ng-deep .ant-advanced-search-form .ant-form-item{margin-bottom:0!important}::ng-deep .ant-select-selection--single{height:28px!important}::ng-deep .ant-input{height:28px}::ng-deep .ant-input[disabled]:hover{border-color:#d9d9d9!important}::ng-deep .ant-select-selection__rendered{line-height:28px!important}::ng-deep .ant-calendar-range-picker-input{text-align:left!important}::ng-deep .ant-calendar-picker{width:100%!important}::ng-deep .ant-row{margin-right:0!important;margin-left:0!important}::ng-deep .ant-col-6{padding-left:12px;padding-right:12px}::ng-deep .ant-col-12{padding-left:12px;padding-right:12px}::ng-deep .ant-col-18{padding-left:12px;padding-right:12px}::ng-deep .ant-col-24{padding-left:12px;padding-right:12px}::ng-deep .ant-alert-info{background-color:#f5f8f6;border:1px solid #cfe3d4}:host ::ng-deep th{background:#f5f8f6!important;font-weight:700!important;white-space:nowrap;font-size:12px;font-family:PingFangSC-Medium,PingFang SC;color:#2a3634;padding:8px!important;box-sizing:border-box}:host ::ng-deep td{font-weight:400;font-style:normal;font-size:12px;color:#2a3634;text-align:left;white-space:nowrap;padding:8px!important;box-sizing:border-box}::ng-deep .ant-pagination-options{display:inline-flex;align-items:center}::ng-deep .ant-time-picker{width:100%}.ant-input-number-disabled,.ant-input[disabled],.ant-select-disabled{color:#4b504e}.hd-filter-container{padding:20px 23px;background:#fff;box-shadow:0 0 12px 0 rgba(93,114,103,.08);border-radius:4px;margin-bottom:8px!important;font-size:12px}.hd-filter-container .ant-row{margin-right:0!important;margin-left:0!important}.hd-filter-container .ant-col-6{padding-left:0!important;padding-right:0!important}.hd-filter-container .hd-filter-label{width:108px;word-break:break-all}.hd-filter-container .hd-filter-control{width:calc(100% - 108px)}.hd-filter-container ::ng-deep .ant-calendar-picker{width:100%}.hd-filter-container .hd-filter-more{color:#12a34f}.hd-filter-container .hd-filter-btn{height:40px;display:inline-flex;align-items:center;justify-content:flex-end}.hd-filter-container hd-button{margin-left:12px}.hd-filter-container ::ng-deep .ant-advanced-search-form .ant-form-item{margin-bottom:0!important}.hd-filter-container ::ng-deep .ant-select-selection--single{height:28px!important}.hd-filter-container ::ng-deep .ant-input{height:28px!important}.hd-filter-container ::ng-deep .ant-calendar-range-picker-input{text-align:left!important}.hd-filter-container .ant-input-number{width:100%}.hd-filter-container .hd-red{color:red}"]
|
|
1127
1127
|
}] }
|
|
1128
1128
|
];
|
|
@@ -5868,7 +5868,8 @@ var FilterListType = {
|
|
|
5868
5868
|
Date: 2,
|
|
5869
5869
|
DateRange: 3,
|
|
5870
5870
|
MultipleSelect: 4,
|
|
5871
|
-
Cascader: 5
|
|
5871
|
+
Cascader: 5,
|
|
5872
|
+
Month: 6 // 月份选择
|
|
5872
5873
|
,
|
|
5873
5874
|
};
|
|
5874
5875
|
FilterListType[FilterListType.Input] = 'Input';
|
|
@@ -5877,6 +5878,7 @@ FilterListType[FilterListType.Date] = 'Date';
|
|
|
5877
5878
|
FilterListType[FilterListType.DateRange] = 'DateRange';
|
|
5878
5879
|
FilterListType[FilterListType.MultipleSelect] = 'MultipleSelect';
|
|
5879
5880
|
FilterListType[FilterListType.Cascader] = 'Cascader';
|
|
5881
|
+
FilterListType[FilterListType.Month] = 'Month';
|
|
5880
5882
|
var HdFilterService = /** @class */ (function () {
|
|
5881
5883
|
function HdFilterService() {
|
|
5882
5884
|
}
|
|
@@ -6043,75 +6045,114 @@ var StaticConst = {
|
|
|
6043
6045
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6044
6046
|
*/
|
|
6045
6047
|
// 工具类
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6048
|
+
/** @type {?} */
|
|
6049
|
+
var Utils = {
|
|
6050
|
+
/**
|
|
6051
|
+
* 填充select控件选项
|
|
6052
|
+
* @param formList 入参数组 Array<any>
|
|
6053
|
+
* @param name 需要填充options的属性名称
|
|
6054
|
+
* @param options 选项列表
|
|
6055
|
+
*/
|
|
6056
|
+
fillSelectOption: /**
|
|
6057
|
+
* 填充select控件选项
|
|
6058
|
+
* @param {?} formList 入参数组 Array<any>
|
|
6059
|
+
* @param {?} name 需要填充options的属性名称
|
|
6060
|
+
* @param {?} options 选项列表
|
|
6061
|
+
* @return {?}
|
|
6062
|
+
*/
|
|
6063
|
+
function (formList, name, options) {
|
|
6064
|
+
/** @type {?} */
|
|
6065
|
+
var returnData = formList;
|
|
6066
|
+
if (!returnData || !returnData.length) {
|
|
6067
|
+
return returnData;
|
|
6063
6068
|
}
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
*/
|
|
6071
|
-
function (list, obj) {
|
|
6072
|
-
/** @type {?} */
|
|
6073
|
-
var returnData = [];
|
|
6074
|
-
if (!list || !list.length) {
|
|
6075
|
-
return returnData;
|
|
6076
|
-
}
|
|
6077
|
-
/** @type {?} */
|
|
6078
|
-
var length = list.length;
|
|
6079
|
-
for (var i = 0; i < length; i++) {
|
|
6080
|
-
if (obj[list[i].name]) {
|
|
6081
|
-
list[i].value = obj[list[i].name];
|
|
6069
|
+
/** @type {?} */
|
|
6070
|
+
var length = formList.length;
|
|
6071
|
+
for (var i = 0; i < length; i++) {
|
|
6072
|
+
if (returnData[i].name === name) {
|
|
6073
|
+
returnData[i].selectOption.selectList = options;
|
|
6074
|
+
}
|
|
6082
6075
|
}
|
|
6083
|
-
}
|
|
6084
|
-
return list;
|
|
6085
|
-
}, ɵ2 = /**
|
|
6086
|
-
* @param {?} list
|
|
6087
|
-
* @param {?=} option
|
|
6088
|
-
* @return {?}
|
|
6089
|
-
*/
|
|
6090
|
-
function (list, option) {
|
|
6091
|
-
/** @type {?} */
|
|
6092
|
-
var returnData = [];
|
|
6093
|
-
if (!list || !list.length) {
|
|
6094
6076
|
return returnData;
|
|
6095
|
-
}
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6077
|
+
},
|
|
6078
|
+
/**
|
|
6079
|
+
* 填充FormItem数组:针对入参list的每一个FormItem,判断obj中是否有对应的name字段,如果有,则填充value。
|
|
6080
|
+
* @param list 入参数组 Array<FormItem>
|
|
6081
|
+
* @param obj 需要填充到list的属性
|
|
6082
|
+
*/
|
|
6083
|
+
fillArrayFormItem: /**
|
|
6084
|
+
* 填充FormItem数组:针对入参list的每一个FormItem,判断obj中是否有对应的name字段,如果有,则填充value。
|
|
6085
|
+
* @param {?} list 入参数组 Array<FormItem>
|
|
6086
|
+
* @param {?} obj 需要填充到list的属性
|
|
6087
|
+
* @return {?}
|
|
6088
|
+
*/
|
|
6089
|
+
function (list, obj) {
|
|
6090
|
+
/** @type {?} */
|
|
6091
|
+
var returnData = [];
|
|
6092
|
+
if (!list || !list.length) {
|
|
6093
|
+
return returnData;
|
|
6094
|
+
}
|
|
6095
|
+
/** @type {?} */
|
|
6096
|
+
var length = list.length;
|
|
6097
|
+
for (var i = 0; i < length; i++) {
|
|
6098
|
+
if (obj[list[i].name]) {
|
|
6099
|
+
list[i].value = obj[list[i].name];
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
return list;
|
|
6103
|
+
},
|
|
6104
|
+
/**
|
|
6105
|
+
* 数组转换成选择器的选项数组
|
|
6106
|
+
* @param list 入参数组 字符串数组或对象数组
|
|
6107
|
+
* @param option 转换选项
|
|
6108
|
+
* 注:list为字符串数组,option不需要传,按照标准的label、value转换
|
|
6109
|
+
*/
|
|
6110
|
+
arrayToSelectOptionList: /**
|
|
6111
|
+
* 数组转换成选择器的选项数组
|
|
6112
|
+
* @param {?} list 入参数组 字符串数组或对象数组
|
|
6113
|
+
* @param {?=} option 转换选项
|
|
6114
|
+
* 注:list为字符串数组,option不需要传,按照标准的label、value转换
|
|
6115
|
+
* @return {?}
|
|
6116
|
+
*/
|
|
6117
|
+
function (list, option) {
|
|
6118
|
+
/** @type {?} */
|
|
6119
|
+
var returnData = [];
|
|
6120
|
+
if (!list || !list.length) {
|
|
6121
|
+
return returnData;
|
|
6122
|
+
}
|
|
6123
|
+
if (option) {
|
|
6124
|
+
if (option.labelTip && option.valueTip) {
|
|
6125
|
+
list.forEach((/**
|
|
6126
|
+
* @param {?} item
|
|
6127
|
+
* @return {?}
|
|
6128
|
+
*/
|
|
6129
|
+
function (item) {
|
|
6130
|
+
/** @type {?} */
|
|
6131
|
+
var returnItem = item;
|
|
6132
|
+
returnItem.label = item[option.label];
|
|
6133
|
+
returnItem.value = item[option.value];
|
|
6134
|
+
if (option.valueTip) {
|
|
6135
|
+
returnItem[option.valueTip] = item[option.value];
|
|
6136
|
+
}
|
|
6137
|
+
if (option.labelTip) {
|
|
6138
|
+
returnItem[option.labelTip] = item[option.label];
|
|
6139
|
+
}
|
|
6140
|
+
returnData.push(returnItem);
|
|
6141
|
+
}));
|
|
6142
|
+
}
|
|
6143
|
+
else {
|
|
6144
|
+
list.forEach((/**
|
|
6145
|
+
* @param {?} item
|
|
6146
|
+
* @return {?}
|
|
6147
|
+
*/
|
|
6148
|
+
function (item) {
|
|
6149
|
+
/** @type {?} */
|
|
6150
|
+
var returnItem = item;
|
|
6151
|
+
returnItem.label = item[option.label];
|
|
6152
|
+
returnItem.value = item[option.value];
|
|
6153
|
+
returnData.push(returnItem);
|
|
6154
|
+
}));
|
|
6155
|
+
}
|
|
6115
6156
|
}
|
|
6116
6157
|
else {
|
|
6117
6158
|
list.forEach((/**
|
|
@@ -6120,50 +6161,187 @@ function (list, option) {
|
|
|
6120
6161
|
*/
|
|
6121
6162
|
function (item) {
|
|
6122
6163
|
/** @type {?} */
|
|
6123
|
-
var returnItem =
|
|
6124
|
-
returnItem.label = item
|
|
6125
|
-
returnItem.value = item
|
|
6164
|
+
var returnItem = {};
|
|
6165
|
+
returnItem.label = item;
|
|
6166
|
+
returnItem.value = item;
|
|
6126
6167
|
returnData.push(returnItem);
|
|
6127
6168
|
}));
|
|
6128
6169
|
}
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6170
|
+
return returnData;
|
|
6171
|
+
},
|
|
6172
|
+
/**
|
|
6173
|
+
* 求和
|
|
6174
|
+
* @param nums 数组
|
|
6175
|
+
* @param precision 精度
|
|
6176
|
+
*/
|
|
6177
|
+
add: /**
|
|
6178
|
+
* 求和
|
|
6179
|
+
* @param {?} nums 数组
|
|
6180
|
+
* @param {?=} precision 精度
|
|
6181
|
+
* @return {?}
|
|
6182
|
+
*/
|
|
6183
|
+
function (nums, precision) {
|
|
6184
|
+
var e_1, _a;
|
|
6185
|
+
if (precision === void 0) { precision = 2; }
|
|
6186
|
+
if (!Array.isArray(nums)) {
|
|
6187
|
+
throw new Error('参数必须是数组');
|
|
6188
|
+
}
|
|
6189
|
+
if (nums.some((/**
|
|
6190
|
+
* @param {?} num
|
|
6133
6191
|
* @return {?}
|
|
6134
6192
|
*/
|
|
6135
|
-
function (
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
}
|
|
6145
|
-
|
|
6146
|
-
|
|
6193
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6194
|
+
throw new Error('数组元素必须是数字');
|
|
6195
|
+
}
|
|
6196
|
+
/** @type {?} */
|
|
6197
|
+
var result = 0;
|
|
6198
|
+
try {
|
|
6199
|
+
for (var nums_1 = __values(nums), nums_1_1 = nums_1.next(); !nums_1_1.done; nums_1_1 = nums_1.next()) {
|
|
6200
|
+
var num = nums_1_1.value;
|
|
6201
|
+
result += num;
|
|
6202
|
+
}
|
|
6203
|
+
}
|
|
6204
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6205
|
+
finally {
|
|
6206
|
+
try {
|
|
6207
|
+
if (nums_1_1 && !nums_1_1.done && (_a = nums_1.return)) _a.call(nums_1);
|
|
6208
|
+
}
|
|
6209
|
+
finally { if (e_1) throw e_1.error; }
|
|
6210
|
+
}
|
|
6211
|
+
return round(result, precision);
|
|
6212
|
+
},
|
|
6147
6213
|
/**
|
|
6148
|
-
*
|
|
6149
|
-
* @param
|
|
6150
|
-
* @param
|
|
6151
|
-
* @param options 选项列表
|
|
6214
|
+
* 减法
|
|
6215
|
+
* @param nums 数组
|
|
6216
|
+
* @param precision 精度
|
|
6152
6217
|
*/
|
|
6153
|
-
|
|
6218
|
+
subtract: /**
|
|
6219
|
+
* 减法
|
|
6220
|
+
* @param {?} nums 数组
|
|
6221
|
+
* @param {?=} precision 精度
|
|
6222
|
+
* @return {?}
|
|
6223
|
+
*/
|
|
6224
|
+
function (nums, precision) {
|
|
6225
|
+
var e_2, _a;
|
|
6226
|
+
if (precision === void 0) { precision = 2; }
|
|
6227
|
+
if (!Array.isArray(nums)) {
|
|
6228
|
+
throw new Error('参数必须是数组');
|
|
6229
|
+
}
|
|
6230
|
+
if (nums.some((/**
|
|
6231
|
+
* @param {?} num
|
|
6232
|
+
* @return {?}
|
|
6233
|
+
*/
|
|
6234
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6235
|
+
throw new Error('数组元素必须是数字');
|
|
6236
|
+
}
|
|
6237
|
+
if (nums.length < 2) {
|
|
6238
|
+
throw new Error('减法入参数量至少要2个!');
|
|
6239
|
+
}
|
|
6240
|
+
/** @type {?} */
|
|
6241
|
+
var result = nums.shift();
|
|
6242
|
+
try {
|
|
6243
|
+
for (var nums_2 = __values(nums), nums_2_1 = nums_2.next(); !nums_2_1.done; nums_2_1 = nums_2.next()) {
|
|
6244
|
+
var num = nums_2_1.value;
|
|
6245
|
+
result -= num;
|
|
6246
|
+
}
|
|
6247
|
+
}
|
|
6248
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
6249
|
+
finally {
|
|
6250
|
+
try {
|
|
6251
|
+
if (nums_2_1 && !nums_2_1.done && (_a = nums_2.return)) _a.call(nums_2);
|
|
6252
|
+
}
|
|
6253
|
+
finally { if (e_2) throw e_2.error; }
|
|
6254
|
+
}
|
|
6255
|
+
return round(result, precision);
|
|
6256
|
+
},
|
|
6154
6257
|
/**
|
|
6155
|
-
*
|
|
6156
|
-
* @param
|
|
6157
|
-
* @param
|
|
6258
|
+
* 乘法
|
|
6259
|
+
* @param nums 数组
|
|
6260
|
+
* @param precision 精度
|
|
6158
6261
|
*/
|
|
6159
|
-
|
|
6262
|
+
multiply: /**
|
|
6263
|
+
* 乘法
|
|
6264
|
+
* @param {?} nums 数组
|
|
6265
|
+
* @param {?=} precision 精度
|
|
6266
|
+
* @return {?}
|
|
6267
|
+
*/
|
|
6268
|
+
function (nums, precision) {
|
|
6269
|
+
var e_3, _a;
|
|
6270
|
+
if (precision === void 0) { precision = 2; }
|
|
6271
|
+
if (!Array.isArray(nums)) {
|
|
6272
|
+
throw new Error('参数必须是数组');
|
|
6273
|
+
}
|
|
6274
|
+
if (nums.some((/**
|
|
6275
|
+
* @param {?} num
|
|
6276
|
+
* @return {?}
|
|
6277
|
+
*/
|
|
6278
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6279
|
+
throw new Error('数组元素必须是数字');
|
|
6280
|
+
}
|
|
6281
|
+
/** @type {?} */
|
|
6282
|
+
var result = 1;
|
|
6283
|
+
try {
|
|
6284
|
+
for (var nums_3 = __values(nums), nums_3_1 = nums_3.next(); !nums_3_1.done; nums_3_1 = nums_3.next()) {
|
|
6285
|
+
var num = nums_3_1.value;
|
|
6286
|
+
result = result * num;
|
|
6287
|
+
}
|
|
6288
|
+
}
|
|
6289
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
6290
|
+
finally {
|
|
6291
|
+
try {
|
|
6292
|
+
if (nums_3_1 && !nums_3_1.done && (_a = nums_3.return)) _a.call(nums_3);
|
|
6293
|
+
}
|
|
6294
|
+
finally { if (e_3) throw e_3.error; }
|
|
6295
|
+
}
|
|
6296
|
+
return round(result, precision);
|
|
6297
|
+
},
|
|
6160
6298
|
/**
|
|
6161
|
-
*
|
|
6162
|
-
* @param
|
|
6163
|
-
* @param
|
|
6164
|
-
|
|
6299
|
+
* 除法
|
|
6300
|
+
* @param nums 数组
|
|
6301
|
+
* @param precision 精度
|
|
6302
|
+
*/
|
|
6303
|
+
divide: /**
|
|
6304
|
+
* 除法
|
|
6305
|
+
* @param {?} nums 数组
|
|
6306
|
+
* @param {?=} precision 精度
|
|
6307
|
+
* @return {?}
|
|
6165
6308
|
*/
|
|
6166
|
-
|
|
6309
|
+
function (nums, precision) {
|
|
6310
|
+
var e_4, _a;
|
|
6311
|
+
if (precision === void 0) { precision = 2; }
|
|
6312
|
+
if (!Array.isArray(nums)) {
|
|
6313
|
+
throw new Error('参数必须是数组');
|
|
6314
|
+
}
|
|
6315
|
+
if (nums.some((/**
|
|
6316
|
+
* @param {?} num
|
|
6317
|
+
* @return {?}
|
|
6318
|
+
*/
|
|
6319
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6320
|
+
throw new Error('数组元素必须是数字');
|
|
6321
|
+
}
|
|
6322
|
+
if (nums.length < 2) {
|
|
6323
|
+
throw new Error('除法入参数量至少要2个!');
|
|
6324
|
+
}
|
|
6325
|
+
/** @type {?} */
|
|
6326
|
+
var result = nums.shift();
|
|
6327
|
+
try {
|
|
6328
|
+
for (var nums_4 = __values(nums), nums_4_1 = nums_4.next(); !nums_4_1.done; nums_4_1 = nums_4.next()) {
|
|
6329
|
+
var num = nums_4_1.value;
|
|
6330
|
+
if (num === 0) {
|
|
6331
|
+
throw new Error('除数不能为0!');
|
|
6332
|
+
}
|
|
6333
|
+
result = result / num;
|
|
6334
|
+
}
|
|
6335
|
+
}
|
|
6336
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
6337
|
+
finally {
|
|
6338
|
+
try {
|
|
6339
|
+
if (nums_4_1 && !nums_4_1.done && (_a = nums_4.return)) _a.call(nums_4);
|
|
6340
|
+
}
|
|
6341
|
+
finally { if (e_4) throw e_4.error; }
|
|
6342
|
+
}
|
|
6343
|
+
return round(result, precision);
|
|
6344
|
+
}
|
|
6167
6345
|
};
|
|
6168
6346
|
|
|
6169
6347
|
/**
|