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
|
@@ -1327,7 +1327,7 @@
|
|
|
1327
1327
|
HdFilterComponent.decorators = [
|
|
1328
1328
|
{ type: core.Component, args: [{
|
|
1329
1329
|
selector: 'hd-filter',
|
|
1330
|
-
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
|
|
1330
|
+
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",
|
|
1331
1331
|
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}"]
|
|
1332
1332
|
}] }
|
|
1333
1333
|
];
|
|
@@ -6073,7 +6073,8 @@
|
|
|
6073
6073
|
Date: 2,
|
|
6074
6074
|
DateRange: 3,
|
|
6075
6075
|
MultipleSelect: 4,
|
|
6076
|
-
Cascader: 5
|
|
6076
|
+
Cascader: 5,
|
|
6077
|
+
Month: 6 // 月份选择
|
|
6077
6078
|
,
|
|
6078
6079
|
};
|
|
6079
6080
|
FilterListType[FilterListType.Input] = 'Input';
|
|
@@ -6082,6 +6083,7 @@
|
|
|
6082
6083
|
FilterListType[FilterListType.DateRange] = 'DateRange';
|
|
6083
6084
|
FilterListType[FilterListType.MultipleSelect] = 'MultipleSelect';
|
|
6084
6085
|
FilterListType[FilterListType.Cascader] = 'Cascader';
|
|
6086
|
+
FilterListType[FilterListType.Month] = 'Month';
|
|
6085
6087
|
var HdFilterService = /** @class */ (function () {
|
|
6086
6088
|
function HdFilterService() {
|
|
6087
6089
|
}
|
|
@@ -6248,75 +6250,114 @@
|
|
|
6248
6250
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6249
6251
|
*/
|
|
6250
6252
|
// 工具类
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6253
|
+
/** @type {?} */
|
|
6254
|
+
var Utils = {
|
|
6255
|
+
/**
|
|
6256
|
+
* 填充select控件选项
|
|
6257
|
+
* @param formList 入参数组 Array<any>
|
|
6258
|
+
* @param name 需要填充options的属性名称
|
|
6259
|
+
* @param options 选项列表
|
|
6260
|
+
*/
|
|
6261
|
+
fillSelectOption: /**
|
|
6262
|
+
* 填充select控件选项
|
|
6263
|
+
* @param {?} formList 入参数组 Array<any>
|
|
6264
|
+
* @param {?} name 需要填充options的属性名称
|
|
6265
|
+
* @param {?} options 选项列表
|
|
6266
|
+
* @return {?}
|
|
6267
|
+
*/
|
|
6268
|
+
function (formList, name, options) {
|
|
6269
|
+
/** @type {?} */
|
|
6270
|
+
var returnData = formList;
|
|
6271
|
+
if (!returnData || !returnData.length) {
|
|
6272
|
+
return returnData;
|
|
6268
6273
|
}
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
*/
|
|
6276
|
-
function (list, obj) {
|
|
6277
|
-
/** @type {?} */
|
|
6278
|
-
var returnData = [];
|
|
6279
|
-
if (!list || !list.length) {
|
|
6280
|
-
return returnData;
|
|
6281
|
-
}
|
|
6282
|
-
/** @type {?} */
|
|
6283
|
-
var length = list.length;
|
|
6284
|
-
for (var i = 0; i < length; i++) {
|
|
6285
|
-
if (obj[list[i].name]) {
|
|
6286
|
-
list[i].value = obj[list[i].name];
|
|
6274
|
+
/** @type {?} */
|
|
6275
|
+
var length = formList.length;
|
|
6276
|
+
for (var i = 0; i < length; i++) {
|
|
6277
|
+
if (returnData[i].name === name) {
|
|
6278
|
+
returnData[i].selectOption.selectList = options;
|
|
6279
|
+
}
|
|
6287
6280
|
}
|
|
6288
|
-
}
|
|
6289
|
-
return list;
|
|
6290
|
-
}, ɵ2 = /**
|
|
6291
|
-
* @param {?} list
|
|
6292
|
-
* @param {?=} option
|
|
6293
|
-
* @return {?}
|
|
6294
|
-
*/
|
|
6295
|
-
function (list, option) {
|
|
6296
|
-
/** @type {?} */
|
|
6297
|
-
var returnData = [];
|
|
6298
|
-
if (!list || !list.length) {
|
|
6299
6281
|
return returnData;
|
|
6300
|
-
}
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6282
|
+
},
|
|
6283
|
+
/**
|
|
6284
|
+
* 填充FormItem数组:针对入参list的每一个FormItem,判断obj中是否有对应的name字段,如果有,则填充value。
|
|
6285
|
+
* @param list 入参数组 Array<FormItem>
|
|
6286
|
+
* @param obj 需要填充到list的属性
|
|
6287
|
+
*/
|
|
6288
|
+
fillArrayFormItem: /**
|
|
6289
|
+
* 填充FormItem数组:针对入参list的每一个FormItem,判断obj中是否有对应的name字段,如果有,则填充value。
|
|
6290
|
+
* @param {?} list 入参数组 Array<FormItem>
|
|
6291
|
+
* @param {?} obj 需要填充到list的属性
|
|
6292
|
+
* @return {?}
|
|
6293
|
+
*/
|
|
6294
|
+
function (list, obj) {
|
|
6295
|
+
/** @type {?} */
|
|
6296
|
+
var returnData = [];
|
|
6297
|
+
if (!list || !list.length) {
|
|
6298
|
+
return returnData;
|
|
6299
|
+
}
|
|
6300
|
+
/** @type {?} */
|
|
6301
|
+
var length = list.length;
|
|
6302
|
+
for (var i = 0; i < length; i++) {
|
|
6303
|
+
if (obj[list[i].name]) {
|
|
6304
|
+
list[i].value = obj[list[i].name];
|
|
6305
|
+
}
|
|
6306
|
+
}
|
|
6307
|
+
return list;
|
|
6308
|
+
},
|
|
6309
|
+
/**
|
|
6310
|
+
* 数组转换成选择器的选项数组
|
|
6311
|
+
* @param list 入参数组 字符串数组或对象数组
|
|
6312
|
+
* @param option 转换选项
|
|
6313
|
+
* 注:list为字符串数组,option不需要传,按照标准的label、value转换
|
|
6314
|
+
*/
|
|
6315
|
+
arrayToSelectOptionList: /**
|
|
6316
|
+
* 数组转换成选择器的选项数组
|
|
6317
|
+
* @param {?} list 入参数组 字符串数组或对象数组
|
|
6318
|
+
* @param {?=} option 转换选项
|
|
6319
|
+
* 注:list为字符串数组,option不需要传,按照标准的label、value转换
|
|
6320
|
+
* @return {?}
|
|
6321
|
+
*/
|
|
6322
|
+
function (list, option) {
|
|
6323
|
+
/** @type {?} */
|
|
6324
|
+
var returnData = [];
|
|
6325
|
+
if (!list || !list.length) {
|
|
6326
|
+
return returnData;
|
|
6327
|
+
}
|
|
6328
|
+
if (option) {
|
|
6329
|
+
if (option.labelTip && option.valueTip) {
|
|
6330
|
+
list.forEach((/**
|
|
6331
|
+
* @param {?} item
|
|
6332
|
+
* @return {?}
|
|
6333
|
+
*/
|
|
6334
|
+
function (item) {
|
|
6335
|
+
/** @type {?} */
|
|
6336
|
+
var returnItem = item;
|
|
6337
|
+
returnItem.label = item[option.label];
|
|
6338
|
+
returnItem.value = item[option.value];
|
|
6339
|
+
if (option.valueTip) {
|
|
6340
|
+
returnItem[option.valueTip] = item[option.value];
|
|
6341
|
+
}
|
|
6342
|
+
if (option.labelTip) {
|
|
6343
|
+
returnItem[option.labelTip] = item[option.label];
|
|
6344
|
+
}
|
|
6345
|
+
returnData.push(returnItem);
|
|
6346
|
+
}));
|
|
6347
|
+
}
|
|
6348
|
+
else {
|
|
6349
|
+
list.forEach((/**
|
|
6350
|
+
* @param {?} item
|
|
6351
|
+
* @return {?}
|
|
6352
|
+
*/
|
|
6353
|
+
function (item) {
|
|
6354
|
+
/** @type {?} */
|
|
6355
|
+
var returnItem = item;
|
|
6356
|
+
returnItem.label = item[option.label];
|
|
6357
|
+
returnItem.value = item[option.value];
|
|
6358
|
+
returnData.push(returnItem);
|
|
6359
|
+
}));
|
|
6360
|
+
}
|
|
6320
6361
|
}
|
|
6321
6362
|
else {
|
|
6322
6363
|
list.forEach((/**
|
|
@@ -6325,50 +6366,187 @@
|
|
|
6325
6366
|
*/
|
|
6326
6367
|
function (item) {
|
|
6327
6368
|
/** @type {?} */
|
|
6328
|
-
var returnItem =
|
|
6329
|
-
returnItem.label = item
|
|
6330
|
-
returnItem.value = item
|
|
6369
|
+
var returnItem = {};
|
|
6370
|
+
returnItem.label = item;
|
|
6371
|
+
returnItem.value = item;
|
|
6331
6372
|
returnData.push(returnItem);
|
|
6332
6373
|
}));
|
|
6333
6374
|
}
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6375
|
+
return returnData;
|
|
6376
|
+
},
|
|
6377
|
+
/**
|
|
6378
|
+
* 求和
|
|
6379
|
+
* @param nums 数组
|
|
6380
|
+
* @param precision 精度
|
|
6381
|
+
*/
|
|
6382
|
+
add: /**
|
|
6383
|
+
* 求和
|
|
6384
|
+
* @param {?} nums 数组
|
|
6385
|
+
* @param {?=} precision 精度
|
|
6386
|
+
* @return {?}
|
|
6387
|
+
*/
|
|
6388
|
+
function (nums, precision) {
|
|
6389
|
+
var e_1, _a;
|
|
6390
|
+
if (precision === void 0) { precision = 2; }
|
|
6391
|
+
if (!Array.isArray(nums)) {
|
|
6392
|
+
throw new Error('参数必须是数组');
|
|
6393
|
+
}
|
|
6394
|
+
if (nums.some((/**
|
|
6395
|
+
* @param {?} num
|
|
6338
6396
|
* @return {?}
|
|
6339
6397
|
*/
|
|
6340
|
-
function (
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6398
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6399
|
+
throw new Error('数组元素必须是数字');
|
|
6400
|
+
}
|
|
6401
|
+
/** @type {?} */
|
|
6402
|
+
var result = 0;
|
|
6403
|
+
try {
|
|
6404
|
+
for (var nums_1 = __values(nums), nums_1_1 = nums_1.next(); !nums_1_1.done; nums_1_1 = nums_1.next()) {
|
|
6405
|
+
var num = nums_1_1.value;
|
|
6406
|
+
result += num;
|
|
6407
|
+
}
|
|
6408
|
+
}
|
|
6409
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6410
|
+
finally {
|
|
6411
|
+
try {
|
|
6412
|
+
if (nums_1_1 && !nums_1_1.done && (_a = nums_1.return)) _a.call(nums_1);
|
|
6413
|
+
}
|
|
6414
|
+
finally { if (e_1) throw e_1.error; }
|
|
6415
|
+
}
|
|
6416
|
+
return lodash.round(result, precision);
|
|
6417
|
+
},
|
|
6352
6418
|
/**
|
|
6353
|
-
*
|
|
6354
|
-
* @param
|
|
6355
|
-
* @param
|
|
6356
|
-
|
|
6419
|
+
* 减法
|
|
6420
|
+
* @param nums 数组
|
|
6421
|
+
* @param precision 精度
|
|
6422
|
+
*/
|
|
6423
|
+
subtract: /**
|
|
6424
|
+
* 减法
|
|
6425
|
+
* @param {?} nums 数组
|
|
6426
|
+
* @param {?=} precision 精度
|
|
6427
|
+
* @return {?}
|
|
6357
6428
|
*/
|
|
6358
|
-
|
|
6429
|
+
function (nums, precision) {
|
|
6430
|
+
var e_2, _a;
|
|
6431
|
+
if (precision === void 0) { precision = 2; }
|
|
6432
|
+
if (!Array.isArray(nums)) {
|
|
6433
|
+
throw new Error('参数必须是数组');
|
|
6434
|
+
}
|
|
6435
|
+
if (nums.some((/**
|
|
6436
|
+
* @param {?} num
|
|
6437
|
+
* @return {?}
|
|
6438
|
+
*/
|
|
6439
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6440
|
+
throw new Error('数组元素必须是数字');
|
|
6441
|
+
}
|
|
6442
|
+
if (nums.length < 2) {
|
|
6443
|
+
throw new Error('减法入参数量至少要2个!');
|
|
6444
|
+
}
|
|
6445
|
+
/** @type {?} */
|
|
6446
|
+
var result = nums.shift();
|
|
6447
|
+
try {
|
|
6448
|
+
for (var nums_2 = __values(nums), nums_2_1 = nums_2.next(); !nums_2_1.done; nums_2_1 = nums_2.next()) {
|
|
6449
|
+
var num = nums_2_1.value;
|
|
6450
|
+
result -= num;
|
|
6451
|
+
}
|
|
6452
|
+
}
|
|
6453
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
6454
|
+
finally {
|
|
6455
|
+
try {
|
|
6456
|
+
if (nums_2_1 && !nums_2_1.done && (_a = nums_2.return)) _a.call(nums_2);
|
|
6457
|
+
}
|
|
6458
|
+
finally { if (e_2) throw e_2.error; }
|
|
6459
|
+
}
|
|
6460
|
+
return lodash.round(result, precision);
|
|
6461
|
+
},
|
|
6359
6462
|
/**
|
|
6360
|
-
*
|
|
6361
|
-
* @param
|
|
6362
|
-
* @param
|
|
6463
|
+
* 乘法
|
|
6464
|
+
* @param nums 数组
|
|
6465
|
+
* @param precision 精度
|
|
6466
|
+
*/
|
|
6467
|
+
multiply: /**
|
|
6468
|
+
* 乘法
|
|
6469
|
+
* @param {?} nums 数组
|
|
6470
|
+
* @param {?=} precision 精度
|
|
6471
|
+
* @return {?}
|
|
6363
6472
|
*/
|
|
6364
|
-
|
|
6473
|
+
function (nums, precision) {
|
|
6474
|
+
var e_3, _a;
|
|
6475
|
+
if (precision === void 0) { precision = 2; }
|
|
6476
|
+
if (!Array.isArray(nums)) {
|
|
6477
|
+
throw new Error('参数必须是数组');
|
|
6478
|
+
}
|
|
6479
|
+
if (nums.some((/**
|
|
6480
|
+
* @param {?} num
|
|
6481
|
+
* @return {?}
|
|
6482
|
+
*/
|
|
6483
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6484
|
+
throw new Error('数组元素必须是数字');
|
|
6485
|
+
}
|
|
6486
|
+
/** @type {?} */
|
|
6487
|
+
var result = 1;
|
|
6488
|
+
try {
|
|
6489
|
+
for (var nums_3 = __values(nums), nums_3_1 = nums_3.next(); !nums_3_1.done; nums_3_1 = nums_3.next()) {
|
|
6490
|
+
var num = nums_3_1.value;
|
|
6491
|
+
result = result * num;
|
|
6492
|
+
}
|
|
6493
|
+
}
|
|
6494
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
6495
|
+
finally {
|
|
6496
|
+
try {
|
|
6497
|
+
if (nums_3_1 && !nums_3_1.done && (_a = nums_3.return)) _a.call(nums_3);
|
|
6498
|
+
}
|
|
6499
|
+
finally { if (e_3) throw e_3.error; }
|
|
6500
|
+
}
|
|
6501
|
+
return lodash.round(result, precision);
|
|
6502
|
+
},
|
|
6365
6503
|
/**
|
|
6366
|
-
*
|
|
6367
|
-
* @param
|
|
6368
|
-
* @param
|
|
6369
|
-
|
|
6504
|
+
* 除法
|
|
6505
|
+
* @param nums 数组
|
|
6506
|
+
* @param precision 精度
|
|
6507
|
+
*/
|
|
6508
|
+
divide: /**
|
|
6509
|
+
* 除法
|
|
6510
|
+
* @param {?} nums 数组
|
|
6511
|
+
* @param {?=} precision 精度
|
|
6512
|
+
* @return {?}
|
|
6370
6513
|
*/
|
|
6371
|
-
|
|
6514
|
+
function (nums, precision) {
|
|
6515
|
+
var e_4, _a;
|
|
6516
|
+
if (precision === void 0) { precision = 2; }
|
|
6517
|
+
if (!Array.isArray(nums)) {
|
|
6518
|
+
throw new Error('参数必须是数组');
|
|
6519
|
+
}
|
|
6520
|
+
if (nums.some((/**
|
|
6521
|
+
* @param {?} num
|
|
6522
|
+
* @return {?}
|
|
6523
|
+
*/
|
|
6524
|
+
function (num) { return typeof num !== 'number'; }))) {
|
|
6525
|
+
throw new Error('数组元素必须是数字');
|
|
6526
|
+
}
|
|
6527
|
+
if (nums.length < 2) {
|
|
6528
|
+
throw new Error('除法入参数量至少要2个!');
|
|
6529
|
+
}
|
|
6530
|
+
/** @type {?} */
|
|
6531
|
+
var result = nums.shift();
|
|
6532
|
+
try {
|
|
6533
|
+
for (var nums_4 = __values(nums), nums_4_1 = nums_4.next(); !nums_4_1.done; nums_4_1 = nums_4.next()) {
|
|
6534
|
+
var num = nums_4_1.value;
|
|
6535
|
+
if (num === 0) {
|
|
6536
|
+
throw new Error('除数不能为0!');
|
|
6537
|
+
}
|
|
6538
|
+
result = result / num;
|
|
6539
|
+
}
|
|
6540
|
+
}
|
|
6541
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
6542
|
+
finally {
|
|
6543
|
+
try {
|
|
6544
|
+
if (nums_4_1 && !nums_4_1.done && (_a = nums_4.return)) _a.call(nums_4);
|
|
6545
|
+
}
|
|
6546
|
+
finally { if (e_4) throw e_4.error; }
|
|
6547
|
+
}
|
|
6548
|
+
return lodash.round(result, precision);
|
|
6549
|
+
}
|
|
6372
6550
|
};
|
|
6373
6551
|
|
|
6374
6552
|
exports.ButtonSize = ButtonSize;
|