@douyinfe/semi-foundation 2.78.0-alpha.2 → 2.78.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.
Files changed (50) hide show
  1. package/backtop/foundation.ts +3 -0
  2. package/cropper/foundation.ts +83 -0
  3. package/jsonViewer/foundation.ts +29 -9
  4. package/jsonViewer/jsonViewer.scss +2 -0
  5. package/lib/cjs/backtop/foundation.js +3 -0
  6. package/lib/cjs/cropper/foundation.d.ts +15 -0
  7. package/lib/cjs/cropper/foundation.js +84 -0
  8. package/lib/cjs/jsonViewer/foundation.d.ts +4 -3
  9. package/lib/cjs/jsonViewer/foundation.js +34 -13
  10. package/lib/cjs/jsonViewer/jsonViewer.css +2 -0
  11. package/lib/cjs/jsonViewer/jsonViewer.scss +2 -0
  12. package/lib/cjs/markdownRender/foundation.d.ts +1 -1
  13. package/lib/cjs/navigation/navigation.css +4 -4
  14. package/lib/cjs/navigation/variables.scss +2 -2
  15. package/lib/cjs/scrollList/scrollList.css +1 -0
  16. package/lib/cjs/scrollList/scrollList.scss +1 -0
  17. package/lib/cjs/scrollList/variables.scss +1 -0
  18. package/lib/cjs/table/animation.scss +1 -1
  19. package/lib/cjs/table/table.css +1 -1
  20. package/lib/cjs/tooltip/foundation.d.ts +0 -5
  21. package/lib/cjs/tooltip/foundation.js +0 -22
  22. package/lib/cjs/userGuide/userGuide.css +3 -0
  23. package/lib/cjs/userGuide/userGuide.scss +4 -0
  24. package/lib/es/backtop/foundation.js +3 -0
  25. package/lib/es/cropper/foundation.d.ts +15 -0
  26. package/lib/es/cropper/foundation.js +84 -0
  27. package/lib/es/jsonViewer/foundation.d.ts +4 -3
  28. package/lib/es/jsonViewer/foundation.js +34 -13
  29. package/lib/es/jsonViewer/jsonViewer.css +2 -0
  30. package/lib/es/jsonViewer/jsonViewer.scss +2 -0
  31. package/lib/es/markdownRender/foundation.d.ts +1 -1
  32. package/lib/es/navigation/navigation.css +4 -4
  33. package/lib/es/navigation/variables.scss +2 -2
  34. package/lib/es/scrollList/scrollList.css +1 -0
  35. package/lib/es/scrollList/scrollList.scss +1 -0
  36. package/lib/es/scrollList/variables.scss +1 -0
  37. package/lib/es/table/animation.scss +1 -1
  38. package/lib/es/table/table.css +1 -1
  39. package/lib/es/tooltip/foundation.d.ts +0 -5
  40. package/lib/es/tooltip/foundation.js +0 -22
  41. package/lib/es/userGuide/userGuide.css +3 -0
  42. package/lib/es/userGuide/userGuide.scss +4 -0
  43. package/markdownRender/foundation.ts +1 -2
  44. package/navigation/variables.scss +2 -2
  45. package/package.json +4 -4
  46. package/scrollList/scrollList.scss +1 -0
  47. package/scrollList/variables.scss +1 -0
  48. package/table/animation.scss +1 -1
  49. package/tooltip/foundation.ts +2 -26
  50. package/userGuide/userGuide.scss +4 -0
@@ -22,6 +22,9 @@ export default class BackTopFoundation extends BaseFoundation<BackTopAdapter> {
22
22
  init() {
23
23
  const { target } = this.getProps();
24
24
  const targetNode = target();
25
+ if (!targetNode) {
26
+ return;
27
+ }
25
28
  targetNode.addEventListener('scroll', this.handleScroll);
26
29
  this.handleScroll();
27
30
  }
@@ -60,6 +60,12 @@ export default class CropperFoundation <P = Record<string, any>, S = Record<stri
60
60
  rangeX: [number, number];
61
61
  rangeY: [number, number];
62
62
  initial: boolean;
63
+ previewImg: HTMLImageElement;
64
+ previewContainer: HTMLElement;
65
+ previewContainerInitSize: {
66
+ width: number;
67
+ height: number
68
+ };
63
69
 
64
70
  constructor(adapter: CropperAdapter<P, S>) {
65
71
  super({ ...adapter });
@@ -74,6 +80,8 @@ export default class CropperFoundation <P = Record<string, any>, S = Record<stri
74
80
  this.rangeX = null;
75
81
  this.rangeY = null;
76
82
  this.initial = false;
83
+ this.previewImg = null;
84
+ this.previewContainer = null;
77
85
  }
78
86
 
79
87
  init() {
@@ -88,6 +96,7 @@ export default class CropperFoundation <P = Record<string, any>, S = Record<stri
88
96
  destroy() {
89
97
  this.unBindMoveEvent();
90
98
  this.unBindResizeEvent();
99
+ this.removePreview();
91
100
  }
92
101
 
93
102
  getImgDataWhenResize = (ratio: number) => {
@@ -228,6 +237,80 @@ export default class CropperFoundation <P = Record<string, any>, S = Record<stri
228
237
  cropperBox: newCropperBoxState,
229
238
  loaded: true,
230
239
  } as any);
240
+
241
+ this.renderPreview();
242
+ }
243
+
244
+ renderPreview = () => {
245
+ const { preview, src } = this.getProps();
246
+ const previewNode = preview?.();
247
+ if (!previewNode) {
248
+ return;
249
+ }
250
+ const img = document.createElement('img');
251
+ this.previewImg = img;
252
+ this.previewContainer = previewNode;
253
+ img.src = src;
254
+ previewNode.appendChild(img);
255
+ this.previewContainer.style.overflow = 'hidden';
256
+ // 记录预览容器初始宽高
257
+ const { width: previewWidth, height: previewHeight } = previewNode.getBoundingClientRect();
258
+ this.previewContainerInitSize = {
259
+ width: previewWidth,
260
+ height: previewHeight,
261
+ };
262
+ }
263
+
264
+ updatePreview = (props: {
265
+ width: number;
266
+ height: number;
267
+ translateX: number;
268
+ translateY: number;
269
+ rotate: number
270
+ }) => {
271
+ if (!this.previewImg) {
272
+ return;
273
+ }
274
+ const { cropperBox } = this.getStates();
275
+ let zoom = 1;
276
+ const { width: containerWidth, height: containerHeight } = this.previewContainerInitSize;
277
+ let previewWidth = containerWidth;
278
+ let previewHeight = containerHeight;
279
+ if (previewWidth < previewHeight) {
280
+ zoom = containerWidth / cropperBox.width;
281
+ let tempHeight = zoom * cropperBox.height;
282
+ if (tempHeight > containerHeight) {
283
+ zoom = containerHeight / cropperBox.height;
284
+ previewWidth = zoom * cropperBox.width;
285
+ } else {
286
+ previewHeight = tempHeight;
287
+ }
288
+ } else {
289
+ zoom = containerHeight / cropperBox.height;
290
+ let tempWidth = zoom * cropperBox.width;
291
+ if (tempWidth > containerWidth) {
292
+ zoom = containerWidth / cropperBox.width;
293
+ previewHeight = zoom * cropperBox.height;
294
+ } else {
295
+ previewWidth = tempWidth;
296
+ }
297
+ }
298
+ const { width, height, translateX, translateY, rotate } = props;
299
+ // Set the image style
300
+ this.previewImg.style.width = `${width * zoom}px`;
301
+ this.previewImg.style.height = `${height * zoom}px`;
302
+ this.previewImg.style.transform = `translate(${translateX * zoom}px, ${translateY * zoom}px) rotate(${rotate}deg)`;
303
+ this.previewImg.style.transformOrigin = 'center';
304
+ // set preview container size
305
+ this.previewContainer.style.width = `${previewWidth}px`;
306
+ this.previewContainer.style.height = `${previewHeight}px`;
307
+ }
308
+
309
+ removePreview = () => {
310
+ if (this.previewImg && this.previewContainer) {
311
+ this.previewContainer.removeChild(this.previewImg);
312
+ this.previewImg = null;
313
+ }
231
314
  }
232
315
 
233
316
  handleWheel = (e: any) => {
@@ -1,4 +1,3 @@
1
-
2
1
  import { JsonViewer, JsonViewerOptions, CustomRenderRule } from '@douyinfe/semi-json-viewer-core';
3
2
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
4
3
 
@@ -37,18 +36,35 @@ class JsonViewerFoundation extends BaseFoundation<JsonViewerAdapter> {
37
36
 
38
37
  }
39
38
 
40
- search(searchText: string) {
41
- const state = this.getState('searchOptions');
42
- const { caseSensitive, wholeWord, regex } = state;
43
- this.jsonViewer?.getSearchWidget().search(searchText, caseSensitive, wholeWord, regex);
39
+ search(searchText: string, caseSensitive?: boolean, wholeWord?: boolean, regex?: boolean) {
40
+ let options;
41
+ if (caseSensitive !== undefined || wholeWord !== undefined || regex !== undefined) {
42
+ options = {
43
+ caseSensitive: caseSensitive ?? false,
44
+ wholeWord: wholeWord ?? false,
45
+ regex: regex ?? false
46
+ };
47
+ } else {
48
+ options = this.getState('searchOptions');
49
+ }
50
+ const { caseSensitive: cs, wholeWord: ww, regex: rx } = options;
51
+ this.jsonViewer?.getSearchWidget().search(searchText, cs, ww, rx);
44
52
  }
45
53
 
46
- prevSearch() {
47
- this.jsonViewer?.getSearchWidget().navigateResults(-1);
54
+ prevSearch(step?: number) {
55
+ if (step === undefined) {
56
+ this.jsonViewer?.getSearchWidget().navigateResults(-1);
57
+ } else {
58
+ this.jsonViewer?.getSearchWidget().navigateResults(-step);
59
+ }
48
60
  }
49
61
 
50
- nextSearch() {
51
- this.jsonViewer?.getSearchWidget().navigateResults(1);
62
+ nextSearch(step?: number) {
63
+ if (step === undefined) {
64
+ this.jsonViewer?.getSearchWidget().navigateResults(1);
65
+ } else {
66
+ this.jsonViewer?.getSearchWidget().navigateResults(step);
67
+ }
52
68
  }
53
69
 
54
70
  replace(replaceText: string) {
@@ -72,6 +88,10 @@ class JsonViewerFoundation extends BaseFoundation<JsonViewerAdapter> {
72
88
  showSearchBar() {
73
89
  this._adapter.showSearchBar();
74
90
  }
91
+
92
+ getSearchResults() {
93
+ return this.jsonViewer?.getSearchWidget().searchResults;
94
+ }
75
95
  }
76
96
 
77
97
  export default JsonViewerFoundation;
@@ -83,6 +83,8 @@ $module: #{$prefix}-json-viewer;
83
83
  text-align: center;
84
84
  width: 50px;
85
85
  user-select: none;
86
+ word-wrap: normal !important;
87
+ overflow-wrap: normal !important;
86
88
  }
87
89
 
88
90
  &-content-container {
@@ -51,6 +51,9 @@ class BackTopFoundation extends _foundation.default {
51
51
  target
52
52
  } = this.getProps();
53
53
  const targetNode = target();
54
+ if (!targetNode) {
55
+ return;
56
+ }
54
57
  targetNode.addEventListener('scroll', this.handleScroll);
55
58
  this.handleScroll();
56
59
  }
@@ -51,6 +51,12 @@ export default class CropperFoundation<P = Record<string, any>, S = Record<strin
51
51
  rangeX: [number, number];
52
52
  rangeY: [number, number];
53
53
  initial: boolean;
54
+ previewImg: HTMLImageElement;
55
+ previewContainer: HTMLElement;
56
+ previewContainerInitSize: {
57
+ width: number;
58
+ height: number;
59
+ };
54
60
  constructor(adapter: CropperAdapter<P, S>);
55
61
  init(): void;
56
62
  destroy(): void;
@@ -72,6 +78,15 @@ export default class CropperFoundation<P = Record<string, any>, S = Record<strin
72
78
  };
73
79
  handleResize: () => void;
74
80
  handleImageLoad: (e: any) => void;
81
+ renderPreview: () => void;
82
+ updatePreview: (props: {
83
+ width: number;
84
+ height: number;
85
+ translateX: number;
86
+ translateY: number;
87
+ rotate: number;
88
+ }) => void;
89
+ removePreview: () => void;
75
90
  handleWheel: (e: any) => void;
76
91
  getMoveParamByDir(dir: string): {
77
92
  paramX: number;
@@ -156,6 +156,87 @@ class CropperFoundation extends _foundation.default {
156
156
  cropperBox: newCropperBoxState,
157
157
  loaded: true
158
158
  });
159
+ this.renderPreview();
160
+ };
161
+ this.renderPreview = () => {
162
+ const {
163
+ preview,
164
+ src
165
+ } = this.getProps();
166
+ const previewNode = preview === null || preview === void 0 ? void 0 : preview();
167
+ if (!previewNode) {
168
+ return;
169
+ }
170
+ const img = document.createElement('img');
171
+ this.previewImg = img;
172
+ this.previewContainer = previewNode;
173
+ img.src = src;
174
+ previewNode.appendChild(img);
175
+ this.previewContainer.style.overflow = 'hidden';
176
+ // 记录预览容器初始宽高
177
+ const {
178
+ width: previewWidth,
179
+ height: previewHeight
180
+ } = previewNode.getBoundingClientRect();
181
+ this.previewContainerInitSize = {
182
+ width: previewWidth,
183
+ height: previewHeight
184
+ };
185
+ };
186
+ this.updatePreview = props => {
187
+ if (!this.previewImg) {
188
+ return;
189
+ }
190
+ const {
191
+ cropperBox
192
+ } = this.getStates();
193
+ let zoom = 1;
194
+ const {
195
+ width: containerWidth,
196
+ height: containerHeight
197
+ } = this.previewContainerInitSize;
198
+ let previewWidth = containerWidth;
199
+ let previewHeight = containerHeight;
200
+ if (previewWidth < previewHeight) {
201
+ zoom = containerWidth / cropperBox.width;
202
+ let tempHeight = zoom * cropperBox.height;
203
+ if (tempHeight > containerHeight) {
204
+ zoom = containerHeight / cropperBox.height;
205
+ previewWidth = zoom * cropperBox.width;
206
+ } else {
207
+ previewHeight = tempHeight;
208
+ }
209
+ } else {
210
+ zoom = containerHeight / cropperBox.height;
211
+ let tempWidth = zoom * cropperBox.width;
212
+ if (tempWidth > containerWidth) {
213
+ zoom = containerWidth / cropperBox.width;
214
+ previewHeight = zoom * cropperBox.height;
215
+ } else {
216
+ previewWidth = tempWidth;
217
+ }
218
+ }
219
+ const {
220
+ width,
221
+ height,
222
+ translateX,
223
+ translateY,
224
+ rotate
225
+ } = props;
226
+ // Set the image style
227
+ this.previewImg.style.width = `${width * zoom}px`;
228
+ this.previewImg.style.height = `${height * zoom}px`;
229
+ this.previewImg.style.transform = `translate(${translateX * zoom}px, ${translateY * zoom}px) rotate(${rotate}deg)`;
230
+ this.previewImg.style.transformOrigin = 'center';
231
+ // set preview container size
232
+ this.previewContainer.style.width = `${previewWidth}px`;
233
+ this.previewContainer.style.height = `${previewHeight}px`;
234
+ };
235
+ this.removePreview = () => {
236
+ if (this.previewImg && this.previewContainer) {
237
+ this.previewContainer.removeChild(this.previewImg);
238
+ this.previewImg = null;
239
+ }
159
240
  };
160
241
  this.handleWheel = e => {
161
242
  // 防止双手缩放导致页面被放大
@@ -729,6 +810,8 @@ class CropperFoundation extends _foundation.default {
729
810
  this.rangeX = null;
730
811
  this.rangeY = null;
731
812
  this.initial = false;
813
+ this.previewImg = null;
814
+ this.previewContainer = null;
732
815
  }
733
816
  init() {
734
817
  // 获取容器的宽高
@@ -741,6 +824,7 @@ class CropperFoundation extends _foundation.default {
741
824
  destroy() {
742
825
  this.unBindMoveEvent();
743
826
  this.unBindResizeEvent();
827
+ this.removePreview();
744
828
  }
745
829
  getMoveParamByDir(dir) {
746
830
  let paramX = 0,
@@ -14,12 +14,13 @@ declare class JsonViewerFoundation extends BaseFoundation<JsonViewerAdapter> {
14
14
  constructor(adapter: JsonViewerAdapter);
15
15
  jsonViewer: JsonViewer | null;
16
16
  init(): void;
17
- search(searchText: string): void;
18
- prevSearch(): void;
19
- nextSearch(): void;
17
+ search(searchText: string, caseSensitive?: boolean, wholeWord?: boolean, regex?: boolean): void;
18
+ prevSearch(step?: number): void;
19
+ nextSearch(step?: number): void;
20
20
  replace(replaceText: string): void;
21
21
  replaceAll(replaceText: string): void;
22
22
  setSearchOptions(key: string): void;
23
23
  showSearchBar(): void;
24
+ getSearchResults(): import("@douyinfe/semi-json-viewer-core/src/common/model").FindMatch[];
24
25
  }
25
26
  export default JsonViewerFoundation;
@@ -28,23 +28,40 @@ class JsonViewerFoundation extends _foundation.default {
28
28
  }
29
29
  });
30
30
  }
31
- search(searchText) {
31
+ search(searchText, caseSensitive, wholeWord, regex) {
32
32
  var _a;
33
- const state = this.getState('searchOptions');
33
+ let options;
34
+ if (caseSensitive !== undefined || wholeWord !== undefined || regex !== undefined) {
35
+ options = {
36
+ caseSensitive: caseSensitive !== null && caseSensitive !== void 0 ? caseSensitive : false,
37
+ wholeWord: wholeWord !== null && wholeWord !== void 0 ? wholeWord : false,
38
+ regex: regex !== null && regex !== void 0 ? regex : false
39
+ };
40
+ } else {
41
+ options = this.getState('searchOptions');
42
+ }
34
43
  const {
35
- caseSensitive,
36
- wholeWord,
37
- regex
38
- } = state;
39
- (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().search(searchText, caseSensitive, wholeWord, regex);
44
+ caseSensitive: cs,
45
+ wholeWord: ww,
46
+ regex: rx
47
+ } = options;
48
+ (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().search(searchText, cs, ww, rx);
40
49
  }
41
- prevSearch() {
42
- var _a;
43
- (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(-1);
50
+ prevSearch(step) {
51
+ var _a, _b;
52
+ if (step === undefined) {
53
+ (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(-1);
54
+ } else {
55
+ (_b = this.jsonViewer) === null || _b === void 0 ? void 0 : _b.getSearchWidget().navigateResults(-step);
56
+ }
44
57
  }
45
- nextSearch() {
46
- var _a;
47
- (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(1);
58
+ nextSearch(step) {
59
+ var _a, _b;
60
+ if (step === undefined) {
61
+ (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(1);
62
+ } else {
63
+ (_b = this.jsonViewer) === null || _b === void 0 ? void 0 : _b.getSearchWidget().navigateResults(step);
64
+ }
48
65
  }
49
66
  replace(replaceText) {
50
67
  var _a;
@@ -66,5 +83,9 @@ class JsonViewerFoundation extends _foundation.default {
66
83
  showSearchBar() {
67
84
  this._adapter.showSearchBar();
68
85
  }
86
+ getSearchResults() {
87
+ var _a;
88
+ return (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().searchResults;
89
+ }
69
90
  }
70
91
  var _default = exports.default = JsonViewerFoundation;
@@ -70,6 +70,8 @@
70
70
  text-align: center;
71
71
  width: 50px;
72
72
  user-select: none;
73
+ word-wrap: normal !important;
74
+ overflow-wrap: normal !important;
73
75
  }
74
76
  .semi-json-viewer-content-container {
75
77
  scrollbar-width: none; /* 隐藏滚动条(Firefox) */
@@ -83,6 +83,8 @@ $module: #{$prefix}-json-viewer;
83
83
  text-align: center;
84
84
  width: 50px;
85
85
  user-select: none;
86
+ word-wrap: normal !important;
87
+ overflow-wrap: normal !important;
86
88
  }
87
89
 
88
90
  &-content-container {
@@ -1,6 +1,6 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
2
  import { MDXProps } from 'mdx/types';
3
- import type { PluggableList } from 'unified';
3
+ import { type PluggableList } from "@mdx-js/mdx/lib/core";
4
4
  export interface MarkdownRenderAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
5
5
  getRuntime: () => any;
6
6
  }
@@ -529,12 +529,12 @@
529
529
  .semi-navigation-vertical .semi-navigation-header {
530
530
  padding-top: 32px;
531
531
  padding-bottom: 36px;
532
- padding-left: 5.5px;
532
+ padding-left: 3.5px;
533
533
  padding-right: 8px;
534
534
  width: 100%;
535
535
  }
536
536
  .semi-navigation-vertical .semi-navigation-header-collapsed {
537
- padding-left: 5.5px;
537
+ padding-left: 3.5px;
538
538
  padding-right: 0;
539
539
  transition: padding-left 100ms ease-out, width 200ms cubic-bezier(0.62, 0.05, 0.36, 0.95);
540
540
  }
@@ -772,12 +772,12 @@
772
772
  }
773
773
  .semi-rtl .semi-navigation-vertical .semi-navigation-header,
774
774
  .semi-portal-rtl .semi-navigation-vertical .semi-navigation-header {
775
- padding-right: 5.5px;
775
+ padding-right: 3.5px;
776
776
  padding-left: 8px;
777
777
  }
778
778
  .semi-rtl .semi-navigation-vertical .semi-navigation-header-collapsed,
779
779
  .semi-portal-rtl .semi-navigation-vertical .semi-navigation-header-collapsed {
780
- padding-right: 5.5px;
780
+ padding-right: 3.5px;
781
781
  padding-left: 0;
782
782
  transition: padding-right 100ms ease-out, width 200ms cubic-bezier(0.62, 0.05, 0.36, 0.95);
783
783
  }
@@ -47,9 +47,9 @@ $spacing-navigation_dropdown_item_nav_sub_title-paddingY: $spacing-tight; // 导
47
47
  $spacing-navigation_dropdown_item_nav_item-marginTop: 0; // 导航栏下拉菜单项顶部外边距
48
48
  $spacing-navigation_dropdown_item_nav_item-marginBottom: 0; // 导航栏下拉菜单项底部外边距
49
49
  $spacing-navigation_vertical_nav_item_last-marginBottom: 0; // 侧边导航栏下拉最后一个菜单项底部外边距
50
- $spacing-navigation_vertical_nav_header-paddingLeft: ($width-navigation_container_collapsed - $spacing-base-tight - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏 header 左侧内边距
50
+ $spacing-navigation_vertical_nav_header-paddingLeft: ($width-navigation_container_collapsed - $spacing-navigation_collapsed-paddingX * 2 - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏 header 左侧内边距
51
51
  $spacing-navigation_vertical_nav_header-paddingRight: $spacing-tight; // 侧边导航栏 header 右侧内边距
52
- $spacing-navigation_vertical_nav_header_collapsed-paddingLeft: ($width-navigation_container_collapsed - $spacing-base-tight - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏收起后 header 左侧内边距
52
+ $spacing-navigation_vertical_nav_header_collapsed-paddingLeft: ($width-navigation_container_collapsed - $spacing-navigation_collapsed-paddingX * 2 - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏收起后 header 左侧内边距
53
53
  $spacing-navigation_vertical_nav_header_collapsed-paddingRight: 0; // 侧边导航栏收起后 header 右侧内边距
54
54
  $spacing-navigation_vertical_footer-paddingLeft: $spacing-tight; // 侧边导航栏 footer 左侧内边距
55
55
  $spacing-navigation_vertical_footer-paddingRight: $spacing-tight; // 侧边导航栏 footer 右侧内边距
@@ -17,6 +17,7 @@
17
17
  .semi-scrolllist-header {
18
18
  text-align: center;
19
19
  padding: 0 16px;
20
+ background: transparent;
20
21
  }
21
22
  .semi-scrolllist-header-title {
22
23
  padding: 16px 0;
@@ -22,6 +22,7 @@ $module: #{$prefix}-scrolllist;
22
22
  &-header {
23
23
  text-align: center;
24
24
  padding: $spacing-scrollList_header-paddingY $spacing-scrollList_header-paddingX;
25
+ background: $color-scrollList_header-bg;
25
26
 
26
27
  &-title {
27
28
  padding: $spacing-scrollList_header_title-paddingY $spacing-scrollList_header_title-paddingX;
@@ -1,6 +1,7 @@
1
1
  // Color
2
2
  $color-scrollList-bg: var(--semi-color-bg-3); // 滚动列表背景色
3
3
  $color-scrollList-border: var(--semi-color-border); // 滚动列表描边颜色
4
+ $color-scrollList_header-bg: transparent; // 滚动列表 header 背景色
4
5
  $color-scrollList_header-title: var(--semi-color-text-0); // 滚动列表标题颜色
5
6
  $color-scrollList_item-bg: transparent; // 滚动列表选项背景色
6
7
  $color-scrollList_item-text: var(--semi-color-text-0); // 滚动列表选项文字颜色
@@ -1,5 +1,5 @@
1
1
  $transition_duration-table_body-bg: var(--semi-transition_duration-none); // 表格-背景颜色-动画持续时间
2
2
  $transition_function-table_body-bg: var(--semi-transition_function-easeOut); // 表格-背景颜色-过渡曲线
3
3
  $transition_delay-table_body-bg: 0ms; // 表格-背景颜色-延迟时间
4
- $transition_duration-table_row-head-bg: 0.1s; // 表格-行头-背景颜色-动画持续时间
4
+ $transition_duration-table_row-head-bg: var(--semi-transition_duration-none); // 表格-行头-背景颜色-动画持续时间
5
5
  $transition_function-table_row-head-bg: linear; // 表格-行头-背景颜色-过渡曲线
@@ -134,7 +134,7 @@
134
134
  vertical-align: middle;
135
135
  overflow-wrap: break-word;
136
136
  position: relative;
137
- transition: background-color 0.1s linear;
137
+ transition: background-color var(--semi-transition_duration-none) linear;
138
138
  }
139
139
  .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort {
140
140
  cursor: pointer;
@@ -59,7 +59,6 @@ export interface PopupContainerDOMRect extends DOMRectLikeType {
59
59
  export default class Tooltip<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<TooltipAdapter<P, S>, P, S> {
60
60
  _timer: ReturnType<typeof setTimeout>;
61
61
  _mounted: boolean;
62
- anchorName: string;
63
62
  constructor(adapter: TooltipAdapter<P, S>);
64
63
  init(): void;
65
64
  destroy(): void;
@@ -77,10 +76,6 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
77
76
  _reducePos(position?: string): string;
78
77
  clearDelayTimer(): void;
79
78
  updateStateIfCursorOnTrigger: (trigger: HTMLElement) => void;
80
- getNativeAnchorStyle: () => {
81
- positionAnchor: string;
82
- position: string;
83
- };
84
79
  _generateEvent(types: ArrayElement<typeof strings.TRIGGER_SET>): {
85
80
  triggerEventSet: {
86
81
  [x: string]: (event: any) => void;
@@ -8,7 +8,6 @@ var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
8
8
  var _get2 = _interopRequireDefault(require("lodash/get"));
9
9
  var _foundation = _interopRequireDefault(require("../base/foundation"));
10
10
  var _a11y = require("../utils/a11y");
11
- var _uuid = require("../utils/uuid");
12
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
12
  const REGS = {
14
13
  TOP: /top/i,
@@ -29,7 +28,6 @@ class Tooltip extends _foundation.default {
29
28
  var _this;
30
29
  super(Object.assign({}, adapter));
31
30
  _this = this;
32
- this.anchorName = `--native-semi-anchor-${(0, _uuid.getUuidShort)()}`;
33
31
  this.removePortal = () => {
34
32
  this._adapter.removePortal();
35
33
  };
@@ -44,26 +42,6 @@ class Tooltip extends _foundation.default {
44
42
  (_b = triggerEventSet[eventNames.mouseEnter]) === null || _b === void 0 ? void 0 : _b.call(triggerEventSet);
45
43
  }
46
44
  };
47
- this.getNativeAnchorStyle = () => {
48
- const style = {
49
- positionAnchor: this.anchorName,
50
- position: "fixed"
51
- };
52
- const position = this._adapter.getProp("position");
53
- const spacing = this._adapter.getProp("spacing");
54
- if (position === "top") {
55
- style['bottom'] = `anchor(top)`;
56
- style['justifySelf'] = "anchor-center";
57
- style["transform"] = `translateY(-${spacing}px)`;
58
- } else if (position === "bottom") {
59
- style['top'] = `anchor(bottom)`;
60
- style['justifySelf'] = "anchor-center";
61
- style["transform"] = `translateY(${spacing}px)`;
62
- } else {
63
- throw new Error(`Currently, not support position ${position} when enable native anchor ability, only 'top' 'bottom'.`);
64
- }
65
- return style;
66
- };
67
45
  this.onResize = () => {
68
46
  // this.log('resize');
69
47
  // rePosition when window resize
@@ -9,6 +9,9 @@
9
9
  height: 100vh;
10
10
  pointer-events: none;
11
11
  }
12
+ .semi-userGuide-spotlight-transparent-rect {
13
+ pointer-events: auto;
14
+ }
12
15
  .semi-userGuide-spotlight-rect {
13
16
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
14
17
  }
@@ -14,6 +14,10 @@ $module: #{$prefix}-userGuide;
14
14
  height: 100vh;
15
15
  pointer-events: none;
16
16
 
17
+ &-transparent-rect {
18
+ pointer-events: auto;
19
+ }
20
+
17
21
  &-rect {
18
22
  transition: all $transition_duration-userGuide_spotLight $transition_function-userGuide_spotLight;
19
23
  }
@@ -44,6 +44,9 @@ export default class BackTopFoundation extends BaseFoundation {
44
44
  target
45
45
  } = this.getProps();
46
46
  const targetNode = target();
47
+ if (!targetNode) {
48
+ return;
49
+ }
47
50
  targetNode.addEventListener('scroll', this.handleScroll);
48
51
  this.handleScroll();
49
52
  }
@@ -51,6 +51,12 @@ export default class CropperFoundation<P = Record<string, any>, S = Record<strin
51
51
  rangeX: [number, number];
52
52
  rangeY: [number, number];
53
53
  initial: boolean;
54
+ previewImg: HTMLImageElement;
55
+ previewContainer: HTMLElement;
56
+ previewContainerInitSize: {
57
+ width: number;
58
+ height: number;
59
+ };
54
60
  constructor(adapter: CropperAdapter<P, S>);
55
61
  init(): void;
56
62
  destroy(): void;
@@ -72,6 +78,15 @@ export default class CropperFoundation<P = Record<string, any>, S = Record<strin
72
78
  };
73
79
  handleResize: () => void;
74
80
  handleImageLoad: (e: any) => void;
81
+ renderPreview: () => void;
82
+ updatePreview: (props: {
83
+ width: number;
84
+ height: number;
85
+ translateX: number;
86
+ translateY: number;
87
+ rotate: number;
88
+ }) => void;
89
+ removePreview: () => void;
75
90
  handleWheel: (e: any) => void;
76
91
  getMoveParamByDir(dir: string): {
77
92
  paramX: number;
@@ -149,6 +149,87 @@ export default class CropperFoundation extends BaseFoundation {
149
149
  cropperBox: newCropperBoxState,
150
150
  loaded: true
151
151
  });
152
+ this.renderPreview();
153
+ };
154
+ this.renderPreview = () => {
155
+ const {
156
+ preview,
157
+ src
158
+ } = this.getProps();
159
+ const previewNode = preview === null || preview === void 0 ? void 0 : preview();
160
+ if (!previewNode) {
161
+ return;
162
+ }
163
+ const img = document.createElement('img');
164
+ this.previewImg = img;
165
+ this.previewContainer = previewNode;
166
+ img.src = src;
167
+ previewNode.appendChild(img);
168
+ this.previewContainer.style.overflow = 'hidden';
169
+ // 记录预览容器初始宽高
170
+ const {
171
+ width: previewWidth,
172
+ height: previewHeight
173
+ } = previewNode.getBoundingClientRect();
174
+ this.previewContainerInitSize = {
175
+ width: previewWidth,
176
+ height: previewHeight
177
+ };
178
+ };
179
+ this.updatePreview = props => {
180
+ if (!this.previewImg) {
181
+ return;
182
+ }
183
+ const {
184
+ cropperBox
185
+ } = this.getStates();
186
+ let zoom = 1;
187
+ const {
188
+ width: containerWidth,
189
+ height: containerHeight
190
+ } = this.previewContainerInitSize;
191
+ let previewWidth = containerWidth;
192
+ let previewHeight = containerHeight;
193
+ if (previewWidth < previewHeight) {
194
+ zoom = containerWidth / cropperBox.width;
195
+ let tempHeight = zoom * cropperBox.height;
196
+ if (tempHeight > containerHeight) {
197
+ zoom = containerHeight / cropperBox.height;
198
+ previewWidth = zoom * cropperBox.width;
199
+ } else {
200
+ previewHeight = tempHeight;
201
+ }
202
+ } else {
203
+ zoom = containerHeight / cropperBox.height;
204
+ let tempWidth = zoom * cropperBox.width;
205
+ if (tempWidth > containerWidth) {
206
+ zoom = containerWidth / cropperBox.width;
207
+ previewHeight = zoom * cropperBox.height;
208
+ } else {
209
+ previewWidth = tempWidth;
210
+ }
211
+ }
212
+ const {
213
+ width,
214
+ height,
215
+ translateX,
216
+ translateY,
217
+ rotate
218
+ } = props;
219
+ // Set the image style
220
+ this.previewImg.style.width = `${width * zoom}px`;
221
+ this.previewImg.style.height = `${height * zoom}px`;
222
+ this.previewImg.style.transform = `translate(${translateX * zoom}px, ${translateY * zoom}px) rotate(${rotate}deg)`;
223
+ this.previewImg.style.transformOrigin = 'center';
224
+ // set preview container size
225
+ this.previewContainer.style.width = `${previewWidth}px`;
226
+ this.previewContainer.style.height = `${previewHeight}px`;
227
+ };
228
+ this.removePreview = () => {
229
+ if (this.previewImg && this.previewContainer) {
230
+ this.previewContainer.removeChild(this.previewImg);
231
+ this.previewImg = null;
232
+ }
152
233
  };
153
234
  this.handleWheel = e => {
154
235
  // 防止双手缩放导致页面被放大
@@ -722,6 +803,8 @@ export default class CropperFoundation extends BaseFoundation {
722
803
  this.rangeX = null;
723
804
  this.rangeY = null;
724
805
  this.initial = false;
806
+ this.previewImg = null;
807
+ this.previewContainer = null;
725
808
  }
726
809
  init() {
727
810
  // 获取容器的宽高
@@ -734,6 +817,7 @@ export default class CropperFoundation extends BaseFoundation {
734
817
  destroy() {
735
818
  this.unBindMoveEvent();
736
819
  this.unBindResizeEvent();
820
+ this.removePreview();
737
821
  }
738
822
  getMoveParamByDir(dir) {
739
823
  let paramX = 0,
@@ -14,12 +14,13 @@ declare class JsonViewerFoundation extends BaseFoundation<JsonViewerAdapter> {
14
14
  constructor(adapter: JsonViewerAdapter);
15
15
  jsonViewer: JsonViewer | null;
16
16
  init(): void;
17
- search(searchText: string): void;
18
- prevSearch(): void;
19
- nextSearch(): void;
17
+ search(searchText: string, caseSensitive?: boolean, wholeWord?: boolean, regex?: boolean): void;
18
+ prevSearch(step?: number): void;
19
+ nextSearch(step?: number): void;
20
20
  replace(replaceText: string): void;
21
21
  replaceAll(replaceText: string): void;
22
22
  setSearchOptions(key: string): void;
23
23
  showSearchBar(): void;
24
+ getSearchResults(): import("@douyinfe/semi-json-viewer-core/src/common/model").FindMatch[];
24
25
  }
25
26
  export default JsonViewerFoundation;
@@ -21,23 +21,40 @@ class JsonViewerFoundation extends BaseFoundation {
21
21
  }
22
22
  });
23
23
  }
24
- search(searchText) {
24
+ search(searchText, caseSensitive, wholeWord, regex) {
25
25
  var _a;
26
- const state = this.getState('searchOptions');
26
+ let options;
27
+ if (caseSensitive !== undefined || wholeWord !== undefined || regex !== undefined) {
28
+ options = {
29
+ caseSensitive: caseSensitive !== null && caseSensitive !== void 0 ? caseSensitive : false,
30
+ wholeWord: wholeWord !== null && wholeWord !== void 0 ? wholeWord : false,
31
+ regex: regex !== null && regex !== void 0 ? regex : false
32
+ };
33
+ } else {
34
+ options = this.getState('searchOptions');
35
+ }
27
36
  const {
28
- caseSensitive,
29
- wholeWord,
30
- regex
31
- } = state;
32
- (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().search(searchText, caseSensitive, wholeWord, regex);
37
+ caseSensitive: cs,
38
+ wholeWord: ww,
39
+ regex: rx
40
+ } = options;
41
+ (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().search(searchText, cs, ww, rx);
33
42
  }
34
- prevSearch() {
35
- var _a;
36
- (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(-1);
43
+ prevSearch(step) {
44
+ var _a, _b;
45
+ if (step === undefined) {
46
+ (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(-1);
47
+ } else {
48
+ (_b = this.jsonViewer) === null || _b === void 0 ? void 0 : _b.getSearchWidget().navigateResults(-step);
49
+ }
37
50
  }
38
- nextSearch() {
39
- var _a;
40
- (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(1);
51
+ nextSearch(step) {
52
+ var _a, _b;
53
+ if (step === undefined) {
54
+ (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().navigateResults(1);
55
+ } else {
56
+ (_b = this.jsonViewer) === null || _b === void 0 ? void 0 : _b.getSearchWidget().navigateResults(step);
57
+ }
41
58
  }
42
59
  replace(replaceText) {
43
60
  var _a;
@@ -59,5 +76,9 @@ class JsonViewerFoundation extends BaseFoundation {
59
76
  showSearchBar() {
60
77
  this._adapter.showSearchBar();
61
78
  }
79
+ getSearchResults() {
80
+ var _a;
81
+ return (_a = this.jsonViewer) === null || _a === void 0 ? void 0 : _a.getSearchWidget().searchResults;
82
+ }
62
83
  }
63
84
  export default JsonViewerFoundation;
@@ -70,6 +70,8 @@
70
70
  text-align: center;
71
71
  width: 50px;
72
72
  user-select: none;
73
+ word-wrap: normal !important;
74
+ overflow-wrap: normal !important;
73
75
  }
74
76
  .semi-json-viewer-content-container {
75
77
  scrollbar-width: none; /* 隐藏滚动条(Firefox) */
@@ -83,6 +83,8 @@ $module: #{$prefix}-json-viewer;
83
83
  text-align: center;
84
84
  width: 50px;
85
85
  user-select: none;
86
+ word-wrap: normal !important;
87
+ overflow-wrap: normal !important;
86
88
  }
87
89
 
88
90
  &-content-container {
@@ -1,6 +1,6 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
2
  import { MDXProps } from 'mdx/types';
3
- import type { PluggableList } from 'unified';
3
+ import { type PluggableList } from "@mdx-js/mdx/lib/core";
4
4
  export interface MarkdownRenderAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
5
5
  getRuntime: () => any;
6
6
  }
@@ -529,12 +529,12 @@
529
529
  .semi-navigation-vertical .semi-navigation-header {
530
530
  padding-top: 32px;
531
531
  padding-bottom: 36px;
532
- padding-left: 5.5px;
532
+ padding-left: 3.5px;
533
533
  padding-right: 8px;
534
534
  width: 100%;
535
535
  }
536
536
  .semi-navigation-vertical .semi-navigation-header-collapsed {
537
- padding-left: 5.5px;
537
+ padding-left: 3.5px;
538
538
  padding-right: 0;
539
539
  transition: padding-left 100ms ease-out, width 200ms cubic-bezier(0.62, 0.05, 0.36, 0.95);
540
540
  }
@@ -772,12 +772,12 @@
772
772
  }
773
773
  .semi-rtl .semi-navigation-vertical .semi-navigation-header,
774
774
  .semi-portal-rtl .semi-navigation-vertical .semi-navigation-header {
775
- padding-right: 5.5px;
775
+ padding-right: 3.5px;
776
776
  padding-left: 8px;
777
777
  }
778
778
  .semi-rtl .semi-navigation-vertical .semi-navigation-header-collapsed,
779
779
  .semi-portal-rtl .semi-navigation-vertical .semi-navigation-header-collapsed {
780
- padding-right: 5.5px;
780
+ padding-right: 3.5px;
781
781
  padding-left: 0;
782
782
  transition: padding-right 100ms ease-out, width 200ms cubic-bezier(0.62, 0.05, 0.36, 0.95);
783
783
  }
@@ -47,9 +47,9 @@ $spacing-navigation_dropdown_item_nav_sub_title-paddingY: $spacing-tight; // 导
47
47
  $spacing-navigation_dropdown_item_nav_item-marginTop: 0; // 导航栏下拉菜单项顶部外边距
48
48
  $spacing-navigation_dropdown_item_nav_item-marginBottom: 0; // 导航栏下拉菜单项底部外边距
49
49
  $spacing-navigation_vertical_nav_item_last-marginBottom: 0; // 侧边导航栏下拉最后一个菜单项底部外边距
50
- $spacing-navigation_vertical_nav_header-paddingLeft: ($width-navigation_container_collapsed - $spacing-base-tight - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏 header 左侧内边距
50
+ $spacing-navigation_vertical_nav_header-paddingLeft: ($width-navigation_container_collapsed - $spacing-navigation_collapsed-paddingX * 2 - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏 header 左侧内边距
51
51
  $spacing-navigation_vertical_nav_header-paddingRight: $spacing-tight; // 侧边导航栏 header 右侧内边距
52
- $spacing-navigation_vertical_nav_header_collapsed-paddingLeft: ($width-navigation_container_collapsed - $spacing-base-tight - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏收起后 header 左侧内边距
52
+ $spacing-navigation_vertical_nav_header_collapsed-paddingLeft: ($width-navigation_container_collapsed - $spacing-navigation_collapsed-paddingX * 2 - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏收起后 header 左侧内边距
53
53
  $spacing-navigation_vertical_nav_header_collapsed-paddingRight: 0; // 侧边导航栏收起后 header 右侧内边距
54
54
  $spacing-navigation_vertical_footer-paddingLeft: $spacing-tight; // 侧边导航栏 footer 左侧内边距
55
55
  $spacing-navigation_vertical_footer-paddingRight: $spacing-tight; // 侧边导航栏 footer 右侧内边距
@@ -17,6 +17,7 @@
17
17
  .semi-scrolllist-header {
18
18
  text-align: center;
19
19
  padding: 0 16px;
20
+ background: transparent;
20
21
  }
21
22
  .semi-scrolllist-header-title {
22
23
  padding: 16px 0;
@@ -22,6 +22,7 @@ $module: #{$prefix}-scrolllist;
22
22
  &-header {
23
23
  text-align: center;
24
24
  padding: $spacing-scrollList_header-paddingY $spacing-scrollList_header-paddingX;
25
+ background: $color-scrollList_header-bg;
25
26
 
26
27
  &-title {
27
28
  padding: $spacing-scrollList_header_title-paddingY $spacing-scrollList_header_title-paddingX;
@@ -1,6 +1,7 @@
1
1
  // Color
2
2
  $color-scrollList-bg: var(--semi-color-bg-3); // 滚动列表背景色
3
3
  $color-scrollList-border: var(--semi-color-border); // 滚动列表描边颜色
4
+ $color-scrollList_header-bg: transparent; // 滚动列表 header 背景色
4
5
  $color-scrollList_header-title: var(--semi-color-text-0); // 滚动列表标题颜色
5
6
  $color-scrollList_item-bg: transparent; // 滚动列表选项背景色
6
7
  $color-scrollList_item-text: var(--semi-color-text-0); // 滚动列表选项文字颜色
@@ -1,5 +1,5 @@
1
1
  $transition_duration-table_body-bg: var(--semi-transition_duration-none); // 表格-背景颜色-动画持续时间
2
2
  $transition_function-table_body-bg: var(--semi-transition_function-easeOut); // 表格-背景颜色-过渡曲线
3
3
  $transition_delay-table_body-bg: 0ms; // 表格-背景颜色-延迟时间
4
- $transition_duration-table_row-head-bg: 0.1s; // 表格-行头-背景颜色-动画持续时间
4
+ $transition_duration-table_row-head-bg: var(--semi-transition_duration-none); // 表格-行头-背景颜色-动画持续时间
5
5
  $transition_function-table_row-head-bg: linear; // 表格-行头-背景颜色-过渡曲线
@@ -134,7 +134,7 @@
134
134
  vertical-align: middle;
135
135
  overflow-wrap: break-word;
136
136
  position: relative;
137
- transition: background-color 0.1s linear;
137
+ transition: background-color var(--semi-transition_duration-none) linear;
138
138
  }
139
139
  .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort {
140
140
  cursor: pointer;
@@ -59,7 +59,6 @@ export interface PopupContainerDOMRect extends DOMRectLikeType {
59
59
  export default class Tooltip<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<TooltipAdapter<P, S>, P, S> {
60
60
  _timer: ReturnType<typeof setTimeout>;
61
61
  _mounted: boolean;
62
- anchorName: string;
63
62
  constructor(adapter: TooltipAdapter<P, S>);
64
63
  init(): void;
65
64
  destroy(): void;
@@ -77,10 +76,6 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
77
76
  _reducePos(position?: string): string;
78
77
  clearDelayTimer(): void;
79
78
  updateStateIfCursorOnTrigger: (trigger: HTMLElement) => void;
80
- getNativeAnchorStyle: () => {
81
- positionAnchor: string;
82
- position: string;
83
- };
84
79
  _generateEvent(types: ArrayElement<typeof strings.TRIGGER_SET>): {
85
80
  triggerEventSet: {
86
81
  [x: string]: (event: any) => void;
@@ -2,7 +2,6 @@ import _isEmpty from "lodash/isEmpty";
2
2
  import _get from "lodash/get";
3
3
  import BaseFoundation from '../base/foundation';
4
4
  import { handlePrevent } from '../utils/a11y';
5
- import { getUuidShort } from "../utils/uuid";
6
5
  const REGS = {
7
6
  TOP: /top/i,
8
7
  RIGHT: /right/i,
@@ -22,7 +21,6 @@ export default class Tooltip extends BaseFoundation {
22
21
  var _this;
23
22
  super(Object.assign({}, adapter));
24
23
  _this = this;
25
- this.anchorName = `--native-semi-anchor-${getUuidShort()}`;
26
24
  this.removePortal = () => {
27
25
  this._adapter.removePortal();
28
26
  };
@@ -37,26 +35,6 @@ export default class Tooltip extends BaseFoundation {
37
35
  (_b = triggerEventSet[eventNames.mouseEnter]) === null || _b === void 0 ? void 0 : _b.call(triggerEventSet);
38
36
  }
39
37
  };
40
- this.getNativeAnchorStyle = () => {
41
- const style = {
42
- positionAnchor: this.anchorName,
43
- position: "fixed"
44
- };
45
- const position = this._adapter.getProp("position");
46
- const spacing = this._adapter.getProp("spacing");
47
- if (position === "top") {
48
- style['bottom'] = `anchor(top)`;
49
- style['justifySelf'] = "anchor-center";
50
- style["transform"] = `translateY(-${spacing}px)`;
51
- } else if (position === "bottom") {
52
- style['top'] = `anchor(bottom)`;
53
- style['justifySelf'] = "anchor-center";
54
- style["transform"] = `translateY(${spacing}px)`;
55
- } else {
56
- throw new Error(`Currently, not support position ${position} when enable native anchor ability, only 'top' 'bottom'.`);
57
- }
58
- return style;
59
- };
60
38
  this.onResize = () => {
61
39
  // this.log('resize');
62
40
  // rePosition when window resize
@@ -9,6 +9,9 @@
9
9
  height: 100vh;
10
10
  pointer-events: none;
11
11
  }
12
+ .semi-userGuide-spotlight-transparent-rect {
13
+ pointer-events: auto;
14
+ }
12
15
  .semi-userGuide-spotlight-rect {
13
16
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
14
17
  }
@@ -14,6 +14,10 @@ $module: #{$prefix}-userGuide;
14
14
  height: 100vh;
15
15
  pointer-events: none;
16
16
 
17
+ &-transparent-rect {
18
+ pointer-events: auto;
19
+ }
20
+
17
21
  &-rect {
18
22
  transition: all $transition_duration-userGuide_spotLight $transition_function-userGuide_spotLight;
19
23
  }
@@ -2,8 +2,7 @@ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
2
  import { CompileOptions, evaluate, compile, EvaluateOptions, evaluateSync, RunOptions } from '@mdx-js/mdx';
3
3
  import { MDXProps } from 'mdx/types';
4
4
  import remarkGfm from 'remark-gfm';
5
- import type { PluggableList } from 'unified';
6
-
5
+ import { type PluggableList } from "@mdx-js/mdx/lib/core";
7
6
  export interface MarkdownRenderAdapter <P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
8
7
  getRuntime: () => any
9
8
 
@@ -47,9 +47,9 @@ $spacing-navigation_dropdown_item_nav_sub_title-paddingY: $spacing-tight; // 导
47
47
  $spacing-navigation_dropdown_item_nav_item-marginTop: 0; // 导航栏下拉菜单项顶部外边距
48
48
  $spacing-navigation_dropdown_item_nav_item-marginBottom: 0; // 导航栏下拉菜单项底部外边距
49
49
  $spacing-navigation_vertical_nav_item_last-marginBottom: 0; // 侧边导航栏下拉最后一个菜单项底部外边距
50
- $spacing-navigation_vertical_nav_header-paddingLeft: ($width-navigation_container_collapsed - $spacing-base-tight - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏 header 左侧内边距
50
+ $spacing-navigation_vertical_nav_header-paddingLeft: ($width-navigation_container_collapsed - $spacing-navigation_collapsed-paddingX * 2 - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏 header 左侧内边距
51
51
  $spacing-navigation_vertical_nav_header-paddingRight: $spacing-tight; // 侧边导航栏 header 右侧内边距
52
- $spacing-navigation_vertical_nav_header_collapsed-paddingLeft: ($width-navigation_container_collapsed - $spacing-base-tight - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏收起后 header 左侧内边距
52
+ $spacing-navigation_vertical_nav_header_collapsed-paddingLeft: ($width-navigation_container_collapsed - $spacing-navigation_collapsed-paddingX * 2 - $width-navigation_border - $height-navigation_header_logo_collapsed) * 0.5; // 侧边导航栏收起后 header 左侧内边距
53
53
  $spacing-navigation_vertical_nav_header_collapsed-paddingRight: 0; // 侧边导航栏收起后 header 右侧内边距
54
54
  $spacing-navigation_vertical_footer-paddingLeft: $spacing-tight; // 侧边导航栏 footer 左侧内边距
55
55
  $spacing-navigation_vertical_footer-paddingRight: $spacing-tight; // 侧边导航栏 footer 右侧内边距
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.78.0-alpha.2",
3
+ "version": "2.78.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.78.0-alpha.2",
11
- "@douyinfe/semi-json-viewer-core": "2.78.0-alpha.2",
10
+ "@douyinfe/semi-animation": "2.78.0",
11
+ "@douyinfe/semi-json-viewer-core": "2.78.0",
12
12
  "@mdx-js/mdx": "^3.0.1",
13
13
  "async-validator": "^3.5.0",
14
14
  "classnames": "^2.2.6",
@@ -29,7 +29,7 @@
29
29
  "*.scss",
30
30
  "*.css"
31
31
  ],
32
- "gitHead": "8f2966f2472daa5369f886b2c246ceccf59ed94e",
32
+ "gitHead": "eb0c5baa2dd7436a6d4118eebde39f3da67eef7f",
33
33
  "devDependencies": {
34
34
  "@babel/plugin-transform-runtime": "^7.15.8",
35
35
  "@babel/preset-env": "^7.15.8",
@@ -22,6 +22,7 @@ $module: #{$prefix}-scrolllist;
22
22
  &-header {
23
23
  text-align: center;
24
24
  padding: $spacing-scrollList_header-paddingY $spacing-scrollList_header-paddingX;
25
+ background: $color-scrollList_header-bg;
25
26
 
26
27
  &-title {
27
28
  padding: $spacing-scrollList_header_title-paddingY $spacing-scrollList_header_title-paddingX;
@@ -1,6 +1,7 @@
1
1
  // Color
2
2
  $color-scrollList-bg: var(--semi-color-bg-3); // 滚动列表背景色
3
3
  $color-scrollList-border: var(--semi-color-border); // 滚动列表描边颜色
4
+ $color-scrollList_header-bg: transparent; // 滚动列表 header 背景色
4
5
  $color-scrollList_header-title: var(--semi-color-text-0); // 滚动列表标题颜色
5
6
  $color-scrollList_item-bg: transparent; // 滚动列表选项背景色
6
7
  $color-scrollList_item-text: var(--semi-color-text-0); // 滚动列表选项文字颜色
@@ -1,5 +1,5 @@
1
1
  $transition_duration-table_body-bg: var(--semi-transition_duration-none); // 表格-背景颜色-动画持续时间
2
2
  $transition_function-table_body-bg: var(--semi-transition_function-easeOut); // 表格-背景颜色-过渡曲线
3
3
  $transition_delay-table_body-bg: 0ms; // 表格-背景颜色-延迟时间
4
- $transition_duration-table_row-head-bg: 0.1s; // 表格-行头-背景颜色-动画持续时间
4
+ $transition_duration-table_row-head-bg: var(--semi-transition_duration-none); // 表格-行头-背景颜色-动画持续时间
5
5
  $transition_function-table_row-head-bg: linear; // 表格-行头-背景颜色-过渡曲线
@@ -4,7 +4,6 @@ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
4
4
  import { ArrayElement } from '../utils/type';
5
5
  import { strings } from './constants';
6
6
  import { handlePrevent } from '../utils/a11y';
7
- import { getUuidShort } from "../utils/uuid";
8
7
 
9
8
  const REGS = {
10
9
  TOP: /top/i,
@@ -82,7 +81,7 @@ export interface PopupContainerDOMRect extends DOMRectLikeType {
82
81
  export default class Tooltip<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<TooltipAdapter<P, S>, P, S> {
83
82
  _timer: ReturnType<typeof setTimeout>;
84
83
  _mounted: boolean;
85
- anchorName = `--native-semi-anchor-${getUuidShort()}`
84
+
86
85
  constructor(adapter: TooltipAdapter<P, S>) {
87
86
  super({ ...adapter });
88
87
  this._timer = null;
@@ -136,7 +135,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
136
135
  unBindResizeEvent() {
137
136
  this._adapter.unregisterResizeHandler(this.onResize);
138
137
  }
139
-
138
+
140
139
  removePortal = () => {
141
140
  this._adapter.removePortal();
142
141
  }
@@ -200,29 +199,6 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
200
199
  }
201
200
  }
202
201
 
203
- getNativeAnchorStyle = () => {
204
- const style = {
205
- positionAnchor: this.anchorName,
206
- position: "fixed",
207
- };
208
- const position = this._adapter.getProp("position");
209
- const spacing = this._adapter.getProp("spacing");
210
- if (position === "top") {
211
- style['bottom'] = `anchor(top)`;
212
- style['justifySelf'] = "anchor-center";
213
- style["transform"] = `translateY(-${spacing}px)`;
214
-
215
- } else if (position === "bottom") {
216
- style['top'] = `anchor(bottom)`;
217
- style['justifySelf'] = "anchor-center";
218
- style["transform"] = `translateY(${spacing}px)`;
219
-
220
- } else {
221
- throw new Error(`Currently, not support position ${position} when enable native anchor ability, only 'top' 'bottom'.`);
222
- }
223
- return style;
224
- }
225
-
226
202
  _generateEvent(types: ArrayElement<typeof strings.TRIGGER_SET>) {
227
203
  const eventNames = this._adapter.getEventName();
228
204
  const triggerEventSet = {
@@ -14,6 +14,10 @@ $module: #{$prefix}-userGuide;
14
14
  height: 100vh;
15
15
  pointer-events: none;
16
16
 
17
+ &-transparent-rect {
18
+ pointer-events: auto;
19
+ }
20
+
17
21
  &-rect {
18
22
  transition: all $transition_duration-userGuide_spotLight $transition_function-userGuide_spotLight;
19
23
  }