fantasy-ngzorro 1.3.33 → 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.
@@ -5222,75 +5222,97 @@ const StaticConst = {
5222
5222
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5223
5223
  */
5224
5224
  // 工具类
5225
- const ɵ0 = /**
5226
- * @param {?} formList
5227
- * @param {?} name
5228
- * @param {?} options
5229
- * @return {?}
5230
- */
5231
- function (formList, name, options) {
5232
- /** @type {?} */
5233
- let returnData = formList;
5234
- if (!returnData || !returnData.length) {
5235
- return returnData;
5236
- }
5237
- /** @type {?} */
5238
- const length = formList.length;
5239
- for (let i = 0; i < length; i++) {
5240
- if (returnData[i].name === name) {
5241
- returnData[i].selectOption.selectList = options;
5225
+ /** @type {?} */
5226
+ const Utils = {
5227
+ /**
5228
+ * 填充select控件选项
5229
+ * @param {?} formList 入参数组 Array<any>
5230
+ * @param {?} name 需要填充options的属性名称
5231
+ * @param {?} options 选项列表
5232
+ * @return {?}
5233
+ */
5234
+ fillSelectOption(formList, name, options) {
5235
+ /** @type {?} */
5236
+ const returnData = formList;
5237
+ if (!returnData || !returnData.length) {
5238
+ return returnData;
5242
5239
  }
5243
- }
5244
- return returnData;
5245
- }, ɵ1 = /**
5246
- * @param {?} list
5247
- * @param {?} obj
5248
- * @return {?}
5249
- */
5250
- function (list, obj) {
5251
- /** @type {?} */
5252
- let returnData = [];
5253
- if (!list || !list.length) {
5254
- return returnData;
5255
- }
5256
- /** @type {?} */
5257
- const length = list.length;
5258
- for (let i = 0; i < length; i++) {
5259
- if (obj[list[i].name]) {
5260
- list[i].value = obj[list[i].name];
5240
+ /** @type {?} */
5241
+ const length = formList.length;
5242
+ for (let i = 0; i < length; i++) {
5243
+ if (returnData[i].name === name) {
5244
+ returnData[i].selectOption.selectList = options;
5245
+ }
5261
5246
  }
5262
- }
5263
- return list;
5264
- }, ɵ2 = /**
5265
- * @param {?} list
5266
- * @param {?=} option
5267
- * @return {?}
5268
- */
5269
- function (list, option) {
5270
- /** @type {?} */
5271
- let returnData = [];
5272
- if (!list || !list.length) {
5273
5247
  return returnData;
5274
- }
5275
- if (option) {
5276
- if (option.labelTip && option.valueTip) {
5277
- list.forEach((/**
5278
- * @param {?} item
5279
- * @return {?}
5280
- */
5281
- (item) => {
5282
- /** @type {?} */
5283
- let returnItem = item;
5284
- returnItem.label = item[option.label];
5285
- returnItem.value = item[option.value];
5286
- if (option.valueTip) {
5287
- returnItem[option.valueTip] = item[option.value];
5288
- }
5289
- if (option.labelTip) {
5290
- returnItem[option.labelTip] = item[option.label];
5291
- }
5292
- returnData.push(returnItem);
5293
- }));
5248
+ },
5249
+ /**
5250
+ * 填充FormItem数组:针对入参list的每一个FormItem,判断obj中是否有对应的name字段,如果有,则填充value。
5251
+ * @param {?} list 入参数组 Array<FormItem>
5252
+ * @param {?} obj 需要填充到list的属性
5253
+ * @return {?}
5254
+ */
5255
+ fillArrayFormItem(list, obj) {
5256
+ /** @type {?} */
5257
+ const returnData = [];
5258
+ if (!list || !list.length) {
5259
+ return returnData;
5260
+ }
5261
+ /** @type {?} */
5262
+ const length = list.length;
5263
+ for (let i = 0; i < length; i++) {
5264
+ if (obj[list[i].name]) {
5265
+ list[i].value = obj[list[i].name];
5266
+ }
5267
+ }
5268
+ return list;
5269
+ },
5270
+ /**
5271
+ * 数组转换成选择器的选项数组
5272
+ * @param {?} list 入参数组 字符串数组或对象数组
5273
+ * @param {?=} option 转换选项
5274
+ * 注:list为字符串数组,option不需要传,按照标准的label、value转换
5275
+ * @return {?}
5276
+ */
5277
+ arrayToSelectOptionList(list, option) {
5278
+ /** @type {?} */
5279
+ const returnData = [];
5280
+ if (!list || !list.length) {
5281
+ return returnData;
5282
+ }
5283
+ if (option) {
5284
+ if (option.labelTip && option.valueTip) {
5285
+ list.forEach((/**
5286
+ * @param {?} item
5287
+ * @return {?}
5288
+ */
5289
+ (item) => {
5290
+ /** @type {?} */
5291
+ const returnItem = item;
5292
+ returnItem.label = item[option.label];
5293
+ returnItem.value = item[option.value];
5294
+ if (option.valueTip) {
5295
+ returnItem[option.valueTip] = item[option.value];
5296
+ }
5297
+ if (option.labelTip) {
5298
+ returnItem[option.labelTip] = item[option.label];
5299
+ }
5300
+ returnData.push(returnItem);
5301
+ }));
5302
+ }
5303
+ else {
5304
+ list.forEach((/**
5305
+ * @param {?} item
5306
+ * @return {?}
5307
+ */
5308
+ (item) => {
5309
+ /** @type {?} */
5310
+ const returnItem = item;
5311
+ returnItem.label = item[option.label];
5312
+ returnItem.value = item[option.value];
5313
+ returnData.push(returnItem);
5314
+ }));
5315
+ }
5294
5316
  }
5295
5317
  else {
5296
5318
  list.forEach((/**
@@ -5299,50 +5321,119 @@ function (list, option) {
5299
5321
  */
5300
5322
  (item) => {
5301
5323
  /** @type {?} */
5302
- let returnItem = item;
5303
- returnItem.label = item[option.label];
5304
- returnItem.value = item[option.value];
5324
+ const returnItem = {};
5325
+ returnItem.label = item;
5326
+ returnItem.value = item;
5305
5327
  returnData.push(returnItem);
5306
5328
  }));
5307
5329
  }
5308
- }
5309
- else {
5310
- list.forEach((/**
5311
- * @param {?} item
5330
+ return returnData;
5331
+ },
5332
+ /**
5333
+ * 求和
5334
+ * @param {?} nums 数组
5335
+ * @param {?=} precision 精度
5336
+ * @return {?}
5337
+ */
5338
+ add(nums, precision = 2) {
5339
+ if (!Array.isArray(nums)) {
5340
+ throw new Error('参数必须是数组');
5341
+ }
5342
+ if (nums.some((/**
5343
+ * @param {?} num
5312
5344
  * @return {?}
5313
5345
  */
5314
- (item) => {
5315
- /** @type {?} */
5316
- let returnItem = {};
5317
- returnItem.label = item;
5318
- returnItem.value = item;
5319
- returnData.push(returnItem);
5320
- }));
5321
- }
5322
- return returnData;
5323
- };
5324
- /** @type {?} */
5325
- const Utils = {
5346
+ num => typeof num !== 'number'))) {
5347
+ throw new Error('数组元素必须是数字');
5348
+ }
5349
+ /** @type {?} */
5350
+ let result = 0;
5351
+ for (const num of nums) {
5352
+ result += num;
5353
+ }
5354
+ return round(result, precision);
5355
+ },
5326
5356
  /**
5327
- * 填充select控件选项
5328
- * @param formList 入参数组 Array<any>
5329
- * @param name 需要填充options的属性名称
5330
- * @param options 选项列表
5357
+ * 减法
5358
+ * @param {?} nums 数组
5359
+ * @param {?=} precision 精度
5360
+ * @return {?}
5331
5361
  */
5332
- fillSelectOption: (ɵ0),
5362
+ subtract(nums, precision = 2) {
5363
+ if (!Array.isArray(nums)) {
5364
+ throw new Error('参数必须是数组');
5365
+ }
5366
+ if (nums.some((/**
5367
+ * @param {?} num
5368
+ * @return {?}
5369
+ */
5370
+ num => typeof num !== 'number'))) {
5371
+ throw new Error('数组元素必须是数字');
5372
+ }
5373
+ if (nums.length < 2) {
5374
+ throw new Error('减法入参数量至少要2个!');
5375
+ }
5376
+ /** @type {?} */
5377
+ let result = nums.shift();
5378
+ for (const num of nums) {
5379
+ result -= num;
5380
+ }
5381
+ return round(result, precision);
5382
+ },
5333
5383
  /**
5334
- * 填充FormItem数组:针对入参list的每一个FormItem,判断obj中是否有对应的name字段,如果有,则填充value。
5335
- * @param list 入参数组 Array<FormItem>
5336
- * @param obj 需要填充到list的属性
5384
+ * 乘法
5385
+ * @param {?} nums 数组
5386
+ * @param {?=} precision 精度
5387
+ * @return {?}
5337
5388
  */
5338
- fillArrayFormItem: (ɵ1),
5389
+ multiply(nums, precision = 2) {
5390
+ if (!Array.isArray(nums)) {
5391
+ throw new Error('参数必须是数组');
5392
+ }
5393
+ if (nums.some((/**
5394
+ * @param {?} num
5395
+ * @return {?}
5396
+ */
5397
+ num => typeof num !== 'number'))) {
5398
+ throw new Error('数组元素必须是数字');
5399
+ }
5400
+ /** @type {?} */
5401
+ let result = 1;
5402
+ for (const num of nums) {
5403
+ result = result * num;
5404
+ }
5405
+ return round(result, precision);
5406
+ },
5339
5407
  /**
5340
- * 数组转换成选择器的选项数组
5341
- * @param list 入参数组 字符串数组或对象数组
5342
- * @param option 转换选项
5343
- * 注:list为字符串数组,option不需要传,按照标准的label、value转换
5408
+ * 除法
5409
+ * @param {?} nums 数组
5410
+ * @param {?=} precision 精度
5411
+ * @return {?}
5344
5412
  */
5345
- arrayToSelectOptionList: 2)
5413
+ divide(nums, precision = 2) {
5414
+ if (!Array.isArray(nums)) {
5415
+ throw new Error('参数必须是数组');
5416
+ }
5417
+ if (nums.some((/**
5418
+ * @param {?} num
5419
+ * @return {?}
5420
+ */
5421
+ num => typeof num !== 'number'))) {
5422
+ throw new Error('数组元素必须是数字');
5423
+ }
5424
+ if (nums.length < 2) {
5425
+ throw new Error('除法入参数量至少要2个!');
5426
+ }
5427
+ /** @type {?} */
5428
+ let result = nums.shift();
5429
+ for (const num of nums) {
5430
+ if (num === 0) {
5431
+ throw new Error('除数不能为0!');
5432
+ }
5433
+ result = result / num;
5434
+ }
5435
+ return round(result, precision);
5436
+ }
5346
5437
  };
5347
5438
 
5348
5439
  /**