@douyinfe/semi-foundation 2.63.0 → 2.64.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.
Files changed (90) hide show
  1. package/calendar/foundation.ts +20 -0
  2. package/chat/foundation.ts +18 -23
  3. package/colorPicker/AlphaSliderFoundation.ts +62 -0
  4. package/colorPicker/ColorChooseAreaFoundation.ts +86 -0
  5. package/colorPicker/ColorSliderFoundation.ts +61 -0
  6. package/colorPicker/DataPartFoundation.ts +113 -0
  7. package/colorPicker/colorPicker.scss +113 -0
  8. package/colorPicker/constants.ts +11 -0
  9. package/colorPicker/foundation.ts +206 -0
  10. package/colorPicker/interface.ts +51 -0
  11. package/colorPicker/utils/convert.ts +228 -0
  12. package/colorPicker/utils/round.ts +3 -0
  13. package/colorPicker/utils/split.ts +40 -0
  14. package/colorPicker/variables.scss +28 -0
  15. package/datePicker/foundation.ts +1 -1
  16. package/image/image.scss +6 -1
  17. package/image/previewImageFoundation.ts +233 -150
  18. package/image/previewInnerFoundation.ts +11 -6
  19. package/lib/cjs/calendar/foundation.js +18 -0
  20. package/lib/cjs/chat/foundation.d.ts +1 -2
  21. package/lib/cjs/chat/foundation.js +2 -7
  22. package/lib/cjs/colorPicker/AlphaSliderFoundation.d.ts +27 -0
  23. package/lib/cjs/colorPicker/AlphaSliderFoundation.js +40 -0
  24. package/lib/cjs/colorPicker/ColorChooseAreaFoundation.d.ts +42 -0
  25. package/lib/cjs/colorPicker/ColorChooseAreaFoundation.js +62 -0
  26. package/lib/cjs/colorPicker/ColorSliderFoundation.d.ts +26 -0
  27. package/lib/cjs/colorPicker/ColorSliderFoundation.js +40 -0
  28. package/lib/cjs/colorPicker/DataPartFoundation.d.ts +28 -0
  29. package/lib/cjs/colorPicker/DataPartFoundation.js +115 -0
  30. package/lib/cjs/colorPicker/colorPicker.css +84 -0
  31. package/lib/cjs/colorPicker/colorPicker.scss +113 -0
  32. package/lib/cjs/colorPicker/constants.d.ts +4 -0
  33. package/lib/cjs/colorPicker/constants.js +11 -0
  34. package/lib/cjs/colorPicker/foundation.d.ts +66 -0
  35. package/lib/cjs/colorPicker/foundation.js +150 -0
  36. package/lib/cjs/colorPicker/interface.d.ts +40 -0
  37. package/lib/cjs/colorPicker/interface.js +5 -0
  38. package/lib/cjs/colorPicker/utils/convert.d.ts +28 -0
  39. package/lib/cjs/colorPicker/utils/convert.js +306 -0
  40. package/lib/cjs/colorPicker/utils/round.d.ts +1 -0
  41. package/lib/cjs/colorPicker/utils/round.js +12 -0
  42. package/lib/cjs/colorPicker/utils/split.d.ts +18 -0
  43. package/lib/cjs/colorPicker/utils/split.js +40 -0
  44. package/lib/cjs/colorPicker/variables.scss +28 -0
  45. package/lib/cjs/datePicker/foundation.js +1 -1
  46. package/lib/cjs/image/image.css +5 -1
  47. package/lib/cjs/image/image.scss +6 -1
  48. package/lib/cjs/image/previewImageFoundation.d.ts +46 -13
  49. package/lib/cjs/image/previewImageFoundation.js +207 -181
  50. package/lib/cjs/image/previewInnerFoundation.d.ts +4 -3
  51. package/lib/cjs/image/previewInnerFoundation.js +5 -2
  52. package/lib/cjs/upload/foundation.d.ts +1 -0
  53. package/lib/cjs/upload/foundation.js +30 -14
  54. package/lib/es/calendar/foundation.js +18 -0
  55. package/lib/es/chat/foundation.d.ts +1 -2
  56. package/lib/es/chat/foundation.js +2 -7
  57. package/lib/es/colorPicker/AlphaSliderFoundation.d.ts +27 -0
  58. package/lib/es/colorPicker/AlphaSliderFoundation.js +33 -0
  59. package/lib/es/colorPicker/ColorChooseAreaFoundation.d.ts +42 -0
  60. package/lib/es/colorPicker/ColorChooseAreaFoundation.js +55 -0
  61. package/lib/es/colorPicker/ColorSliderFoundation.d.ts +26 -0
  62. package/lib/es/colorPicker/ColorSliderFoundation.js +33 -0
  63. package/lib/es/colorPicker/DataPartFoundation.d.ts +28 -0
  64. package/lib/es/colorPicker/DataPartFoundation.js +108 -0
  65. package/lib/es/colorPicker/colorPicker.css +84 -0
  66. package/lib/es/colorPicker/colorPicker.scss +113 -0
  67. package/lib/es/colorPicker/constants.d.ts +4 -0
  68. package/lib/es/colorPicker/constants.js +6 -0
  69. package/lib/es/colorPicker/foundation.d.ts +66 -0
  70. package/lib/es/colorPicker/foundation.js +143 -0
  71. package/lib/es/colorPicker/interface.d.ts +40 -0
  72. package/lib/es/colorPicker/interface.js +1 -0
  73. package/lib/es/colorPicker/utils/convert.d.ts +28 -0
  74. package/lib/es/colorPicker/utils/convert.js +277 -0
  75. package/lib/es/colorPicker/utils/round.d.ts +1 -0
  76. package/lib/es/colorPicker/utils/round.js +5 -0
  77. package/lib/es/colorPicker/utils/split.d.ts +18 -0
  78. package/lib/es/colorPicker/utils/split.js +34 -0
  79. package/lib/es/colorPicker/variables.scss +28 -0
  80. package/lib/es/datePicker/foundation.js +1 -1
  81. package/lib/es/image/image.css +5 -1
  82. package/lib/es/image/image.scss +6 -1
  83. package/lib/es/image/previewImageFoundation.d.ts +46 -13
  84. package/lib/es/image/previewImageFoundation.js +207 -181
  85. package/lib/es/image/previewInnerFoundation.d.ts +4 -3
  86. package/lib/es/image/previewInnerFoundation.js +5 -2
  87. package/lib/es/upload/foundation.d.ts +1 -0
  88. package/lib/es/upload/foundation.js +30 -14
  89. package/package.json +3 -3
  90. package/upload/foundation.ts +19 -3
@@ -94,6 +94,7 @@ export interface UploadAdapter<P = Record<string, any>, S = Record<string, any>>
94
94
  }
95
95
 
96
96
  class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<UploadAdapter<P, S>, P, S> {
97
+ destroyState: boolean = false;
97
98
  constructor(adapter: UploadAdapter<P, S>) {
98
99
  super({ ...adapter });
99
100
  }
@@ -111,6 +112,7 @@ class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends
111
112
  if (!disabled) {
112
113
  this.unbindPastingHandler();
113
114
  }
115
+ this.destroyState = true;
114
116
  }
115
117
 
116
118
  getError({ action, xhr, message, fileName }: { action: string;xhr: XMLHttpRequest;message?: string;fileName: string }): XhrError {
@@ -569,13 +571,27 @@ class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends
569
571
  }
570
572
 
571
573
  if (xhr.upload) {
572
- xhr.upload.onprogress = (e: ProgressEvent): void => this.handleProgress({ e, fileInstance });
574
+ xhr.upload.onprogress = (e: ProgressEvent): void => {
575
+ if (!this.destroyState) {
576
+ this.handleProgress({ e, fileInstance });
577
+ } else {
578
+ xhr.abort();
579
+ }
580
+ };
573
581
  }
574
582
 
575
583
  // Callback function after upload is completed
576
- xhr.onload = (e: ProgressEvent): void => this.handleOnLoad({ e, xhr, fileInstance });
584
+ xhr.onload = (e: ProgressEvent): void => {
585
+ if (!this.destroyState) {
586
+ this.handleOnLoad({ e, xhr, fileInstance });
587
+ }
588
+ };
577
589
 
578
- xhr.onerror = (e: ProgressEvent): void => this.handleError({ e, xhr, fileInstance });
590
+ xhr.onerror = (e: ProgressEvent): void => {
591
+ if (!this.destroyState) {
592
+ this.handleError({ e, xhr, fileInstance });
593
+ }
594
+ };
579
595
 
580
596
  // add headers
581
597
  let headers = option.headers || {};