ngx-tethys 18.2.2 → 18.2.3

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.
@@ -1,3 +1,4 @@
1
+ import { ThyPopoverConfig } from 'ngx-tethys/popover';
1
2
  import { Observable } from 'rxjs';
2
3
  import { AfterContentChecked, AfterContentInit, AfterViewInit, ElementRef, OnChanges, OnInit, QueryList, Signal, SimpleChanges, TemplateRef } from '@angular/core';
3
4
  import { RouterLinkActive } from '@angular/router';
@@ -5,7 +6,7 @@ import { ThyNavInkBarDirective } from './nav-ink-bar.directive';
5
6
  import { ThyNavItemDirective } from './nav-item.directive';
6
7
  import { ThyNavLocale } from 'ngx-tethys/i18n';
7
8
  import * as i0 from "@angular/core";
8
- export type ThyNavType = 'pulled' | 'tabs' | 'pills' | 'lite' | 'primary' | 'secondary' | 'thirdly' | 'secondary-divider';
9
+ export type ThyNavType = 'pulled' | 'tabs' | 'pills' | 'lite' | 'card' | 'primary' | 'secondary' | 'thirdly' | 'secondary-divider';
9
10
  export type ThyNavSize = 'lg' | 'md' | 'sm';
10
11
  export type ThyNavHorizontal = '' | 'start' | 'center' | 'end';
11
12
  /**
@@ -19,7 +20,7 @@ export declare class ThyNav implements OnInit, AfterViewInit, AfterContentInit,
19
20
  private changeDetectorRef;
20
21
  private popover;
21
22
  private readonly destroyRef;
22
- private type;
23
+ type: ThyNavType;
23
24
  private size;
24
25
  initialized: boolean;
25
26
  horizontal: ThyNavHorizontal;
@@ -70,8 +71,14 @@ export declare class ThyNav implements OnInit, AfterViewInit, AfterContentInit,
70
71
  thyResponsive: boolean;
71
72
  /**
72
73
  * 更多操作的菜单点击内部是否可关闭
74
+ * @deprecated please use thyPopoverOptions
73
75
  */
74
76
  thyInsideClosable: boolean;
77
+ /**
78
+ * 更多菜单弹出框的参数,底层使用 Popover 组件
79
+ * @type ThyPopoverConfig
80
+ */
81
+ thyPopoverOptions: import("@angular/core").InputSignal<ThyPopoverConfig<unknown>>;
75
82
  /**
76
83
  * 右侧额外区域模板
77
84
  * @type TemplateRef
@@ -113,18 +120,19 @@ export declare class ThyNav implements OnInit, AfterViewInit, AfterContentInit,
113
120
  ngAfterContentInit(): void;
114
121
  ngAfterContentChecked(): void;
115
122
  private setMoreBtnOffset;
123
+ private setNavItemDivider;
116
124
  createResizeObserver(element: HTMLElement): Observable<unknown>;
117
125
  private calculateMoreIsActive;
118
126
  private setHiddenItems;
119
127
  private getShowItemsEndIndexWhenHorizontal;
120
128
  private getShowItemsEndIndexWhenVertical;
121
129
  private resetSizes;
122
- openMore(event: Event, template: TemplateRef<any>): void;
130
+ openMoreMenu(event: Event, template: TemplateRef<any>): void;
123
131
  navItemClick(item: ThyNavItemDirective): void;
124
132
  private alignInkBarToSelectedTab;
125
133
  ngOnChanges(changes: SimpleChanges): void;
126
134
  static ɵfac: i0.ɵɵFactoryDeclaration<ThyNav, never>;
127
- static ɵcmp: i0.ɵɵComponentDeclaration<ThyNav, "thy-nav", never, { "thyType": { "alias": "thyType"; "required": false; }; "thySize": { "alias": "thySize"; "required": false; }; "thyHorizontal": { "alias": "thyHorizontal"; "required": false; }; "thyVertical": { "alias": "thyVertical"; "required": false; }; "thyFill": { "alias": "thyFill"; "required": false; }; "thyResponsive": { "alias": "thyResponsive"; "required": false; }; "thyInsideClosable": { "alias": "thyInsideClosable"; "required": false; }; "thyExtra": { "alias": "thyExtra"; "required": false; }; }, {}, ["moreOperation", "morePopover", "extra", "links", "routers"], ["*"], true, never>;
135
+ static ɵcmp: i0.ɵɵComponentDeclaration<ThyNav, "thy-nav", never, { "thyType": { "alias": "thyType"; "required": false; }; "thySize": { "alias": "thySize"; "required": false; }; "thyHorizontal": { "alias": "thyHorizontal"; "required": false; }; "thyVertical": { "alias": "thyVertical"; "required": false; }; "thyFill": { "alias": "thyFill"; "required": false; }; "thyResponsive": { "alias": "thyResponsive"; "required": false; }; "thyInsideClosable": { "alias": "thyInsideClosable"; "required": false; }; "thyPopoverOptions": { "alias": "thyPopoverOptions"; "required": false; "isSignal": true; }; "thyExtra": { "alias": "thyExtra"; "required": false; }; }, {}, ["moreOperation", "morePopover", "extra", "links", "routers"], ["*"], true, never>;
128
136
  static ngAcceptInputType_thyVertical: boolean | string | number;
129
137
  static ngAcceptInputType_thyFill: boolean | string | number;
130
138
  static ngAcceptInputType_thyResponsive: boolean | string | number;
@@ -1,7 +1,7 @@
1
- @use "sass:color";
2
- @use "../../styles/mixins/hover" as mixins-hover;
3
- @use "../../styles/mixins/hover";
4
- @use "../../styles/variables";
1
+ @use 'sass:color';
2
+ @use '../../styles/mixins/hover' as mixins-hover;
3
+ @use '../../styles/mixins/hover';
4
+ @use '../../styles/variables';
5
5
 
6
6
  @mixin nav-item-variant($color, $hover-color, $border-bottom) {
7
7
  & {
@@ -47,7 +47,6 @@
47
47
  border-radius: $border-radius;
48
48
  }
49
49
 
50
-
51
50
  &.thy-nav-origin-active {
52
51
  text-decoration: none;
53
52
  background: rgba($hover-color, 0.1);
@@ -79,35 +78,50 @@
79
78
  }
80
79
  }
81
80
 
82
- @mixin set-nav-size($nav-item-right-offset: 0px) {
81
+ @mixin set-nav-size($nav-item-right-offset: 0px, $nav-type: '') {
82
+ $nav-card-item-padding: variables.$nav-card-item-padding-y variables.$nav-card-item-padding-x;
83
+ $nav-card-item-right: variables.$nav-card-item-right;
84
+
83
85
  .thy-nav-item {
84
86
  height: variables.$nav-height;
85
- @include nav-item-size(
86
- variables.$nav-item-padding-y variables.$nav-item-padding-x,
87
- variables.$nav-item-right - $nav-item-right-offset,
88
- variables.$nav-item-font-size
89
- );
87
+ @if ($nav-type == 'card') {
88
+ @include nav-item-size($nav-card-item-padding, $nav-card-item-right, variables.$nav-item-font-size);
89
+ } @else {
90
+ @include nav-item-size(
91
+ variables.$nav-item-padding-y variables.$nav-item-padding-x,
92
+ variables.$nav-item-right - $nav-item-right-offset,
93
+ variables.$nav-item-font-size
94
+ );
95
+ }
90
96
  }
91
97
 
92
98
  &.thy-nav-lg {
93
99
  .thy-nav-item {
94
100
  height: variables.$nav-height-lg;
95
- @include nav-item-size(
96
- variables.$nav-item-padding-y-lg variables.$nav-item-padding-x-lg,
97
- variables.$nav-item-right-lg - $nav-item-right-offset,
98
- variables.$nav-item-font-size-lg
99
- );
101
+ @if ($nav-type == 'card') {
102
+ @include nav-item-size($nav-card-item-padding, $nav-card-item-right, variables.$nav-item-font-size-lg);
103
+ } @else {
104
+ @include nav-item-size(
105
+ variables.$nav-item-padding-y-lg variables.$nav-item-padding-x-lg,
106
+ variables.$nav-item-right-lg - $nav-item-right-offset,
107
+ variables.$nav-item-font-size-lg
108
+ );
109
+ }
100
110
  }
101
111
  }
102
112
 
103
113
  &.thy-nav-sm {
104
114
  .thy-nav-item {
105
115
  height: variables.$nav-height-sm;
106
- @include nav-item-size(
107
- variables.$nav-item-padding-y-sm variables.$nav-item-padding-x-sm,
108
- variables.$nav-item-right-sm - $nav-item-right-offset,
109
- variables.$nav-item-font-size-sm
110
- );
116
+ @if ($nav-type == 'card') {
117
+ @include nav-item-size($nav-card-item-padding, $nav-card-item-right, variables.$nav-item-font-size-sm);
118
+ } @else {
119
+ @include nav-item-size(
120
+ variables.$nav-item-padding-y-sm variables.$nav-item-padding-x-sm,
121
+ variables.$nav-item-right-sm - $nav-item-right-offset,
122
+ variables.$nav-item-font-size-sm
123
+ );
124
+ }
111
125
  }
112
126
  }
113
127
  }
@@ -1,9 +1,9 @@
1
- @use "sass:meta";
2
- @use "sass:list";
3
- @use "sass:map";
4
- @use "../../styles/variables";
5
- @use "../../tag/styles/mixin" as tag;
6
- @use "mixin";
1
+ @use 'sass:meta';
2
+ @use 'sass:list';
3
+ @use 'sass:map';
4
+ @use '../../styles/variables';
5
+ @use '../../tag/styles/mixin' as tag;
6
+ @use 'mixin';
7
7
 
8
8
  .thy-nav {
9
9
  display: flex;
@@ -29,6 +29,21 @@
29
29
  .thy-nav-extra {
30
30
  display: inline-flex;
31
31
  align-items: center;
32
+ flex-grow: 1;
33
+ justify-content: flex-end;
34
+ }
35
+
36
+ .thy-nav-more-icon {
37
+ margin-left: 8px;
38
+ }
39
+
40
+ .thy-nav-origin-active {
41
+ .thy-nav-more-icon {
42
+ svg {
43
+ transform: rotate(180deg);
44
+ transition: transform 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
45
+ }
46
+ }
32
47
  }
33
48
 
34
49
  &-ink-bar {
@@ -37,7 +52,9 @@
37
52
  pointer-events: none;
38
53
 
39
54
  &-animated {
40
- transition: left 0.3s, top 0.3s;
55
+ transition:
56
+ left 0.3s,
57
+ top 0.3s;
41
58
  }
42
59
  }
43
60
  }
@@ -66,17 +83,62 @@
66
83
  @include mixin.set-nav-size(12px);
67
84
  }
68
85
 
86
+ .thy-nav-card {
87
+ @include mixin.nav-border-bottom();
88
+ @include mixin.set-nav-size(0, 'card');
89
+
90
+ .thy-nav-item {
91
+ display: flex;
92
+ align-items: center;
93
+ padding: 12px 20px;
94
+ margin-right: 0;
95
+ border: 1px solid transparent;
96
+
97
+ &.has-right-divider {
98
+ position: relative;
99
+ &::after {
100
+ content: '';
101
+ position: absolute;
102
+ right: 0;
103
+ top: 50%;
104
+ transform: translateY(-50%);
105
+ display: inline-block;
106
+ height: 1rem;
107
+ vertical-align: middle;
108
+ border-left: 1px solid variables.$gray-300;
109
+ }
110
+ }
111
+
112
+ &.active {
113
+ &:not(.thy-nav-more-container) {
114
+ border: 1px solid variables.$border-color;
115
+ border-bottom-color: variables.$bg-default;
116
+ border-bottom-width: 2px;
117
+ border-radius: 8px 8px 0 0;
118
+ &::before {
119
+ left: -8px;
120
+ border-bottom-right-radius: 8px;
121
+ border-width: 0 1px 1px 0;
122
+ box-shadow: 1px 2px 0 variables.$white;
123
+ }
124
+ &::after {
125
+ right: -8px;
126
+ border-bottom-left-radius: 8px;
127
+ border-width: 0 0 1px 1px;
128
+ box-shadow: -1px 2px 0 variables.$white;
129
+ }
130
+ }
131
+ }
132
+
133
+ @include mixin.nav-item-variant(variables.$nav-item-color, variables.$nav-item-hover-color, null);
134
+ }
135
+ }
136
+
69
137
  .thy-nav-pills {
70
138
  .thy-nav-item {
71
- // height: variables.$nav-height - 28px;
72
139
  display: inline-flex;
73
140
  align-items: center;
74
141
  border-bottom-width: 0px;
75
- // padding: {
76
- // left: 12px;
77
- // right: 12px;
78
- // }
79
- // @include tag.tag-size('md')
80
142
  @include mixin.nav-item-size(null, variables.$nav-item-right, variables.$font-size-sm);
81
143
  @include mixin.nav-item-pills-variant(variables.$tag-default-color, variables.$nav-item-hover-color);
82
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-tethys",
3
- "version": "18.2.2",
3
+ "version": "18.2.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@github.com/atinc/ngx-tethys.git"
@@ -1 +1 @@
1
- export declare const VERSION = "18.2.2";
1
+ export declare const VERSION = "18.2.3";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '18.2.2';
4
+ exports.VERSION = '18.2.3';
@@ -21,6 +21,7 @@ $success: #73d897 !default;
21
21
  $info: #5dcfff !default;
22
22
  $warning: #ffcd5d !default;
23
23
  $danger: #ff7575 !default;
24
+ $black: #000 !default;
24
25
 
25
26
  $body-color: $gray-800 !default;
26
27
  $secondary: $gray-700 !default;
@@ -34,8 +35,6 @@ $pass: #2cccda !default;
34
35
  $gray-210: #e9e9e9 !default; //整块区域的背景色为 #f3f3f3 后,某个卡片模块的背景色,用于文件详情
35
36
  // deprecated
36
37
  $gray-900: #212529 !default;
37
- // deprecated
38
- $black: #000;
39
38
 
40
39
  /** text color */
41
40
  $text-placeholder: $gray-400 !default;
@@ -529,6 +528,10 @@ $nav-item-padding-y-sm: 0.625rem !default; // 高度 44px
529
528
  $nav-item-padding-x-sm: 0.5rem !default;
530
529
  $nav-item-right-sm: 20px !default;
531
530
  $nav-item-font-size-sm: 14px !default;
531
+ // nav card item size
532
+ $nav-card-item-padding-y: 0px !default;
533
+ $nav-card-item-padding-x: 20px !default;
534
+ $nav-card-item-right: 0px !default;
532
535
 
533
536
  $nav-item-primary-padding-y: 0.9512rem !default; // 高度 56px, 文字 15px
534
537
  $nav-item-primary-padding-x: 1rem !default;
@@ -0,0 +1,13 @@
1
+ @use 'variables.scss' as variables2;
2
+
3
+ .color-block {
4
+ height: 30px;
5
+ line-height: 30px;
6
+ padding: 0 20px;
7
+ width: 200px;
8
+ }
9
+ .default-use {
10
+ height: 30px;
11
+ width: 200px;
12
+ background-color: variables2.$gray-100; // or var(--gray-100)
13
+ }