@univerjs-pro/exchange-client 0.4.1 → 0.4.2

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.
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-exchange-uploading{display:flex;flex-direction:column;align-items:flex-start;margin-top:var(--margin-lg)}.univer-exchange-uploading-tip{color:var(--color-black);font-size:var(--font-size-sm);padding:0 var(--padding-lg) 0 var(--padding-sm)}.univer-exchange-uploading-progress{padding:0 var(--padding-lg) 0 var(--padding-sm)}.univer-exchange-upload-progress{width:324px;height:6px;margin:var(--margin-base) 0 var(--margin-sm) 0;background-color:rgb(var(--border-color));border-radius:var(--border-radius-lg)}.univer-exchange-upload-progress-inner{height:6px;border-radius:var(--border-radius-lg);transition:width .5s}.univer-exchange-upload-button{cursor:pointer;user-select:none;height:28px;border-width:0;border-radius:6px;padding:0 var(--padding-sm);font-size:var(--font-size-xs);transition:all .15s;color:rgb(var(--hyacinth-500));background-color:transparent;border-color:transparent}.univer-exchange-upload-button:hover{background-color:rgb(var(--hyacinth-50))}.univer-exchange-link-list{max-height:280px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin;margin-top:var(--margin-lg)}.univer-exchange-link-list-inner{display:flex;list-style:none;padding:0;margin:0;gap:8px;flex-direction:column}.univer-exchange-link-list-inner-item-link{display:flex;justify-content:space-between;text-decoration-line:none;color:var(--color-black);padding:var(--padding-xs) var(--padding-sm);background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-link-list-inner-item-link:hover{background-color:rgb(var(--border-color))}.univer-exchange-link-list-inner-item-link-content{display:flex;align-items:center;width:calc(100% - 48px)}.univer-exchange-link-list-inner-item-link-icon{height:20px;font-size:20px;display:flex}.univer-exchange-link-list-inner-item-link-name{margin-left:var(--margin-xxs);color:var(--color-black);font-size:var(--font-size-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.univer-exchange-link-list-inner-item-link-direct{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-link-list-inner-item-link-direct:hover{background-color:rgb(var(--bg-color-hover))}.univer-exchange-upload-error{display:flex;flex-direction:column;align-items:flex-start;margin-top:var(--margin-lg)}.univer-exchange-upload-error-tip{color:var(--color-black);font-size:var(--font-size-sm);padding:0 var(--padding-lg) 0 var(--padding-sm);margin-bottom:var(--margin-sm)}.univer-exchange-upload-success{display:flex;padding:0 var(--padding-xs) 0 var(--padding-sm);align-items:center;justify-content:space-between;margin-top:var(--margin-sm)}.univer-exchange-upload-success-tip{color:rgb(var(--text-color-secondary));font-size:var(--font-size-xs)}.univer-exchange-upload-notification{position:fixed;z-index:1000;bottom:48px;right:12px;width:372px;display:flex;flex-direction:column;justify-content:flex-start;padding:var(--padding-xl) var(--padding-base) var(--padding-lg) var(--padding-base);background-color:#fff;border-radius:6px;box-shadow:var(--box-shadow-base);box-sizing:border-box}.univer-exchange-upload-notification-header{display:flex;align-items:center;justify-content:space-between;padding:0 var(--padding-sm) 0 6px}.univer-exchange-upload-notification-header-title{display:flex}.univer-exchange-upload-notification-header-icon{height:24px;font-size:24px}.univer-exchange-upload-notification-header-icon-success{color:rgb(var(--success-color))}.univer-exchange-upload-notification-header-icon-uploading{color:rgb(var(--info-color))}.univer-exchange-upload-notification-header-icon-error{color:rgb(var(--error-color))}.univer-exchange-upload-notification-header-text{margin-left:6px;line-height:24px;color:var(--color-black);font-size:17px;font-weight:600}.univer-exchange-upload-notification-header-close{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-upload-notification-header-close:hover{background-color:rgb(var(--bg-color-hover))}
1
+ .univer-exchange-uploading{display:flex;flex-direction:column;align-items:flex-start;margin-top:var(--margin-lg)}.univer-exchange-uploading-tip{color:var(--color-black);font-size:var(--font-size-sm);padding:0 var(--padding-lg) 0 var(--padding-sm)}.univer-exchange-uploading-progress{padding:0 var(--padding-lg) 0 var(--padding-sm)}.univer-exchange-upload-button{cursor:pointer;user-select:none;height:28px;border-width:0;border-radius:6px;padding:0 var(--padding-sm);font-size:var(--font-size-xs);transition:all .15s;color:rgb(var(--hyacinth-500));background-color:transparent;border-color:transparent}.univer-exchange-upload-button:hover{background-color:rgb(var(--hyacinth-50))}.univer-exchange-upload-progress{width:324px;height:6px;margin:var(--margin-base) 0 var(--margin-sm) 0;background-color:rgb(var(--border-color));border-radius:var(--border-radius-lg)}.univer-exchange-upload-progress-inner{height:6px;border-radius:var(--border-radius-lg);transition:width .5s}.univer-exchange-link-list{max-height:280px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin;margin-top:var(--margin-lg)}.univer-exchange-link-list-inner{display:flex;list-style:none;padding:0;margin:0;gap:8px;flex-direction:column}.univer-exchange-link-list-inner-item-link{display:flex;justify-content:space-between;text-decoration-line:none;color:var(--color-black);padding:var(--padding-xs) var(--padding-sm);background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-link-list-inner-item-link:hover{background-color:rgb(var(--border-color))}.univer-exchange-link-list-inner-item-link-content{display:flex;align-items:center;width:calc(100% - 48px)}.univer-exchange-link-list-inner-item-link-icon{height:20px;font-size:20px;display:flex}.univer-exchange-link-list-inner-item-link-name{margin-left:var(--margin-xxs);color:var(--color-black);font-size:var(--font-size-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.univer-exchange-link-list-inner-item-link-direct{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-link-list-inner-item-link-direct:hover{background-color:rgb(var(--bg-color-hover))}.univer-exchange-upload-error{display:flex;flex-direction:column;align-items:flex-start;margin-top:var(--margin-lg)}.univer-exchange-upload-error-tip{color:var(--color-black);font-size:var(--font-size-sm);padding:0 var(--padding-lg) 0 var(--padding-sm);margin-bottom:var(--margin-sm)}.univer-exchange-upload-success{display:flex;padding:0 var(--padding-xs) 0 var(--padding-sm);align-items:center;justify-content:space-between;margin-top:var(--margin-sm)}.univer-exchange-upload-success-tip{color:rgb(var(--text-color-secondary));font-size:var(--font-size-xs)}.univer-exchange-upload-notification{position:fixed;z-index:1000;bottom:48px;right:12px;width:372px;display:flex;flex-direction:column;justify-content:flex-start;padding:var(--padding-xl) var(--padding-base) var(--padding-lg) var(--padding-base);background-color:#fff;border-radius:6px;box-shadow:var(--box-shadow-base);box-sizing:border-box}.univer-exchange-upload-notification-header{display:flex;align-items:center;justify-content:space-between;padding:0 var(--padding-sm) 0 6px}.univer-exchange-upload-notification-header-title{display:flex}.univer-exchange-upload-notification-header-icon{height:24px;font-size:24px}.univer-exchange-upload-notification-header-icon-success{color:rgb(var(--success-color))}.univer-exchange-upload-notification-header-icon-uploading{color:rgb(var(--info-color))}.univer-exchange-upload-notification-header-icon-error{color:rgb(var(--error-color))}.univer-exchange-upload-notification-header-text{margin-left:6px;line-height:24px;color:var(--color-black);font-size:17px;font-weight:600}.univer-exchange-upload-notification-header-close{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-upload-notification-header-close:hover{background-color:rgb(var(--bg-color-hover))}
@@ -5,6 +5,6 @@ export { IRequestService, RequestService } from './services/request.service';
5
5
  /** @deprecated Will be removed in the 0.2.19 release */
6
6
  export { EXCHANGE_EXPORT_SERVER_URL_KEY, EXCHANGE_GET_TASK_SERVER_URL_KEY, EXCHANGE_IMPORT_SERVER_URL_KEY, EXCHANGE_SIGN_URL_SERVER_URL_KEY, EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY } from './services/request.service';
7
7
  export { IUploadNotificationService, UploadNotificationService, UploadNotificationState } from './services/upload-notification.service';
8
- export { IUploadProgressService, UploadProgressService } from './services/upload-progress.service';
9
8
  export { downloadFile, getUniverTypeByFile, getUploadFile } from './services/utils/tool';
10
9
  export { UploadNotificationContainer } from './views/UploadNotificationContainer';
10
+ export { transformWorkbookDataToSnapshotJson } from './services/utils/snapshot';
@@ -1,8 +1,9 @@
1
1
  import { IDisposable, Disposable, ILogService, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';
2
- import { IProgressService, IMessageService } from '@univerjs/ui';
3
- import { UniverType } from '@univerjs/protocol';
2
+ import { Observable } from 'rxjs';
4
3
  import { ExchangeService } from './exchange.service';
5
4
  import { UploadNotificationService } from './upload-notification.service';
5
+ import { UniverType } from '@univerjs/protocol';
6
+ import { IMessageService } from '@univerjs/ui';
6
7
  export interface IExchangeOperateService {
7
8
  interrupt(): void;
8
9
  /**
@@ -58,6 +59,16 @@ export interface IExchangeOperateService {
58
59
  * @param getLink
59
60
  */
60
61
  registerLink(getLink: (unitId: string, univerType: UniverInstanceType) => string): void;
62
+ /**
63
+ * Observable of upload progress
64
+ */
65
+ progress$: Observable<IUploadProgress>;
66
+ }
67
+ export interface IUploadProgress {
68
+ /** Task that already completed. */
69
+ done: number;
70
+ /** The total number of tasks need to execute. */
71
+ count: number;
61
72
  }
62
73
  export declare const IExchangeOperateService: import('@wendellhu/redi').IdentifierDecorator<IExchangeOperateService>;
63
74
  export declare class ExchangeOperateService extends Disposable implements IExchangeOperateService, IDisposable {
@@ -66,10 +77,13 @@ export declare class ExchangeOperateService extends Disposable implements IExcha
66
77
  private readonly _localeService;
67
78
  private readonly _exchangeService;
68
79
  private readonly _uploadNotificationService;
69
- private readonly _uploadProgressService;
70
80
  protected readonly _logService: ILogService;
71
81
  private _interrupted;
72
- constructor(_univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService, _exchangeService: ExchangeService, _uploadNotificationService: UploadNotificationService, _uploadProgressService: IProgressService, _logService: ILogService);
82
+ private readonly _progress$;
83
+ readonly progress$: Observable<IUploadProgress>;
84
+ private _totalUploadTaskCount;
85
+ private _doneUploadTaskCount;
86
+ constructor(_univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService, _exchangeService: ExchangeService, _uploadNotificationService: UploadNotificationService, _logService: ILogService);
73
87
  interrupt(): void;
74
88
  uploadFileToUnitId(types: UniverType[]): Promise<{
75
89
  unitId: string;
@@ -99,4 +113,9 @@ export declare class ExchangeOperateService extends Disposable implements IExcha
99
113
  private _showNetworkError;
100
114
  private _showDownloadMessage;
101
115
  private _showUploadMessage;
116
+ private _emitProgress;
117
+ private _addTotalCount;
118
+ private _addDoneTask;
119
+ private _completeProgress;
120
+ private _clearProgress;
102
121
  }