ol-base-components 2.8.11 → 2.8.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "2.8.11",
3
+ "version": "2.8.12",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
@@ -422,11 +422,16 @@ export default {
422
422
  type: Boolean,
423
423
  default: true,
424
424
  },
425
- //获取swagger后的钩子,返回swagger结构数据
425
+ //获取swagger后的钩子,返回swagger结构数据。用于处理swagger数据
426
426
  swaggerColumnsProcessor: {
427
427
  type: Function,
428
428
  default: null,
429
429
  },
430
+ // swagger与本地columns合并完成后的钩子,允许父组件二次处理columns,一般用于不影响顺序的属性修改。区别于直接column中添加
431
+ mergedColumnsProcessor: {
432
+ type: Function,
433
+ default: null,
434
+ },
430
435
  },
431
436
 
432
437
  data() {
@@ -522,12 +527,12 @@ export default {
522
527
  let swaggerColumns =
523
528
  swaggerData.paths[this.url].get.responses["200"].content["application/json"].schema
524
529
  .properties.items.items.properties;
525
-
526
- try {
527
- const res = await this.swaggerColumnsProcessor(swaggerColumns);
528
- swaggerColumns = res;
529
- } catch (err) {}
530
-
530
+ if (typeof this.swaggerColumnsProcessor === "function") {
531
+ try {
532
+ const res = await this.swaggerColumnsProcessor({ swaggerColumns });
533
+ swaggerColumns = res;
534
+ } catch (err) {}
535
+ }
531
536
  // 递归映射函数
532
537
  const mapSwaggerToColumns = columns => {
533
538
  columns.forEach(column => {
@@ -586,6 +591,15 @@ export default {
586
591
  addShow(this.tableData.columns);
587
592
  console.log(`\x1b[36m\x1b[4mol插件-表格`, this.tableData.columns);
588
593
 
594
+ // 合并完成后,暴露处理钩子
595
+ if (typeof this.mergedColumnsProcessor === "function") {
596
+ try {
597
+ await this.mergedColumnsProcessor({
598
+ columns: this.tableData.columns,
599
+ });
600
+ } catch (e) {}
601
+ }
602
+
589
603
  // init 执行完成后,添加深度监听
590
604
  this.startColumnsWatching();
591
605
  })