three-trees-ui 1.0.99 → 1.1.1

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.
@@ -16,23 +16,33 @@
16
16
  @click="showDialog"
17
17
  >
18
18
  <div
19
- v-if="inputWriteable"
20
- class="el-input el-input--suffix"
21
- :class="{ 'custom-selector-mobile': isMobile }"
19
+ ref="tagSpans"
20
+ style="width: calc(100% - 25px);"
21
+ :class="{
22
+ 'el-select__tags_readonly': !inputWriteable,
23
+ 'el-select__tags': inputWriteable,
24
+ }"
22
25
  >
23
- <div v-if="isMobile" class="custom-selector-mobile-box">
24
- <div
26
+ <span class="tag-wrap">
27
+ <span
25
28
  v-for="(item, index) in selectors"
26
29
  :key="index"
27
- class="common-selector-tag"
30
+ class="el-tag el-tag--info el-tag--small"
31
+ @click.stop
28
32
  >
29
- <span>{{ item.name }}</span>
30
- <i class="el-icon-error" @click.stop="handleRemove(item)"></i>
31
- </div>
32
- </div>
33
+ <span class="el-select__tags-text">{{ item.name }}</span>
34
+ <i
35
+ v-if="inputWriteable"
36
+ class="el-tag__close el-icon-close"
37
+ @click="handleRemove(item)"
38
+ ></i>
39
+ </span>
40
+ </span>
41
+ </div>
42
+ <div v-if="inputWriteable" class="el-input el-input--suffix">
33
43
  <input
34
44
  ref="inputEl"
35
- v-model="calcInputValue"
45
+ v-model="value"
36
46
  v-validate="inputValidate"
37
47
  type="text"
38
48
  readonly="readonly"
@@ -40,6 +50,10 @@
40
50
  autocomplete="off"
41
51
  class="el-input__inner"
42
52
  :placeholder="placeholder"
53
+ :style="{
54
+ height: inputSuffixHeight + 'px',
55
+ lineHeight: inputSuffixHeight + 'px',
56
+ }"
43
57
  />
44
58
  <span class="el-input__suffix">
45
59
  <span class="el-input__suffix-inner">
@@ -48,55 +62,50 @@
48
62
  </span>
49
63
  </span>
50
64
  </div>
51
- <div v-else class="el-select__tags_readonly">
52
- <span>{{ calcInputValue }}</span>
53
- </div>
54
65
  </div>
55
66
  <ht-field-tail :field-name="inputName" :input-value="value" />
56
- <template v-if="isDialogShow">
57
- <post-selector-dialog
58
- v-if="!isMobile"
59
- ref="postSelectorDialog"
60
- v-model="selectors"
61
- :title="title"
62
- :append-to-body="appendToBody"
63
- :data="data"
64
- :pagination="pagination"
65
- :select-label="selectLabel"
66
- :quick-search-props="quickSearchProps"
67
- :single="single"
68
- :search-placeholder="searchPlaceholder"
69
- :primary-field="primaryField"
70
- :mode="mode"
71
- @filter-type-change="(type) => $emit('filter-type-change', type)"
72
- @search="(word) => $emit('search', word)"
73
- @reset="() => $emit('reset')"
74
- @row-click="(row) => $emit('row-click', row)"
75
- @select-data="(data) => $emit('select-data', data)"
76
- @page-change="(page) => $emit('page-change', page)"
77
- @size-change="(size) => $emit('size-change', size)"
78
- @load-org-post="(org) => $emit('load-org-post', org)"
79
- @load-policy-post="(policy) => $emit('load-policy-post', policy)"
80
- />
81
- <post-selector-mobile-dialog
82
- v-else
83
- ref="postSelectorMobileDialog"
84
- v-model="selectors"
85
- :title="title"
86
- :append-to-body="appendToBody"
87
- :data="data"
88
- :pagination="pagination"
89
- :select-label="selectLabel"
90
- :single="single"
91
- :search-placeholder="searchPlaceholder"
92
- :primary-field="primaryField"
93
- @search="(word) => $emit('search', word)"
94
- @reset="() => $emit('reset')"
95
- @row-click="(row) => $emit('row-click', row)"
96
- @select-data="(data) => $emit('select-data', data)"
97
- @page-change="(page) => $emit('page-change', page)"
98
- />
99
- </template>
67
+ <post-selector-dialog
68
+ v-if="!isMobile"
69
+ ref="postSelectorDialog"
70
+ v-model="selectors"
71
+ :title="title"
72
+ :append-to-body="appendToBody"
73
+ :data="data"
74
+ :pagination="pagination"
75
+ :select-label="selectLabel"
76
+ :quick-search-props="quickSearchProps"
77
+ :single="single"
78
+ :search-placeholder="searchPlaceholder"
79
+ :primary-field="primaryField"
80
+ :mode="mode"
81
+ @filter-type-change="(type) => $emit('filter-type-change', type)"
82
+ @search="(word) => $emit('search', word)"
83
+ @reset="() => $emit('reset')"
84
+ @row-click="(row) => $emit('row-click', row)"
85
+ @select-data="(data) => $emit('select-data', data)"
86
+ @page-change="(page) => $emit('page-change', page)"
87
+ @size-change="(size) => $emit('size-change', size)"
88
+ @load-org-post="(org) => $emit('load-org-post', org)"
89
+ @load-policy-post="(policy) => $emit('load-policy-post', policy)"
90
+ />
91
+ <post-selector-mobile-dialog
92
+ v-else
93
+ ref="postSelectorMobileDialog"
94
+ v-model="selectors"
95
+ :title="title"
96
+ :append-to-body="appendToBody"
97
+ :data="data"
98
+ :pagination="pagination"
99
+ :select-label="selectLabel"
100
+ :single="single"
101
+ :search-placeholder="searchPlaceholder"
102
+ :primary-field="primaryField"
103
+ @search="(word) => $emit('search', word)"
104
+ @reset="() => $emit('reset')"
105
+ @row-click="(row) => $emit('row-click', row)"
106
+ @select-data="(data) => $emit('select-data', data)"
107
+ @page-change="(page) => $emit('page-change', page)"
108
+ />
100
109
  </div>
101
110
  </template>
102
111
  <script>
@@ -176,23 +185,11 @@
176
185
  },
177
186
  data() {
178
187
  return {
179
- isDialogShow: false,
180
188
  inputSuffixHeight: 30,
181
189
  selectors: [],
182
190
  }
183
191
  },
184
192
  computed: {
185
- calcInputValue: function() {
186
- let name = ''
187
- if (this.selectors) {
188
- name = this.selectors
189
- .map((k) => {
190
- return k.name
191
- })
192
- .join(',')
193
- }
194
- return name
195
- },
196
193
  primaryField: function() {
197
194
  return this.config && this.config.hasOwnProperty('id')
198
195
  ? 'id'
@@ -251,8 +248,14 @@
251
248
  // 通过valueChange事件发布值变更消息
252
249
  this.$emit('valueChange', ary.join(','), newVal)
253
250
  setTimeout(() => {
251
+ if (newVal.length > 0) {
252
+ this.calacInputSuffixHeight()
253
+ } else {
254
+ this.inputSuffixHeight = 30
255
+ }
254
256
  if (this.$refs.inputEl) {
255
- this.$validator.validate(this.inputName)
257
+ this.$refs.inputEl.focus()
258
+ this.$refs.inputEl.blur()
256
259
  }
257
260
  }, 10)
258
261
  },
@@ -318,14 +321,10 @@
318
321
  this.selectors = tmpAry
319
322
  }
320
323
  },
321
- async showDialog() {
324
+ showDialog() {
322
325
  if (!this.inputWriteable) {
323
326
  return
324
327
  }
325
- if (this.isDialogShow === false) {
326
- this.isDialogShow = true
327
- await this.$nextTick()
328
- }
329
328
  if (this.isMobile) {
330
329
  this.$refs.postSelectorMobileDialog.showDialog()
331
330
  } else {
@@ -341,12 +340,12 @@
341
340
  },
342
341
  // 更新当前输入框的高度来适配已选数据的高度
343
342
  calacInputSuffixHeight() {
344
- // if (!this.$refs.tagSpans) return
345
- // if (this.$refs.tagSpans.offsetHeight) {
346
- // this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
347
- // } else {
348
- // this.inputSuffixHeight = 30
349
- // }
343
+ if (!this.$refs.tagSpans) return
344
+ if (this.$refs.tagSpans.offsetHeight) {
345
+ this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
346
+ } else {
347
+ this.inputSuffixHeight = 30
348
+ }
350
349
  },
351
350
  },
352
351
  }
@@ -357,10 +356,6 @@
357
356
  margin-left: 1px;
358
357
  }
359
358
 
360
- .el-input__inner {
361
- height: 32px;
362
- line-height: 32px;
363
- }
364
359
  .el-select__tags_readonly {
365
360
  position: relative;
366
361
  top: 50%;
@@ -6,11 +6,10 @@
6
6
  v-else-if="contentType.indexOf('image') > -1"
7
7
  class="frame-viewer__img"
8
8
  >
9
- <el-image
10
- style="width: 100px; height: 100px"
9
+ <img
11
10
  :src="dataSrc"
12
- :preview-src-list="[dataSrc]"
13
- ></el-image>
11
+ :style="{ height: utils.isMobile() ? 'auto' : '100%' }"
12
+ />
14
13
  </div>
15
14
  <iframe
16
15
  v-else
@@ -125,12 +124,12 @@
125
124
  return
126
125
  }
127
126
  if (iframe.attachEvent) {
128
- iframe.attachEvent('onload', function () {
127
+ iframe.attachEvent('onload', function() {
129
128
  that.setFrameBody(this.contentWindow.document)
130
129
  that.watermarkRender()
131
130
  })
132
131
  } else {
133
- iframe.onload = function () {
132
+ iframe.onload = function() {
134
133
  that.setFrameBody(this.contentWindow.document)
135
134
  that.watermarkRender()
136
135
  }
@@ -16,23 +16,33 @@
16
16
  @click="showDialog"
17
17
  >
18
18
  <div
19
- v-if="inputWriteable"
20
- class="el-input el-input--suffix"
21
- :class="{ 'custom-selector-mobile': isMobile }"
19
+ ref="tagSpans"
20
+ style="width: calc(100% - 25px);"
21
+ :class="{
22
+ 'el-select__tags_readonly': !inputWriteable,
23
+ 'el-select__tags': inputWriteable,
24
+ }"
22
25
  >
23
- <div v-if="isMobile" class="custom-selector-mobile-box">
24
- <div
26
+ <span class="tag-wrap">
27
+ <span
25
28
  v-for="(item, index) in selectors"
26
29
  :key="index"
27
- class="common-selector-tag"
30
+ class="el-tag el-tag--info el-tag--small"
31
+ @click.stop
28
32
  >
29
- <span>{{ item.name }}</span>
30
- <i class="el-icon-error" @click.stop="handleRemove(item)"></i>
31
- </div>
32
- </div>
33
+ <span class="el-select__tags-text">{{ item.name }}</span>
34
+ <i
35
+ v-if="inputWriteable"
36
+ class="el-tag__close el-icon-close"
37
+ @click="handleRemove(item)"
38
+ ></i>
39
+ </span>
40
+ </span>
41
+ </div>
42
+ <div v-if="inputWriteable" class="el-input el-input--suffix">
33
43
  <input
34
44
  ref="inputEl"
35
- v-model="calcInputValue"
45
+ v-model="value"
36
46
  v-validate="inputValidate"
37
47
  type="text"
38
48
  readonly="readonly"
@@ -40,6 +50,10 @@
40
50
  autocomplete="off"
41
51
  class="el-input__inner"
42
52
  :placeholder="placeholder"
53
+ :style="{
54
+ height: inputSuffixHeight + 'px',
55
+ lineHeight: inputSuffixHeight + 'px',
56
+ }"
43
57
  />
44
58
  <span class="el-input__suffix">
45
59
  <span class="el-input__suffix-inner">
@@ -48,55 +62,50 @@
48
62
  </span>
49
63
  </span>
50
64
  </div>
51
- <div v-else class="el-select__tags_readonly">
52
- <span>{{ calcInputValue }}</span>
53
- </div>
54
65
  </div>
55
66
  <ht-field-tail :field-name="inputName" :input-value="value" />
56
- <template v-if="isDialogShow">
57
- <role-selector-mobile-dialog
58
- v-if="isMobile"
59
- ref="roleSelectorMobileDialog"
60
- v-model="selectors"
61
- :search-placeholder="searchPlaceholder"
62
- :single="single"
63
- :data="data"
64
- :table-columns="tableColumns"
65
- :pagination="pagination"
66
- :select-label="selectLabel"
67
- :quick-search-props="quickSearchProps"
68
- :append-to-body="appendToBody"
69
- :title="title"
70
- :primary-field="primaryField"
71
- @search="(word) => $emit('search', word)"
72
- @reset="() => $emit('reset')"
73
- @row-click="(row) => $emit('row-click', row)"
74
- @select-data="(data) => $emit('select-data', data)"
75
- @page-change="(page) => $emit('page-change', page)"
76
- />
77
- <role-selector-dialog
78
- v-else
79
- ref="roleSelectorDialog"
80
- v-model="selectors"
81
- :title="title"
82
- :append-to-body="appendToBody"
83
- :data="data"
84
- :pagination="pagination"
85
- :select-label="selectLabel"
86
- :quick-search-props="quickSearchProps"
87
- :single="single"
88
- :search-placeholder="searchPlaceholder"
89
- :primary-field="primaryField"
90
- :mode="mode"
91
- @filter-type-change="(type) => $emit('filter-type-change', type)"
92
- @search="(word) => $emit('search', word)"
93
- @reset="() => $emit('reset')"
94
- @row-click="(row) => $emit('row-click', row)"
95
- @select-data="(data) => $emit('select-data', data)"
96
- @page-change="(page) => $emit('page-change', page)"
97
- @size-change="(size) => $emit('size-change', size)"
98
- />
99
- </template>
67
+ <role-selector-mobile-dialog
68
+ v-if="isMobile"
69
+ ref="roleSelectorMobileDialog"
70
+ v-model="selectors"
71
+ :search-placeholder="searchPlaceholder"
72
+ :single="single"
73
+ :data="data"
74
+ :table-columns="tableColumns"
75
+ :pagination="pagination"
76
+ :select-label="selectLabel"
77
+ :quick-search-props="quickSearchProps"
78
+ :append-to-body="appendToBody"
79
+ :title="title"
80
+ :primary-field="primaryField"
81
+ @search="(word) => $emit('search', word)"
82
+ @reset="() => $emit('reset')"
83
+ @row-click="(row) => $emit('row-click', row)"
84
+ @select-data="(data) => $emit('select-data', data)"
85
+ @page-change="(page) => $emit('page-change', page)"
86
+ />
87
+ <role-selector-dialog
88
+ v-else
89
+ ref="roleSelectorDialog"
90
+ v-model="selectors"
91
+ :title="title"
92
+ :append-to-body="appendToBody"
93
+ :data="data"
94
+ :pagination="pagination"
95
+ :select-label="selectLabel"
96
+ :quick-search-props="quickSearchProps"
97
+ :single="single"
98
+ :search-placeholder="searchPlaceholder"
99
+ :primary-field="primaryField"
100
+ :mode="mode"
101
+ @filter-type-change="(type) => $emit('filter-type-change', type)"
102
+ @search="(word) => $emit('search', word)"
103
+ @reset="() => $emit('reset')"
104
+ @row-click="(row) => $emit('row-click', row)"
105
+ @select-data="(data) => $emit('select-data', data)"
106
+ @page-change="(page) => $emit('page-change', page)"
107
+ @size-change="(size) => $emit('size-change', size)"
108
+ />
100
109
  </div>
101
110
  </template>
102
111
  <script>
@@ -173,23 +182,11 @@
173
182
  },
174
183
  data() {
175
184
  return {
176
- isDialogShow: false,
177
185
  inputSuffixHeight: 30,
178
186
  selectors: [],
179
187
  }
180
188
  },
181
189
  computed: {
182
- calcInputValue: function() {
183
- let name = ''
184
- if (this.selectors) {
185
- name = this.selectors
186
- .map((k) => {
187
- return k.name
188
- })
189
- .join(',')
190
- }
191
- return name
192
- },
193
190
  primaryField: function() {
194
191
  return this.config && this.config.hasOwnProperty('id')
195
192
  ? 'id'
@@ -248,8 +245,14 @@
248
245
  // 通过valueChange事件发布值变更消息
249
246
  this.$emit('valueChange', ary.join(','), newVal)
250
247
  setTimeout(() => {
248
+ if (newVal.length > 0) {
249
+ this.calacInputSuffixHeight()
250
+ } else {
251
+ this.inputSuffixHeight = 30
252
+ }
251
253
  if (this.$refs.inputEl) {
252
- this.$validator.validate(this.inputName)
254
+ this.$refs.inputEl.focus()
255
+ this.$refs.inputEl.blur()
253
256
  }
254
257
  }, 10)
255
258
  },
@@ -314,14 +317,10 @@
314
317
  this.selectors = tmpAry
315
318
  }
316
319
  },
317
- async showDialog() {
320
+ showDialog() {
318
321
  if (!this.inputWriteable) {
319
322
  return
320
323
  }
321
- if (this.isDialogShow === false) {
322
- this.isDialogShow = true
323
- await this.$nextTick()
324
- }
325
324
  if (this.isMobile) {
326
325
  this.$refs.roleSelectorMobileDialog.showDialog()
327
326
  } else {
@@ -338,12 +337,12 @@
338
337
  },
339
338
  // 更新当前输入框的高度来适配已选数据的高度
340
339
  calacInputSuffixHeight() {
341
- // if (!this.$refs.tagSpans) return
342
- // if (this.$refs.tagSpans.offsetHeight) {
343
- // this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
344
- // } else {
345
- // this.inputSuffixHeight = 30
346
- // }
340
+ if (!this.$refs.tagSpans) return
341
+ if (this.$refs.tagSpans.offsetHeight) {
342
+ this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5
343
+ } else {
344
+ this.inputSuffixHeight = 30
345
+ }
347
346
  },
348
347
  },
349
348
  }
@@ -354,11 +353,6 @@
354
353
  margin-left: 1px;
355
354
  }
356
355
 
357
- .el-input__inner {
358
- height: 32px;
359
- line-height: 32px;
360
- }
361
-
362
356
  .el-select__tags_readonly {
363
357
  position: relative;
364
358
  top: 50%;
@@ -493,7 +493,6 @@
493
493
  let _this = this
494
494
  _this.reloadOnlineForm = true
495
495
  setTimeout(() => {
496
- let data = this.data
497
496
  eval(rep.diyJs)
498
497
  }, 10)
499
498
  },