@douyinfe/semi-foundation 2.19.0-alpha.6 → 2.19.0-alpha.7

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.
@@ -202,6 +202,9 @@ $module: #{$prefix}-button;
202
202
  }
203
203
 
204
204
  &-group {
205
+ display: flex;
206
+ flex-wrap: wrap;
207
+
205
208
  & > .#{$module} {
206
209
  margin: 0;
207
210
  padding-left: 0;
@@ -257,16 +260,50 @@ $module: #{$prefix}-button;
257
260
  border-top-left-radius: $radius-button_group;
258
261
  border-bottom-left-radius: $radius-button_group;
259
262
  }
260
- &:not(:last-child) {
261
- .#{$prefix}-button-content {
262
- border-right: $width-button_group-border $color-button_group-border-default solid;
263
- }
264
- }
265
263
  &:last-child {
266
264
  border-top-right-radius: $radius-button_group;
267
265
  border-bottom-right-radius: $radius-button_group;
268
266
  }
269
267
  }
268
+
269
+ &-line {
270
+ display: inline-flex;
271
+ align-items: center;
272
+ background-color: $color-button_group-border-default;
273
+
274
+ &-primary {
275
+ background-color: $color-button_primary-bg-default;
276
+ }
277
+ &-secondary {
278
+ background-color: $color-button_secondary-bg-default;
279
+ }
280
+ &-tertiary {
281
+ background-color: $color-button_tertiary-bg-default;
282
+ }
283
+ &-warning {
284
+ background-color: $color-button_warning-bg-default;
285
+ }
286
+ &-danger {
287
+ background-color: $color-button_danger-bg-default;
288
+ }
289
+ &-disabled {
290
+ background-color: $color-button_disabled-bg-default;
291
+ }
292
+ &-light {
293
+ background-color: $color-button_light-bg-default;
294
+ }
295
+ &-borderless {
296
+ background-color: transparent;
297
+ }
298
+
299
+ &::before {
300
+ display: block;
301
+ content: '';
302
+ width: $width-button_group-border;
303
+ height: $height-button_group_line_default;
304
+ background-color: $color-button_group-border-default;
305
+ }
306
+ }
270
307
  }
271
308
  }
272
309
 
@@ -141,6 +141,7 @@ $font-button-fontWeight: $font-weight-bold; // 按钮文字字重
141
141
  $height-button_large: $height-control-large; // 按钮高度 - 大尺寸
142
142
  $height-button_small: $height-control-small; // 按钮高度 - 小尺寸
143
143
  $height-button_default: $height-control-default; // 按钮高度 - 默认
144
+ $height-button_group_line_default: 20px; // 分割线高度 - 默认
144
145
 
145
146
  $width-button-border: $border-thickness; // 按钮描边宽度
146
147
  $radius-button: var(--semi-border-radius-small); // 按钮圆角大小
@@ -186,6 +186,10 @@
186
186
  .semi-button-block {
187
187
  width: 100%;
188
188
  }
189
+ .semi-button-group {
190
+ display: flex;
191
+ flex-wrap: wrap;
192
+ }
189
193
  .semi-button-group > .semi-button {
190
194
  margin: 0;
191
195
  padding-left: 0;
@@ -224,13 +228,46 @@
224
228
  border-top-left-radius: var(--semi-border-radius-small);
225
229
  border-bottom-left-radius: var(--semi-border-radius-small);
226
230
  }
227
- .semi-button-group > .semi-button:not(:last-child) .semi-button-content {
228
- border-right: 1px var(--semi-color-border) solid;
229
- }
230
231
  .semi-button-group > .semi-button:last-child {
231
232
  border-top-right-radius: var(--semi-border-radius-small);
232
233
  border-bottom-right-radius: var(--semi-border-radius-small);
233
234
  }
235
+ .semi-button-group-line {
236
+ display: inline-flex;
237
+ align-items: center;
238
+ background-color: var(--semi-color-border);
239
+ }
240
+ .semi-button-group-line-primary {
241
+ background-color: var(--semi-color-primary);
242
+ }
243
+ .semi-button-group-line-secondary {
244
+ background-color: var(--semi-color-secondary);
245
+ }
246
+ .semi-button-group-line-tertiary {
247
+ background-color: var(--semi-color-tertiary);
248
+ }
249
+ .semi-button-group-line-warning {
250
+ background-color: var(--semi-color-warning);
251
+ }
252
+ .semi-button-group-line-danger {
253
+ background-color: var(--semi-color-danger);
254
+ }
255
+ .semi-button-group-line-disabled {
256
+ background-color: var(--semi-color-disabled-bg);
257
+ }
258
+ .semi-button-group-line-light {
259
+ background-color: var(--semi-color-fill-0);
260
+ }
261
+ .semi-button-group-line-borderless {
262
+ background-color: transparent;
263
+ }
264
+ .semi-button-group-line::before {
265
+ display: block;
266
+ content: "";
267
+ width: 1px;
268
+ height: 20px;
269
+ background-color: var(--semi-color-border);
270
+ }
234
271
 
235
272
  .semi-rtl .semi-button,
236
273
  .semi-portal-rtl .semi-button {
@@ -202,6 +202,9 @@ $module: #{$prefix}-button;
202
202
  }
203
203
 
204
204
  &-group {
205
+ display: flex;
206
+ flex-wrap: wrap;
207
+
205
208
  & > .#{$module} {
206
209
  margin: 0;
207
210
  padding-left: 0;
@@ -257,16 +260,50 @@ $module: #{$prefix}-button;
257
260
  border-top-left-radius: $radius-button_group;
258
261
  border-bottom-left-radius: $radius-button_group;
259
262
  }
260
- &:not(:last-child) {
261
- .#{$prefix}-button-content {
262
- border-right: $width-button_group-border $color-button_group-border-default solid;
263
- }
264
- }
265
263
  &:last-child {
266
264
  border-top-right-radius: $radius-button_group;
267
265
  border-bottom-right-radius: $radius-button_group;
268
266
  }
269
267
  }
268
+
269
+ &-line {
270
+ display: inline-flex;
271
+ align-items: center;
272
+ background-color: $color-button_group-border-default;
273
+
274
+ &-primary {
275
+ background-color: $color-button_primary-bg-default;
276
+ }
277
+ &-secondary {
278
+ background-color: $color-button_secondary-bg-default;
279
+ }
280
+ &-tertiary {
281
+ background-color: $color-button_tertiary-bg-default;
282
+ }
283
+ &-warning {
284
+ background-color: $color-button_warning-bg-default;
285
+ }
286
+ &-danger {
287
+ background-color: $color-button_danger-bg-default;
288
+ }
289
+ &-disabled {
290
+ background-color: $color-button_disabled-bg-default;
291
+ }
292
+ &-light {
293
+ background-color: $color-button_light-bg-default;
294
+ }
295
+ &-borderless {
296
+ background-color: transparent;
297
+ }
298
+
299
+ &::before {
300
+ display: block;
301
+ content: '';
302
+ width: $width-button_group-border;
303
+ height: $height-button_group_line_default;
304
+ background-color: $color-button_group-border-default;
305
+ }
306
+ }
270
307
  }
271
308
  }
272
309
 
@@ -141,6 +141,7 @@ $font-button-fontWeight: $font-weight-bold; // 按钮文字字重
141
141
  $height-button_large: $height-control-large; // 按钮高度 - 大尺寸
142
142
  $height-button_small: $height-control-small; // 按钮高度 - 小尺寸
143
143
  $height-button_default: $height-control-default; // 按钮高度 - 默认
144
+ $height-button_group_line_default: 20px; // 分割线高度 - 默认
144
145
 
145
146
  $width-button-border: $border-thickness; // 按钮描边宽度
146
147
  $radius-button: var(--semi-border-radius-small); // 按钮圆角大小
@@ -1,8 +1,10 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
2
  export interface PopconfirmAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
3
3
  setVisible: (visible: boolean) => void;
4
- notifyConfirm: (e: any) => void;
5
- notifyCancel: (e: any) => void;
4
+ updateConfirmLoading: (loading: boolean) => void;
5
+ updateCancelLoading: (loading: boolean) => void;
6
+ notifyConfirm: (e: any) => Promise<any> | void;
7
+ notifyCancel: (e: any) => Promise<any> | void;
6
8
  notifyVisibleChange: (visible: boolean) => void;
7
9
  notifyClickOutSide: (e: any) => void;
8
10
  }
@@ -12,6 +12,8 @@ exports.default = void 0;
12
12
 
13
13
  var _foundation = _interopRequireDefault(require("../base/foundation"));
14
14
 
15
+ var _isPromise = _interopRequireDefault(require("../utils/isPromise"));
16
+
15
17
  /* eslint-disable @typescript-eslint/no-empty-function */
16
18
  class PopConfirmFoundation extends _foundation.default {
17
19
  init() {}
@@ -19,15 +21,39 @@ class PopConfirmFoundation extends _foundation.default {
19
21
  destroy() {}
20
22
 
21
23
  handleCancel(e) {
22
- this._adapter.notifyCancel(e);
24
+ const maybePromise = this._adapter.notifyCancel(e);
25
+
26
+ if ((0, _isPromise.default)(maybePromise)) {
27
+ this._adapter.updateCancelLoading(true);
23
28
 
24
- this.handleVisibleChange(false);
29
+ maybePromise.then(result => {
30
+ this.handleVisibleChange(false);
31
+
32
+ this._adapter.updateCancelLoading(false);
33
+ }, errors => {
34
+ this._adapter.updateCancelLoading(false);
35
+ });
36
+ } else {
37
+ this.handleVisibleChange(false);
38
+ }
25
39
  }
26
40
 
27
41
  handleConfirm(e) {
28
- this._adapter.notifyConfirm(e);
42
+ const maybePromise = this._adapter.notifyConfirm(e);
29
43
 
30
- this.handleVisibleChange(false);
44
+ if ((0, _isPromise.default)(maybePromise)) {
45
+ this._adapter.updateConfirmLoading(true);
46
+
47
+ maybePromise.then(result => {
48
+ this._adapter.updateConfirmLoading(false);
49
+
50
+ this.handleVisibleChange(false);
51
+ }, errors => {
52
+ this._adapter.updateConfirmLoading(false);
53
+ });
54
+ } else {
55
+ this.handleVisibleChange(false);
56
+ }
31
57
  }
32
58
 
33
59
  handleClickOutSide(e) {
@@ -186,6 +186,10 @@
186
186
  .semi-button-block {
187
187
  width: 100%;
188
188
  }
189
+ .semi-button-group {
190
+ display: flex;
191
+ flex-wrap: wrap;
192
+ }
189
193
  .semi-button-group > .semi-button {
190
194
  margin: 0;
191
195
  padding-left: 0;
@@ -224,13 +228,46 @@
224
228
  border-top-left-radius: var(--semi-border-radius-small);
225
229
  border-bottom-left-radius: var(--semi-border-radius-small);
226
230
  }
227
- .semi-button-group > .semi-button:not(:last-child) .semi-button-content {
228
- border-right: 1px var(--semi-color-border) solid;
229
- }
230
231
  .semi-button-group > .semi-button:last-child {
231
232
  border-top-right-radius: var(--semi-border-radius-small);
232
233
  border-bottom-right-radius: var(--semi-border-radius-small);
233
234
  }
235
+ .semi-button-group-line {
236
+ display: inline-flex;
237
+ align-items: center;
238
+ background-color: var(--semi-color-border);
239
+ }
240
+ .semi-button-group-line-primary {
241
+ background-color: var(--semi-color-primary);
242
+ }
243
+ .semi-button-group-line-secondary {
244
+ background-color: var(--semi-color-secondary);
245
+ }
246
+ .semi-button-group-line-tertiary {
247
+ background-color: var(--semi-color-tertiary);
248
+ }
249
+ .semi-button-group-line-warning {
250
+ background-color: var(--semi-color-warning);
251
+ }
252
+ .semi-button-group-line-danger {
253
+ background-color: var(--semi-color-danger);
254
+ }
255
+ .semi-button-group-line-disabled {
256
+ background-color: var(--semi-color-disabled-bg);
257
+ }
258
+ .semi-button-group-line-light {
259
+ background-color: var(--semi-color-fill-0);
260
+ }
261
+ .semi-button-group-line-borderless {
262
+ background-color: transparent;
263
+ }
264
+ .semi-button-group-line::before {
265
+ display: block;
266
+ content: "";
267
+ width: 1px;
268
+ height: 20px;
269
+ background-color: var(--semi-color-border);
270
+ }
234
271
 
235
272
  .semi-rtl .semi-button,
236
273
  .semi-portal-rtl .semi-button {
@@ -202,6 +202,9 @@ $module: #{$prefix}-button;
202
202
  }
203
203
 
204
204
  &-group {
205
+ display: flex;
206
+ flex-wrap: wrap;
207
+
205
208
  & > .#{$module} {
206
209
  margin: 0;
207
210
  padding-left: 0;
@@ -257,16 +260,50 @@ $module: #{$prefix}-button;
257
260
  border-top-left-radius: $radius-button_group;
258
261
  border-bottom-left-radius: $radius-button_group;
259
262
  }
260
- &:not(:last-child) {
261
- .#{$prefix}-button-content {
262
- border-right: $width-button_group-border $color-button_group-border-default solid;
263
- }
264
- }
265
263
  &:last-child {
266
264
  border-top-right-radius: $radius-button_group;
267
265
  border-bottom-right-radius: $radius-button_group;
268
266
  }
269
267
  }
268
+
269
+ &-line {
270
+ display: inline-flex;
271
+ align-items: center;
272
+ background-color: $color-button_group-border-default;
273
+
274
+ &-primary {
275
+ background-color: $color-button_primary-bg-default;
276
+ }
277
+ &-secondary {
278
+ background-color: $color-button_secondary-bg-default;
279
+ }
280
+ &-tertiary {
281
+ background-color: $color-button_tertiary-bg-default;
282
+ }
283
+ &-warning {
284
+ background-color: $color-button_warning-bg-default;
285
+ }
286
+ &-danger {
287
+ background-color: $color-button_danger-bg-default;
288
+ }
289
+ &-disabled {
290
+ background-color: $color-button_disabled-bg-default;
291
+ }
292
+ &-light {
293
+ background-color: $color-button_light-bg-default;
294
+ }
295
+ &-borderless {
296
+ background-color: transparent;
297
+ }
298
+
299
+ &::before {
300
+ display: block;
301
+ content: '';
302
+ width: $width-button_group-border;
303
+ height: $height-button_group_line_default;
304
+ background-color: $color-button_group-border-default;
305
+ }
306
+ }
270
307
  }
271
308
  }
272
309
 
@@ -141,6 +141,7 @@ $font-button-fontWeight: $font-weight-bold; // 按钮文字字重
141
141
  $height-button_large: $height-control-large; // 按钮高度 - 大尺寸
142
142
  $height-button_small: $height-control-small; // 按钮高度 - 小尺寸
143
143
  $height-button_default: $height-control-default; // 按钮高度 - 默认
144
+ $height-button_group_line_default: 20px; // 分割线高度 - 默认
144
145
 
145
146
  $width-button-border: $border-thickness; // 按钮描边宽度
146
147
  $radius-button: var(--semi-border-radius-small); // 按钮圆角大小
@@ -1,8 +1,10 @@
1
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
2
2
  export interface PopconfirmAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
3
3
  setVisible: (visible: boolean) => void;
4
- notifyConfirm: (e: any) => void;
5
- notifyCancel: (e: any) => void;
4
+ updateConfirmLoading: (loading: boolean) => void;
5
+ updateCancelLoading: (loading: boolean) => void;
6
+ notifyConfirm: (e: any) => Promise<any> | void;
7
+ notifyCancel: (e: any) => Promise<any> | void;
6
8
  notifyVisibleChange: (visible: boolean) => void;
7
9
  notifyClickOutSide: (e: any) => void;
8
10
  }
@@ -1,20 +1,45 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-function */
2
2
  import BaseFoundation from '../base/foundation';
3
+ import isPromise from '../utils/isPromise';
3
4
  export default class PopConfirmFoundation extends BaseFoundation {
4
5
  init() {}
5
6
 
6
7
  destroy() {}
7
8
 
8
9
  handleCancel(e) {
9
- this._adapter.notifyCancel(e);
10
+ const maybePromise = this._adapter.notifyCancel(e);
10
11
 
11
- this.handleVisibleChange(false);
12
+ if (isPromise(maybePromise)) {
13
+ this._adapter.updateCancelLoading(true);
14
+
15
+ maybePromise.then(result => {
16
+ this.handleVisibleChange(false);
17
+
18
+ this._adapter.updateCancelLoading(false);
19
+ }, errors => {
20
+ this._adapter.updateCancelLoading(false);
21
+ });
22
+ } else {
23
+ this.handleVisibleChange(false);
24
+ }
12
25
  }
13
26
 
14
27
  handleConfirm(e) {
15
- this._adapter.notifyConfirm(e);
28
+ const maybePromise = this._adapter.notifyConfirm(e);
16
29
 
17
- this.handleVisibleChange(false);
30
+ if (isPromise(maybePromise)) {
31
+ this._adapter.updateConfirmLoading(true);
32
+
33
+ maybePromise.then(result => {
34
+ this._adapter.updateConfirmLoading(false);
35
+
36
+ this.handleVisibleChange(false);
37
+ }, errors => {
38
+ this._adapter.updateConfirmLoading(false);
39
+ });
40
+ } else {
41
+ this.handleVisibleChange(false);
42
+ }
18
43
  }
19
44
 
20
45
  handleClickOutSide(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.19.0-alpha.6",
3
+ "version": "2.19.0-alpha.7",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "f131defbb2a909ebb7035eea975bf3466908ac15",
27
+ "gitHead": "e4926d98b1e98ec52a3bc8b7c29a51bf223b8208",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
@@ -1,11 +1,14 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-function */
2
2
 
3
3
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
4
+ import isPromise from '../utils/isPromise';
4
5
 
5
6
  export interface PopconfirmAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
6
7
  setVisible: (visible: boolean) => void;
7
- notifyConfirm: (e: any) => void;
8
- notifyCancel: (e: any) => void;
8
+ updateConfirmLoading: (loading: boolean) => void;
9
+ updateCancelLoading: (loading: boolean) => void;
10
+ notifyConfirm: (e: any) => Promise<any> | void;
11
+ notifyCancel: (e: any) => Promise<any> | void;
9
12
  notifyVisibleChange: (visible: boolean) => void;
10
13
  notifyClickOutSide: (e: any) => void;
11
14
  }
@@ -17,13 +20,39 @@ export default class PopConfirmFoundation<P = Record<string, any>, S = Record<st
17
20
  destroy(): void {}
18
21
 
19
22
  handleCancel(e: any): void {
20
- this._adapter.notifyCancel(e);
21
- this.handleVisibleChange(false);
23
+ const maybePromise = this._adapter.notifyCancel(e) as Promise<any>;
24
+ if (isPromise(maybePromise)) {
25
+ this._adapter.updateCancelLoading(true);
26
+ maybePromise.then(
27
+ (result: any) => {
28
+ this.handleVisibleChange(false);
29
+ this._adapter.updateCancelLoading(false);
30
+ },
31
+ (errors: any) => {
32
+ this._adapter.updateCancelLoading(false);
33
+ }
34
+ );
35
+ } else {
36
+ this.handleVisibleChange(false);
37
+ }
22
38
  }
23
39
 
24
40
  handleConfirm(e: any): void {
25
- this._adapter.notifyConfirm(e);
26
- this.handleVisibleChange(false);
41
+ const maybePromise = this._adapter.notifyConfirm(e) as Promise<any>;
42
+ if (isPromise(maybePromise)) {
43
+ this._adapter.updateConfirmLoading(true);
44
+ maybePromise.then(
45
+ (result: any) => {
46
+ this._adapter.updateConfirmLoading(false);
47
+ this.handleVisibleChange(false);
48
+ },
49
+ (errors: any) => {
50
+ this._adapter.updateConfirmLoading(false);
51
+ }
52
+ );
53
+ } else {
54
+ this.handleVisibleChange(false);
55
+ }
27
56
  }
28
57
 
29
58
  handleClickOutSide(e: any): void {