@univerjs-pro/drill-down-extraction 0.3.0-nightly.202410101606
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/README.md +16 -0
- package/lib/cjs/index.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/index.css +1 -0
- package/lib/locale/en-US.json +45 -0
- package/lib/locale/ru-RU.json +45 -0
- package/lib/locale/zh-CN.json +45 -0
- package/lib/types/common/extraction-field.d.ts +24 -0
- package/lib/types/common/field-extraction-event.d.ts +34 -0
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/controllers/config.schema.d.ts +5 -0
- package/lib/types/controllers/drill-down-extraction-hyper-link.controller.d.ts +21 -0
- package/lib/types/controllers/drill-down-extraction-ui.controller.d.ts +7 -0
- package/lib/types/controllers/drill-down-extraction.controller.d.ts +58 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/locale/en-US.d.ts +3 -0
- package/lib/types/locale/ru-RU.d.ts +3 -0
- package/lib/types/locale/zh-CN.d.ts +46 -0
- package/lib/types/plugin.d.ts +13 -0
- package/lib/types/services/suggestion-manager.service.d.ts +62 -0
- package/lib/types/views/components/ExtractionFieldForm.d.ts +2 -0
- package/lib/types/views/components/FloatingButton.d.ts +25 -0
- package/lib/umd/index.js +1 -0
- package/package.json +104 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"drill-down-extraction": {
|
3
|
+
"message": {
|
4
|
+
"failed": "Extraction data has been cancelled: {0}",
|
5
|
+
"success": " Fields extract data successfully",
|
6
|
+
"drop": "The result has been discarded"
|
7
|
+
},
|
8
|
+
"config": {
|
9
|
+
"title": "Fields extraction Process",
|
10
|
+
"helper": " Fields extraction process",
|
11
|
+
"dataSource": "Hyperlink in the column",
|
12
|
+
"dataSourcePlaceholder": "Select the link to the data source",
|
13
|
+
"dataSourceError": "Please select a link",
|
14
|
+
"column": "Extraction Fields",
|
15
|
+
"columnPlaceholder": "Select the fields",
|
16
|
+
"columnError": "Please select the field to be extracted",
|
17
|
+
"columnItemTitle": " Fields",
|
18
|
+
"optionsBlank": "No options available",
|
19
|
+
"gettingData": "Extracting Fields...",
|
20
|
+
"gettingDataError": "Failed to extract data.",
|
21
|
+
"stopMessage": "Fields extraction has been stopped.",
|
22
|
+
"gettingDataSuccess": "Fields extraction is successful. Check whether the data is correct.",
|
23
|
+
"startCompletion": "Begin Extracting Fields",
|
24
|
+
"drop": "Drop",
|
25
|
+
"retry": "Retry",
|
26
|
+
"confirm": "Confirm",
|
27
|
+
"stop": "Stop",
|
28
|
+
"cancel": "Cancel",
|
29
|
+
"subscribe": "Subscribe",
|
30
|
+
"toInstall": "To Install",
|
31
|
+
"SuccessMessage": " Fields extraction successfully",
|
32
|
+
"cancelMessage": "Fields extraction has been cancelled",
|
33
|
+
"dropMessage": "The result has been discarded",
|
34
|
+
"stayTuned": "Feature under development. Stay tuned!",
|
35
|
+
"limitDialogTitle": "Limited per extraction",
|
36
|
+
"limitDialogContent": "{0} rows extraction limit reached. To extract more rows, please subscribe.",
|
37
|
+
"extensionDialogTitle": "No extension installed",
|
38
|
+
"extensionDialogContent": "The field extraction process requires the Clipsheet extension to be installed."
|
39
|
+
},
|
40
|
+
"hyperLink": {
|
41
|
+
"optionLabel": "Extraction field",
|
42
|
+
"placeholder": "Please get the extraction field by ClipSheet extension"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"drill-down-extraction": {
|
3
|
+
"message": {
|
4
|
+
"failed": "数据采集失败: {0}",
|
5
|
+
"success": "数据采集完成",
|
6
|
+
"drop": "已丢弃采集数据"
|
7
|
+
},
|
8
|
+
"config": {
|
9
|
+
"title": "数据采集",
|
10
|
+
"helper": "用采集字段写入数据",
|
11
|
+
"dataSource": "超链接所在列",
|
12
|
+
"dataSourcePlaceholder": "选择数据源链接",
|
13
|
+
"dataSourceError": "请选择数据源链接",
|
14
|
+
"column": "采集字段",
|
15
|
+
"columnPlaceholder": "选择采集字段",
|
16
|
+
"columnError": "选择采集字段",
|
17
|
+
"columnItemTitle": "字段",
|
18
|
+
"optionsBlank": "暂无选项",
|
19
|
+
"gettingData": "数据采集中...",
|
20
|
+
"gettingDataError": "采集数据失败",
|
21
|
+
"stopMessage": "数据采集已暂停",
|
22
|
+
"gettingDataSuccess": "数据采集成功,请检查是否正确",
|
23
|
+
"startCompletion": "开始数据采集",
|
24
|
+
"drop": "丢弃",
|
25
|
+
"retry": "重试",
|
26
|
+
"confirm": "确认",
|
27
|
+
"stop": "停止",
|
28
|
+
"cancel": "取消",
|
29
|
+
"subscribe": "订阅",
|
30
|
+
"toInstall": "前去安装",
|
31
|
+
"SuccessMessage": "数据采集成功",
|
32
|
+
"cancelMessage": "已取消数据采集",
|
33
|
+
"dropMessage": "已丢弃采集数据",
|
34
|
+
"stayTuned": "功能正在开发中,敬请期待!",
|
35
|
+
"limitDialogTitle": "采集限制提醒",
|
36
|
+
"limitDialogContent": "已达到 {0} 行采集上限,要采集更多数据,请订阅。",
|
37
|
+
"extensionDialogTitle": "未安装扩展",
|
38
|
+
"extensionDialogContent": "采集字段写入数据需要安装 Clipsheet 扩展。"
|
39
|
+
},
|
40
|
+
"hyperLink": {
|
41
|
+
"optionLabel": "采集字段",
|
42
|
+
"placeholder": "请使用插件获取采集字段"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export declare const EXTRACTION_FIELD_TYPE = "extract_field";
|
2
|
+
export interface ISelectorItem {
|
3
|
+
selector: string;
|
4
|
+
text: string;
|
5
|
+
}
|
6
|
+
export interface IExtractionFieldData {
|
7
|
+
url: string;
|
8
|
+
type: typeof EXTRACTION_FIELD_TYPE;
|
9
|
+
selectors: Array<ISelectorItem>;
|
10
|
+
}
|
11
|
+
export declare const extractionFieldLinkHelper: {
|
12
|
+
payloadPattern: RegExp;
|
13
|
+
getSelectorItems(data: IExtractionFieldData): {
|
14
|
+
text: string;
|
15
|
+
payload: string;
|
16
|
+
}[];
|
17
|
+
generateLinkPayload(url: string, selector: string): string;
|
18
|
+
isPayload(payload: string): boolean;
|
19
|
+
parsePayload(payload: string): [string, string] | null;
|
20
|
+
};
|
21
|
+
export declare const extractionFieldHelper: {
|
22
|
+
parsePlainText(clipboard: string): IExtractionFieldData | null;
|
23
|
+
checkData(data: any): data is IExtractionFieldData;
|
24
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
export interface IFieldExtractionRequestEvent {
|
2
|
+
id: string;
|
3
|
+
interval: number;
|
4
|
+
url: string;
|
5
|
+
selectors: string[];
|
6
|
+
}
|
7
|
+
export interface IFieldExtractionResponseEvent {
|
8
|
+
id: string;
|
9
|
+
url: string;
|
10
|
+
datum: Array<{
|
11
|
+
selector: string;
|
12
|
+
text: string;
|
13
|
+
}>;
|
14
|
+
success: boolean;
|
15
|
+
}
|
16
|
+
export declare enum FieldExtractionEvents {
|
17
|
+
Request = "univer-field-extraction-request",
|
18
|
+
Response = "univer-field-extraction-response",
|
19
|
+
Installed = "univer-field-extraction-installed"
|
20
|
+
}
|
21
|
+
declare function sendRequestFieldExtractionEvent(detail: IFieldExtractionRequestEvent): void;
|
22
|
+
declare function sendResponseFieldExtractionEvent(detail: IFieldExtractionResponseEvent): void;
|
23
|
+
declare function listenFieldExtractionRequestEvent(callback: (params: IFieldExtractionRequestEvent) => void): () => void;
|
24
|
+
declare function listenFieldExtractionResponseEvent(callback: (params: IFieldExtractionResponseEvent) => void): () => void;
|
25
|
+
declare function listenExtensionInstalledEvent(callback: () => void): () => void;
|
26
|
+
export declare const fieldExtractionEvent: {
|
27
|
+
sendRequest: typeof sendRequestFieldExtractionEvent;
|
28
|
+
sendResponse: typeof sendResponseFieldExtractionEvent;
|
29
|
+
broadcastInstalled: () => boolean;
|
30
|
+
listenInstalled: typeof listenExtensionInstalledEvent;
|
31
|
+
listenRequest: typeof listenFieldExtractionRequestEvent;
|
32
|
+
listenResponse: typeof listenFieldExtractionResponseEvent;
|
33
|
+
};
|
34
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const UniverSheetsDrillDownExtractionPluginName: "UNIVER_DRILL_DOWN_EXTRACTION_PLUGIN";
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Disposable, Injector, LocaleService } from '@univerjs/core';
|
2
|
+
import { SheetInterceptorService } from '@univerjs/sheets';
|
3
|
+
import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
|
4
|
+
import { SheetsHyperLinkCopyPasteController, SheetsHyperLinkSidePanelService } from '@univerjs/sheets-hyper-link-ui';
|
5
|
+
import { ISheetClipboardService } from '@univerjs/sheets-ui';
|
6
|
+
export declare class SheetsDrillDownExtractionHyperLinkController extends Disposable {
|
7
|
+
private _sheetClipboardService;
|
8
|
+
private readonly _sheetInterceptorService;
|
9
|
+
private _sheetHyperLinkSidePanelService;
|
10
|
+
private _hyperLinkModel;
|
11
|
+
private _injector;
|
12
|
+
private _localeService;
|
13
|
+
private _hyperLinkCopyPasteController;
|
14
|
+
private _copyInfo;
|
15
|
+
constructor(_sheetClipboardService: ISheetClipboardService, _sheetInterceptorService: SheetInterceptorService, _sheetHyperLinkSidePanelService: SheetsHyperLinkSidePanelService, _hyperLinkModel: HyperLinkModel, _injector: Injector, _localeService: LocaleService, _hyperLinkCopyPasteController: SheetsHyperLinkCopyPasteController);
|
16
|
+
private _registerHyperLink;
|
17
|
+
private _initCopyPaste;
|
18
|
+
private _initSetRangeValuesCommandInterceptor;
|
19
|
+
private _collect;
|
20
|
+
private _generateMutations;
|
21
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
2
|
+
import { ComponentManager } from '@univerjs/ui';
|
3
|
+
export declare class DrillDownExtractionUIController extends Disposable {
|
4
|
+
private readonly _componentManager;
|
5
|
+
constructor(_componentManager: ComponentManager);
|
6
|
+
private _initComponent;
|
7
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { ICellData, IObjectMatrixPrimitiveType, IRange, Disposable, ICommandService, IPermissionService, IUniverInstanceService, LocaleService, ThemeService, UserManagerService } from '@univerjs/core';
|
2
|
+
import { ISheetCommandSharedParams, RangeProtectionRuleModel, RefRangeService, SheetsSelectionsService } from '@univerjs/sheets';
|
3
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
4
|
+
import { HTTPService } from '@univerjs/network';
|
5
|
+
import { HyperLinkModel } from '@univerjs/sheets-hyper-link';
|
6
|
+
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
|
7
|
+
import { IMessageService } from '@univerjs/ui';
|
8
|
+
import { SuggestionManagerService } from '../services/suggestion-manager.service';
|
9
|
+
export declare const DrillDownExtractionFloatingButtonName = "DrillDownExtractionFloatingButtonName";
|
10
|
+
export declare const DrillDownExtractionFloatingRectName = "DrillDownExtractionFloatingRectName";
|
11
|
+
export declare const DrillDownExtractionFloatingRectZIndex = 100;
|
12
|
+
export interface IFieldsExtractionCommandParams extends ISheetCommandSharedParams {
|
13
|
+
urlToRowsMap: Map<string, number[]>;
|
14
|
+
selectorToColumnsMap: Map<string, number[]>;
|
15
|
+
}
|
16
|
+
export declare function generateNullCellValue(range: IRange[]): IObjectMatrixPrimitiveType<ICellData>;
|
17
|
+
export declare class DrillDownExtractionController extends Disposable {
|
18
|
+
private _selectionProtectionRuleModel;
|
19
|
+
private _permissionService;
|
20
|
+
private readonly _selectionManagerService;
|
21
|
+
private readonly _sheetPopManagerService;
|
22
|
+
private readonly _httpService;
|
23
|
+
private readonly _refRangeService;
|
24
|
+
private readonly _localeService;
|
25
|
+
private readonly _commandService;
|
26
|
+
private readonly _messageService;
|
27
|
+
private readonly _instanceService;
|
28
|
+
private readonly _hyperLinkModel;
|
29
|
+
private readonly _suggestionManagerService;
|
30
|
+
private readonly _renderManagerService;
|
31
|
+
private readonly _themeService;
|
32
|
+
private readonly _userManagerService;
|
33
|
+
private _rectsDisposer;
|
34
|
+
constructor(_selectionProtectionRuleModel: RangeProtectionRuleModel, _permissionService: IPermissionService, _selectionManagerService: SheetsSelectionsService, _sheetPopManagerService: SheetCanvasPopManagerService, _httpService: HTTPService, _refRangeService: RefRangeService, _localeService: LocaleService, _commandService: ICommandService, _messageService: IMessageService, _instanceService: IUniverInstanceService, _hyperLinkModel: HyperLinkModel, _suggestionManagerService: SuggestionManagerService, _renderManagerService: IRenderManagerService, _themeService: ThemeService, _userManagerService: UserManagerService);
|
35
|
+
getRowsLimit(): Promise<number>;
|
36
|
+
private _initCommand;
|
37
|
+
private _initActiveSheetChange;
|
38
|
+
private _initSelectionChangeListener;
|
39
|
+
private _initRequestingRangeListener;
|
40
|
+
private _selectionContentShouldBeDrillDownExtract;
|
41
|
+
private _showDrillDownExtractButton;
|
42
|
+
private _operationHandlerListener;
|
43
|
+
private _generateSuggestOptions;
|
44
|
+
private _requestingRange;
|
45
|
+
private _getScale;
|
46
|
+
private _clearSuggestionContent;
|
47
|
+
private _getClearRangeByColumns;
|
48
|
+
private _isHyperLink;
|
49
|
+
private _getExtractionField;
|
50
|
+
private _getHyperlinkFromCell;
|
51
|
+
private _generateCellValue;
|
52
|
+
private _getExtractionInterval;
|
53
|
+
private _getRequest;
|
54
|
+
private _stopSubscription;
|
55
|
+
private _requestDrillDownExtract;
|
56
|
+
stopDrillDown(): void;
|
57
|
+
}
|
58
|
+
export declare function hasURL(text: string): boolean;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
declare const locales: {
|
2
|
+
'drill-down-extraction': {
|
3
|
+
message: {
|
4
|
+
failed: string;
|
5
|
+
success: string;
|
6
|
+
drop: string;
|
7
|
+
};
|
8
|
+
config: {
|
9
|
+
title: string;
|
10
|
+
helper: string;
|
11
|
+
dataSource: string;
|
12
|
+
dataSourcePlaceholder: string;
|
13
|
+
dataSourceError: string;
|
14
|
+
column: string;
|
15
|
+
columnPlaceholder: string;
|
16
|
+
columnError: string;
|
17
|
+
columnItemTitle: string;
|
18
|
+
optionsBlank: string;
|
19
|
+
gettingData: string;
|
20
|
+
gettingDataError: string;
|
21
|
+
stopMessage: string;
|
22
|
+
gettingDataSuccess: string;
|
23
|
+
startCompletion: string;
|
24
|
+
drop: string;
|
25
|
+
retry: string;
|
26
|
+
confirm: string;
|
27
|
+
stop: string;
|
28
|
+
cancel: string;
|
29
|
+
subscribe: string;
|
30
|
+
toInstall: string;
|
31
|
+
SuccessMessage: string;
|
32
|
+
cancelMessage: string;
|
33
|
+
dropMessage: string;
|
34
|
+
stayTuned: string;
|
35
|
+
limitDialogTitle: string;
|
36
|
+
limitDialogContent: string;
|
37
|
+
extensionDialogTitle: string;
|
38
|
+
extensionDialogContent: string;
|
39
|
+
};
|
40
|
+
hyperLink: {
|
41
|
+
optionLabel: string;
|
42
|
+
placeholder: string;
|
43
|
+
};
|
44
|
+
};
|
45
|
+
};
|
46
|
+
export default locales;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { IUniverDrillDownExtractionConfig } from './controllers/config.schema';
|
2
|
+
import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
3
|
+
export declare class UniverSheetsDrillDownExtractionPlugin extends Plugin {
|
4
|
+
private readonly _config;
|
5
|
+
protected _injector: Injector;
|
6
|
+
private readonly _configService;
|
7
|
+
static pluginName: "UNIVER_DRILL_DOWN_EXTRACTION_PLUGIN";
|
8
|
+
static type: UniverInstanceType;
|
9
|
+
constructor(_config: IUniverDrillDownExtractionConfig | undefined, _injector: Injector, _configService: IConfigService);
|
10
|
+
onStarting(): void;
|
11
|
+
onReady(): void;
|
12
|
+
onSteady(): void;
|
13
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { DisposableCollection, IDisposable, IRange, Nullable } from '@univerjs/core';
|
2
|
+
export interface ISuggestionManagerServiceParam {
|
3
|
+
unitId: string;
|
4
|
+
subUnitId: string;
|
5
|
+
range: IRange;
|
6
|
+
disposable: DisposableCollection;
|
7
|
+
}
|
8
|
+
export interface ISuggestManagerServiceRequestParam {
|
9
|
+
minInterval: number | null;
|
10
|
+
maxInterval: number | null;
|
11
|
+
}
|
12
|
+
export declare enum SuggestStateEnum {
|
13
|
+
CONFIG = 0,
|
14
|
+
REQUESTING = 1,
|
15
|
+
COMPLETE = 2,
|
16
|
+
ERROR = 3,
|
17
|
+
STOP = 4,
|
18
|
+
IDLE = 5
|
19
|
+
}
|
20
|
+
export declare enum OperationTypeEnum {
|
21
|
+
REQUEST = 0,
|
22
|
+
CLEAR = 1,
|
23
|
+
STOP = 2,
|
24
|
+
START = 3
|
25
|
+
}
|
26
|
+
export interface ISuggestionManagerOptions {
|
27
|
+
label: string;
|
28
|
+
value: string;
|
29
|
+
selected?: boolean;
|
30
|
+
}
|
31
|
+
export declare class SuggestionManagerService {
|
32
|
+
private _suggestionParam;
|
33
|
+
private _requestParam;
|
34
|
+
private _suggestState;
|
35
|
+
private _request$;
|
36
|
+
readonly request$: import('rxjs').Observable<SuggestStateEnum>;
|
37
|
+
private _operation$;
|
38
|
+
readonly operation$: import('rxjs').Observable<OperationTypeEnum>;
|
39
|
+
private _extensionInstalled;
|
40
|
+
constructor();
|
41
|
+
get extensionInstalled(): boolean;
|
42
|
+
get suggestState(): SuggestStateEnum;
|
43
|
+
dispose(): void;
|
44
|
+
suggest(suggestState?: SuggestStateEnum): void;
|
45
|
+
operation(state?: OperationTypeEnum): void;
|
46
|
+
isSuggesting(): boolean;
|
47
|
+
updateRange(range: IRange): void;
|
48
|
+
disposeSuggestion(): void;
|
49
|
+
addDisposable(disposable: IDisposable): void;
|
50
|
+
setRequestParam(value: Nullable<ISuggestManagerServiceRequestParam>): void;
|
51
|
+
setSuggestionParam(value: Nullable<ISuggestionManagerServiceParam>): void;
|
52
|
+
getRequestParam(): Nullable<ISuggestManagerServiceRequestParam>;
|
53
|
+
getSuggestionParam(): Nullable<ISuggestionManagerServiceParam>;
|
54
|
+
getSuggestionRange(): IRange | undefined;
|
55
|
+
private _hyperlinkOptions;
|
56
|
+
getHyperlinkOptions(): ISuggestionManagerOptions[];
|
57
|
+
setHyperlinkOptions(options: ISuggestionManagerOptions[]): void;
|
58
|
+
private _columnOptions;
|
59
|
+
getColumnOptions(): ISuggestionManagerOptions[];
|
60
|
+
setColumnOptions(options: ISuggestionManagerOptions[]): void;
|
61
|
+
getSelectedColumns(): number[];
|
62
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { default as React } from 'react';
|
2
|
+
export default function DrillDownExtractionFloatingButton(): React.JSX.Element;
|
3
|
+
interface IDrillDownExtractionColumnSelectorProps {
|
4
|
+
options: {
|
5
|
+
label: string;
|
6
|
+
value: string;
|
7
|
+
}[];
|
8
|
+
value: string[];
|
9
|
+
onChange: (value: string[]) => void;
|
10
|
+
}
|
11
|
+
export declare function DrillDownExtractionColumnSelector(props: IDrillDownExtractionColumnSelectorProps): React.JSX.Element;
|
12
|
+
export declare function DrillDownExtractionFloatingHeader(): React.JSX.Element;
|
13
|
+
export declare function DrillDownExtractionLimitationDialog(props: {
|
14
|
+
visible: boolean;
|
15
|
+
onClose?: () => void;
|
16
|
+
limit?: number;
|
17
|
+
}): React.JSX.Element;
|
18
|
+
export declare function InstallExtensionDialog(props: {
|
19
|
+
visible: boolean;
|
20
|
+
onClose?: () => void;
|
21
|
+
}): React.JSX.Element;
|
22
|
+
export declare function DrillDownExtractionStartFooter(props: {
|
23
|
+
onStart: () => void;
|
24
|
+
}): React.JSX.Element;
|
25
|
+
export {};
|