tianheng-ui 0.0.59 → 0.0.62

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.59",
4
+ "version": "0.0.62",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -25,7 +25,6 @@
25
25
  "mini-css-extract-plugin": "^2.6.1",
26
26
  "normalize.css": "^8.0.1",
27
27
  "nprogress": "^0.2.0",
28
- "vant": "^2.12.50",
29
28
  "viewerjs": "^1.10.5",
30
29
  "vue": "^2.5.11",
31
30
  "vue-i18n": "^5.0.3",
@@ -58,16 +58,16 @@ export default {
58
58
  ];
59
59
  return className;
60
60
  },
61
- _elFormItemSize() {
62
- return (this.elFormItem || {}).elFormItemSize;
61
+ _thFormItemSize() {
62
+ return (this.thFormItem || {}).thFormItemSize;
63
63
  },
64
64
  buttonSize() {
65
- return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
65
+ return this.size || this._thFormItemSize || (this.$ELEMENT || {}).size;
66
66
  },
67
67
  buttonDisabled() {
68
68
  return this.$options.propsData.hasOwnProperty("disabled")
69
69
  ? this.disabled
70
- : (this.elForm || {}).disabled;
70
+ : (this.thForm || {}).disabled;
71
71
  }
72
72
  },
73
73
 
@@ -40,7 +40,7 @@ import htmlWorkerUrl from "file-loader!ace-builds/src-noconflict/worker-html";
40
40
  ace.config.setModuleUrl("ace/mode/html_worker", htmlWorkerUrl);
41
41
 
42
42
  export default {
43
- name: "CodeEditor",
43
+ name: "ThCodeEditor",
44
44
  model: {
45
45
  event: "change"
46
46
  },
@@ -1,24 +1,24 @@
1
1
  <template>
2
- <div>
2
+ <div v-if="formJson.config">
3
3
  <el-form
4
4
  class="generateForm"
5
- :class="{ 'form-hideLabel': data.config.hideLabel }"
5
+ :class="{ 'form-hideLabel': formJson.config.hideLabel }"
6
6
  :style="{ width: formWidth }"
7
- :label-suffix="data.config.labelSuffix"
8
- :size="data.config.size"
7
+ :label-suffix="formJson.config.labelSuffix"
8
+ :size="formJson.config.size"
9
9
  :model="models"
10
- :label-position="data.config.labelPosition"
11
- :label-width="data.config.labelWidth + 'px'"
10
+ :label-position="formJson.config.labelPosition"
11
+ :label-width="formJson.config.labelWidth + 'px'"
12
12
  ref="generateForm"
13
13
  >
14
14
  <genetate-form-item
15
- v-for="item in data.list"
15
+ v-for="item in formJson.list"
16
16
  :key="item.key"
17
17
  :models.sync="models"
18
18
  :widget="item"
19
19
  :slotKeys="slotKeys"
20
20
  :remote="remote"
21
- :config="data.config"
21
+ :config="formJson.config"
22
22
  :prop="item.type === 'grid' ? '' : item.model"
23
23
  :componentsData="componentsData"
24
24
  @input-change="onInputChange"
@@ -31,21 +31,21 @@
31
31
  <!-- <van-form
32
32
  v-else
33
33
  class="generateForm"
34
- :class="{ 'form-hideLabel': data.config.hideLabel }"
34
+ :class="{ 'form-hideLabel': formJson.config.hideLabel }"
35
35
  :style="{ width: formWidth }"
36
36
  style="margin: 0 auto;"
37
- :label-align="data.config.labelPosition"
38
- :label-width="data.config.labelWidth + 'px'"
37
+ :label-align="formJson.config.labelPosition"
38
+ :label-width="formJson.config.labelWidth + 'px'"
39
39
  ref="generateForm"
40
40
  >
41
41
  <genetate-form-item-h5
42
- v-for="item in data.list"
42
+ v-for="item in formJson.list"
43
43
  :key="item.key"
44
44
  :models.sync="models"
45
45
  :widget="item"
46
46
  :slotKeys="slotKeys"
47
47
  :remote="remote"
48
- :config="data.config"
48
+ :config="formJson.config"
49
49
  :prop="item.type === 'grid' ? '' : item.model"
50
50
  :componentsData="componentsData"
51
51
  @input-change="onInputChange"
@@ -60,35 +60,80 @@
60
60
 
61
61
  <script>
62
62
  import GenetateFormItem from "./GenerateFormItem";
63
- import GenetateFormItemH5 from "./GenerateFormItemH5";
64
- import Vue from "vue";
65
- import { Form } from "vant";
66
- Vue.use(Form);
63
+ // import GenetateFormItemH5 from "./GenerateFormItemH5";
64
+ // import Vue from "vue";
65
+ // import { Form } from "vant";
66
+ // Vue.use(Form);
67
67
 
68
68
  export default {
69
69
  name: "th-generate-form",
70
- components: { GenetateFormItem, GenetateFormItemH5 },
71
- props: ["data", "remote", "value", "insite", "slotKeys", "client"],
70
+ components: { GenetateFormItem },
71
+ props: {
72
+ data: {
73
+ type: Object,
74
+ default: () => {
75
+ return {};
76
+ }
77
+ },
78
+ remote: {
79
+ type: Object,
80
+ default: () => {
81
+ return {};
82
+ }
83
+ },
84
+ value: {
85
+ type: Object,
86
+ default: () => {
87
+ return {};
88
+ }
89
+ },
90
+ slotKeys: {
91
+ type: Array,
92
+ default: () => {
93
+ return [];
94
+ }
95
+ },
96
+ client: String
97
+ },
72
98
  data() {
73
99
  return {
100
+ formJson: this.data,
74
101
  models: {},
75
102
  componentsData: []
76
103
  };
77
104
  },
78
105
  computed: {
79
106
  formWidth() {
80
- if (this.data.config.width) return this.data.config.width;
107
+ if (this.formJson.config.width) return this.formJson.config.width;
81
108
  if (this.client === "mobile") return "375px";
82
109
 
83
110
  return "";
84
111
  }
85
112
  },
113
+ watch: {
114
+ data(val) {
115
+ this.formJson = val;
116
+ },
117
+ formJson: {
118
+ handler(val) {
119
+ this.$emit("update:data", val);
120
+ },
121
+ deep: true
122
+ },
123
+ value: {
124
+ deep: true,
125
+ handler(val) {
126
+ this.models = { ...this.models, ...val };
127
+ }
128
+ }
129
+ },
86
130
  created() {
87
- this.generateModle(this.data.list);
131
+ this.generateModle(this.formJson.list);
88
132
  },
89
133
  mounted() {},
90
134
  methods: {
91
135
  generateModle(genList, modelObj) {
136
+ if (!genList) return;
92
137
  genList.map(item => {
93
138
  if (item.type === "grid") {
94
139
  item.columns.forEach(item => {
@@ -185,20 +230,9 @@ export default {
185
230
  onInputChange(value, field) {
186
231
  this.$emit("on-change", field, value, this.models);
187
232
  },
188
- refresh() {}
189
- },
190
- watch: {
191
- data: {
192
- deep: true,
193
- handler(val) {
194
- // this.generateModle(val.list);
195
- }
196
- },
197
- value: {
198
- deep: true,
199
- handler(val) {
200
- this.models = { ...this.models, ...val };
201
- }
233
+ setJSON(json) {
234
+ this.formJson = json;
235
+ this.generateModle(this.formJson.list);
202
236
  }
203
237
  }
204
238
  };
@@ -33,10 +33,8 @@
33
33
  >
34
34
  <transition-group name="fade" tag="div" class="widget-form-list">
35
35
  <widget-form-item
36
- v-for="(element, elementIndex) in data.list.filter(item => {
37
- return item.key;
38
- })"
39
- :key="elementIndex"
36
+ v-for="(element, elementIndex) in widgetList"
37
+ :key="element.key"
40
38
  :widget="element"
41
39
  :widgetIndex="elementIndex"
42
40
  :widgetArray="data"
@@ -75,6 +73,11 @@ export default {
75
73
  }
76
74
  },
77
75
  computed: {
76
+ widgetList() {
77
+ return this.data.list.filter(item => {
78
+ return item.key;
79
+ });
80
+ },
78
81
  formWidth() {
79
82
  if (this.data.config.width) return this.data.config.width;
80
83
  if (this.client === "mobile") return "375px";
@@ -84,7 +87,11 @@ export default {
84
87
  },
85
88
  mounted() {
86
89
  document.body.ondrop = function(event) {
87
- let isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
90
+ let s = navigator.userAgent;
91
+ let isFirefox =
92
+ typeof s === "string"
93
+ ? s.toLowerCase().indexOf("firefox") > -1
94
+ : s.indexOf("firefox") > -1;
88
95
  if (isFirefox) {
89
96
  event.preventDefault();
90
97
  event.stopPropagation();
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <el-button
2
+ <th-button
3
3
  :style="{
4
4
  width: widget.options.width,
5
5
  height: widget.options.height
@@ -14,7 +14,7 @@
14
14
  :icon="widget.options.buttonIcon"
15
15
  >
16
16
  {{ widget.options.defaultValue }}
17
- </el-button>
17
+ </th-button>
18
18
  </template>
19
19
 
20
20
  <script>
@@ -25,9 +25,6 @@
25
25
 
26
26
  <script>
27
27
  import { itemsComponent } from "../mixins/index";
28
- import Vue from "vue";
29
- import { Field } from "vant";
30
- Vue.use(Field);
31
28
  export default {
32
29
  mixins: [itemsComponent]
33
30
  };
File without changes
File without changes
@@ -283,7 +283,7 @@ export default {
283
283
  action: this.action,
284
284
  multiple: this.multiple,
285
285
  'before-upload': this.beforeUpload,
286
- 'with-credentials': this.withCredentials,
286
+ // 'with-credentials': this.withCredentials,
287
287
  headers: this.headers,
288
288
  name: this.name,
289
289
  data: this.data,
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="el-upload-dragger"
3
+ class="th-upload-dragger"
4
4
  :class="{
5
5
  'is-dragover': dragover
6
6
  }"
@@ -2,16 +2,16 @@
2
2
  <transition-group
3
3
  tag="ul"
4
4
  :class="[
5
- 'el-upload-list',
6
- 'el-upload-list--' + listType,
5
+ 'th-upload-list',
6
+ 'th-upload-list--' + listType,
7
7
  { 'is-disabled': disabled }
8
8
  ]"
9
- name="el-list"
9
+ name="th-list"
10
10
  >
11
11
  <li
12
12
  v-for="file in files"
13
13
  :class="[
14
- 'el-upload-list__item',
14
+ 'th-upload-list__item',
15
15
  'is-' + file.status,
16
16
  focusing ? 'focusing' : ''
17
17
  ]"
@@ -24,7 +24,7 @@
24
24
  >
25
25
  <slot :file="file">
26
26
  <img
27
- class="el-upload-list__item-thumbnail"
27
+ class="th-upload-list__item-thumbnail"
28
28
  v-if="
29
29
  file.status !== 'uploading' &&
30
30
  ['picture-card', 'picture'].indexOf(listType) > -1
@@ -32,10 +32,10 @@
32
32
  :src="file.url"
33
33
  alt=""
34
34
  />
35
- <a class="el-upload-list__item-name" @click="handleClick(file)">
35
+ <a class="th-upload-list__item-name" @click="handleClick(file)">
36
36
  <i class="el-icon-document"></i>{{ file.name }}
37
37
  </a>
38
- <label class="el-upload-list__item-status-label">
38
+ <label class="th-upload-list__item-status-label">
39
39
  <i
40
40
  :class="{
41
41
  'el-icon-upload-success': true,
@@ -50,9 +50,9 @@
50
50
  v-if="!disabled"
51
51
  @click="$emit('remove', file)"
52
52
  ></i>
53
- <i class="el-icon-close-tip" v-if="!disabled">{{
53
+ <!-- <i class="el-icon-close-tip" v-if="!disabled">{{
54
54
  t("el.upload.deleteTip")
55
- }}</i>
55
+ }}</i> -->
56
56
  <!--因为close按钮只在li:focus的时候 display, li blur后就不存在了,所以键盘导航时永远无法 focus到 close按钮上-->
57
57
  <el-progress
58
58
  v-if="file.status === 'uploading'"
@@ -62,11 +62,11 @@
62
62
  >
63
63
  </el-progress>
64
64
  <span
65
- class="el-upload-list__item-actions"
65
+ class="th-upload-list__item-actions"
66
66
  v-if="listType === 'picture-card'"
67
67
  >
68
68
  <span
69
- class="el-upload-list__item-preview"
69
+ class="th-upload-list__item-preview"
70
70
  v-if="handlePreview && listType === 'picture-card'"
71
71
  @click="handlePreview(file)"
72
72
  >
@@ -74,7 +74,7 @@
74
74
  </span>
75
75
  <span
76
76
  v-if="!disabled"
77
- class="el-upload-list__item-delete"
77
+ class="th-upload-list__item-delete"
78
78
  @click="$emit('remove', file)"
79
79
  >
80
80
  <i class="el-icon-delete"></i>
@@ -85,11 +85,9 @@
85
85
  </transition-group>
86
86
  </template>
87
87
  <script>
88
- import Locale from "element-ui/src/mixins/locale";
89
88
  import ElProgress from "element-ui/packages/progress";
90
89
  export default {
91
90
  name: "ThUploadList",
92
- mixins: [Locale],
93
91
  data() {
94
92
  return {
95
93
  focusing: false
@@ -1,3 +1,12 @@
1
+ <template>
2
+ <div @click="handleClick" :class="classMatch" @keydown="handleKeydown" tabindex="0" >
3
+ <upload-dragger v-if="drag" :disabled="disabled" @file="uploadFiles"><slot></slot></upload-dragger>
4
+ <slot v-else></slot>
5
+ <input class="th-upload__input" type="file" ref="input" :name="name" @change="handleChange" :multiple="multiple" :accept="accept"></input>
6
+ </div>
7
+ </template>
8
+
9
+
1
10
  <script>
2
11
  import ajax from './ajax';
3
12
  import UploadDragger from './upload-dragger.vue';
@@ -54,7 +63,15 @@ export default {
54
63
  reqs: {}
55
64
  };
56
65
  },
57
-
66
+ computed: {
67
+ classMatch(){
68
+ const classGroup = {
69
+ 'th-upload': true
70
+ }
71
+ classGroup[`th-upload--${this.listType}`] = true;
72
+ return classGroup
73
+ },
74
+ },
58
75
  methods: {
59
76
  isImage(str) {
60
77
  return str.indexOf('image') !== -1;
@@ -172,40 +189,5 @@ export default {
172
189
  }
173
190
  }
174
191
  },
175
-
176
- render(h) {
177
- let {
178
- handleClick,
179
- drag,
180
- name,
181
- handleChange,
182
- multiple,
183
- accept,
184
- listType,
185
- uploadFiles,
186
- disabled,
187
- handleKeydown
188
- } = this;
189
- const data = {
190
- class: {
191
- 'el-upload': true
192
- },
193
- on: {
194
- click: handleClick,
195
- keydown: handleKeydown
196
- }
197
- };
198
- data.class[`el-upload--${listType}`] = true;
199
- return (
200
- <div {...data} tabindex="0" >
201
- {
202
- drag
203
- ? <upload-dragger disabled={disabled} on-file={uploadFiles}>{this.$slots.default}</upload-dragger>
204
- : this.$slots.default
205
- }
206
- <input class="el-upload__input" type="file" ref="input" name={name} on-change={handleChange} multiple={multiple} accept={accept}></input>
207
- </div>
208
- );
209
- }
210
192
  };
211
193
  </script>
@@ -17,7 +17,9 @@ export function initListenerForm(listener) {
17
17
  console.log(listener.eventDefinitions, key);
18
18
  if (key.indexOf("time") !== -1) {
19
19
  k = key;
20
- self.eventDefinitionType = key.replace("time", "").toLowerCase();
20
+ let s = key.replace("time", "");
21
+ self.eventDefinitionType =
22
+ typeof s === "string" ? s.toLowerCase() : s;
21
23
  }
22
24
  }
23
25
  console.log(k);
@@ -1,9 +0,0 @@
1
- import { t } from 'element-ui/src/locale';
2
-
3
- export default {
4
- methods: {
5
- t(...args) {
6
- return t.apply(this, args);
7
- }
8
- }
9
- };