tianheng-ui 0.0.96 → 0.0.98

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,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.96",
4
+ "version": "0.0.98",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -2,7 +2,7 @@
2
2
  <el-form-item
3
3
  class="widget-view"
4
4
  :class="{
5
- active: selectWidget.key == widget.key,
5
+ active: selectWidget.model == widget.model,
6
6
  is_req: widget.options.required,
7
7
  hideLabel: widget.options.hideLabel,
8
8
  'widget-col': ['grid', 'tabs', 'table', 'table_h5', 'alliance'].includes(
@@ -25,7 +25,7 @@
25
25
  ></component>
26
26
 
27
27
  <div
28
- v-if="selectWidget.key == widget.key"
28
+ v-if="selectWidget.model == widget.model"
29
29
  class="widget-actions"
30
30
  :class="{
31
31
  'widget-actions-col': [
@@ -117,36 +117,66 @@ export default {
117
117
  },
118
118
 
119
119
  handleWidgetClone(index) {
120
- const key =
121
- Date.parse(new Date().toString()) +
122
- "_" +
123
- Math.ceil(Math.random() * 99999);
124
- let cloneData = {
125
- ...this.widgetArray.list[index],
126
- options: {
127
- ...this.widgetArray.list[index].options,
128
- remoteFunc: "func_" + key
129
- },
130
- key,
131
- model: this.widgetArray.list[index].type + "_" + key,
132
- rules: this.widgetArray.list[index].rules || []
120
+ const data = JSON.parse(JSON.stringify(this.widgetArray.list[index]));
121
+
122
+ const initKey = item => {
123
+ const key =
124
+ Date.parse(new Date().toString()) +
125
+ "_" +
126
+ Math.ceil(Math.random() * 99999);
127
+
128
+ item.options.remoteFunc = `func__${key}`;
129
+ item.key = key;
130
+ item.model = item.type + "_" + key;
131
+
132
+ if (["table", "table_h5"].includes(item.type)) {
133
+ item.list.forEach(element => {
134
+ initKey(element);
135
+ });
136
+ }
137
+ if (["tabs"].includes(item.type)) {
138
+ item.tabs.forEach(tab => {
139
+ tab.forEach(element => {
140
+ initKey(element);
141
+ });
142
+ });
143
+ }
144
+ if (["grid"].includes(item.type)) {
145
+ item.columns.forEach(column => {
146
+ column.list.forEach(element => {
147
+ initKey(element);
148
+ });
149
+ });
150
+ }
133
151
  };
152
+ initKey(data);
134
153
 
135
- if (
136
- this.widgetArray.list[index].type === "radio" ||
137
- this.widgetArray.list[index].type === "checkbox" ||
138
- this.widgetArray.list[index].type === "select"
139
- ) {
140
- cloneData = {
141
- ...cloneData,
142
- options: {
143
- ...cloneData.options,
144
- options: cloneData.options.options.map(item => ({ ...item }))
145
- }
146
- };
147
- }
154
+ // let cloneData = {
155
+ // ...JSON.parse(JSON.stringify(this.widgetArray.list[index])),
156
+ // options: {
157
+ // ...this.widgetArray.list[index].options,
158
+ // remoteFunc: "func_" + key
159
+ // },
160
+ // key,
161
+ // model: this.widgetArray.list[index].type + "_" + key,
162
+ // rules: this.widgetArray.list[index].rules || []
163
+ // };
164
+
165
+ // if (
166
+ // this.widgetArray.list[index].type === "radio" ||
167
+ // this.widgetArray.list[index].type === "checkbox" ||
168
+ // this.widgetArray.list[index].type === "select"
169
+ // ) {
170
+ // cloneData = {
171
+ // ...cloneData,
172
+ // options: {
173
+ // ...cloneData.options,
174
+ // options: cloneData.options.options.map(item => ({ ...item }))
175
+ // }
176
+ // };
177
+ // }
148
178
 
149
- this.widgetArray.list.splice(index, 0, cloneData);
179
+ this.widgetArray.list.splice(index, 0, data);
150
180
 
151
181
  this.$nextTick(() => {
152
182
  this.selectWidget = this.widgetArray.list[index + 1];
@@ -442,16 +442,6 @@ export const basicComponents = [
442
442
  onChange: ""
443
443
  }
444
444
  },
445
- {
446
- name: "填充物",
447
- type: "filler",
448
- icon: "icon-ic",
449
- options: {
450
- defaultValue: "",
451
- width: "100%",
452
- height: "20px"
453
- }
454
- },
455
445
  {
456
446
  name: "图片",
457
447
  type: "image",
@@ -715,7 +705,20 @@ export const layoutComponents = [
715
705
  hideLabel: true
716
706
  }
717
707
  },
718
-
708
+ {
709
+ name: "填充物",
710
+ type: "filler",
711
+ icon: "icon-ic",
712
+ options: {
713
+ defaultValue: "",
714
+ width: "100%",
715
+ height: "20px",
716
+ labelWidth: 100,
717
+ isLabelWidth: false,
718
+ hideLabel: true,
719
+ hidden: false,
720
+ }
721
+ },
719
722
  {
720
723
  name: "分割线",
721
724
  type: "divider",
@@ -31,6 +31,11 @@
31
31
  <el-form-item label="高度">
32
32
  <el-input v-model="widget.options.height"></el-input>
33
33
  </el-form-item>
34
+
35
+ <el-form-item label="操作属性">
36
+ <el-checkbox v-model="widget.options.hidden">隐藏组件 </el-checkbox>
37
+ <el-checkbox v-model="widget.options.hideLabel">隐藏标签 </el-checkbox>
38
+ </el-form-item>
34
39
  </el-form>
35
40
  </div>
36
41
  </template>
@@ -15,7 +15,6 @@ const basicComponents = [
15
15
  "slider",
16
16
  "number",
17
17
  "rate",
18
- "filler",
19
18
  "image",
20
19
  "upload",
21
20
  "editor",
@@ -24,7 +23,7 @@ const basicComponents = [
24
23
 
25
24
  const advanceComponents = ["table", "table_h5", "tabs", "blank"];
26
25
 
27
- const layoutComponents = ["grid", "alliance", "divider"];
26
+ const layoutComponents = ["grid", "alliance", "filler", "divider"];
28
27
 
29
28
  module.exports = {
30
29
  basicComponents,
@@ -1,6 +1,7 @@
1
1
  <template>
2
+ <!-- widget.key -->
2
3
  <th-row
3
- :class="{ active: selectWidget.key == widget.key }"
4
+ :class="{ active: selectWidget.model == widget.model }"
4
5
  :gutter="widget.options.gutter ? widget.options.gutter : 0"
5
6
  :justify="widget.options.justify"
6
7
  :align="widget.options.align"
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <div class="fm-container">
3
- <el-container v-if="Object.keys(widgetFormData.config).length" class="container-box">
3
+ <el-container
4
+ v-if="Object.keys(widgetFormData.config).length"
5
+ class="container-box"
6
+ >
4
7
  <el-main>
5
8
  <el-container>
6
9
  <!-- 左侧字段区 -->
@@ -441,7 +444,6 @@ export default {
441
444
  "slider",
442
445
  "text",
443
446
  "button",
444
- "filler",
445
447
  "image",
446
448
  "upload",
447
449
  "editor",
@@ -454,7 +456,7 @@ export default {
454
456
  },
455
457
  layoutFields: {
456
458
  type: Array,
457
- default: () => ["grid", "alliance", "divider"]
459
+ default: () => ["grid", "filler", "divider"]
458
460
  },
459
461
  remoteApis: {
460
462
  type: Array,
@@ -463,8 +465,8 @@ export default {
463
465
  },
464
466
  data() {
465
467
  this.basicComponents = basicComponents;
466
- this.layoutComponents = layoutComponents;
467
468
  this.advanceComponents = advanceComponents;
469
+ this.layoutComponents = layoutComponents;
468
470
  this.baseConfig = JSON.parse(JSON.stringify(baseConfig));
469
471
  return {
470
472
  widgetFormData: this.data,
@@ -523,6 +525,7 @@ export default {
523
525
  const list = this.layoutComponents.filter(e => {
524
526
  return this.layoutFields.includes(e.type);
525
527
  });
528
+ console.log(this.layoutComponents)
526
529
  return list;
527
530
  }
528
531
  },
@@ -547,13 +550,10 @@ export default {
547
550
  this.baseConfig,
548
551
  this.widgetFormData.config
549
552
  );
550
- if (
551
- this.widgetFormData.list &&
552
- this.widgetFormData.list.length
553
- ) {
553
+ if (this.widgetFormData.list && this.widgetFormData.list.length) {
554
554
  this.widgetFormSelect = this.widgetFormData.list[0];
555
- }else {
556
- this.widgetFormData.list = []
555
+ } else {
556
+ this.widgetFormData.list = [];
557
557
  }
558
558
  },
559
559
  mounted() {},