lambo-design-bi 0.0.178 → 0.0.180

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.
@@ -4,18 +4,21 @@
4
4
  <template slot="content-title" v-if="(widget.options.title && widget.options.title.length > 0)">
5
5
  {{ widget.options.title }}
6
6
  </template>
7
- <template v-for="(item, index) in widget.widgets">
8
- <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
9
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
10
- <slot :name="slot" v-bind="scope" />
11
- </template>
12
- </component>
13
- </template>
7
+ <div :style="containerStyle || {}">
8
+ <div v-for="(item, index) in widget.widgets" :key="index">
9
+ <component :is="getWidgetName(item)" :widget="item" :params="params">
10
+ <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
11
+ <slot :name="slot" v-bind="scope" />
12
+ </template>
13
+ </component>
14
+ </div>
15
+ </div>
14
16
  </lambo-indicator-card-bi>
15
17
  </template>
16
18
  <script>
17
19
  import LamboIndicatorCardBi from './comps/indicator-card/src/indicator-card-bi.vue'
18
20
  import { getWidgetName } from '../../util/widget-map'
21
+ import { parseStyleStr } from '../../util/css-util'
19
22
 
20
23
  export default {
21
24
  name: "BiContainerCard",
@@ -32,11 +35,14 @@ export default {
32
35
  },
33
36
  data() {
34
37
  return {
35
-
38
+ containerStyle: {},
36
39
  }
37
40
  },
38
41
  methods: {
39
- getWidgetName
42
+ getWidgetName,
43
+ initConfig() {
44
+ this.containerStyle = parseStyleStr(this.widget.options.style) || {}
45
+ }
40
46
  },
41
47
  created() {
42
48
  console.log("ContainerCard params:", this.params)
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <el-col :span="(widget.options && widget.options.span) ? parseInt(widget.options.span) : 24">
3
- <template v-for="(item, index) in widget.widgets">
4
- <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
3
+ <div v-for="(item, index) in widget.widgets" :key="index" >
4
+ <component :is="getWidgetName(item)" :widget="item" :params="params">
5
5
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
6
6
  <slot :name="slot" v-bind="scope" />
7
7
  </template>
8
8
  </component>
9
- </template>
9
+ </div>
10
10
  </el-col>
11
11
  </template>
12
12
  <script>
@@ -1,12 +1,12 @@
1
1
  <template>
2
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">
3
+ <div v-for="(item, index) in widget.widgets" :key="index" >
4
+ <component :is="getWidgetName(item)" :widget="item" :params="params">
5
5
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
6
6
  <slot :name="slot" v-bind="scope" />
7
7
  </template>
8
8
  </component>
9
- </template>
9
+ </div>
10
10
  </el-row>
11
11
  </template>
12
12
  <script>
@@ -1,12 +1,12 @@
1
1
  <template>
2
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">
3
+ <div v-for="(item, index) in widget.widgets" :key="index">
4
+ <component :is="getWidgetName(item)" :widget="item" :params="params">
5
5
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
6
6
  <slot :name="slot" v-bind="scope" />
7
7
  </template>
8
8
  </component>
9
- </template>
9
+ </div>
10
10
  </el-row>
11
11
  </template>
12
12
  <script>
@@ -11,13 +11,13 @@
11
11
  </BiSearchForm>
12
12
  </LamboIndicatorCardBiSearch>
13
13
 
14
- <template v-for="(item, index) in childPageWidget.widgets">
15
- <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
14
+ <div v-for="(item, index) in childPageWidget.widgets" :key="index">
15
+ <component :is="getWidgetName(item)" :widget="item" :params="params">
16
16
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
17
17
  <slot :name="slot" v-bind="scope" />
18
18
  </template>
19
19
  </component>
20
- </template>
20
+ </div>
21
21
 
22
22
  </LamboPageContainer>
23
23
  </template>
@@ -8,13 +8,13 @@
8
8
  </BiSearchForm>
9
9
  </LamboIndicatorCardBiSearch>
10
10
 
11
- <template v-for="(item, index) in pageWidget.widgets">
12
- <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
11
+ <div v-for="(item, index) in pageWidget.widgets" :key="index">
12
+ <component :is="getWidgetName(item)" :widget="item" :params="params">
13
13
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
14
14
  <slot :name="slot" v-bind="scope" />
15
15
  </template>
16
16
  </component>
17
- </template>
17
+ </div>
18
18
 
19
19
  </LamboPageContainer>
20
20
  </template>
@@ -4,6 +4,7 @@
4
4
  <script>
5
5
  import LamboTextObjGroupBi from "../../../pub/text/text-obj-group.vue"
6
6
  import { getListMapData } from "../api/data"
7
+ import { parseStyleStr } from '../util/css-util'
7
8
 
8
9
  export default {
9
10
  name: 'BiTextGroup',
@@ -28,8 +29,8 @@ export default {
28
29
  let oldTextList = this.widget.options.textList || []
29
30
  let newTextList = oldTextList.map(item => ({
30
31
  ...item,
31
- titleStyle: parseStyleString(item.titleStyle),
32
- valStyle: parseStyleString(item.valStyle)
32
+ titleStyle: parseStyleStr(item.titleStyle),
33
+ valStyle: parseStyleStr(item.valStyle)
33
34
  }))
34
35
  this.textList = newTextList
35
36
  },
@@ -72,17 +73,6 @@ export default {
72
73
  } catch (error) {
73
74
  console.error("文字卡片批量请求异常:", error)
74
75
  }
75
- },
76
- parseStyleString(styleStr) {
77
- if (typeof styleStr === 'string') {
78
- try {
79
- return JSON.parse(styleStr)
80
- } catch (e) {
81
- console.warn('样式字符串解析失败:', styleStr)
82
- return {}
83
- }
84
- }
85
- return styleStr || {}
86
76
  }
87
77
  },
88
78
  created() {
@@ -0,0 +1,23 @@
1
+ /**
2
+ * css样式字符串转样式对象
3
+ * 字符串{"backgroundColor":"#F3F8FE","margin-top": "0px"} 转
4
+ * 样式对象
5
+ * {
6
+ backgroundColor: '#F3F8FE',
7
+ margin-top: '0px',
8
+ }
9
+
10
+ * @param {*} styleStr
11
+ * @returns
12
+ */
13
+ export function parseStyleStr(styleStr) {
14
+ if (typeof styleStr === 'string') {
15
+ try {
16
+ return JSON.parse(styleStr)
17
+ } catch (e) {
18
+ console.warn('样式字符串解析失败:', styleStr)
19
+ return {}
20
+ }
21
+ }
22
+ return styleStr || {}
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.178",
3
+ "version": "0.0.180",
4
4
  "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",