zydx-plus 1.2.18 → 1.2.21

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,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.2.18",
3
+ "version": "1.2.21",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -57,9 +57,11 @@
57
57
  </template>
58
58
  </button>
59
59
  <div class="paginator_info">
60
- <input type="input"
60
+ <input type="text"
61
+ @keyup="handleKeyup"
61
62
  class="paginator_input"
62
- v-model.number="page" />
63
+ v-model.number="page"
64
+ @input="handleInput" />
63
65
  <span>/</span>
64
66
  <span>{{ pages }}</span>
65
67
  </div>
@@ -112,6 +114,18 @@
112
114
  <script>
113
115
  import { defineComponent } from 'vue'
114
116
  import useOffsetPagination from './useOffsetPagination.vue';
117
+ export const debounceTimer = 500
118
+ export function debounce(fn, delay = debounceTimer) {
119
+ var timeoutID = null
120
+ return function () {
121
+ clearTimeout(timeoutID)
122
+ var args = arguments
123
+ var that = this
124
+ timeoutID = setTimeout(function () {
125
+ fn.apply(that, args)
126
+ }, delay)
127
+ }
128
+ }
115
129
  export default defineComponent({
116
130
  name: 'zydx-pagination',
117
131
  components: {
@@ -145,6 +159,24 @@ export default defineComponent({
145
159
  pageChange: function (v) {
146
160
  this.$emit('page:change', v)
147
161
  this.page = v
162
+ },
163
+ handleInput: debounce(function (e) {
164
+ let input = Number(e.target.value)
165
+ if (input > this.pages) {
166
+ this.page = this.pages
167
+ this.$emit('page:change', this.page)
168
+ return
169
+ }
170
+ if (input < 1) {
171
+ this.page = 1
172
+ this.$emit('page:change', 1)
173
+ return
174
+ }
175
+ this.page = input
176
+ this.$emit('page:change', this.page)
177
+ }),
178
+ handleKeyup: function (e) {
179
+ this.page = e.target.value.replace(/[^\d]/, '')
148
180
  }
149
181
  },
150
182
  computed: {
@@ -154,16 +186,6 @@ export default defineComponent({
154
186
 
155
187
  },
156
188
  watch: {
157
- page: {
158
- handler: function (v) {
159
- if (v >= this.pages) {
160
- this.page = Number(String(this.page).slice(2))
161
- }
162
- if (v <= 1) {
163
- this.page = 1
164
- }
165
- }
166
- },
167
189
  currentPage: {
168
190
  handler: function (v) {
169
191
  if (v >= this.pages) {
@@ -68,6 +68,8 @@ export default defineComponent({
68
68
  this.isLoading = false
69
69
  this.isNextClicked = false
70
70
  this.isPrevClicked = false
71
+ } else {
72
+ this.isLoading = true
71
73
  }
72
74
  },
73
75
  immediate: true
@@ -0,0 +1,7 @@
1
+ import publicTable from './src/zydxTopicDry';
2
+
3
+ publicTable.install = function(Vue) {
4
+ Vue.component(publicTable.name, publicTable);
5
+ };
6
+
7
+ export default publicTable;
@@ -0,0 +1,39 @@
1
+ .title_box {
2
+ display: flex;
3
+ flex-direction: row;
4
+ }
5
+
6
+ .title_box>div:first-child {
7
+ flex-grow: 1;
8
+ text-overflow: ellipsis;
9
+ white-space: nowrap;
10
+ overflow: hidden;
11
+ line-height: 30px;
12
+ }
13
+
14
+ .title_box>div:last-child {
15
+ display: flex;
16
+ flex-wrap: nowrap;
17
+ align-items: center;
18
+ text-indent: 0em;
19
+ }
20
+
21
+ .title_box_a {
22
+ width: 100%;
23
+ text-align: left;
24
+ line-height: 30px;
25
+ overflow: hidden;
26
+ }
27
+
28
+ .title_box_a>div {
29
+ display: inline;
30
+ }
31
+
32
+ .title_box_a>div:last-child {
33
+ float: right;
34
+ flex-direction: row;
35
+ display: flex;
36
+ align-items: center;
37
+ height: 30px;
38
+ text-indent: 0em;
39
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @描述: 题干一类的通用样式(比如:左侧文字,右侧按钮)
3
+ * @创建时间: 2022-08-12 11:19:00
4
+ * @内容:
5
+ 必传值:名字/类型/默认值/作用
6
+ 非必传值:
7
+ isHide 是否都在一行显示, true 超出一行的部分。。。。。
8
+ * @回调事件:
9
+ @组件内方法:
10
+ */
11
+ <template>
12
+ <div>
13
+ <div :class="title_style" :style="text_indent">
14
+ <div>
15
+ <slot name="title_slot"></slot>
16
+ </div>
17
+ <div>
18
+ <slot name="button_slot"></slot>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </template>
23
+
24
+ <script>
25
+ export default {
26
+ name: 'zydx-topic-dry',
27
+ computed: { // 计算属性
28
+ title_style () {
29
+ if (this.is_hide) {
30
+ return 'title_box'
31
+ }
32
+ return 'title_box_a'
33
+ },
34
+ text_indent () {
35
+ return "text-indent: "+this.indent_em+"em;"
36
+ }
37
+ },
38
+ props: {
39
+ is_hide: { // 是否都在一行显示, true 超出一行的部分显示...
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ indent_em: { // 首行缩进em
44
+ type: Number,
45
+ default: 0
46
+ }
47
+ },
48
+ mounted() {
49
+ }
50
+ }
51
+ </script>
52
+
53
+ <style scoped src="./zydxStyle.css">
54
+ </style>
@@ -47,6 +47,13 @@ export default {
47
47
  height: {
48
48
  type: String,
49
49
  default: '30px'
50
+ },
51
+ /**
52
+ **
53
+ */
54
+ default_expand_key: {
55
+ type: Array,
56
+ default: () => []
50
57
  }
51
58
  },
52
59
  data() {
@@ -55,8 +62,8 @@ export default {
55
62
  }
56
63
  },
57
64
  mounted() {
58
-
59
65
  },
66
+
60
67
  watch: {
61
68
  data: {
62
69
  handler: function (v) {
@@ -74,16 +81,17 @@ export default {
74
81
  }
75
82
  let output = []
76
83
  for (const leaf of array) {
84
+ const { id } = leaf
77
85
  let next = {
78
86
  ...leaf,
79
- isOpen: false,
87
+ isOpen: this.default_expand_key.includes(id),
80
88
  children: leaf.children ? this.traverse(leaf.children) : []
81
89
  }
82
90
  output.push(next)
83
91
  }
84
92
  return output
85
93
  },
86
- handleClick: function (tree) {
94
+ handleClick: async function (tree) {
87
95
  this.$emit('update:select', tree)
88
96
  const { id } = tree
89
97
  this.treeData = this.treeData.map((item) => {
@@ -115,7 +123,8 @@ export default {
115
123
  <div class="tree"
116
124
  :key="tree.id"
117
125
  v-for="(tree) in treeData">
118
- <div class="tree_node"
126
+ <div :data-id="tree.id"
127
+ class="tree_node"
119
128
  :class="{ 'tree_node_active': tree.isOpen }"
120
129
  @click="handleClick(tree)">
121
130
  <template v-if="tree.level">
@@ -143,6 +152,7 @@ export default {
143
152
  <tree :data="tree.children"
144
153
  :active_color="active_color"
145
154
  :border="border"
155
+ :default_expand_key="default_expand_key"
146
156
  :key="tree.id"
147
157
  @update:select="updateSelect"
148
158
  :accordian="accordian"></tree>
@@ -168,7 +178,7 @@ export default {
168
178
  justify-content: flex-start;
169
179
  text-align: left;
170
180
  height: v-bind(height);
171
- cursor: pointer;
181
+ cursor: grabbing;
172
182
  gap: 16px;
173
183
  border-bottom: v-bind(border)
174
184
  }
package/src/index.js CHANGED
@@ -25,7 +25,7 @@ function install(app) {
25
25
  }
26
26
 
27
27
  export default {
28
- version: '1.2.18',
28
+ version: '1.2.21',
29
29
  install,
30
30
  Calendar,
31
31
  Message,