@vitrosoftware/common-ui-ts 1.1.227 → 1.1.229
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/css/std/controls/alert/alert.css +10 -47
- package/css/std/controls/bim-viewer/bim-viewer-index.css +4 -0
- package/css/std/controls/bim-viewer/style.css +4 -0
- package/css/std/controls/dialog/dialog-content.css +3 -0
- package/css/std/controls/dialog/dialog-footer.css +2 -0
- package/css/std/controls/dxf-viewer/common.css +4 -0
- package/css/std/controls/dxf-viewer/dxf-viewer-index.css +4 -0
- package/css/std/controls/field-iterator/field-iterator.css +6 -0
- package/css/std/controls/file/file.css +5 -4
- package/css/std/controls/filter/filter.css +1 -1
- package/css/std/controls/issue-tile/issue-tile-footer.css +1 -1
- package/css/std/controls/issue-tile/issue-tile-header.css +1 -1
- package/css/std/controls/issue-tile/issue-tile.css +1 -1
- package/css/std/controls/lookup-picker/lookup-picker-selected-item.css +0 -1
- package/css/std/controls/lookup-picker/lookup-picker-value-list.css +0 -1
- package/css/std/controls/lookup-picker/lookup-picker.css +38 -21
- package/css/std/controls/pdf-viewer/custom.css +4 -0
- package/css/std/controls/pdf-viewer/img/compare-dlg-separator.svg +3 -1
- package/css/std/controls/pdf-viewer/img/compare-dlg-title.svg +12 -0
- package/css/std/controls/pdf-viewer/pdf-viewer-index.css +217 -0
- package/css/std/controls/pdf-viewer/pdf-viewer.css +213 -0
- package/css/std/controls/select/select.css +26 -2
- package/css/std/controls/tab-group/tab-group.css +6 -3
- package/css/std/controls/table-view/table-view-custom-lookup-edit.css +1 -1
- package/css/std/controls/table-view/treegrid-cell.css +5 -0
- package/css/std/controls/table-view/treegrid-context-menu.css +22 -3
- package/css/std/controls/video-viewer/video-viewer.css +1 -1
- package/dist/index.css +101 -85
- package/dist/index.js +478 -344
- package/dist/index.js.map +1 -1
- package/dist/src/constants/Factory.d.ts +1 -0
- package/dist/src/controls/Alert/Alert.d.ts +0 -4
- package/dist/src/controls/BimViewer/BimViewer.d.ts +1 -0
- package/dist/src/controls/BimViewer/Viewer.d.ts +1 -0
- package/dist/src/controls/Dialog/Dialog.d.ts +2 -0
- package/dist/src/controls/Dialog/DialogContent.d.ts +1 -0
- package/dist/src/controls/DxfViewer/DxfViewer.d.ts +1 -0
- package/dist/src/controls/DxfViewer/Viewer.d.ts +1 -0
- package/dist/src/controls/IssueTile/IssueTile.d.ts +7 -5
- package/dist/src/controls/LookupPicker/LookupPicker.d.ts +2 -0
- package/dist/src/controls/LookupPicker/RightButtonGroup.d.ts +2 -2
- package/dist/src/controls/LookupPicker/ValueList.d.ts +2 -0
- package/dist/src/controls/MicroFrontend/MicroFrontend.d.ts +1 -2
- package/dist/src/controls/PdfViewer/services/PdfViewerService.d.ts +8 -0
- package/dist/src/controls/ScrollBar/ScrollBar.d.ts +4 -3
- package/dist/src/controls/Search/Search.d.ts +3 -2
- package/dist/src/controls/TabGroup/Tab.d.ts +3 -3
- package/dist/src/controls/TabGroup/TabGroup.d.ts +0 -1
- package/dist/src/controls/TabGroup/TabGroupComponent.d.ts +0 -1
- package/dist/src/controls/TabGroup/models/Tab.d.ts +2 -1
- package/dist/src/controls/TableView/TableView.d.ts +2 -0
- package/dist/src/controls/TableView/TableViewConstants.d.ts +8 -2
- package/dist/src/controls/TableView/models/TableViewMenuItem.d.ts +2 -0
- package/dist/src/controls/TableView/services/TableViewService.d.ts +5 -0
- package/dist/src/controls/TableView/services/impl/TableViewServiceImpl.d.ts +7 -1
- package/dist/src/controls/View/View.d.ts +1 -1
- package/dist/src/controls/ViewPart/ViewPart.d.ts +2 -1
- package/dist/src/models/Item.d.ts +0 -1
- package/dist/src/models/ItemCopyRequest.d.ts +5 -1
- package/dist/src/models/ItemId.d.ts +2 -0
- package/dist/src/services/FileService.d.ts +8 -0
- package/dist/src/services/ItemSelectDialogService.d.ts +1 -1
- package/dist/src/services.d.ts +3 -0
- package/lib/dxf-viewer/OrbitControls.js +6 -2
- package/lib/dxf-viewer/parser/DxfArrayScanner.js +27 -1
- package/lib/dxf-viewer/parser/DxfParser.js +7 -4
- package/lib/fflate/fflate.module.js +2672 -0
- package/package.json +1 -1
- package/src/controls/BimViewer/js/bim-viewer.js +20 -32
- package/src/controls/DxfViewer/js/dxf-viewer.js +170 -60
- package/src/controls/PdfViewer/js/pdf-viewer.js +993 -56
- package/css/std/controls/file/img/file-button-context.svg +0 -6
|
@@ -26,6 +26,7 @@ export interface DialogProps {
|
|
|
26
26
|
};
|
|
27
27
|
isHideFooter?: boolean;
|
|
28
28
|
isShow?: boolean;
|
|
29
|
+
isCustomContentContainer?: boolean;
|
|
29
30
|
dialog?: any;
|
|
30
31
|
className?: string;
|
|
31
32
|
headerClassName?: string;
|
|
@@ -34,5 +35,6 @@ export interface DialogProps {
|
|
|
34
35
|
hiddenContent?: React.ReactNode;
|
|
35
36
|
zIndex?: number;
|
|
36
37
|
children?: React.ReactNode;
|
|
38
|
+
key?: string;
|
|
37
39
|
}
|
|
38
40
|
export declare const Dialog: (props: DialogProps) => JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { MicroFrontendProps } from '../MicroFrontend/MicroFrontend';
|
|
2
3
|
export interface IssueTileProps {
|
|
3
4
|
id: string;
|
|
4
5
|
url?: string;
|
|
@@ -16,17 +17,18 @@ export interface IssueTileProps {
|
|
|
16
17
|
onClick: (e: any, value: string) => any;
|
|
17
18
|
}[];
|
|
18
19
|
onClick?: () => any;
|
|
19
|
-
onShowMoreClick?: (e: any, issue?: any) =>
|
|
20
|
+
onShowMoreClick?: (e: any, issue?: any) => void;
|
|
20
21
|
isActive?: boolean;
|
|
21
|
-
fieldList
|
|
22
|
-
componentMap
|
|
22
|
+
fieldList?: any[];
|
|
23
|
+
componentMap?: {
|
|
23
24
|
name: string;
|
|
24
25
|
value: React.FunctionComponent<any>;
|
|
25
26
|
}[];
|
|
26
27
|
rowFieldList?: string[];
|
|
27
28
|
fieldValueMap?: any;
|
|
28
|
-
onChange
|
|
29
|
+
onChange?: (changedFieldValueMap: Map<string, any>, saveStatus?: {
|
|
29
30
|
isSaving: boolean;
|
|
30
|
-
}) =>
|
|
31
|
+
}) => void;
|
|
32
|
+
content?: MicroFrontendProps;
|
|
31
33
|
}
|
|
32
34
|
export declare const IssueTile: (props: IssueTileProps) => JSX.Element;
|
|
@@ -26,8 +26,10 @@ export interface LookupPickerProps {
|
|
|
26
26
|
isRequired?: boolean;
|
|
27
27
|
isFlipDropdown?: boolean;
|
|
28
28
|
dropdownPlacement?: string;
|
|
29
|
+
dropdownAllowedAutoPlacements?: string[];
|
|
29
30
|
isShowButtonClear?: boolean;
|
|
30
31
|
isShowSearchButton?: boolean;
|
|
32
|
+
isValueListFullWidth?: boolean;
|
|
31
33
|
onSearch?: () => Promise<{
|
|
32
34
|
id: string;
|
|
33
35
|
}[] | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface RightButtonGroupProps {
|
|
3
3
|
selectedValueList: {
|
|
4
4
|
id: string;
|
|
@@ -16,4 +16,4 @@ export interface RightButtonGroupProps {
|
|
|
16
16
|
id: string;
|
|
17
17
|
}) => string;
|
|
18
18
|
}
|
|
19
|
-
export declare const RightButtonGroup:
|
|
19
|
+
export declare const RightButtonGroup: React.ForwardRefExoticComponent<RightButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -19,7 +19,9 @@ interface ValueListProps {
|
|
|
19
19
|
id: string;
|
|
20
20
|
}) => FunctionComponentElement<any> | null;
|
|
21
21
|
placement?: any;
|
|
22
|
+
allowedAutoPlacements?: any;
|
|
22
23
|
button?: ButtonProps;
|
|
24
|
+
isFullWidth?: boolean;
|
|
23
25
|
}
|
|
24
26
|
export declare const ValueList: (props: ValueListProps) => JSX.Element;
|
|
25
27
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
interface MicroFrontendProps {
|
|
2
|
+
export interface MicroFrontendProps {
|
|
3
3
|
name: string;
|
|
4
4
|
host: string;
|
|
5
5
|
data: any;
|
|
@@ -8,4 +8,3 @@ interface MicroFrontendProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare const MicroFrontend: FunctionComponent<MicroFrontendProps>;
|
|
11
|
-
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { models } from '../../../models';
|
|
2
2
|
import type { Field } from '../../../models/Field';
|
|
3
|
+
import type { Item } from '../../../models/Item';
|
|
3
4
|
import type { ListConfig } from '../../../models/ListConfig';
|
|
5
|
+
import type { ItemService } from '../../../services/ItemService';
|
|
6
|
+
import type { FileService } from '../../../services/FileService';
|
|
4
7
|
export interface PdfViewerService {
|
|
5
8
|
file: any;
|
|
6
9
|
versionId?: string;
|
|
@@ -25,4 +28,9 @@ export interface PdfViewerService {
|
|
|
25
28
|
container: any;
|
|
26
29
|
getSettingsFromLocalStorage: () => any;
|
|
27
30
|
setSettingsToLocalStorage: (settings: string) => void;
|
|
31
|
+
onIssueTileChange: (issue: Item, changedFieldValueMap: Map<string, unknown>) => void;
|
|
32
|
+
getItemIdList: () => Promise<string[]>;
|
|
33
|
+
itemService: ItemService;
|
|
34
|
+
fileService: FileService;
|
|
35
|
+
selectFileBtnText: string;
|
|
28
36
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface ScrollBarProps {
|
|
2
|
+
interface ScrollBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
isHideScrollX?: boolean;
|
|
4
4
|
isFocusOnScroll?: boolean;
|
|
5
|
-
|
|
5
|
+
isPreventParentScroll?: boolean;
|
|
6
|
+
onInit?: (container: any, scrollElement: any) => void;
|
|
6
7
|
children: React.ReactNode;
|
|
7
8
|
className?: string;
|
|
8
9
|
contentRef?: React.RefObject<HTMLDivElement>;
|
|
9
10
|
contentClassName?: string;
|
|
10
11
|
onScrollY?: (e: any, element: any) => void;
|
|
11
12
|
}
|
|
12
|
-
export declare const ScrollBar:
|
|
13
|
+
export declare const ScrollBar: React.ForwardRefExoticComponent<ScrollBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
14
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { models } from '../../models';
|
|
3
3
|
import type { ListConfig } from '../../models/ListConfig';
|
|
4
4
|
import type { Field } from '../../models/Field';
|
|
5
|
+
import type { SearchService } from './services/SearchService';
|
|
5
6
|
interface SearchProps {
|
|
6
7
|
id: string;
|
|
7
8
|
destination?: string;
|
|
@@ -16,5 +17,5 @@ interface SearchProps {
|
|
|
16
17
|
id: string;
|
|
17
18
|
}[];
|
|
18
19
|
}
|
|
19
|
-
export declare const Search:
|
|
20
|
+
export declare const Search: React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<SearchService>>;
|
|
20
21
|
export {};
|
|
@@ -4,7 +4,7 @@ export interface TabProps {
|
|
|
4
4
|
active: boolean;
|
|
5
5
|
onClick: (index: number) => void;
|
|
6
6
|
eventKey?: string;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
imageUrl?: string;
|
|
8
|
+
text: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const Tab: (props: TabProps) => JSX.Element
|
|
10
|
+
export declare const Tab: (props: TabProps) => JSX.Element;
|
|
@@ -9,6 +9,5 @@ export interface TabGroupProps {
|
|
|
9
9
|
itemList: models.Tab[];
|
|
10
10
|
className?: string;
|
|
11
11
|
isDisabled?: boolean;
|
|
12
|
-
isHideSingleHeader?: boolean;
|
|
13
12
|
}
|
|
14
13
|
export declare const TabGroup: React.ForwardRefExoticComponent<TabGroupProps & React.RefAttributes<services.TabGroupService>>;
|
|
@@ -7,7 +7,6 @@ export interface TabGroupComponentProps {
|
|
|
7
7
|
wrap?: boolean;
|
|
8
8
|
itemList: models.Tab[];
|
|
9
9
|
isDisabled?: boolean;
|
|
10
|
-
isHideSingleHeader?: boolean;
|
|
11
10
|
className?: string;
|
|
12
11
|
}
|
|
13
12
|
export declare const TabGroupComponent: React.ForwardRefExoticComponent<TabGroupComponentProps & React.RefAttributes<services.TabGroupService>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { interfaces } from 'inversify';
|
|
2
3
|
import { models } from '../../models';
|
|
3
4
|
import { services } from '../../services';
|
|
4
5
|
export declare const TableView: (props: TableViewProps) => JSX.Element;
|
|
@@ -24,4 +25,5 @@ export interface TableViewProps {
|
|
|
24
25
|
isReadOnly?: boolean;
|
|
25
26
|
isNoVScroll?: boolean;
|
|
26
27
|
className?: string;
|
|
28
|
+
container?: interfaces.Container;
|
|
27
29
|
}
|
|
@@ -79,7 +79,8 @@ export declare enum CFG_ATTRIBUTE {
|
|
|
79
79
|
CUSTOM_SCROLL = "CustomScroll",
|
|
80
80
|
SHOW_V_SCROLL = "ShowVScroll",
|
|
81
81
|
MID_WIDTH = "MidWidth",
|
|
82
|
-
RIGHT_WIDTH = "RightWidth"
|
|
82
|
+
RIGHT_WIDTH = "RightWidth",
|
|
83
|
+
SCROLL_TOP = "ScrollTop"
|
|
83
84
|
}
|
|
84
85
|
export declare enum URL {
|
|
85
86
|
LAYOUT = "Layout",
|
|
@@ -143,7 +144,12 @@ export declare enum ATTRIBUTE {
|
|
|
143
144
|
ID = "Id",
|
|
144
145
|
ADDED = "Added",
|
|
145
146
|
FORMULA = "Formula",
|
|
146
|
-
FORMAT = "Format"
|
|
147
|
+
FORMAT = "Format",
|
|
148
|
+
SPAN = "Span",
|
|
149
|
+
LANG = "Lang",
|
|
150
|
+
GMT = "GMT",
|
|
151
|
+
ACTIONS = "Actions",
|
|
152
|
+
MENU = "Menu"
|
|
147
153
|
}
|
|
148
154
|
export declare enum DRAG_ITEM_TYPE {
|
|
149
155
|
CANNOT_DROP = 0,
|
|
@@ -32,6 +32,8 @@ export interface TableViewService {
|
|
|
32
32
|
refreshMode?: string;
|
|
33
33
|
viewId: string;
|
|
34
34
|
visibleColumnList?: string[];
|
|
35
|
+
disabledActionList: string[];
|
|
36
|
+
linkItemId: string | undefined;
|
|
35
37
|
setSearchCriterionList(searchCriterionList: models.Criterion[], searchId: string): void;
|
|
36
38
|
clearSearchCriterionList(searchId: string): void;
|
|
37
39
|
getSearchCriterionList(searchId?: string): models.Criterion[];
|
|
@@ -122,6 +124,7 @@ export interface TableViewService {
|
|
|
122
124
|
getPage(num?: number): models.TableViewRow;
|
|
123
125
|
reloadPage(page: models.TableViewRow): void;
|
|
124
126
|
getFirstVisible(): models.TableViewRow | undefined;
|
|
127
|
+
getLastVisible(): models.TableViewRow | undefined;
|
|
125
128
|
getGanttSlack(row: models.TableViewRow, col?: string, bar?: string): number;
|
|
126
129
|
getDependencies(row: models.TableViewRow, col?: string, ancestors?: boolean): Array<any>;
|
|
127
130
|
getZoomList(col?: string): Array<any>;
|
|
@@ -137,4 +140,6 @@ export interface TableViewService {
|
|
|
137
140
|
changeDef(row: models.TableViewRow, def: string, show?: boolean, undo?: boolean): void;
|
|
138
141
|
expand(row: models.TableViewRow): void;
|
|
139
142
|
getRequestDataXml(data: string): string;
|
|
143
|
+
getNextCol(col: string): any;
|
|
144
|
+
getBodyScrollHeight(): number | undefined;
|
|
140
145
|
}
|
|
@@ -15,6 +15,7 @@ export declare class TableViewServiceImpl implements services.TableViewService {
|
|
|
15
15
|
filterRow: models.TableViewRow;
|
|
16
16
|
viewId: string;
|
|
17
17
|
visibleColumnList: string[];
|
|
18
|
+
disabledActionList: string[];
|
|
18
19
|
constructor(grid: any);
|
|
19
20
|
get columnList(): any;
|
|
20
21
|
get columnNameList(): any;
|
|
@@ -42,6 +43,8 @@ export declare class TableViewServiceImpl implements services.TableViewService {
|
|
|
42
43
|
set group(val: string);
|
|
43
44
|
get def(): any;
|
|
44
45
|
get source(): any;
|
|
46
|
+
set linkItemId(id: string | undefined);
|
|
47
|
+
get linkItemId(): string | undefined;
|
|
45
48
|
setSearchCriterionList(searchCriterionList: models.Criterion[], searchId: string): void;
|
|
46
49
|
setCfgAttribute(attr: string, value: any): void;
|
|
47
50
|
getCfgAttribute(attr: string): string;
|
|
@@ -148,7 +151,10 @@ export declare class TableViewServiceImpl implements services.TableViewService {
|
|
|
148
151
|
expand(row: models.TableViewRow): void;
|
|
149
152
|
getRequestDataXml(data: string): string;
|
|
150
153
|
private setXmlPart;
|
|
151
|
-
private
|
|
154
|
+
private setSearchCriterionListXml;
|
|
152
155
|
private setVisibleColumnListXml;
|
|
153
156
|
private addGanttVisibleColumnList;
|
|
157
|
+
getNextCol(col: string): any;
|
|
158
|
+
getLastVisible(): any;
|
|
159
|
+
getBodyScrollHeight(): any;
|
|
154
160
|
}
|
|
@@ -4,7 +4,7 @@ interface ViewProps {
|
|
|
4
4
|
item: any;
|
|
5
5
|
tabList?: Array<any>;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
|
-
|
|
7
|
+
className?: string;
|
|
8
8
|
}
|
|
9
9
|
export declare const View: React.ForwardRefExoticComponent<ViewProps & React.RefAttributes<services.TabGroupService>>;
|
|
10
10
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Item } from "../models/Item";
|
|
2
|
+
export interface FileService {
|
|
3
|
+
get(sourceId: string): Promise<Array<Item>>;
|
|
4
|
+
getBySourceIdVersionId(sourceId: string, version: string): Promise<Item>;
|
|
5
|
+
download(itemId: string, fileName: string, version?: string, isFileBody?: boolean): void;
|
|
6
|
+
restore(versionId: string): any;
|
|
7
|
+
getName(fileName: string, majorVersion: number, minorVersion: number): string;
|
|
8
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface ItemSelectDialogService {
|
|
2
|
-
show(listId: string, viewId?: string, isMultiSelect?: boolean, isFolderOnly?: boolean, dialogSettings?: {
|
|
2
|
+
show(listId: string, viewId?: string, isMultiSelect?: boolean, isFolderOnly?: boolean, isFileOnly?: boolean, dialogSettings?: {
|
|
3
3
|
title?: string;
|
|
4
4
|
subtitle?: string;
|
|
5
5
|
image?: string;
|
package/dist/src/services.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { TreeViewService as _TreeViewService } from './controls/TreeView/service
|
|
|
24
24
|
import { TreeViewEventHandler as _TreeViewEventHandler } from './controls/TreeView/services/TreeViewEventHandler';
|
|
25
25
|
import { TabGroupService as _TabGroupService } from './controls/TabGroup/services/TabGroupService';
|
|
26
26
|
import { DropdownButtonService as _DropdownButtonService } from './controls/DropdownButton/services/DropdownButtonService';
|
|
27
|
+
import { SearchService as _SearchService } from './controls/Search/services/SearchService';
|
|
27
28
|
export declare namespace services {
|
|
28
29
|
interface BimViewerService extends _BimViewerService {
|
|
29
30
|
}
|
|
@@ -77,4 +78,6 @@ export declare namespace services {
|
|
|
77
78
|
}
|
|
78
79
|
interface DropdownButtonService extends _DropdownButtonService {
|
|
79
80
|
}
|
|
81
|
+
interface SearchService extends _SearchService {
|
|
82
|
+
}
|
|
80
83
|
}
|
|
@@ -882,7 +882,7 @@ export const OrbitControls = function ( object, domElement ) {
|
|
|
882
882
|
|
|
883
883
|
case 1:
|
|
884
884
|
|
|
885
|
-
mouseAction = scope.mouseButtons.
|
|
885
|
+
mouseAction = scope.mouseButtons.RIGHT;
|
|
886
886
|
break;
|
|
887
887
|
|
|
888
888
|
case 2:
|
|
@@ -1022,7 +1022,11 @@ export const OrbitControls = function ( object, domElement ) {
|
|
|
1022
1022
|
|
|
1023
1023
|
function onMouseWheel( event ) {
|
|
1024
1024
|
|
|
1025
|
-
if (
|
|
1025
|
+
if (scope.enabled === false || scope.enableZoom === false || (state !== STATE.NONE && state !== STATE.ROTATE)) return;
|
|
1026
|
+
|
|
1027
|
+
if (window.dxfViewer?.options && event.isTrusted) {
|
|
1028
|
+
window.dxfViewer.options.autoZoom = false;
|
|
1029
|
+
}
|
|
1026
1030
|
|
|
1027
1031
|
event.preventDefault();
|
|
1028
1032
|
event.stopPropagation();
|
|
@@ -9,18 +9,36 @@
|
|
|
9
9
|
* @param data - an array where each element represents a line in the dxf file
|
|
10
10
|
* @constructor
|
|
11
11
|
*/
|
|
12
|
-
export default function DxfArrayScanner(data) {
|
|
12
|
+
export default function DxfArrayScanner(data, fetcher) {
|
|
13
13
|
this._pointer = 0;
|
|
14
14
|
this._data = data;
|
|
15
15
|
this._eof = false;
|
|
16
|
+
this._fetcher = fetcher;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
DxfArrayScanner.prototype.checkNextChunk = function () {
|
|
20
|
+
var delta = this._data.length - this._pointer;
|
|
21
|
+
const reserve = 6;
|
|
22
|
+
if (delta <= reserve) {
|
|
23
|
+
var nextChunk = this._fetcher.GetNextChunk();
|
|
24
|
+
if (nextChunk) {
|
|
25
|
+
const tail = this._data.slice(this._pointer - reserve)
|
|
26
|
+
this._data = tail.concat(nextChunk);
|
|
27
|
+
this._pointer = reserve;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
18
33
|
/**
|
|
19
34
|
* Gets the next group (code, value) from the array. A group is two consecutive elements
|
|
20
35
|
* in the array. The first is the code, the second is the value.
|
|
21
36
|
* @returns {{code: Number}|*}
|
|
22
37
|
*/
|
|
23
38
|
DxfArrayScanner.prototype.next = function() {
|
|
39
|
+
if (this._fetcher)
|
|
40
|
+
this.checkNextChunk();
|
|
41
|
+
|
|
24
42
|
var group;
|
|
25
43
|
if(!this.hasNext()) {
|
|
26
44
|
if(!this._eof)
|
|
@@ -33,6 +51,10 @@ DxfArrayScanner.prototype.next = function() {
|
|
|
33
51
|
code: parseInt(this._data[this._pointer])
|
|
34
52
|
};
|
|
35
53
|
|
|
54
|
+
if (isNaN(group.code)) {
|
|
55
|
+
throw new Error("Cannot parse group code: " + this._data[this._pointer])
|
|
56
|
+
}
|
|
57
|
+
|
|
36
58
|
this._pointer++;
|
|
37
59
|
|
|
38
60
|
group.value = parseGroupValue(group.code, this._data[this._pointer]);
|
|
@@ -58,6 +80,10 @@ DxfArrayScanner.prototype.peek = function() {
|
|
|
58
80
|
code: parseInt(this._data[this._pointer])
|
|
59
81
|
};
|
|
60
82
|
|
|
83
|
+
if (isNaN(group.code)) {
|
|
84
|
+
throw new Error("Cannot parse group code: " + this._data[this._pointer])
|
|
85
|
+
}
|
|
86
|
+
|
|
61
87
|
group.value = parseGroupValue(group.code, this._data[this._pointer + 1]);
|
|
62
88
|
|
|
63
89
|
return group;
|
|
@@ -65,7 +65,8 @@ function registerDefaultObjectHandlers(dxfParser) {
|
|
|
65
65
|
dxfParser.registerObjectHandler(Layout);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export default function DxfParser() {
|
|
68
|
+
export default function DxfParser(dxfFetcher) {
|
|
69
|
+
this._dxfFetcher = dxfFetcher;
|
|
69
70
|
this._entityHandlers = {};
|
|
70
71
|
this._objectHandlers = {};
|
|
71
72
|
|
|
@@ -127,7 +128,7 @@ DxfParser.prototype._parse = function(dxfString) {
|
|
|
127
128
|
var scanner, curr, dxf = {}, lastHandle = 0;
|
|
128
129
|
var dxfLinesArray = dxfString.split(/\r\n|\r|\n/g);
|
|
129
130
|
|
|
130
|
-
scanner = new DxfArrayScanner(dxfLinesArray);
|
|
131
|
+
scanner = new DxfArrayScanner(dxfLinesArray, this._dxfFetcher);
|
|
131
132
|
if (!scanner.hasNext()) {
|
|
132
133
|
throw Error('Empty file');
|
|
133
134
|
}
|
|
@@ -202,7 +203,7 @@ DxfParser.prototype._parse = function(dxfString) {
|
|
|
202
203
|
if(currVarName) header[currVarName] = currVarValue;
|
|
203
204
|
break;
|
|
204
205
|
} else if(curr.code === 9) {
|
|
205
|
-
if(currVarName) header[currVarName] = currVarValue;
|
|
206
|
+
if (currVarName != null) header[currVarName] = currVarValue;
|
|
206
207
|
currVarName = curr.value;
|
|
207
208
|
// Filter here for particular variables we are interested in
|
|
208
209
|
} else {
|
|
@@ -287,7 +288,7 @@ DxfParser.prototype._parse = function(dxfString) {
|
|
|
287
288
|
curr = scanner.next();
|
|
288
289
|
break;
|
|
289
290
|
case 67:
|
|
290
|
-
block.
|
|
291
|
+
block.inPaperSpace = (curr.value && curr.value == 1) ? true : false;
|
|
291
292
|
curr = scanner.next();
|
|
292
293
|
break;
|
|
293
294
|
case 70:
|
|
@@ -417,6 +418,8 @@ DxfParser.prototype._parse = function(dxfString) {
|
|
|
417
418
|
if(expectedCount !== actualCount)
|
|
418
419
|
expectedCount !== actualCount;
|
|
419
420
|
log.warn('Parsed ' + actualCount + ' ' + tableDefinition.dxfSymbolName + '\'s but expected ' + expectedCount);
|
|
421
|
+
} else {
|
|
422
|
+
table[tableDefinition.tableRecordsProperty] = []
|
|
420
423
|
}
|
|
421
424
|
curr = scanner.next();
|
|
422
425
|
return table;
|