@tagplus/components 0.2.109 → 0.2.110

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
@@ -7,7 +7,7 @@
7
7
  "email": "bruno@tagplus.com.br"
8
8
  }
9
9
  ],
10
- "version": "0.2.109",
10
+ "version": "0.2.110",
11
11
  "main": "./dist/tp.common.js",
12
12
  "directories": {
13
13
  "lib": "src/lib"
@@ -29,7 +29,7 @@
29
29
  "doc": "yarn docs",
30
30
  "docs": "nodemon --exec \"vuese gen && vuese serve\" --watch ./src -e js,vue,scss",
31
31
  "docs:gen": "vuese gen",
32
- "lint": "vue-cli-service lint",
32
+ "lint": "eslint --cache --ext .js,.vue --ignore-path .gitignore .",
33
33
  "pub": "yarn build && yarn publish --access public",
34
34
  "pub:beta": "yarn build && yarn publish --tag beta",
35
35
  "serve": "vue-cli-service serve --open ./examples/main.js",
@@ -51,20 +51,22 @@
51
51
  "vue-i18n": "^8.14.0"
52
52
  },
53
53
  "devDependencies": {
54
+ "@babel/eslint-parser": "^7.17.0",
55
+ "@nuxtjs/eslint-config": "^8.0.0",
56
+ "@nuxtjs/eslint-module": "^3.0.2",
54
57
  "@vue/cli-plugin-babel": "^5.0.3",
55
- "@vue/cli-plugin-eslint": "^5.0.3",
56
58
  "@vue/cli-plugin-unit-jest": "^5.0.3",
57
59
  "@vue/cli-service": "^5.0.3",
58
- "@vue/eslint-config-prettier": "^6.0.0",
59
60
  "@vue/test-utils": "1.0.0-beta.30",
60
61
  "@vuese/cli": "^2.10.0",
61
62
  "babel-core": "7.0.0-bridge.0",
62
- "babel-eslint": "^10.0.1",
63
63
  "babel-jest": "^24.9.0",
64
64
  "babel-plugin-module-resolver": "^3.2.0",
65
- "eslint": "^6.2.2",
66
- "eslint-plugin-prettier": "^3.1.0",
67
- "eslint-plugin-vue": "^6.0.1",
65
+ "eslint": "^8.9.0",
66
+ "eslint-config-prettier": "^8.4.0",
67
+ "eslint-config-standard": "^16.0.3",
68
+ "eslint-plugin-nuxt": ">=0.4.2",
69
+ "eslint-plugin-prettier": "^4.0.0",
68
70
  "node-sass": "^4.9.0",
69
71
  "nodemon": "^2.0.1",
70
72
  "prettier": "^1.18.2",
@@ -18,7 +18,7 @@
18
18
 
19
19
  <template
20
20
  v-for="(_, slot) of $scopedSlots"
21
- v-slot:[slot]="scope"
21
+ #[slot]="scope"
22
22
  >
23
23
  <slot
24
24
  :name="slot"
@@ -0,0 +1,222 @@
1
+ <template>
2
+ <div
3
+ class="el-step"
4
+ :style="style"
5
+ :class="[
6
+ !isSimple && `is-${$parent.direction}`,
7
+ isSimple && 'is-simple',
8
+ isLast && !space && !isCenter && 'is-flex',
9
+ isCenter && !isVertical && !isSimple && 'is-center']"
10
+ >
11
+ <!-- icon & line -->
12
+ <div
13
+ class="el-step__head"
14
+ :class="`is-${currentStatus === 'active' ? 'finish' : currentStatus}`"
15
+ >
16
+ <div
17
+ class="el-step__line"
18
+ :style="isLast ? '' : { marginRight: $parent.stepOffset + 'px' }"
19
+ >
20
+ <i class="el-step__line-inner" :style="lineStyle" />
21
+ </div>
22
+
23
+ <div class="el-step__icon" :class="`is-${icon ? 'icon' : 'text'}`">
24
+ <slot
25
+ v-if="currentStatus !== 'success' && currentStatus !== 'error'"
26
+ name="icon"
27
+ >
28
+ <i v-if="icon" class="el-step__icon-inner" :class="[icon]" />
29
+ <div v-if="!icon && !isSimple" class="el-step__icon-inner">
30
+ {{ index + 1 }}
31
+ </div>
32
+ </slot>
33
+ <i
34
+ v-else
35
+ :class="['el-icon-' + (currentStatus === 'success' ? 'check' : 'close')]"
36
+ class="el-step__icon-inner is-status"
37
+ />
38
+ </div>
39
+ </div>
40
+ <!-- title & description -->
41
+ <div class="el-step__main">
42
+ <div
43
+ ref="title"
44
+ class="el-step__title"
45
+ :class="['is-' + currentStatus]"
46
+ >
47
+ <slot name="title">
48
+ {{ title }}
49
+ </slot>
50
+ </div>
51
+ <div v-if="isSimple" class="el-step__arrow" />
52
+ <div
53
+ v-else
54
+ class="el-step__description"
55
+ :class="['is-' + currentStatus]"
56
+ >
57
+ <slot name="description">
58
+ {{ description }}
59
+ </slot>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </template>
64
+ <script>
65
+ export default {
66
+ name: 'TpStep',
67
+
68
+ props: {
69
+ title: {
70
+ type: String,
71
+ default: ''
72
+ },
73
+ icon: {
74
+ type: String,
75
+ default: ''
76
+ },
77
+ description: {
78
+ type: String,
79
+ default: ''
80
+ },
81
+ status: {
82
+ type: String,
83
+ default: ''
84
+ }
85
+ },
86
+
87
+ data() {
88
+ return {
89
+ index: -1,
90
+ lineStyle: {},
91
+ internalStatus: ''
92
+ }
93
+ },
94
+
95
+ computed: {
96
+ currentStatus() {
97
+ return this.internalStatus
98
+ },
99
+ prevStatus() {
100
+ const prevStep = this.$parent.steps[this.index - 1]
101
+ return prevStep ? prevStep.currentStatus : 'wait'
102
+ },
103
+ isCenter() {
104
+ return this.$parent.alignCenter
105
+ },
106
+ isVertical() {
107
+ return this.$parent.direction === 'vertical'
108
+ },
109
+ isSimple() {
110
+ return this.$parent.simple
111
+ },
112
+ isLast() {
113
+ const parent = this.$parent
114
+ return parent.steps[parent.steps.length - 1] === this
115
+ },
116
+ stepsCount() {
117
+ return this.$parent.steps.length
118
+ },
119
+ space() {
120
+ const { isSimple, $parent: { space } } = this
121
+ return isSimple ? '' : space
122
+ },
123
+ style: function() {
124
+ const style = {}
125
+ const parent = this.$parent
126
+ const len = parent.steps.length
127
+
128
+ const space = (typeof this.space === 'number'
129
+ ? this.space + 'px'
130
+ : this.space
131
+ ? this.space
132
+ : 100 / (len - (this.isCenter ? 0 : 1)) + '%')
133
+ style.flexBasis = space
134
+ if (this.isVertical) return style
135
+ if (this.isLast) {
136
+ style.maxWidth = 100 / this.stepsCount + '%'
137
+ } else {
138
+ style.marginRight = -this.$parent.stepOffset + 'px'
139
+ }
140
+
141
+ return style
142
+ }
143
+ },
144
+
145
+ watch: {
146
+ status (newVal) {
147
+ if(newVal === 'process' || newVal === 'error'){
148
+ this.updateStatus(this.$parent.active)
149
+ }
150
+ },
151
+
152
+ },
153
+
154
+ beforeCreate() {
155
+ this.$parent.steps.push(this)
156
+ },
157
+
158
+ beforeDestroy() {
159
+ const steps = this.$parent.steps
160
+ const index = steps.indexOf(this)
161
+ if (index >= 0) {
162
+ steps.splice(index, 1)
163
+ }
164
+ },
165
+
166
+ mounted() {
167
+ const unwatch = this.$watch('index', () => {
168
+ this.$watch('$parent.active', this.updateStatus, { immediate: true })
169
+ this.$watch('$parent.processStatus', () => {
170
+ const activeIndex = this.$parent.active
171
+ this.updateStatus(activeIndex)
172
+ }, { immediate: true })
173
+ unwatch()
174
+ })
175
+ },
176
+
177
+ methods: {
178
+ updateStatus(val) {
179
+ const prevChild = this.$parent.$children[this.index - 1]
180
+
181
+ if (this.status === 'error'){
182
+ this.internalStatus = 'error'
183
+ } else if (val > this.index) {
184
+ this.internalStatus = this.$parent.finishStatus
185
+ } else if (val === this.index && this.prevStatus !== 'error') {
186
+ this.internalStatus = this.$parent.processStatus
187
+ } else if (this.$parent.newItem && this.prevStatus !== 'error') {
188
+ this.internalStatus = 'wait'
189
+ }
190
+
191
+ if (prevChild) prevChild.calcProgress(this.internalStatus)
192
+ },
193
+
194
+ calcProgress(status) {
195
+ let step = 100
196
+ const style = {}
197
+
198
+ style.transitionDelay = 150 * this.index + 'ms'
199
+ // if (status === this.$parent.processStatus) {
200
+ // step = this.currentStatus !== 'error' ? 0 : 0
201
+ // } else
202
+ if (status === 'wait') {
203
+ step = 0
204
+ style.transitionDelay = (-50 * this.index) + 'ms'
205
+ }
206
+
207
+ style.borderWidth = step && !this.isSimple ? '1px' : 0
208
+ this.$parent.direction === 'vertical'
209
+ ? style.height = step + '%'
210
+ : style.width = step + '%'
211
+
212
+ this.lineStyle = style
213
+ }
214
+ }
215
+ }
216
+ </script>
217
+ <style lang="scss" scoped>
218
+ .el-step__head.is-process {
219
+ color: #2d6eda;
220
+ border-color: #2d6eda;
221
+ }
222
+ </style>
@@ -0,0 +1,3 @@
1
+ import Step from './Step'
2
+
3
+ export default Step
@@ -0,0 +1,19 @@
1
+
2
+ <script>
3
+ import { Steps } from 'element-ui'
4
+
5
+ export default {
6
+ name: 'TpSteps',
7
+ extends: Steps,
8
+ props: {
9
+ newItem: {
10
+ type: Boolean,
11
+ default: false
12
+ }
13
+ },
14
+ }
15
+
16
+ </script>
17
+
18
+ <style lang="scss" scoped>
19
+ </style>
@@ -0,0 +1,3 @@
1
+ import Steps from './Steps'
2
+
3
+ export default Steps
@@ -8,6 +8,8 @@ import Loader from './Loader'
8
8
  import Skeleton from './Skeleton'
9
9
  import Tip from './Tip'
10
10
  import Multisuggest from './Multisuggest'
11
+ import Step from './Step'
12
+ import Steps from './Steps'
11
13
  import InputNumber from './InputNumber'
12
14
 
13
15
  export {
@@ -21,5 +23,7 @@ export {
21
23
  Skeleton,
22
24
  Tip,
23
25
  Multisuggest,
26
+ Step,
27
+ Steps,
24
28
  InputNumber
25
29
  }