n20-common-lib 1.1.10

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.
Files changed (85) hide show
  1. package/README.md +24 -0
  2. package/package.json +120 -0
  3. package/src/assets/css/_coreLib.scss +26 -0
  4. package/src/assets/css/cl-approve-card.scss +66 -0
  5. package/src/assets/css/cl-drag-list.scss +22 -0
  6. package/src/assets/css/cl-empty.scss +10 -0
  7. package/src/assets/css/cl-expandable.scss +31 -0
  8. package/src/assets/css/cl-file-upload-table.scss +11 -0
  9. package/src/assets/css/cl-filter.scss +20 -0
  10. package/src/assets/css/cl-foldedpanel.scss +35 -0
  11. package/src/assets/css/cl-footer-box.scss +8 -0
  12. package/src/assets/css/cl-form-item.scss +281 -0
  13. package/src/assets/css/cl-more-tab.scss +98 -0
  14. package/src/assets/css/cl-nav-menu.scss +5 -0
  15. package/src/assets/css/cl-pagination.scss +71 -0
  16. package/src/assets/css/cl-secondary-tab.scss +30 -0
  17. package/src/assets/css/cl-sifting.scss +51 -0
  18. package/src/assets/css/cl-statis.scss +14 -0
  19. package/src/assets/css/cl-step.scss +164 -0
  20. package/src/assets/css/cl-suspend.scss +25 -0
  21. package/src/assets/css/cl-tertiary-tab.scss +37 -0
  22. package/src/assets/css/cl-upload.scss +41 -0
  23. package/src/assets/css/cl-worn-pagination.scss +50 -0
  24. package/src/assets/css/element-variables.scss +1053 -0
  25. package/src/assets/css/element.dev.scss +5 -0
  26. package/src/assets/css/font-icon.scss +22 -0
  27. package/src/assets/css/index.dev.scss +3 -0
  28. package/src/assets/css/index.scss +8 -0
  29. package/src/assets/css/normalize.scss +243 -0
  30. package/src/assets/css/rootvar.scss +66 -0
  31. package/src/assets/css/title-pop.scss +4 -0
  32. package/src/assets/getJsonc.js +51 -0
  33. package/src/assets/postMessage.js +2 -0
  34. package/src/assets/postMessageC.js +37 -0
  35. package/src/components/ApproveCard/index.vue +83 -0
  36. package/src/components/DatePicker/index.vue +22 -0
  37. package/src/components/Dialog/index.vue +115 -0
  38. package/src/components/DragList/index.vue +64 -0
  39. package/src/components/Empty/img/404.png +0 -0
  40. package/src/components/Empty/img/abnormal.svg +109 -0
  41. package/src/components/Empty/img/dispose.svg +72 -0
  42. package/src/components/Empty/img/empty.svg +58 -0
  43. package/src/components/Empty/img/general.svg +59 -0
  44. package/src/components/Empty/img/lock.svg +58 -0
  45. package/src/components/Empty/img/network.svg +60 -0
  46. package/src/components/Empty/img/relevant.svg +69 -0
  47. package/src/components/Empty/img/search.svg +73 -0
  48. package/src/components/Empty/index.vue +92 -0
  49. package/src/components/Expandable/index.vue +47 -0
  50. package/src/components/FileUploadTable/index.vue +456 -0
  51. package/src/components/Filters/index.vue +77 -0
  52. package/src/components/FoldedPanel/index.vue +64 -0
  53. package/src/components/FooterBox/index.vue +18 -0
  54. package/src/components/InputNumber/index.vue +126 -0
  55. package/src/components/MoreTab/index.vue +232 -0
  56. package/src/components/NavMenu/index.vue +90 -0
  57. package/src/components/Pagination/index.vue +126 -0
  58. package/src/components/SecondaryTab/index.vue +75 -0
  59. package/src/components/Select/index.vue +51 -0
  60. package/src/components/Sifting/index.vue +97 -0
  61. package/src/components/Statis/index.vue +55 -0
  62. package/src/components/Step/index.vue +65 -0
  63. package/src/components/Suspend/index.vue +63 -0
  64. package/src/components/Suspend/suspensionBtn.png +0 -0
  65. package/src/components/TertiaryTab/index.vue +49 -0
  66. package/src/components/TimePicker/index.vue +22 -0
  67. package/src/components/Upload/index.vue +237 -0
  68. package/src/components/WornPagination/index.vue +202 -0
  69. package/src/directives/VMove/index.js +42 -0
  70. package/src/directives/VTitle/index.js +55 -0
  71. package/src/directives/VTitle/tooltip.vue +21 -0
  72. package/src/directives/vDrag/index.js +72 -0
  73. package/src/index.js +111 -0
  74. package/src/utils/auth.js +41 -0
  75. package/src/utils/axios.js +180 -0
  76. package/src/utils/print.js +156 -0
  77. package/src/utils/pushLink.js +5 -0
  78. package/style/css/normalize.scss +243 -0
  79. package/style/fonts/element-icons.535877f5.woff +0 -0
  80. package/style/fonts/element-icons.732389de.ttf +0 -0
  81. package/style/index.css +3 -0
  82. package/style/index.css.map +1 -0
  83. package/style/index.umd.min.js +2 -0
  84. package/style/index.umd.min.js.map +1 -0
  85. package/style/server-config.jsonc +212 -0
@@ -0,0 +1,202 @@
1
+ <template>
2
+ <div class="cl-worn-pagination">
3
+ <el-button :class="isbanprev ? 'isban' :''" plain onlyicon size="mini" icon="el-icon-arrow-left" @click="prev" />
4
+ <el-button :class="isban ? 'isban' :''" plain onlyicon size="mini" icon="el-icon-arrow-right" @click="next" />
5
+ <span class="pages">
6
+ <span>{{ current }}</span
7
+ >/{{ totalPage }}
8
+ </span>
9
+ <div class="page-jumper">
10
+ <span>到第</span>
11
+ <el-input
12
+ v-model="input"
13
+ class="el-pagination__editor"
14
+ :min="1"
15
+ :max="totalPage"
16
+ type="number"
17
+ @blur="onBlurPage"
18
+ @change="handleChange"
19
+ />
20
+
21
+ <span>页</span>
22
+ </div>
23
+ <i class="setting el-icon-s-tools" @click="goSetting"></i>
24
+ <div v-show="showSetting" class="setting-wrapper" @click="prevent">
25
+ <span class="hint">每页显示</span>
26
+ <el-button
27
+ v-for="(n, i) in settings"
28
+ :key="'pagination-setting-' + i"
29
+ size="mini"
30
+ type="primary"
31
+ @click="handleSizeChange(n)"
32
+ >{{ n }}
33
+ </el-button>
34
+
35
+ <el-input
36
+ v-model="sizeInput"
37
+ class="el-pagination__editor"
38
+ type="number"
39
+ placeholder="自定义"
40
+ @change="handleSizeChange"
41
+ @blur="onBlurPageSize"
42
+ />
43
+ </div>
44
+ </div>
45
+ </template>
46
+
47
+ <script>
48
+ import { on, off } from 'element-ui/src/utils/dom'
49
+ export default {
50
+ name: 'WornPagination',
51
+ props: {
52
+ page: {
53
+ type:Number,
54
+ default: 1
55
+ },
56
+ pageSize: {
57
+ type:Number,
58
+ default: 0
59
+ },
60
+ total: {
61
+ type:Number,
62
+ default: 0
63
+ },
64
+ sizeInputLimit: {
65
+ //自定义分页条数 限制 默认200
66
+ type: Number,
67
+ default: 200
68
+ }
69
+ },
70
+ data() {
71
+ return {
72
+ settings: [20, 50, 100],
73
+ current: 1,
74
+ size: 20,
75
+ totalPage: 1,
76
+ input: 1,
77
+ sizeInput: '',
78
+ isban: false,
79
+ isbanprev: false,
80
+ showSetting: false
81
+ }
82
+ },
83
+ watch: {
84
+ size() {
85
+ let index = this.settings.indexOf(this.size)
86
+ if (index < 0) this.sizeInput = this.size
87
+ else this.sizeInput = ''
88
+ },
89
+ page() {
90
+ this.handleChange(this.page)
91
+ },
92
+ pageSize() {
93
+ this.handleSizeChange(this.pageSize)
94
+ },
95
+ total() {
96
+ this.handleTotal()
97
+ }
98
+ },
99
+ mounted() {
100
+ this.current = this.page
101
+ this.size = this.pageSize
102
+ this.handleTotal()
103
+ },
104
+ methods: {
105
+ prevent(e) {
106
+ e.preventDefault()
107
+ e.stopPropagation()
108
+ },
109
+ handleTotal() {
110
+ if (this.total) {
111
+ let count = parseInt(this.total / this.pageSize)
112
+ this.totalPage =
113
+ this.total % this.pageSize === 0 ? count : count + 1
114
+ }else{
115
+ this.totalPage = 1
116
+ }
117
+ },
118
+ onBlurPage() {
119
+ if (this.input === '') {
120
+ this.input = 1
121
+ this.current = 1
122
+ this.$emit('update:page', this.current)
123
+ }
124
+ },
125
+ handleChange(v) {
126
+ if (!v) return
127
+
128
+ v = parseInt(v)
129
+ if (v > this.totalPage) {
130
+ v = this.totalPage
131
+ }
132
+ if (v < 1) {
133
+ v = 1
134
+ }
135
+ this.input = v
136
+ this.current = v
137
+ this.$emit('update:page', this.current)
138
+ },
139
+ onBlurPageSize() {
140
+ if (!this.sizeInput) {
141
+ this.sizeInput = 20
142
+ this.$emit('update:pageSize', this.size)
143
+ this.current = 1
144
+ this.$emit('update:page', this.current)
145
+ }
146
+ },
147
+ handleSizeChange(v) {
148
+ if (!v) return
149
+
150
+ //检查是否超出限制
151
+ if (v > this.sizeInputLimit) {
152
+ this.$message.error(
153
+ '自定义分页不可超过' + this.sizeInputLimit + '条每页!'
154
+ )
155
+ return
156
+ }
157
+
158
+ v = parseInt(v)
159
+ if (v < 1) v = 1
160
+
161
+ this.size = v
162
+ this.$emit('update:pageSize', this.size)
163
+
164
+ this.current = 1
165
+ this.$emit('update:page', this.current)
166
+
167
+ this.handleTotal()
168
+ },
169
+ prev() {
170
+ if (this.current <= 1) {
171
+ this.isbanprev = true
172
+ }
173
+ this.isbanprev = false
174
+ this.handleChange(this.current - 1)
175
+ },
176
+ next() {
177
+ let num = this.current + 1
178
+ if (num !== this.totalPage + 1) {
179
+ this.isban = false
180
+ this.handleChange(this.current + 1)
181
+ } else {
182
+ this.isban = true
183
+ }
184
+ },
185
+ goSetting(e) {
186
+ this.showSetting = !this.showSetting
187
+ if (this.showSetting) {
188
+ setTimeout(() => {
189
+ on(document, 'click', this.handleDocumentClick)
190
+ }, 100)
191
+ }
192
+
193
+ e.preventDefault()
194
+ e.stopPropagation()
195
+ },
196
+ handleDocumentClick() {
197
+ this.showSetting = false
198
+ off(document, 'click', this.handleDocumentClick)
199
+ }
200
+ }
201
+ }
202
+ </script>
@@ -0,0 +1,42 @@
1
+ const directive = {}
2
+
3
+ directive.install = (Vue) => {
4
+ Vue.directive('move', {
5
+ bind(el, binding) {
6
+ var _this, pvrPageX, pvrPageY
7
+ var mousemoveThisMove = function(evt) {
8
+ var ev = evt || event
9
+ ev.stopPropagation()
10
+ ev.preventDefault()
11
+ _this.pageXc = ev.pageX - pvrPageX
12
+ _this.pageYc = ev.pageY - pvrPageY
13
+ if (_this.pageXc !== 0 || _this.pageYc !== 0) {
14
+ binding.value(_this, binding.arg)
15
+ }
16
+ pvrPageX = ev.pageX
17
+ pvrPageY = ev.pageY
18
+ }
19
+ var mouseupThisMove = function() {
20
+ document.removeEventListener('mousemove', mousemoveThisMove)
21
+ document.removeEventListener('mouseup', mouseupThisMove)
22
+ }
23
+ el.addEventListener('mousedown', function(evt) {
24
+ var ev = evt || event
25
+ this.pageXc = this.pageYc = 0
26
+ _this = this
27
+ pvrPageX = ev.pageX
28
+ pvrPageY = ev.pageY
29
+ document.addEventListener('mousemove', mousemoveThisMove)
30
+ document.addEventListener('mouseup', mouseupThisMove)
31
+ })
32
+ }
33
+ /*update() {
34
+ console.log('被绑定元素所在的模板更新时调用,而不论绑定值是否变化。通过比较更新前后的绑定值,可以忽略不必要的模板更新')
35
+ },
36
+ unbind() {
37
+ console.log('只调用一次, 指令与元素解绑时调用')
38
+ }*/
39
+ })
40
+ }
41
+
42
+ export default directive
@@ -0,0 +1,55 @@
1
+ import Tooltip from './tooltip.vue'
2
+
3
+ function tipShow(el, tip) {
4
+ if (el.$tooltipTitle) {
5
+ if (!el.$tooltipTitleOverflow || el.clientWidth < el.scrollWidth) {
6
+ tip.title = el.$tooltipTitle
7
+ tip.$refs['title-pop'].referenceElm = el
8
+ tip.$refs['title-pop'].doDestroy()
9
+ tip.$nextTick(() => {
10
+ tip.visible = true
11
+ })
12
+ }
13
+ }
14
+ }
15
+ function tipHide(el, tip) {
16
+ tip.visible = false
17
+ }
18
+
19
+ const TitleDirective = {}
20
+ TitleDirective.install = (Vue) => {
21
+ if (Vue.prototype.$isServer) return
22
+
23
+ const tooltip = new (Vue.extend(Tooltip))({
24
+ el: document.createElement('div'),
25
+ data: {
26
+ title: '',
27
+ visible: false
28
+ }
29
+ })
30
+ document.querySelector('body').appendChild(tooltip.$el)
31
+
32
+ Vue.directive('title', {
33
+ bind: function(el, binding, vnode) {
34
+ if (vnode.data && vnode.data.attrs) {
35
+ el.$tooltipTitleOverflow = vnode.data.attrs['show-overflow-tooltip']
36
+ }
37
+ el.$tooltipTitle = binding.value
38
+ el.$tooltipShow = () => tipShow(el, tooltip)
39
+ el.$tooltipHide = () => tipHide(el, tooltip)
40
+ el.addEventListener('mouseenter', el.$tooltipShow)
41
+ el.addEventListener('mouseleave', el.$tooltipHide)
42
+ },
43
+ update: function(el, binding) {
44
+ if (binding.value !== binding.oldValue) {
45
+ el.$tooltipTitle = binding.value
46
+ }
47
+ },
48
+ unbind: function(el, binding) {
49
+ el.removeEventListener('mouseenter', el.$tooltipShow)
50
+ el.removeEventListener('mouseleave', el.$tooltipHide)
51
+ }
52
+ })
53
+ }
54
+
55
+ export default TitleDirective
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <el-popover
3
+ ref="title-pop"
4
+ v-model="visible"
5
+ trigger="manual"
6
+ popper-class="title-pop"
7
+ placement="top"
8
+ >{{ title }}</el-popover
9
+ >
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ data() {
15
+ return {
16
+ title: '',
17
+ visible: false
18
+ }
19
+ }
20
+ }
21
+ </script>
@@ -0,0 +1,72 @@
1
+ /**
2
+ * author: zhengwei
3
+ * tiem: 2021-8-31
4
+ * amend: 只注册到bind上,有问题;onXX会导致事件覆盖
5
+ */
6
+ // 封装全局弹窗拖拽指令 v-drag
7
+ function dialogMoveFn(_this) {
8
+ var dialogDom = _this.parentNode
9
+ dialogDom.style.top = parseFloat(dialogDom.style.top || '0') + _this.pageYc + 'px'
10
+ dialogDom.style.left = parseFloat(dialogDom.style.left || '0') + _this.pageXc + 'px'
11
+ }
12
+
13
+ const dialogMove = {
14
+ install: function(Vue) {
15
+ Vue.directive('drag', {
16
+ update(el, binding) {
17
+ if (el.style.display === 'none') {
18
+ var dialogDom = el.querySelector('.el-dialog')
19
+ if (dialogDom) {
20
+ dialogDom.style.left = ''
21
+ dialogDom.style.top = ''
22
+ }
23
+ }
24
+ Vue.nextTick(function() {
25
+ var dialogHeader = el.querySelector('.el-dialog__header')
26
+ if (dialogHeader && !dialogHeader._hasMoveDir) {
27
+ var _this, pvrPageX, pvrPageY
28
+ dialogHeader._hasMoveDir = true
29
+ dialogHeader.style.cursor = 'move'
30
+
31
+ dialogHeader.addEventListener('mousedown', function(evt) {
32
+ var ev = evt || event
33
+ this.pageXc = this.pageYc = 0
34
+ _this = this
35
+ pvrPageX = ev.pageX
36
+ pvrPageY = ev.pageY
37
+ document.addEventListener('mousemove', mousemoveThisMove)
38
+ document.addEventListener('mouseup', mouseupThisMove)
39
+ })
40
+
41
+ var mousemoveThisMove = function(evt) {
42
+ var ev = evt || event
43
+ ev.stopPropagation()
44
+ ev.preventDefault()
45
+ if (
46
+ ev.clientX >= 0 &&
47
+ ev.clientY >= 0 &&
48
+ ev.clientX <= document.documentElement.clientWidth &&
49
+ ev.clientY <= document.documentElement.clientHeight
50
+ ) {
51
+ _this.pageXc = ev.pageX - pvrPageX
52
+ _this.pageYc = ev.pageY - pvrPageY
53
+ if (_this.pageXc !== 0 || _this.pageYc !== 0) {
54
+ binding.value ? binding.value(_this, binding.arg) : dialogMoveFn(_this)
55
+ }
56
+ pvrPageX = ev.pageX
57
+ pvrPageY = ev.pageY
58
+ }
59
+ }
60
+
61
+ var mouseupThisMove = function() {
62
+ document.removeEventListener('mousemove', mousemoveThisMove)
63
+ document.removeEventListener('mouseup', mouseupThisMove)
64
+ }
65
+ }
66
+ })
67
+ }
68
+ })
69
+ }
70
+ }
71
+
72
+ export default dialogMove
package/src/index.js ADDED
@@ -0,0 +1,111 @@
1
+ /** 提供组件给外部使用的入口 */
2
+ import NavMenu from './components/NavMenu/index.vue'
3
+ import InputNumber from './components/InputNumber/index.vue'
4
+ import TimePicker from './components/TimePicker/index.vue'
5
+ import DatePicker from './components/DatePicker/index.vue'
6
+ import Select from './components/Select/index.vue'
7
+ import Suspend from './components/Suspend/index.vue'
8
+ import MoreTab from './components/MoreTab/index.vue'
9
+ import Step from './components/Step/index.vue'
10
+ import SecondaryTab from './components/SecondaryTab/index.vue'
11
+ import TertiaryTab from './components/TertiaryTab/index.vue'
12
+ import Pagination from './components/Pagination/index.vue'
13
+ import WornPagination from './components/WornPagination/index.vue'
14
+ import Statis from './components/Statis/index.vue'
15
+ import ApproveCard from './components/ApproveCard/index.vue'
16
+ import Expandable from './components/Expandable/index.vue'
17
+ import Empty from './components/Empty/index.vue'
18
+ import Upload from './components/Upload/index.vue'
19
+ import Dialog from './components/Dialog/index.vue'
20
+ import DragList from './components/DragList/index.vue'
21
+ import Sifting from './components/Sifting/index.vue'
22
+ import FileUploadTable from './components/FileUploadTable/index.vue'
23
+ import FooterBox from './components/FooterBox/index.vue'
24
+ import Filters from './components/Filters/index.vue'
25
+ import FoldedPanel from './components/FoldedPanel/index.vue'
26
+ /** 注入指令 */
27
+ import VTitle from './directives/VTitle/index.js'
28
+ import VDrag from './directives/vDrag/index.js'
29
+ import VMove from './directives/VMove/index.js'
30
+
31
+ /** 注入方法 */
32
+ import axios from './utils/axios.js'
33
+ import pushLink from './utils/pushLink.js'
34
+ import print from './utils/print.js'
35
+
36
+ const components = [
37
+ NavMenu,
38
+ InputNumber,
39
+ TimePicker,
40
+ DatePicker,
41
+ Select,
42
+ Suspend,
43
+ MoreTab,
44
+ Step,
45
+ SecondaryTab,
46
+ TertiaryTab,
47
+ Pagination,
48
+ WornPagination,
49
+ Statis,
50
+ ApproveCard,
51
+ Expandable,
52
+ Empty,
53
+ Upload,
54
+ Dialog,
55
+ DragList,
56
+ Sifting,
57
+ FileUploadTable,
58
+ FooterBox,
59
+ Filters,
60
+ FoldedPanel
61
+ ]
62
+
63
+ const install = function(Vue, opts = { prefix: 'Cl' }) {
64
+ components.forEach((component) => {
65
+ let name = component.name
66
+ name = opts.prefix + name.replace(name[0], name[0].toUpperCase())
67
+ Vue.component(name, component)
68
+ })
69
+
70
+ Vue.use(VTitle)
71
+ Vue.use(VDrag)
72
+ Vue.use(VMove)
73
+
74
+ Vue.prototype.$axios = axios
75
+ Vue.prototype.$pushLink = pushLink
76
+ Vue.prototype.$print = print
77
+ }
78
+
79
+ /* istanbul ignore if */
80
+ if (typeof window !== 'undefined' && window.Vue) {
81
+ install(window.Vue)
82
+ }
83
+
84
+ export default {
85
+ version: '1.0.0',
86
+ install,
87
+ axios,
88
+ pushLink,
89
+ print,
90
+ NavMenu,
91
+ InputNumber,
92
+ TimePicker,
93
+ DatePicker,
94
+ Select,
95
+ Suspend,
96
+ MoreTab,
97
+ Step,
98
+ SecondaryTab,
99
+ TertiaryTab,
100
+ Pagination,
101
+ WornPagination,
102
+ Statis,
103
+ ApproveCard,
104
+ Expandable,
105
+ Empty,
106
+ Upload,
107
+ Dialog,
108
+ DragList,
109
+ Sifting,
110
+ FileUploadTable
111
+ }
@@ -0,0 +1,41 @@
1
+ /* 设置/获取token */
2
+ import Cookies from 'js-cookie'
3
+
4
+ const auth = {
5
+ TokenKey: 'token',
6
+ getTokenKey() {
7
+ return this.TokenKey
8
+ },
9
+ getCookieToken() {
10
+ return Cookies.get(this.TokenKey)
11
+ },
12
+ getToken() {
13
+ return sessionStorage.getItem(this.TokenKey)
14
+ },
15
+ setToken(token) {
16
+ Cookies.set(this.TokenKey, token, { expires: 1 })
17
+ sessionStorage.setItem(this.TokenKey, token)
18
+ },
19
+ removeToken() {
20
+ Cookies.remove(this.TokenKey)
21
+ sessionStorage.removeItem(this.TokenKey)
22
+ toLogin()
23
+ }
24
+ }
25
+
26
+ function toLogin() {
27
+ if (window.__POWERED_BY_QIANKUN__) {
28
+ window.open(window.location.origin, '_self')
29
+ } else {
30
+ alert('登录过期,请重新登录')
31
+ }
32
+ }
33
+
34
+ auth.TokenKey = 'Admin-Token'
35
+
36
+ {
37
+ const _token = auth.getCookieToken()
38
+ _token && auth.setToken(_token)
39
+ }
40
+
41
+ export default auth