@mezzanine-ui/core 0.12.9 → 0.13.0

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": "@mezzanine-ui/core",
3
- "version": "0.12.9",
3
+ "version": "0.13.0",
4
4
  "description": "Core for mezzanine-ui",
5
5
  "author": "Mezzanine",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@mezzanine-ui/icons": "^0.12.9",
40
- "@mezzanine-ui/system": "^0.12.9",
39
+ "@mezzanine-ui/icons": "^0.13.0",
40
+ "@mezzanine-ui/system": "^0.13.0",
41
41
  "lodash": "^4.17.21",
42
42
  "tslib": "^2.4.1"
43
43
  }
@@ -1,5 +1,8 @@
1
+ /* stylelint-disable color-function-notation */
2
+ /* stylelint-disable alpha-value-notation */
1
3
  @use '~@mezzanine-ui/system/palette';
2
4
  @use '~@mezzanine-ui/system/typography';
5
+ @use '~@mezzanine-ui/system/transition';
3
6
  @use './table' as *;
4
7
 
5
8
  $table-header-height: 40px !default;
@@ -16,7 +19,7 @@ $table-refresh-vertical-padding: 8px !default;
16
19
  height: auto;
17
20
  min-height: $min-height;
18
21
  display: flex;
19
- align-items: center;
22
+ align-items: stretch;
20
23
  justify-content: flex-start;
21
24
  border-bottom: 1px solid palette.color(border);
22
25
  }
@@ -54,17 +57,95 @@ $table-refresh-vertical-padding: 8px !default;
54
57
  font-size: typography.px-to-rem($size);
55
58
  }
56
59
 
57
- .#{$prefix} {
60
+ @mixin with-scroll-box-shadow($colorName) {
61
+ &--fixed {
62
+ &:first-child {
63
+ position: sticky;
64
+ z-index: 2;
65
+ left: 0;
66
+ }
67
+
68
+ &::before {
69
+ content: '';
70
+ position: absolute;
71
+ left: 0;
72
+ top: 0;
73
+ width: 100%;
74
+ height: 100%;
75
+ z-index: -1;
76
+ background-color: palette.color(#{$colorName});
77
+ }
78
+
79
+ &::after {
80
+ position: absolute;
81
+ top: 0;
82
+ right: 0;
83
+ bottom: -1px;
84
+ width: 10px;
85
+ transform: translateX(100%);
86
+ transition: transition.standard(box-shadow);
87
+ content: '';
88
+ pointer-events: none;
89
+ }
90
+
91
+ &--stuck {
92
+ &::after {
93
+ box-shadow: inset 8px 0 8px -8px rgba(0, 0, 0, 0.25);
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ .#{$loading-prefix} {
100
+ z-index: 4;
101
+ }
102
+
103
+ .#{$container-prefix} {
104
+ width: 100%;
105
+ max-height: var(--table-scroll-y, 'unset');
58
106
  position: relative;
107
+ overflow: auto;
108
+ scrollbar-width: thin; /* firefox specific (firefox 只能先用原生的) */
109
+
110
+ &::-webkit-scrollbar {
111
+ height: 8px;
112
+ width: 0;
113
+
114
+ /* smartphones, touchscreens */
115
+ @media (hover: none) and (pointer: coarse) {
116
+ display: none;
117
+ height: 0;
118
+ }
119
+ }
120
+
121
+ &::-webkit-scrollbar-thumb {
122
+ border-radius: 6px;
123
+ background: #6a6a6a;
124
+ }
125
+
126
+ &::-webkit-scrollbar-track {
127
+ background: #f2f2f2;
128
+ }
129
+ }
130
+
131
+ .#{$prefix} {
59
132
  width: 100%;
60
- height: 100%;
61
- display: flex;
62
- flex-flow: column;
63
- align-items: flex-start;
64
- justify-content: flex-start;
133
+ min-width: var(--table-scroll-x, '100%');
134
+ table-layout: fixed;
135
+ border-collapse: collapse;
136
+ border-spacing: 0;
65
137
  box-sizing: border-box;
66
138
 
67
139
  @include text_color;
140
+ @include body_bg();
141
+ }
142
+
143
+ .#{$header-fixed-prefix} {
144
+ width: 100%;
145
+ min-width: var(--table-scroll-x, '100%');
146
+ position: sticky;
147
+ z-index: 3;
148
+ top: 0;
68
149
  }
69
150
 
70
151
  .#{$header-prefix} {
@@ -75,33 +156,48 @@ $table-refresh-vertical-padding: 8px !default;
75
156
 
76
157
  &__cellWrapper {
77
158
  @include flexible;
159
+
160
+ background-color: palette.color(divider);
161
+
162
+ @include with-scroll-box-shadow(divider);
78
163
  }
79
164
  }
80
165
 
81
166
  .#{$body-prefix} {
82
167
  position: relative;
83
168
  width: 100%;
84
- flex: 1 0 0;
85
- overflow: auto;
86
- scrollbar-width: none; /* Firefox specific */
87
-
88
- &::-webkit-scrollbar {
89
- display: none;
90
- -webkit-overflow-scrolling: touch;
91
- }
169
+ min-width: var(--table-scroll-x, '100%');
92
170
 
93
171
  &__row {
94
172
  @include row(52px);
95
173
  @include body_content;
96
174
  @include body_bg;
97
175
 
176
+ position: relative;
177
+
98
178
  &:hover,
99
179
  &--highlight {
100
- @include action_highlight_bg;
180
+ .#{$body-prefix} {
181
+ &__row {
182
+ &__cellWrapper {
183
+ @include action_highlight_bg;
184
+
185
+ &--fixed {
186
+ @include body_bg;
187
+
188
+ &::before {
189
+ @include action_highlight_bg;
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
101
195
  }
102
196
 
103
197
  &__cellWrapper {
104
198
  @include flexible;
199
+ @include body_bg;
200
+ @include with-scroll-box-shadow(surface);
105
201
  }
106
202
 
107
203
  &__expandedTableWrapper {
@@ -119,12 +215,15 @@ $table-refresh-vertical-padding: 8px !default;
119
215
 
120
216
  &__empty {
121
217
  @include body_bg;
218
+
219
+ min-height: calc(var(--table-scroll-y, '130px') - 12px - #{$table-header-height});
122
220
  }
123
221
 
124
222
  &__fetchMore {
125
223
  @include row(auto);
126
224
  @include body_bg;
127
225
 
226
+ justify-content: center;
128
227
  padding: $table-fetch-more-vertical-padding 0;
129
228
  border-bottom: none;
130
229
  }
package/table/_table.scss CHANGED
@@ -1,6 +1,9 @@
1
1
  @use '~@mezzanine-ui/system/size';
2
2
 
3
+ $loading-prefix: mzn-table-loading;
4
+ $container-prefix: mzn-table-scroll-area;
3
5
  $prefix: mzn-table;
6
+ $header-fixed-prefix: mzn-table__header-fixed;
4
7
  $header-prefix: mzn-table__header;
5
8
  $body-prefix: mzn-table__body;
6
9
  $cell-prefix: mzn-table__cell;
package/table/index.js CHANGED
@@ -1 +1 @@
1
- export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix } from './table.js';
1
+ export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderFixedPrefix, tableHeaderPrefix, tableLoadingPrefix, tablePrefix, tableScrollContainerPrefix } from './table.js';
package/table/table.d.ts CHANGED
@@ -1,17 +1,27 @@
1
+ export declare const tableScrollContainerPrefix = "mzn-table-scroll-area";
2
+ export declare const tableLoadingPrefix = "mzn-table-loading";
1
3
  export declare const tablePrefix = "mzn-table";
4
+ export declare const tableHeaderFixedPrefix: string;
2
5
  export declare const tableHeaderPrefix: string;
3
6
  export declare const tableBodyPrefix: string;
4
7
  export declare const tableCellPrefix: string;
5
8
  export declare const tableClasses: {
9
+ readonly loading: "mzn-table-loading";
10
+ readonly scrollContainer: "mzn-table-scroll-area";
6
11
  readonly host: "mzn-table";
12
+ readonly headerFixed: string;
7
13
  readonly header: string;
8
14
  readonly headerCellWrapper: `${string}__cellWrapper`;
15
+ readonly headerCellWrapperFixed: `${string}__cellWrapper--fixed`;
16
+ readonly headerCellWrapperFixedStuck: `${string}__cellWrapper--fixed--stuck`;
9
17
  readonly body: string;
10
18
  readonly bodyEmpty: `${string}__empty`;
11
19
  readonly bodyFetchMore: `${string}__fetchMore`;
12
20
  readonly bodyRow: `${string}__row`;
13
21
  readonly bodyRowHighlight: `${string}__row--highlight`;
14
22
  readonly bodyRowCellWrapper: `${string}__row__cellWrapper`;
23
+ readonly bodyRowCellWrapperFixed: `${string}__row__cellWrapper--fixed`;
24
+ readonly bodyRowCellWrapperFixedStuck: `${string}__row__cellWrapper--fixed--stuck`;
15
25
  readonly bodyRowExpandedTableWrapper: `${string}__row__expandedTableWrapper`;
16
26
  readonly bodyRowExpandedTable: `${string}__row__expandedTable`;
17
27
  readonly bodyRowExpandedTableRow: `${string}__row__expandedTableRow`;
@@ -122,6 +132,13 @@ export interface TableComponents {
122
132
  cell?: any;
123
133
  };
124
134
  }
135
+ /** === Feature scrolling */
136
+ export interface TableScrolling {
137
+ x?: number;
138
+ y?: number;
139
+ /** Only available when horizontal scrolling is enabled */
140
+ fixedFirstColumn?: boolean;
141
+ }
125
142
  /** styling */
126
143
  export declare function getColumnStyle(column: TableColumn<TableRecord<unknown>>): {};
127
144
  export declare function getCellStyle(column: TableColumn<TableRecord<unknown>>): {};
package/table/table.js CHANGED
@@ -1,17 +1,27 @@
1
+ const tableScrollContainerPrefix = 'mzn-table-scroll-area';
2
+ const tableLoadingPrefix = 'mzn-table-loading';
1
3
  const tablePrefix = 'mzn-table';
4
+ const tableHeaderFixedPrefix = `${tablePrefix}__header-fixed`;
2
5
  const tableHeaderPrefix = `${tablePrefix}__header`;
3
6
  const tableBodyPrefix = `${tablePrefix}__body`;
4
7
  const tableCellPrefix = `${tablePrefix}__cell`;
5
8
  const tableClasses = {
9
+ loading: tableLoadingPrefix,
10
+ scrollContainer: tableScrollContainerPrefix,
6
11
  host: tablePrefix,
12
+ headerFixed: tableHeaderFixedPrefix,
7
13
  header: tableHeaderPrefix,
8
14
  headerCellWrapper: `${tableHeaderPrefix}__cellWrapper`,
15
+ headerCellWrapperFixed: `${tableHeaderPrefix}__cellWrapper--fixed`,
16
+ headerCellWrapperFixedStuck: `${tableHeaderPrefix}__cellWrapper--fixed--stuck`,
9
17
  body: tableBodyPrefix,
10
18
  bodyEmpty: `${tableBodyPrefix}__empty`,
11
19
  bodyFetchMore: `${tableBodyPrefix}__fetchMore`,
12
20
  bodyRow: `${tableBodyPrefix}__row`,
13
21
  bodyRowHighlight: `${tableBodyPrefix}__row--highlight`,
14
22
  bodyRowCellWrapper: `${tableBodyPrefix}__row__cellWrapper`,
23
+ bodyRowCellWrapperFixed: `${tableBodyPrefix}__row__cellWrapper--fixed`,
24
+ bodyRowCellWrapperFixedStuck: `${tableBodyPrefix}__row__cellWrapper--fixed--stuck`,
15
25
  bodyRowExpandedTableWrapper: `${tableBodyPrefix}__row__expandedTableWrapper`,
16
26
  bodyRowExpandedTable: `${tableBodyPrefix}__row__expandedTable`,
17
27
  bodyRowExpandedTableRow: `${tableBodyPrefix}__row__expandedTableRow`,
@@ -54,4 +64,4 @@ function getCellStyle(column) {
54
64
  return style;
55
65
  }
56
66
 
57
- export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix };
67
+ export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderFixedPrefix, tableHeaderPrefix, tableLoadingPrefix, tablePrefix, tableScrollContainerPrefix };