n20-common-lib 3.2.67 → 3.2.68

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": "n20-common-lib",
3
- "version": "3.2.67",
3
+ "version": "3.2.68",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -58,6 +58,7 @@
58
58
  @import './v3/footer.scss';
59
59
  @import './v3/radioCard.scss';
60
60
  @import './v3/collapse.scss';
61
+ @import './v3/collapse-link.scss';
61
62
  @import './v3/anchor.scss';
62
63
  @import './info-card.scss';
63
64
 
@@ -0,0 +1,82 @@
1
+ .v3-collapse-link {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: stretch;
5
+ box-sizing: border-box;
6
+
7
+ &__trigger {
8
+ display: inline-flex;
9
+ align-items: center;
10
+ gap: 4px;
11
+ margin: 0;
12
+ padding: 1px 4px;
13
+ overflow: hidden;
14
+ appearance: none;
15
+ border: 0;
16
+ border-radius: 2px;
17
+ background: transparent;
18
+ color: $--color-primary;
19
+ font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
20
+ font-size: 13px;
21
+ font-weight: 400;
22
+ line-height: 22px;
23
+ cursor: pointer;
24
+ user-select: none;
25
+
26
+ &.is-left {
27
+ align-self: flex-start;
28
+ }
29
+
30
+ &.is-right {
31
+ align-self: flex-end;
32
+ }
33
+
34
+ &:focus-visible {
35
+ outline: 2px solid rgba($--color-primary, 0.3);
36
+ outline-offset: 1px;
37
+ }
38
+ }
39
+
40
+ &__text {
41
+ white-space: nowrap;
42
+ }
43
+
44
+ &__arrow {
45
+ display: inline-flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ width: 14px;
49
+ height: 14px;
50
+ font-size: 14px;
51
+ line-height: 14px;
52
+ transition: transform 0.2s ease;
53
+
54
+ &.is-collapsed {
55
+ transform: rotate(180deg);
56
+ }
57
+ }
58
+
59
+ &__divider {
60
+ width: 100%;
61
+ height: 1px;
62
+ margin-top: 12px;
63
+ background: $--border-color-base;
64
+ }
65
+
66
+ &__body-wrap {
67
+ display: grid;
68
+ grid-template-rows: 0fr;
69
+ margin-top: 0;
70
+ transition: grid-template-rows 0.3s ease, margin-top 0.3s ease;
71
+
72
+ &.is-expanded {
73
+ grid-template-rows: 1fr;
74
+ margin-top: 12px;
75
+ }
76
+ }
77
+
78
+ &__body {
79
+ min-height: 0;
80
+ overflow: hidden;
81
+ }
82
+ }
@@ -0,0 +1,88 @@
1
+ <template>
2
+ <div class="v3-collapse-link">
3
+ <button
4
+ type="button"
5
+ class="v3-collapse-link__trigger"
6
+ :class="`is-${align}`"
7
+ :aria-expanded="String(isExpanded)"
8
+ @click="toggle"
9
+ >
10
+ <span class="v3-collapse-link__text">{{ actionText }}</span>
11
+ <i
12
+ class="v3-icon-up v3-collapse-link__arrow"
13
+ :class="{ 'is-collapsed': !isExpanded }"
14
+ aria-hidden="true"
15
+ ></i>
16
+ </button>
17
+ <div v-if="showDivider" class="v3-collapse-link__divider"></div>
18
+ <div
19
+ v-if="$slots.default"
20
+ class="v3-collapse-link__body-wrap"
21
+ :class="{ 'is-expanded': isExpanded }"
22
+ >
23
+ <div class="v3-collapse-link__body">
24
+ <slot></slot>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ import { $lc } from '../../../utils/i18n/index'
32
+
33
+ export default {
34
+ name: 'CollapseLink',
35
+ model: {
36
+ prop: 'expanded',
37
+ event: 'change'
38
+ },
39
+ props: {
40
+ expanded: {
41
+ type: Boolean,
42
+ default: null
43
+ },
44
+ expandText: {
45
+ type: String,
46
+ default: $lc('展开')
47
+ },
48
+ collapseText: {
49
+ type: String,
50
+ default: $lc('收起')
51
+ },
52
+ showDivider: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ align: {
57
+ type: String,
58
+ default: 'left',
59
+ validator: (value) => ['left', 'right'].includes(value)
60
+ }
61
+ },
62
+ data() {
63
+ return {
64
+ localExpanded: true
65
+ }
66
+ },
67
+ computed: {
68
+ isControlled() {
69
+ return this.expanded !== null
70
+ },
71
+ isExpanded() {
72
+ return this.isControlled ? this.expanded : this.localExpanded
73
+ },
74
+ actionText() {
75
+ return this.isExpanded ? this.collapseText : this.expandText
76
+ }
77
+ },
78
+ methods: {
79
+ toggle() {
80
+ const next = !this.isExpanded
81
+ if (!this.isControlled) {
82
+ this.localExpanded = next
83
+ }
84
+ this.$emit('change', next)
85
+ }
86
+ }
87
+ }
88
+ </script>
package/src/index.js CHANGED
@@ -128,6 +128,7 @@ import Upload from './components/Upload/index.vue'
128
128
  import UploadMsg from './components/Upload/uploadMsg.vue'
129
129
  import AnchorV3 from './components/v3/Anchor/index.vue'
130
130
  import Collapse from './components/v3/Collapse/index.vue'
131
+ import CollapseLink from './components/v3/CollapseLink/index.vue'
131
132
  import Footer from './components/v3/Footer/index.vue'
132
133
  import Header from './components/v3/Header/index.vue'
133
134
  import RadioCard from './components/v3/RadioCard/index.vue'
@@ -297,6 +298,7 @@ const components = [
297
298
  Footer,
298
299
  RadioCard,
299
300
  Collapse,
301
+ CollapseLink,
300
302
  AnchorV3
301
303
  ]
302
304
 
@@ -450,6 +452,7 @@ export {
450
452
  Footer,
451
453
  RadioCard,
452
454
  Collapse,
455
+ CollapseLink,
453
456
  AnchorV3,
454
457
  asyncGetRelaNos,
455
458
  // 方法