@douyinfe/semi-foundation 2.3.0-beta.0 → 2.3.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.
@@ -246,6 +246,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
246
246
  * - When yam open type is 'left' or 'right', weeks minHeight should be set
247
247
  * If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
248
248
  */
249
- getYAMOpenType(): "left" | "right" | "none" | "both";
249
+ getYAMOpenType(): "left" | "right" | "both" | "none";
250
250
  }
251
251
  export {};
@@ -26,7 +26,7 @@ class NotificationListFoundation extends _foundation.default {
26
26
  // }
27
27
 
28
28
 
29
- this._adapter.updateNotices([...notices, opts]); // return id;
29
+ this._adapter.updateNotices([opts, ...notices]); // return id;
30
30
 
31
31
  }
32
32
 
@@ -10,8 +10,9 @@ declare function getUuidv4(): string;
10
10
  * getUuidShort({ prefix: '' }) => '0eer2i0'
11
11
  * getUuidShort({ prefix: 'semi', length: 4 }) => 'semi-8jts'
12
12
  */
13
- declare function getUuidShort({ prefix, length }: {
13
+ declare function getUuidShort(options?: GetUuidShortOptions): string;
14
+ interface GetUuidShortOptions {
14
15
  prefix?: string;
15
16
  length?: number;
16
- }): string;
17
+ }
17
18
  export { getUuid, getUuidv4, getUuidShort };
@@ -40,13 +40,14 @@ function getUuidv4() {
40
40
  */
41
41
 
42
42
 
43
- function getUuidShort(_ref) {
43
+ function getUuidShort() {
44
44
  var _context3;
45
45
 
46
- let {
46
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47
+ const {
47
48
  prefix = '',
48
49
  length = 7
49
- } = _ref;
50
+ } = options;
50
51
  const characters = '0123456789abcdefghijklmnopqrstuvwxyz';
51
52
  const total = characters.length;
52
53
  let randomId = '';
@@ -246,6 +246,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
246
246
  * - When yam open type is 'left' or 'right', weeks minHeight should be set
247
247
  * If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
248
248
  */
249
- getYAMOpenType(): "left" | "right" | "none" | "both";
249
+ getYAMOpenType(): "left" | "right" | "both" | "none";
250
250
  }
251
251
  export {};
@@ -13,7 +13,7 @@ export default class NotificationListFoundation extends BaseFoundation {
13
13
  // }
14
14
 
15
15
 
16
- this._adapter.updateNotices([...notices, opts]); // return id;
16
+ this._adapter.updateNotices([opts, ...notices]); // return id;
17
17
 
18
18
  }
19
19
 
@@ -10,8 +10,9 @@ declare function getUuidv4(): string;
10
10
  * getUuidShort({ prefix: '' }) => '0eer2i0'
11
11
  * getUuidShort({ prefix: 'semi', length: 4 }) => 'semi-8jts'
12
12
  */
13
- declare function getUuidShort({ prefix, length }: {
13
+ declare function getUuidShort(options?: GetUuidShortOptions): string;
14
+ interface GetUuidShortOptions {
14
15
  prefix?: string;
15
16
  length?: number;
16
- }): string;
17
+ }
17
18
  export { getUuid, getUuidv4, getUuidShort };
@@ -24,13 +24,14 @@ function getUuidv4() {
24
24
  */
25
25
 
26
26
 
27
- function getUuidShort(_ref) {
27
+ function getUuidShort() {
28
28
  var _context3;
29
29
 
30
- let {
30
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
31
+ const {
31
32
  prefix = '',
32
33
  length = 7
33
- } = _ref;
34
+ } = options;
34
35
  const characters = '0123456789abcdefghijklmnopqrstuvwxyz';
35
36
  const total = characters.length;
36
37
  let randomId = '';
@@ -4,24 +4,22 @@ import { NoticeInstance, NoticePosition, NoticeProps } from '../notification/not
4
4
  import { strings } from './constants';
5
5
 
6
6
 
7
-
8
7
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
9
- export interface NotificationListProps{
8
+ export interface NotificationListProps {
10
9
 
11
10
  }
12
11
 
13
- export interface NotificationListState{
12
+ export interface NotificationListState {
14
13
  notices: NoticeInstance[];
15
14
  removedItems: NoticeInstance[];
16
15
  }
17
16
 
18
- export interface NotificationListAdapter extends DefaultAdapter<NotificationListProps, NotificationListState>{
17
+ export interface NotificationListAdapter extends DefaultAdapter<NotificationListProps, NotificationListState> {
19
18
  updateNotices: (notices: NoticeInstance[], removedItems?: NoticeInstance[]) => void;
20
19
  getNotices: () => NoticeInstance[];
21
20
  }
22
21
 
23
22
 
24
-
25
23
  export interface ConfigProps {
26
24
  top?: number | string;
27
25
  bottom?: number | string;
@@ -34,8 +32,6 @@ export interface ConfigProps {
34
32
  }
35
33
 
36
34
 
37
-
38
-
39
35
  export default class NotificationListFoundation extends BaseFoundation<NotificationListAdapter> {
40
36
 
41
37
  addNotice(opts: NoticeProps) {
@@ -48,7 +44,7 @@ export default class NotificationListFoundation extends BaseFoundation<Notificat
48
44
  // this.removeNotice(opts.id);
49
45
  // }, opts.duration * 1000);
50
46
  // }
51
- this._adapter.updateNotices([...notices, opts]);
47
+ this._adapter.updateNotices([opts, ...notices]);
52
48
  // return id;
53
49
  }
54
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.3.0-beta.0",
3
+ "version": "2.3.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@babel/runtime-corejs3": "^7.15.4",
11
- "@douyinfe/semi-animation": "2.3.0-beta.0",
11
+ "@douyinfe/semi-animation": "2.3.0",
12
12
  "async-validator": "^3.5.0",
13
13
  "classnames": "^2.2.6",
14
14
  "date-fns": "^2.9.0",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "5847f92fd90bc37f1fed5c7d2d6d64f6ebf632bc",
27
+ "gitHead": "456b90e3f3501dd92e9d0b55bb9c8c86312837aa",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
package/utils/uuid.ts CHANGED
@@ -23,7 +23,8 @@ function getUuidv4() {
23
23
  * getUuidShort({ prefix: '' }) => '0eer2i0'
24
24
  * getUuidShort({ prefix: 'semi', length: 4 }) => 'semi-8jts'
25
25
  */
26
- function getUuidShort({ prefix = '', length = 7 }: { prefix?: string; length?: number }) {
26
+ function getUuidShort(options: GetUuidShortOptions = {}) {
27
+ const { prefix = '', length = 7 } = options;
27
28
  const characters = '0123456789abcdefghijklmnopqrstuvwxyz';
28
29
  const total = characters.length;
29
30
  let randomId = '';
@@ -35,4 +36,9 @@ function getUuidShort({ prefix = '', length = 7 }: { prefix?: string; length?: n
35
36
  return prefix ? `${prefix}-${randomId}` : randomId;
36
37
  }
37
38
 
39
+ interface GetUuidShortOptions {
40
+ prefix?: string;
41
+ length?: number;
42
+ }
43
+
38
44
  export { getUuid, getUuidv4, getUuidShort };