zydx-plus 1.2.18 → 1.3.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.3.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,27 @@
1
+ import { createVNode, render } from 'vue'
2
+ import spinner from './src/spinner.vue'
3
+
4
+ // 准备div容器
5
+ const divNode = createVNode('div', { class: 'spinner-container' })
6
+ render(divNode, document.body)
7
+ // 获取 DOM 节点, 用于挂载组件或卸载组件
8
+ const container = divNode.el
9
+ let instance = null
10
+
11
+ const Modal = () => {
12
+ const destory = () => {
13
+ render(null, container)
14
+ }
15
+ let VNode
16
+ if (!instance) {
17
+ VNode = createVNode(spinner, {})
18
+ instance = VNode
19
+ }
20
+ return {
21
+ open: function () {
22
+ render(VNode, container)
23
+ },
24
+ close: () => destory()
25
+ }
26
+ }
27
+ export default Modal
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <Teleport to="body">
3
+ <transition>
4
+ <div class="mask">
5
+ <div class="spinner_wrapper">
6
+ <div class="lds-roller">
7
+ <div></div>
8
+ <div></div>
9
+ <div></div>
10
+ <div></div>
11
+ <div></div>
12
+ <div></div>
13
+ <div></div>
14
+ <div></div>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </transition>
19
+ </Teleport>
20
+ </template>
21
+
22
+ <script>
23
+ import { defineComponent } from 'vue';
24
+ export default defineComponent({
25
+ name: 'zydx-spinner',
26
+ mounted() {
27
+ document.querySelector('body').style.overflow = 'hidden'
28
+ },
29
+ beforeUnmount() {
30
+ document.querySelector('body').style.overflow = 'auto'
31
+ },
32
+ })
33
+ </script>
34
+
35
+ <style scoped>
36
+ .v-enter-active,
37
+ .v-leave-active {
38
+ transition: opacity 0.5s ease;
39
+ }
40
+
41
+ .v-enter-from,
42
+ .v-leave-to {
43
+ opacity: 0;
44
+ }
45
+
46
+ .mask {
47
+ position: fixed;
48
+ top: 0;
49
+ bottom: 0;
50
+ right: 0;
51
+ left: 0;
52
+ width: 100vw;
53
+ height: 100vh;
54
+ background-color: transparent;
55
+ z-index: 1300;
56
+ border: none;
57
+ padding: 0;
58
+ margin: 0;
59
+ }
60
+
61
+ .spinner_wrapper {
62
+ width: 100%;
63
+ height: 100%;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ }
68
+
69
+ .lds-roller {
70
+ display: inline-block;
71
+ position: relative;
72
+ width: 80px;
73
+ height: 80px;
74
+ }
75
+
76
+ .lds-roller div {
77
+ animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
78
+ transform-origin: 40px 40px;
79
+ }
80
+
81
+ .lds-roller div:after {
82
+ content: " ";
83
+ display: block;
84
+ position: absolute;
85
+ width: 7px;
86
+ height: 7px;
87
+ border-radius: 50%;
88
+ background: #bdbdbd;
89
+ margin: -4px 0 0 -4px;
90
+ }
91
+
92
+ .lds-roller div:nth-child(1) {
93
+ animation-delay: -0.036s;
94
+ }
95
+
96
+ .lds-roller div:nth-child(1):after {
97
+ top: 63px;
98
+ left: 63px;
99
+ }
100
+
101
+ .lds-roller div:nth-child(2) {
102
+ animation-delay: -0.072s;
103
+ }
104
+
105
+ .lds-roller div:nth-child(2):after {
106
+ top: 68px;
107
+ left: 56px;
108
+ }
109
+
110
+ .lds-roller div:nth-child(3) {
111
+ animation-delay: -0.108s;
112
+ }
113
+
114
+ .lds-roller div:nth-child(3):after {
115
+ top: 71px;
116
+ left: 48px;
117
+ }
118
+
119
+ .lds-roller div:nth-child(4) {
120
+ animation-delay: -0.144s;
121
+ }
122
+
123
+ .lds-roller div:nth-child(4):after {
124
+ top: 72px;
125
+ left: 40px;
126
+ }
127
+
128
+ .lds-roller div:nth-child(5) {
129
+ animation-delay: -0.18s;
130
+ }
131
+
132
+ .lds-roller div:nth-child(5):after {
133
+ top: 71px;
134
+ left: 32px;
135
+ }
136
+
137
+ .lds-roller div:nth-child(6) {
138
+ animation-delay: -0.216s;
139
+ }
140
+
141
+ .lds-roller div:nth-child(6):after {
142
+ top: 68px;
143
+ left: 24px;
144
+ }
145
+
146
+ .lds-roller div:nth-child(7) {
147
+ animation-delay: -0.252s;
148
+ }
149
+
150
+ .lds-roller div:nth-child(7):after {
151
+ top: 63px;
152
+ left: 17px;
153
+ }
154
+
155
+ .lds-roller div:nth-child(8) {
156
+ animation-delay: -0.288s;
157
+ }
158
+
159
+ .lds-roller div:nth-child(8):after {
160
+ top: 56px;
161
+ left: 12px;
162
+ }
163
+
164
+ @keyframes lds-roller {
165
+ 0% {
166
+ transform: rotate(0deg);
167
+ }
168
+
169
+ 100% {
170
+ transform: rotate(360deg);
171
+ }
172
+ }
173
+ </style>
@@ -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
  }
@@ -0,0 +1,6 @@
1
+ import main from './src/year';
2
+
3
+ main.install = function(Vue) {
4
+ Vue.component(main.name, main);
5
+ };
6
+ export default main;
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <div class="year">
3
+ <div class="year-cont">
4
+ <div class='calendar-Time-header under_line'>
5
+ <span class='calendar-lastMonth' @click="last">{{ lastText }}</span>
6
+ <span class='calendar-TimeH'>{{ yearData }}</span>
7
+ <span class='calendar-nextMonth' @click="next">{{ nextText }}</span>
8
+ </div>
9
+ <div class="year-list">
10
+ <div class="year-li" :class="{active: item === timeObj}" v-for="item in yearList" @click="yearTap(item)">
11
+ <span>{{ item }}</span>
12
+ </div>
13
+ <div class="year-li">
14
+ <span></span>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ export default {
23
+ name: "zydx-year",
24
+ props: {
25
+ lastText: {
26
+ type: String,
27
+ default: '《'
28
+ },
29
+ nextText: {
30
+ type: String,
31
+ default: '》'
32
+ },
33
+ yearStart: { //最低年
34
+ type: String,
35
+ default: '1970'
36
+ },
37
+ yearEnd: { //最高年
38
+ type: String,
39
+ default: '2100'
40
+ },
41
+ },
42
+ data() {
43
+ return {
44
+ yearData: '',
45
+ yearList: [],
46
+ min: 0,
47
+ max: 0,
48
+ timeObj: 0
49
+ }
50
+ },
51
+ created() {
52
+ this.render();
53
+ },
54
+ methods: {
55
+ render() {
56
+ this.timeObj = new Date().getFullYear();
57
+ this.min = this.timeObj - 5
58
+ this.max = this.timeObj + 5
59
+ this.yearFun()
60
+ },
61
+ yearFun() {
62
+ this.yearList = []
63
+ if(this.min < Number(this.yearStart)) {
64
+ this.min = Number(this.yearStart)
65
+ this.max = Number(this.yearStart) + 10
66
+ }
67
+ if(this.max > Number(this.yearEnd)) {
68
+ this.min = Number(this.yearEnd) - 10
69
+ this.max = Number(this.yearEnd)
70
+ }
71
+ this.yearData = `${this.min}-${this.max}`
72
+ for(let i = this.min; i < this.max+1; i++) {
73
+ this.yearList.push(i)
74
+ }
75
+ },
76
+ last() {
77
+ this.min = this.min - 10
78
+ this.max = this.max - 10
79
+ this.yearFun()
80
+ },
81
+ next() {
82
+ this.min = this.min + 10
83
+ this.max = this.max + 10
84
+ this.yearFun()
85
+ },
86
+ yearTap(data) {
87
+ this.$emit('confirm',data)
88
+ }
89
+ }
90
+ }
91
+ </script>
92
+
93
+ <style scoped>
94
+ .year{
95
+ position: absolute;
96
+ top: 22px;
97
+ right: 0;
98
+ width: 300px;
99
+ z-index: 100;
100
+ background-color: #fff;
101
+ box-shadow: 0 0 4px 1px #ccc;
102
+ border-radius: 5px;
103
+ padding: 0 10px;
104
+ display: grid;
105
+ user-select: none;
106
+ }
107
+ .calendar-Time-header{
108
+ text-align: center;
109
+ vertical-align: middle;
110
+ padding: 15px 0;
111
+ font-size: 14px;
112
+ }
113
+ .calendar-lastMonth{
114
+ width: 30px;
115
+ font-size: 12px;
116
+ margin-right: 70px;
117
+ padding: 0 5px;
118
+ text-align: center;
119
+ cursor: pointer;
120
+ }
121
+ .calendar-nextMonth{
122
+ width: 30px;
123
+ text-align: center;
124
+ margin-left: 70px;
125
+ font-size: 12px;
126
+ padding: 0 5px;
127
+ cursor: pointer;
128
+ }
129
+ .year-list{
130
+ margin-bottom: 20px;
131
+ overflow: hidden;
132
+ border-left: 1px solid #ccc;
133
+ border-top: 1px solid #ccc;
134
+ }
135
+ .year-li{
136
+ width: 25%;
137
+ float: left;
138
+ text-align: center;
139
+ height: 70px;
140
+ line-height: 70px;
141
+ font-size: 14px;
142
+ border-right: 1px solid #ccc;
143
+ border-bottom: 1px solid #ccc;
144
+ cursor: pointer;
145
+ }
146
+ .year-li:hover{
147
+ color: #c64c10;
148
+ }
149
+ .active{
150
+ font-weight: 600;
151
+ color: #c64c10;
152
+ }
153
+ </style>
package/src/index.js CHANGED
@@ -6,6 +6,7 @@ import coloring from './components/coloring/index';
6
6
  import tree from './components/tree/index';
7
7
  import Pagination from './components/pagination/index';
8
8
  import Select from './components/select/index';
9
+ import Year from './components/year/index';
9
10
 
10
11
  const components = [
11
12
  Calendar,
@@ -14,7 +15,8 @@ const components = [
14
15
  coloring,
15
16
  tree,
16
17
  Pagination,
17
- Select
18
+ Select,
19
+ Year
18
20
  ];
19
21
 
20
22
  function install(app) {
@@ -25,7 +27,7 @@ function install(app) {
25
27
  }
26
28
 
27
29
  export default {
28
- version: '1.2.18',
30
+ version: '1.3.21',
29
31
  install,
30
32
  Calendar,
31
33
  Message,
@@ -34,6 +36,7 @@ export default {
34
36
  coloring,
35
37
  tree,
36
38
  Pagination,
37
- Select
39
+ Select,
40
+ Year
38
41
  };
39
42