n20-project-component 1.0.3 → 1.0.5

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,65 +1,69 @@
1
- {
2
- "name": "n20-project-component",
3
- "version": "1.0.3",
4
- "description": "PC 端 Vue 2 + Element UI 组件库",
5
- "main": "dist/n20-project-component.umd.min.js",
6
- "module": "dist/n20-project-component.common.js",
7
- "style": "dist/n20-project-component.css",
8
- "files": [
9
- "dist",
10
- "src",
11
- "README.md"
12
- ],
13
- "scripts": {
14
- "dev": "vue-cli-service serve --open",
15
- "build": "vue-cli-service build --target lib --name n20-project-component src/index.js",
16
- "lint": "vue-cli-service lint",
17
- "prepublishOnly": "npm run build"
18
- },
19
- "peerDependencies": {
20
- "vue": "^2.6.0",
21
- "element-ui": "^2.15.0"
22
- },
23
- "dependencies": {},
24
- "devDependencies": {
25
- "@vue/cli-plugin-babel": "~4.5.0",
26
- "@vue/cli-plugin-eslint": "~4.5.0",
27
- "@vue/cli-service": "~4.5.0",
28
- "babel-eslint": "^10.1.0",
29
- "core-js": "^3.6.5",
30
- "element-ui": "^2.15.14",
31
- "eslint": "^6.7.2",
32
- "eslint-plugin-vue": "^6.2.2",
33
- "sass": "1.26.2",
34
- "sass-loader": "8.0.2",
35
- "vue": "^2.6.11",
36
- "vue-template-compiler": "^2.6.11"
37
- },
38
- "eslintConfig": {
39
- "root": true,
40
- "env": {
41
- "node": true
42
- },
43
- "extends": [
44
- "plugin:vue/essential",
45
- "eslint:recommended"
46
- ],
47
- "parserOptions": {
48
- "parser": "babel-eslint"
49
- },
50
- "rules": {}
51
- },
52
- "browserslist": [
53
- "> 1%",
54
- "last 2 versions",
55
- "not dead"
56
- ],
57
- "keywords": [
58
- "vue2",
59
- "element-ui",
60
- "component-library",
61
- "n20"
62
- ],
63
- "author": "",
64
- "license": "MIT"
65
- }
1
+ {
2
+ "name": "n20-project-component",
3
+ "version": "1.0.5",
4
+ "description": "PC 端 Vue 2 + Element UI 组件库",
5
+ "main": "dist/n20-project-component.umd.min.js",
6
+ "module": "dist/n20-project-component.common.js",
7
+ "style": "dist/n20-project-component.css",
8
+ "files": [
9
+ "dist",
10
+ "src",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "dev": "vue-cli-service serve --open",
15
+ "build": "vue-cli-service build --target lib --name n20-project-component src/index.js",
16
+ "lint": "vue-cli-service lint",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "peerDependencies": {
20
+ "vue": "^2.6.0",
21
+ "element-ui": "^2.15.0"
22
+ },
23
+ "dependencies": {
24
+ "n20-common-lib": "^2.22.39"
25
+ },
26
+ "devDependencies": {
27
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
28
+ "@babel/plugin-proposal-optional-chaining": "^7.21.0",
29
+ "@vue/cli-plugin-babel": "~4.5.0",
30
+ "@vue/cli-plugin-eslint": "~4.5.0",
31
+ "@vue/cli-service": "~4.5.0",
32
+ "babel-eslint": "^10.1.0",
33
+ "core-js": "^3.6.5",
34
+ "element-ui": "^2.15.14",
35
+ "eslint": "^6.7.2",
36
+ "eslint-plugin-vue": "^6.2.2",
37
+ "sass": "1.26.2",
38
+ "sass-loader": "8.0.2",
39
+ "vue": "^2.6.11",
40
+ "vue-template-compiler": "^2.6.11"
41
+ },
42
+ "eslintConfig": {
43
+ "root": true,
44
+ "env": {
45
+ "node": true
46
+ },
47
+ "extends": [
48
+ "plugin:vue/essential",
49
+ "eslint:recommended"
50
+ ],
51
+ "parserOptions": {
52
+ "parser": "babel-eslint"
53
+ },
54
+ "rules": {}
55
+ },
56
+ "browserslist": [
57
+ "> 1%",
58
+ "last 2 versions",
59
+ "not dead"
60
+ ],
61
+ "keywords": [
62
+ "vue2",
63
+ "element-ui",
64
+ "component-library",
65
+ "n20"
66
+ ],
67
+ "author": "",
68
+ "license": "MIT"
69
+ }
@@ -1,74 +1,74 @@
1
- <template>
2
- <el-button
3
- :type="type"
4
- :size="size"
5
- :disabled="disabled"
6
- :loading="loading"
7
- :icon="icon"
8
- class="n20-demo-button"
9
- @click="handleClick"
10
- >
11
- <slot>{{ text }}</slot>
12
- </el-button>
13
- </template>
14
-
15
- <script>
16
- /**
17
- * DemoButton - 示例按钮组件
18
- *
19
- * 用于验证组件库构建流程。实际开发时可删除此组件,替换为业务组件。
20
- *
21
- * @example
22
- * <DemoButton type="primary" text="提交" @click="handleSubmit" />
23
- */
24
- export default {
25
- name: 'N20DemoButton',
26
- props: {
27
- /** 按钮文本 */
28
- text: {
29
- type: String,
30
- default: '按钮',
31
- },
32
- /** 按钮类型:primary / success / warning / danger / info / text */
33
- type: {
34
- type: String,
35
- default: 'primary',
36
- },
37
- /** 按钮尺寸:medium / small / mini */
38
- size: {
39
- type: String,
40
- default: '',
41
- },
42
- /** 是否禁用 */
43
- disabled: {
44
- type: Boolean,
45
- default: false,
46
- },
47
- /** 是否加载中 */
48
- loading: {
49
- type: Boolean,
50
- default: false,
51
- },
52
- /** 图标类名 */
53
- icon: {
54
- type: String,
55
- default: '',
56
- },
57
- },
58
- methods: {
59
- handleClick(e) {
60
- this.$emit('click', e)
61
- },
62
- },
63
- }
64
- </script>
65
-
66
- <style lang="scss" scoped>
67
- @import '~@/styles/variables.scss';
68
-
69
- .n20-demo-button {
70
- // 自定义样式示例 —— 在 Element UI 基础上扩展
71
- border-radius: $--n20-border-radius;
72
- font-size: $--n20-font-size-base;
73
- }
74
- </style>
1
+ <template>
2
+ <el-button
3
+ :type="type"
4
+ :size="size"
5
+ :disabled="disabled"
6
+ :loading="loading"
7
+ :icon="icon"
8
+ class="n20-demo-button"
9
+ @click="handleClick"
10
+ >
11
+ <slot>{{ text }}</slot>
12
+ </el-button>
13
+ </template>
14
+
15
+ <script>
16
+ /**
17
+ * DemoButton - 示例按钮组件
18
+ *
19
+ * 用于验证组件库构建流程。实际开发时可删除此组件,替换为业务组件。
20
+ *
21
+ * @example
22
+ * <DemoButton type="primary" text="提交" @click="handleSubmit" />
23
+ */
24
+ export default {
25
+ name: 'N20DemoButton',
26
+ props: {
27
+ /** 按钮文本 */
28
+ text: {
29
+ type: String,
30
+ default: '按钮',
31
+ },
32
+ /** 按钮类型:primary / success / warning / danger / info / text */
33
+ type: {
34
+ type: String,
35
+ default: 'primary',
36
+ },
37
+ /** 按钮尺寸:medium / small / mini */
38
+ size: {
39
+ type: String,
40
+ default: '',
41
+ },
42
+ /** 是否禁用 */
43
+ disabled: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ /** 是否加载中 */
48
+ loading: {
49
+ type: Boolean,
50
+ default: false,
51
+ },
52
+ /** 图标类名 */
53
+ icon: {
54
+ type: String,
55
+ default: '',
56
+ },
57
+ },
58
+ methods: {
59
+ handleClick(e) {
60
+ this.$emit('click', e)
61
+ },
62
+ },
63
+ }
64
+ </script>
65
+
66
+ <style lang="scss" scoped>
67
+ @import '~@/styles/variables.scss';
68
+
69
+ .n20-demo-button {
70
+ // 自定义样式示例 —— 在 Element UI 基础上扩展
71
+ border-radius: $--n20-border-radius;
72
+ font-size: $--n20-font-size-base;
73
+ }
74
+ </style>
@@ -1,133 +1,133 @@
1
- <template>
2
- <span class="n20-copy-text" @click.stop="handleCopy">
3
- <span class="n20-copy-text__content" ref="content">
4
- <slot>{{ text }}</slot>
5
- </span>
6
- <i
7
- v-if="showIcon"
8
- :class="['n20-copy-text__icon', copied ? 'el-icon-check' : 'el-icon-document-copy']"
9
- :style="{ order: iconPosition === 'left' ? -1 : 1 }"
10
- />
11
- </span>
12
- </template>
13
-
14
- <script>
15
- /**
16
- * N20CopyText - 点击复制文本组件
17
- *
18
- * 点击后将指定文本复制到剪贴板,通过 Element Message 显示成功反馈。
19
- *
20
- * @example
21
- * <N20CopyText :text="row.billNo">{{ row.billNo }}</N20CopyText>
22
- *
23
- * @example
24
- * <!-- 自动获取 slot 内容 -->
25
- * <N20CopyText>BILL-2024-001</N20CopyText>
26
- */
27
- export default {
28
- name: 'N20CopyText',
29
- props: {
30
- /** 要复制的文本(默认取 slot 内文本) */
31
- text: {
32
- type: [String, Number],
33
- default: ''
34
- },
35
- /** 复制成功提示文字 */
36
- successTip: {
37
- type: String,
38
- default: '已复制'
39
- },
40
- /** 是否显示复制图标 */
41
- showIcon: {
42
- type: Boolean,
43
- default: true
44
- },
45
- /** 图标位置 */
46
- iconPosition: {
47
- type: String,
48
- default: 'right',
49
- validator: v => ['left', 'right'].includes(v)
50
- },
51
- /** 是否禁用 */
52
- disabled: {
53
- type: Boolean,
54
- default: false
55
- }
56
- },
57
- data() {
58
- return {
59
- copied: false,
60
- timer: null
61
- }
62
- },
63
- beforeDestroy() {
64
- clearTimeout(this.timer)
65
- },
66
- methods: {
67
- async handleCopy() {
68
- if (this.disabled || this.copied) return
69
-
70
- const copyText = this.text || (this.$refs.content && this.$refs.content.innerText) || ''
71
- if (!copyText) return
72
-
73
- try {
74
- if (navigator.clipboard && window.isSecureContext) {
75
- await navigator.clipboard.writeText(String(copyText))
76
- } else {
77
- // fallback for HTTP or older browsers
78
- const textarea = document.createElement('textarea')
79
- textarea.value = String(copyText)
80
- textarea.style.position = 'fixed'
81
- textarea.style.left = '-9999px'
82
- document.body.appendChild(textarea)
83
- textarea.select()
84
- document.execCommand('copy')
85
- document.body.removeChild(textarea)
86
- }
87
-
88
- this.copied = true
89
- this.$message.success(this.successTip)
90
- this.$emit('copy', String(copyText))
91
-
92
- this.timer = setTimeout(() => {
93
- this.copied = false
94
- }, 2000)
95
- } catch (err) {
96
- this.$message.error('复制失败')
97
- this.$emit('error', err)
98
- }
99
- }
100
- }
101
- }
102
- </script>
103
-
104
- <style lang="scss" scoped>
105
- .n20-copy-text {
106
- display: inline-flex;
107
- align-items: center;
108
- gap: 4px;
109
- cursor: pointer;
110
-
111
- &:hover {
112
- .n20-copy-text__icon {
113
- opacity: 1;
114
- }
115
- }
116
-
117
- &__content {
118
- display: inline;
119
- }
120
-
121
- &__icon {
122
- font-size: 14px;
123
- color: #909399;
124
- opacity: 0.4;
125
- transition: all 0.2s ease;
126
-
127
- &.el-icon-check {
128
- color: #67C23A;
129
- opacity: 1;
130
- }
131
- }
132
- }
133
- </style>
1
+ <template>
2
+ <span class="n20-copy-text" @click.stop="handleCopy">
3
+ <span class="n20-copy-text__content" ref="content">
4
+ <slot>{{ text }}</slot>
5
+ </span>
6
+ <i
7
+ v-if="showIcon"
8
+ :class="['n20-copy-text__icon', copied ? 'el-icon-check' : 'el-icon-document-copy']"
9
+ :style="{ order: iconPosition === 'left' ? -1 : 1 }"
10
+ />
11
+ </span>
12
+ </template>
13
+
14
+ <script>
15
+ /**
16
+ * N20CopyText - 点击复制文本组件
17
+ *
18
+ * 点击后将指定文本复制到剪贴板,通过 Element Message 显示成功反馈。
19
+ *
20
+ * @example
21
+ * <N20CopyText :text="row.billNo">{{ row.billNo }}</N20CopyText>
22
+ *
23
+ * @example
24
+ * <!-- 自动获取 slot 内容 -->
25
+ * <N20CopyText>BILL-2024-001</N20CopyText>
26
+ */
27
+ export default {
28
+ name: 'N20CopyText',
29
+ props: {
30
+ /** 要复制的文本(默认取 slot 内文本) */
31
+ text: {
32
+ type: [String, Number],
33
+ default: ''
34
+ },
35
+ /** 复制成功提示文字 */
36
+ successTip: {
37
+ type: String,
38
+ default: '已复制'
39
+ },
40
+ /** 是否显示复制图标 */
41
+ showIcon: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ /** 图标位置 */
46
+ iconPosition: {
47
+ type: String,
48
+ default: 'right',
49
+ validator: v => ['left', 'right'].includes(v)
50
+ },
51
+ /** 是否禁用 */
52
+ disabled: {
53
+ type: Boolean,
54
+ default: false
55
+ }
56
+ },
57
+ data() {
58
+ return {
59
+ copied: false,
60
+ timer: null
61
+ }
62
+ },
63
+ beforeDestroy() {
64
+ clearTimeout(this.timer)
65
+ },
66
+ methods: {
67
+ async handleCopy() {
68
+ if (this.disabled || this.copied) return
69
+
70
+ const copyText = this.text || (this.$refs.content && this.$refs.content.innerText) || ''
71
+ if (!copyText) return
72
+
73
+ try {
74
+ if (navigator.clipboard && window.isSecureContext) {
75
+ await navigator.clipboard.writeText(String(copyText))
76
+ } else {
77
+ // fallback for HTTP or older browsers
78
+ const textarea = document.createElement('textarea')
79
+ textarea.value = String(copyText)
80
+ textarea.style.position = 'fixed'
81
+ textarea.style.left = '-9999px'
82
+ document.body.appendChild(textarea)
83
+ textarea.select()
84
+ document.execCommand('copy')
85
+ document.body.removeChild(textarea)
86
+ }
87
+
88
+ this.copied = true
89
+ this.$message.success(this.successTip)
90
+ this.$emit('copy', String(copyText))
91
+
92
+ this.timer = setTimeout(() => {
93
+ this.copied = false
94
+ }, 2000)
95
+ } catch (err) {
96
+ this.$message.error('复制失败')
97
+ this.$emit('error', err)
98
+ }
99
+ }
100
+ }
101
+ }
102
+ </script>
103
+
104
+ <style lang="scss" scoped>
105
+ .n20-copy-text {
106
+ display: inline-flex;
107
+ align-items: center;
108
+ gap: 4px;
109
+ cursor: pointer;
110
+
111
+ &:hover {
112
+ .n20-copy-text__icon {
113
+ opacity: 1;
114
+ }
115
+ }
116
+
117
+ &__content {
118
+ display: inline;
119
+ }
120
+
121
+ &__icon {
122
+ font-size: 14px;
123
+ color: #909399;
124
+ opacity: 0.4;
125
+ transition: all 0.2s ease;
126
+
127
+ &.el-icon-check {
128
+ color: #67C23A;
129
+ opacity: 1;
130
+ }
131
+ }
132
+ }
133
+ </style>