@douyinfe/semi-foundation 2.43.2 → 2.44.0-beta.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.
@@ -230,11 +230,7 @@ export const filterEvents = (events: Map<string, EventObject[]>, start: Date, en
230
230
  const item = events.get(day);
231
231
  const date = new Date(day);
232
232
  if (isDateInRange(date, start, end)) {
233
- if (res.has(day)) {
234
- res.set(day, [...res.get(day), ...item]);
235
- } else {
236
- res.set(day, item);
237
- }
233
+ res.set(day, item);
238
234
  } else if (isBefore(end, date)) {
239
235
  // do nothing
240
236
  } else {
@@ -320,13 +320,13 @@ export default class CalendarFoundation<P = Record<string, any>, S = Record<stri
320
320
 
321
321
  convertMapToArray(weekMap: Map<string, EventObject[]>, weekStart: Date) {
322
322
  const eventArray = [];
323
- const map = new Map();
324
323
  for (const entry of weekMap.entries()) {
325
324
  const [key, value] = entry;
325
+ const map = new Map();
326
326
  map.set(key, value);
327
+ const weekEvents = this._parseWeeklyEvents(map, weekStart);
328
+ eventArray.push(...weekEvents);
327
329
  }
328
- const weekEvents = this._parseWeeklyEvents(map, weekStart);
329
- eventArray.push(...weekEvents);
330
330
  return eventArray;
331
331
  }
332
332
 
@@ -395,6 +395,7 @@ $module: #{$prefix}-cascader;
395
395
  padding-right: $spacing-cascader_option-paddingRight;
396
396
  }
397
397
 
398
+
398
399
  .#{$module}-option-list {
399
400
  box-sizing: border-box;
400
401
  display: inline-block;
@@ -28,6 +28,12 @@ export interface BasicData {
28
28
  pathData?: BasicCascaderData[]
29
29
  }
30
30
 
31
+ export interface Virtualize {
32
+ itemSize: number;
33
+ height?: number | string;
34
+ width?: number | string
35
+ }
36
+
31
37
  export interface BasicEntities {
32
38
  [idx: string]: BasicEntity
33
39
  }
@@ -157,6 +163,7 @@ export interface BasicCascaderProps {
157
163
  leafOnly?: boolean;
158
164
  enableLeafClick?: boolean;
159
165
  preventScroll?: boolean;
166
+ virtualizeInSearch?: Virtualize;
160
167
  onClear?: () => void;
161
168
  triggerRender?: (props: BasicTriggerRenderProps) => any;
162
169
  onListScroll?: (e: any, panel: BasicScrollPanelProps) => void;
@@ -218,11 +218,7 @@ const filterEvents = (events, start, end) => {
218
218
  const item = events.get(day);
219
219
  const date = new Date(day);
220
220
  if (isDateInRange(date, start, end)) {
221
- if (res.has(day)) {
222
- res.set(day, [...res.get(day), ...item]);
223
- } else {
224
- res.set(day, item);
225
- }
221
+ res.set(day, item);
226
222
  } else if ((0, _dateFns.isBefore)(end, date)) {
227
223
  // do nothing
228
224
  } else {
@@ -225,13 +225,13 @@ class CalendarFoundation extends _foundation.default {
225
225
  }
226
226
  convertMapToArray(weekMap, weekStart) {
227
227
  const eventArray = [];
228
- const map = new Map();
229
228
  for (const entry of weekMap.entries()) {
230
229
  const [key, value] = entry;
230
+ const map = new Map();
231
231
  map.set(key, value);
232
+ const weekEvents = this._parseWeeklyEvents(map, weekStart);
233
+ eventArray.push(...weekEvents);
232
234
  }
233
- const weekEvents = this._parseWeeklyEvents(map, weekStart);
234
- eventArray.push(...weekEvents);
235
235
  return eventArray;
236
236
  }
237
237
  getParseMonthlyEvents(itemLimit) {
@@ -395,6 +395,7 @@ $module: #{$prefix}-cascader;
395
395
  padding-right: $spacing-cascader_option-paddingRight;
396
396
  }
397
397
 
398
+
398
399
  .#{$module}-option-list {
399
400
  box-sizing: border-box;
400
401
  display: inline-block;
@@ -6,6 +6,11 @@ export interface BasicData {
6
6
  searchText: any[];
7
7
  pathData?: BasicCascaderData[];
8
8
  }
9
+ export interface Virtualize {
10
+ itemSize: number;
11
+ height?: number | string;
12
+ width?: number | string;
13
+ }
9
14
  export interface BasicEntities {
10
15
  [idx: string]: BasicEntity;
11
16
  }
@@ -105,6 +110,7 @@ export interface BasicCascaderProps {
105
110
  leafOnly?: boolean;
106
111
  enableLeafClick?: boolean;
107
112
  preventScroll?: boolean;
113
+ virtualizeInSearch?: Virtualize;
108
114
  onClear?: () => void;
109
115
  triggerRender?: (props: BasicTriggerRenderProps) => any;
110
116
  onListScroll?: (e: any, panel: BasicScrollPanelProps) => void;
@@ -44,6 +44,14 @@
44
44
  .semi-tag-invisible {
45
45
  display: none;
46
46
  }
47
+ .semi-tag-prefix-icon {
48
+ display: flex;
49
+ padding-right: 4px;
50
+ }
51
+ .semi-tag-suffix-icon {
52
+ display: flex;
53
+ padding-left: 4px;
54
+ }
47
55
  .semi-tag-content {
48
56
  flex: 1;
49
57
  }
@@ -51,6 +51,16 @@ $types: "ghost", "solid", "light";
51
51
  display: none;
52
52
  }
53
53
 
54
+ &-prefix-icon {
55
+ display: flex;
56
+ padding-right: $spacing-tag_prefix_icon_paddingRight;
57
+ }
58
+
59
+ &-suffix-icon {
60
+ display: flex;
61
+ padding-left: $spacing-tag_suffix_icon_paddingLeft;
62
+ }
63
+
54
64
  &-content {
55
65
  flex: 1;
56
66
 
@@ -25,6 +25,9 @@ $radius-tag_circle: var(--semi-border-radius-full); // 胶囊标签圆角大小
25
25
  $spacing-tag_small-paddingY: 2px; // 小尺寸标签垂直方向内边距
26
26
  $spacing-tag_small-paddingX: $spacing-tight; // 小尺寸标签水平方向内边距
27
27
 
28
+ $spacing-tag_prefix_icon_paddingRight: $spacing-extra-tight; // 后缀图标右侧边距
29
+ $spacing-tag_suffix_icon_paddingLeft: $spacing-extra-tight; // 后缀图标左侧边距
30
+
28
31
  $spacing-tag_large-paddingY: 4px; // 大尺寸标签垂直方向内边距
29
32
  $spacing-tag_large-paddingX: $spacing-tight; // 大尺寸标签水平方向内边距
30
33
 
@@ -670,8 +670,7 @@ class Tooltip extends _foundation.default {
670
670
  * 基于视口和容器一起判断,以下几种情况允许从原方向转到反方向,以判断是否应该由top->bottom为例子
671
671
  *
672
672
  * 1. 视口上下空间不足 且 容器上空间❌下空间✅
673
- * 2. 视口上空间❌下空间✅ 且 容器上下空间不足
674
- * 3. 视口上空间❌下空间✅ 且 容器上空间❌下空间✅
673
+ * 2. 视口上空间❌下空间✅
675
674
  *
676
675
  * Based on the judgment of the viewport and the container, the following situations are allowed to turn from the original direction to the opposite direction
677
676
  * to judge whether it should be top->bottom as an example
@@ -679,7 +678,7 @@ class Tooltip extends _foundation.default {
679
678
  * 2. The space above the viewport ❌ the space below ✅ and the space above and below the container is insufficient
680
679
  * 3. Viewport upper space ❌ lower space✅ and container upper space ❌ lower space✅
681
680
  */
682
- return viewOverFlow && shouldReverseContainer || shouldReverseView && containerOverFlow || shouldReverseView && shouldReverseContainer;
681
+ return viewOverFlow && shouldReverseContainer || shouldReverseView;
683
682
  }
684
683
  // place the dom correctly
685
684
  adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect) {
@@ -199,11 +199,7 @@ export const filterEvents = (events, start, end) => {
199
199
  const item = events.get(day);
200
200
  const date = new Date(day);
201
201
  if (isDateInRange(date, start, end)) {
202
- if (res.has(day)) {
203
- res.set(day, [...res.get(day), ...item]);
204
- } else {
205
- res.set(day, item);
206
- }
202
+ res.set(day, item);
207
203
  } else if (isBefore(end, date)) {
208
204
  // do nothing
209
205
  } else {
@@ -218,13 +218,13 @@ export default class CalendarFoundation extends BaseFoundation {
218
218
  }
219
219
  convertMapToArray(weekMap, weekStart) {
220
220
  const eventArray = [];
221
- const map = new Map();
222
221
  for (const entry of weekMap.entries()) {
223
222
  const [key, value] = entry;
223
+ const map = new Map();
224
224
  map.set(key, value);
225
+ const weekEvents = this._parseWeeklyEvents(map, weekStart);
226
+ eventArray.push(...weekEvents);
225
227
  }
226
- const weekEvents = this._parseWeeklyEvents(map, weekStart);
227
- eventArray.push(...weekEvents);
228
228
  return eventArray;
229
229
  }
230
230
  getParseMonthlyEvents(itemLimit) {
@@ -395,6 +395,7 @@ $module: #{$prefix}-cascader;
395
395
  padding-right: $spacing-cascader_option-paddingRight;
396
396
  }
397
397
 
398
+
398
399
  .#{$module}-option-list {
399
400
  box-sizing: border-box;
400
401
  display: inline-block;
@@ -6,6 +6,11 @@ export interface BasicData {
6
6
  searchText: any[];
7
7
  pathData?: BasicCascaderData[];
8
8
  }
9
+ export interface Virtualize {
10
+ itemSize: number;
11
+ height?: number | string;
12
+ width?: number | string;
13
+ }
9
14
  export interface BasicEntities {
10
15
  [idx: string]: BasicEntity;
11
16
  }
@@ -105,6 +110,7 @@ export interface BasicCascaderProps {
105
110
  leafOnly?: boolean;
106
111
  enableLeafClick?: boolean;
107
112
  preventScroll?: boolean;
113
+ virtualizeInSearch?: Virtualize;
108
114
  onClear?: () => void;
109
115
  triggerRender?: (props: BasicTriggerRenderProps) => any;
110
116
  onListScroll?: (e: any, panel: BasicScrollPanelProps) => void;
@@ -44,6 +44,14 @@
44
44
  .semi-tag-invisible {
45
45
  display: none;
46
46
  }
47
+ .semi-tag-prefix-icon {
48
+ display: flex;
49
+ padding-right: 4px;
50
+ }
51
+ .semi-tag-suffix-icon {
52
+ display: flex;
53
+ padding-left: 4px;
54
+ }
47
55
  .semi-tag-content {
48
56
  flex: 1;
49
57
  }
@@ -51,6 +51,16 @@ $types: "ghost", "solid", "light";
51
51
  display: none;
52
52
  }
53
53
 
54
+ &-prefix-icon {
55
+ display: flex;
56
+ padding-right: $spacing-tag_prefix_icon_paddingRight;
57
+ }
58
+
59
+ &-suffix-icon {
60
+ display: flex;
61
+ padding-left: $spacing-tag_suffix_icon_paddingLeft;
62
+ }
63
+
54
64
  &-content {
55
65
  flex: 1;
56
66
 
@@ -25,6 +25,9 @@ $radius-tag_circle: var(--semi-border-radius-full); // 胶囊标签圆角大小
25
25
  $spacing-tag_small-paddingY: 2px; // 小尺寸标签垂直方向内边距
26
26
  $spacing-tag_small-paddingX: $spacing-tight; // 小尺寸标签水平方向内边距
27
27
 
28
+ $spacing-tag_prefix_icon_paddingRight: $spacing-extra-tight; // 后缀图标右侧边距
29
+ $spacing-tag_suffix_icon_paddingLeft: $spacing-extra-tight; // 后缀图标左侧边距
30
+
28
31
  $spacing-tag_large-paddingY: 4px; // 大尺寸标签垂直方向内边距
29
32
  $spacing-tag_large-paddingX: $spacing-tight; // 大尺寸标签水平方向内边距
30
33
 
@@ -663,8 +663,7 @@ export default class Tooltip extends BaseFoundation {
663
663
  * 基于视口和容器一起判断,以下几种情况允许从原方向转到反方向,以判断是否应该由top->bottom为例子
664
664
  *
665
665
  * 1. 视口上下空间不足 且 容器上空间❌下空间✅
666
- * 2. 视口上空间❌下空间✅ 且 容器上下空间不足
667
- * 3. 视口上空间❌下空间✅ 且 容器上空间❌下空间✅
666
+ * 2. 视口上空间❌下空间✅
668
667
  *
669
668
  * Based on the judgment of the viewport and the container, the following situations are allowed to turn from the original direction to the opposite direction
670
669
  * to judge whether it should be top->bottom as an example
@@ -672,7 +671,7 @@ export default class Tooltip extends BaseFoundation {
672
671
  * 2. The space above the viewport ❌ the space below ✅ and the space above and below the container is insufficient
673
672
  * 3. Viewport upper space ❌ lower space✅ and container upper space ❌ lower space✅
674
673
  */
675
- return viewOverFlow && shouldReverseContainer || shouldReverseView && containerOverFlow || shouldReverseView && shouldReverseContainer;
674
+ return viewOverFlow && shouldReverseContainer || shouldReverseView;
676
675
  }
677
676
  // place the dom correctly
678
677
  adjustPosIfNeed(position, style, triggerRect, wrapperRect, containerRect) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.43.2",
3
+ "version": "2.44.0-beta.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.43.2",
10
+ "@douyinfe/semi-animation": "2.44.0-beta.0",
11
11
  "async-validator": "^3.5.0",
12
12
  "classnames": "^2.2.6",
13
13
  "date-fns": "^2.29.3",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "6c7218869ff6a0c83525f49845b7dc7a858f3705",
26
+ "gitHead": "f304407b2f9fb23f8464d59b685ff1f265f6869a",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
package/tag/tag.scss CHANGED
@@ -51,6 +51,16 @@ $types: "ghost", "solid", "light";
51
51
  display: none;
52
52
  }
53
53
 
54
+ &-prefix-icon {
55
+ display: flex;
56
+ padding-right: $spacing-tag_prefix_icon_paddingRight;
57
+ }
58
+
59
+ &-suffix-icon {
60
+ display: flex;
61
+ padding-left: $spacing-tag_suffix_icon_paddingLeft;
62
+ }
63
+
54
64
  &-content {
55
65
  flex: 1;
56
66
 
@@ -25,6 +25,9 @@ $radius-tag_circle: var(--semi-border-radius-full); // 胶囊标签圆角大小
25
25
  $spacing-tag_small-paddingY: 2px; // 小尺寸标签垂直方向内边距
26
26
  $spacing-tag_small-paddingX: $spacing-tight; // 小尺寸标签水平方向内边距
27
27
 
28
+ $spacing-tag_prefix_icon_paddingRight: $spacing-extra-tight; // 后缀图标右侧边距
29
+ $spacing-tag_suffix_icon_paddingLeft: $spacing-extra-tight; // 后缀图标左侧边距
30
+
28
31
  $spacing-tag_large-paddingY: 4px; // 大尺寸标签垂直方向内边距
29
32
  $spacing-tag_large-paddingX: $spacing-tight; // 大尺寸标签水平方向内边距
30
33
 
@@ -709,8 +709,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
709
709
  * 基于视口和容器一起判断,以下几种情况允许从原方向转到反方向,以判断是否应该由top->bottom为例子
710
710
  *
711
711
  * 1. 视口上下空间不足 且 容器上空间❌下空间✅
712
- * 2. 视口上空间❌下空间✅ 且 容器上下空间不足
713
- * 3. 视口上空间❌下空间✅ 且 容器上空间❌下空间✅
712
+ * 2. 视口上空间❌下空间✅
714
713
  *
715
714
  * Based on the judgment of the viewport and the container, the following situations are allowed to turn from the original direction to the opposite direction
716
715
  * to judge whether it should be top->bottom as an example
@@ -718,7 +717,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
718
717
  * 2. The space above the viewport ❌ the space below ✅ and the space above and below the container is insufficient
719
718
  * 3. Viewport upper space ❌ lower space✅ and container upper space ❌ lower space✅
720
719
  */
721
- return (viewOverFlow && shouldReverseContainer) || (shouldReverseView && containerOverFlow) || (shouldReverseView && shouldReverseContainer);
720
+ return (viewOverFlow && shouldReverseContainer) || shouldReverseView ;
722
721
  }
723
722
 
724
723
  // place the dom correctly