lambo-design-bi 0.0.143 → 0.0.145

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.
@@ -1,23 +1,19 @@
1
- <!-- eslint-disable -->
2
1
  <template>
3
- <div>
4
- <el-row class="custom-row"
5
- :gutter="(widget.options && widget.options.gutter) ? parseInt(widget.options.gutter) : 0">
6
- <template v-for="(item, index) in widget.widgets">
7
- <component :is="getWidgetNameSync(item)" :widget="item" :key="index" :params="params">
8
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
9
- <slot :name="slot" v-bind="scope" />
10
- </template>
11
- </component>
12
- </template>
13
- </el-row>
14
- </div>
2
+ <el-row class="custom-row" :gutter="(widget.options && widget.options.gutter) ? parseInt(widget.options.gutter) : 0">
3
+ <template v-for="(item, index) in widget.widgets">
4
+ <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
5
+ <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
6
+ <slot :name="slot" v-bind="scope" />
7
+ </template>
8
+ </component>
9
+ </template>
10
+ </el-row>
15
11
  </template>
16
12
  <script>
17
- import { getWidgetNameSync } from '../util/widget-map'
13
+ import { getWidgetName } from '../util/widget-map'
18
14
 
19
15
  export default {
20
- name: 'BiRow',
16
+ name: "BiRow",
21
17
  components: {},
22
18
  props: {
23
19
  widget: {
@@ -35,7 +31,7 @@ export default {
35
31
  }
36
32
  },
37
33
  methods: {
38
- getWidgetNameSync
34
+ getWidgetName
39
35
  },
40
36
  created() {
41
37
 
@@ -1,17 +1,18 @@
1
1
  import BiPage from "../page/index.vue"
2
- import BiCol from "../layout/col.vue"
2
+ import BiEmpty from "../../../pub/empty/index.vue"
3
+ import BiPagingTable from "../table/paging-table.vue"
3
4
  import BiContainerCard from "../container/card/card-widget.vue"
4
5
  import BiNumIndex from "../num/index.vue"
6
+ import BiRow from "../layout/row.vue"
7
+ import BiCol from "../layout/col.vue"
5
8
  import BiDetailTable from "../table/detail-table.vue"
6
- import BiPagingTable from "../table/paging-table.vue"
7
- import BiEmpty from "../../../pub/empty/index.vue"
8
9
 
9
10
  /**
10
11
  * Strictly define the order to prevent circular references. For component reuse, copy new components instead of direct references.
11
12
  */
12
13
  export const WIDGET_MAP = {
13
14
  "20": BiPage,
14
- "32": () => import("../layout/row.vue"), // 总是使用动态导入
15
+ "32": BiRow,
15
16
  "33": BiCol,
16
17
  "40": BiContainerCard,
17
18
  "41": BiNumIndex,
@@ -20,29 +21,15 @@ export const WIDGET_MAP = {
20
21
  "_empty": BiEmpty,
21
22
  }
22
23
 
23
- export async function getWidgetName(item) {
24
+ export function getWidgetName(item) {
24
25
  console.log('getWidgetName WIDGET_MAP=', WIDGET_MAP)
25
26
  let type = item.type
26
- if (type && Object.prototype.hasOwnProperty.call(WIDGET_MAP, type)) {
27
- const component = WIDGET_MAP[type];
28
- // 如果是函数,动态导入
29
- if (typeof component === 'function') {
30
- try {
31
- const module = await component();
32
- return module.default;
33
- } catch (error) {
34
- console.error('动态加载组件失败:', error);
35
- return WIDGET_MAP['_empty'];
36
- }
37
- } else {
38
- console.error('组件不是一个函数无法导入');
39
- }
40
- return component
27
+ if (type && Object.prototype.hasOwnProperty.call(WIDGET_MAP, type) && WIDGET_MAP[type]) {
28
+ return WIDGET_MAP[type]
41
29
  } else {
42
30
  console.warn(`未找到type=${type}对应的组件,使用默认组件`)
43
31
  console.log('getWidgetName item=', item)
44
32
  console.log('getWidgetName type=', type)
45
-
46
33
  if (type && Object.prototype.hasOwnProperty.call(WIDGET_MAP, type)) {
47
34
  console.log('getWidgetName 类型包含组件但未成功获取 WIDGET_MAP[type]=', WIDGET_MAP[type])
48
35
  } else {
@@ -51,21 +38,3 @@ export async function getWidgetName(item) {
51
38
  return WIDGET_MAP['_empty']
52
39
  }
53
40
  }
54
-
55
-
56
- // 同步版本(返回组件名而不是组件对象)
57
- export function getWidgetNameSync(item) {
58
- const type = item.type;
59
- const nameMap = {
60
- '20': 'BiPage',
61
- '32': 'BiRow', // 返回组件名
62
- '33': 'BiCol',
63
- '40': 'BiContainerCard',
64
- '41': 'BiNumIndex',
65
- '50': 'BiPagingTable',
66
- '51': 'BiDetailTable',
67
- '_empty': 'BiEmpty'
68
- };
69
-
70
- return nameMap[type] || nameMap['_empty'];
71
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.143",
3
+ "version": "0.0.145",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",