@vitrosoftware/common-ui-ts 1.1.122 → 1.1.124
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/checkbox/checkbox.css +4 -0
- package/css/std/controls/checkbox/img/checkbox-indeterminate.svg +4 -0
- package/css/std/controls/date-picker/date-picker.css +1 -25
- package/css/std/controls/dxf-viewer/annotation.css +85 -0
- package/css/std/controls/dxf-viewer/common.css +24 -0
- package/css/std/controls/dxf-viewer/dxf-viewer-index.css +14081 -0
- package/css/std/controls/dxf-viewer/dxf-viewer.css +194 -0
- package/css/std/controls/dxf-viewer/img/cancel-dark-grey.svg +5 -0
- package/css/std/controls/dxf-viewer/img/collapse-bottom.svg +5 -0
- package/css/std/controls/dxf-viewer/img/collapse-up-blue.svg +5 -0
- package/css/std/controls/dxf-viewer/img/delete-active.svg +11 -0
- package/css/std/controls/dxf-viewer/img/delete.svg +11 -0
- package/css/std/controls/dxf-viewer/img/draw-annotation.svg +3 -0
- package/css/std/controls/dxf-viewer/img/invisible-eye.svg +4 -0
- package/css/std/controls/dxf-viewer/img/show-annotation.svg +3 -0
- package/css/std/controls/dxf-viewer/img/sidebar-layers-toggle.svg +6 -0
- package/css/std/controls/dxf-viewer/img/sidebar-notes-toggle.svg +5 -0
- package/css/std/controls/dxf-viewer/img/sidebar-resizer.svg +6 -0
- package/css/std/controls/dxf-viewer/img/sidebar-toggle.svg +7 -0
- package/css/std/controls/dxf-viewer/img/visible-eye.svg +4 -0
- package/css/std/controls/dxf-viewer/img/zoom-in.svg +6 -0
- package/css/std/controls/dxf-viewer/img/zoom-out.svg +5 -0
- package/css/std/controls/dxf-viewer/layer-list.css +104 -0
- package/css/std/controls/dxf-viewer/panel.css +34 -0
- package/css/std/controls/dxf-viewer/prop-inspector.css +102 -0
- package/css/std/controls/dxf-viewer/select.css +111 -0
- package/css/std/controls/dxf-viewer/sidebar.css +190 -0
- package/css/std/controls/dxf-viewer/thumbnail-list.css +65 -0
- package/css/std/controls/dxf-viewer/toolbar.css +117 -0
- package/css/std/controls/dxf-viewer/treeview.css +3 -0
- package/css/std/controls/dxf-viewer/treeview.panel.css +108 -0
- package/css/std/controls/error-message/error-message.css +22 -0
- package/css/std/controls/image-picker/image-picker.css +0 -26
- package/css/std/controls/input/input.css +1 -24
- package/css/std/controls/issue-tile/issue-tile-header.css +1 -0
- package/css/std/controls/login/ntlm-authentication-form.css +9 -12
- package/css/std/controls/lookup-picker/lookup-picker-value-list.css +38 -2
- package/css/std/controls/lookup-picker/lookup-picker.css +1 -25
- package/css/std/controls/table-view/treegrid-context-menu.css +44 -18
- package/css/std/controls/table-view/treegrid-message.css +4 -4
- package/css/std/controls/time-picker/time-picker.css +1 -25
- package/dist/index.css +81 -143
- package/dist/index.js +15137 -489
- package/dist/index.js.map +1 -1
- package/dist/src/controls/Checkbox/Checkbox.d.ts +1 -0
- package/dist/src/controls/DxfViewer/DxfViewer.d.ts +6 -0
- package/dist/src/controls/DxfViewer/DxfViewerContext.d.ts +31 -0
- package/dist/src/controls/DxfViewer/Layer.d.ts +9 -0
- package/dist/src/controls/DxfViewer/LayerList.d.ts +11 -0
- package/dist/src/controls/DxfViewer/Thumbnail.d.ts +7 -0
- package/dist/src/controls/DxfViewer/ThumbnailList.d.ts +6 -0
- package/dist/src/controls/DxfViewer/Viewer.d.ts +6 -0
- package/dist/src/controls/ErrorMessage/ErrorMessage.d.ts +6 -0
- package/dist/src/controls/Login/FormRef.d.ts +3 -0
- package/dist/src/controls/Login/LoginConstants.d.ts +2 -1
- package/dist/src/controls/Login/LoginFormRef.d.ts +2 -2
- package/dist/src/controls/Login/NTLMAuthenticationForm.d.ts +5 -2
- package/dist/src/controls/LookupPicker/LookupPicker.d.ts +2 -0
- package/dist/src/controls/LookupPicker/ValueList.d.ts +2 -0
- package/dist/src/controls/TableView/TableViewConstants.d.ts +11 -0
- package/dist/src/controls/TableView/TreeGridTableViewContextImpl.d.ts +1 -0
- package/dist/src/controls/TreeView/TreeView.d.ts +4 -0
- package/dist/src/controls/TreeView/TreeViewConfig.d.ts +3 -0
- package/dist/src/controls/TreeView/TreeViewConstants.d.ts +2 -1
- package/dist/src/index.d.ts +7 -1
- package/lib/dxf-viewer/BatchingKey.js +91 -0
- package/lib/dxf-viewer/DxfFetcher.js +39 -0
- package/lib/dxf-viewer/DxfScene.js +2695 -0
- package/lib/dxf-viewer/DxfViewer.js +1056 -0
- package/lib/dxf-viewer/DxfWorker.js +229 -0
- package/lib/dxf-viewer/DynamicBuffer.js +100 -0
- package/lib/dxf-viewer/HatchCalculator.js +345 -0
- package/lib/dxf-viewer/LinearDimension.js +323 -0
- package/lib/dxf-viewer/MTextFormatParser.js +211 -0
- package/lib/dxf-viewer/MaterialKey.js +37 -0
- package/lib/dxf-viewer/OrbitControls.js +1253 -0
- package/lib/dxf-viewer/Pattern.js +94 -0
- package/lib/dxf-viewer/RBTree.js +471 -0
- package/lib/dxf-viewer/TextRenderer.js +1038 -0
- package/lib/dxf-viewer/index.js +42 -0
- package/lib/dxf-viewer/math/Matrix2.js +77 -0
- package/lib/dxf-viewer/math/utils.js +59 -0
- package/lib/dxf-viewer/parser/AutoCadColorIndex.js +265 -0
- package/lib/dxf-viewer/parser/DimStyleCodes.js +33 -0
- package/lib/dxf-viewer/parser/DxfArrayScanner.js +143 -0
- package/lib/dxf-viewer/parser/DxfParser.js +980 -0
- package/lib/dxf-viewer/parser/ExtendedDataParse-My.js +91 -0
- package/lib/dxf-viewer/parser/ExtendedDataParser.js +123 -0
- package/lib/dxf-viewer/parser/ParseHelpers.js +142 -0
- package/lib/dxf-viewer/parser/entities/3dface.js +83 -0
- package/lib/dxf-viewer/parser/entities/arc.js +38 -0
- package/lib/dxf-viewer/parser/entities/attdef.js +89 -0
- package/lib/dxf-viewer/parser/entities/attrib.js +34 -0
- package/lib/dxf-viewer/parser/entities/attribute.js +109 -0
- package/lib/dxf-viewer/parser/entities/circle.js +43 -0
- package/lib/dxf-viewer/parser/entities/dimension.js +72 -0
- package/lib/dxf-viewer/parser/entities/ellipse.js +46 -0
- package/lib/dxf-viewer/parser/entities/hatch.js +343 -0
- package/lib/dxf-viewer/parser/entities/insert.js +62 -0
- package/lib/dxf-viewer/parser/entities/leader.js +84 -0
- package/lib/dxf-viewer/parser/entities/line.js +34 -0
- package/lib/dxf-viewer/parser/entities/lwpolyline.js +100 -0
- package/lib/dxf-viewer/parser/entities/mtext.js +54 -0
- package/lib/dxf-viewer/parser/entities/point.js +35 -0
- package/lib/dxf-viewer/parser/entities/polyline.js +92 -0
- package/lib/dxf-viewer/parser/entities/solid.js +40 -0
- package/lib/dxf-viewer/parser/entities/spline.js +70 -0
- package/lib/dxf-viewer/parser/entities/text.js +47 -0
- package/lib/dxf-viewer/parser/entities/vertex.js +62 -0
- package/lib/dxf-viewer/parser/entities/viewport.js +56 -0
- package/lib/dxf-viewer/parser/objects/dictionary.js +29 -0
- package/lib/dxf-viewer/parser/objects/layout.js +35 -0
- package/lib/dxf-viewer/parser/objects/xrecord.js +29 -0
- package/lib/opentype/opentype.module.js +14571 -0
- package/lib/three/CSS2DRenderer.js +235 -0
- package/lib/three/three.module.js +49912 -0
- package/package.json +12 -10
- package/src/controls/BimViewer/js/bim-viewer.js +2 -2
- package/src/controls/DxfViewer/js/dxf-viewer.js +3580 -0
- package/src/controls/PdfViewer/js/pdf-viewer.js +1 -1
- package/css/std/controls/input/img/error-message.svg +0 -6
- package/css/std/controls/lookup-picker/img/error-message.svg +0 -6
- package/css/std/controls/time-picker/img/error-message.svg +0 -6
- /package/css/std/controls/{date-picker → error-message}/img/error-message.svg +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FileVersionItem } from '../FileVersionSelect/FileVersionItem';
|
|
2
|
+
export interface DxfViewerContext {
|
|
3
|
+
file: any;
|
|
4
|
+
versionId?: string;
|
|
5
|
+
currentVersionId: string;
|
|
6
|
+
issueList: any[];
|
|
7
|
+
openFile(): void;
|
|
8
|
+
fileVersionList: FileVersionItem[];
|
|
9
|
+
createLocale(key: string): any;
|
|
10
|
+
selectIssue?: (id: string) => void;
|
|
11
|
+
getIssueList(): Promise<any>;
|
|
12
|
+
onCreateIssue(data: any): any;
|
|
13
|
+
toggleIssueDetail(show: boolean): any;
|
|
14
|
+
zoomToAnnotation?: (id: string) => void;
|
|
15
|
+
deleteIssueEvent?: string;
|
|
16
|
+
updateIssueEvent?: string;
|
|
17
|
+
onChangeFileVersion: (version: FileVersionItem) => any;
|
|
18
|
+
currentVersionTooltipText?: string;
|
|
19
|
+
notCurrentVersionTooltipText?: string;
|
|
20
|
+
expandSidebarIssueDetail?: () => void;
|
|
21
|
+
initLayers?: (layersList: any[]) => void;
|
|
22
|
+
onChangeLayerVisibility?: (name: string, val: boolean) => void;
|
|
23
|
+
layersTitle: string;
|
|
24
|
+
toggleLayersLabel: string;
|
|
25
|
+
thumbnailListTitle: string;
|
|
26
|
+
onLoaded?: () => void;
|
|
27
|
+
initThumbnail?: (id: string, name: string, imageUrl: string) => string;
|
|
28
|
+
fileName: string;
|
|
29
|
+
fileImageUrl: string;
|
|
30
|
+
scaleAutoLabel: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LayerProps } from './Layer';
|
|
3
|
+
export interface LayerListProps {
|
|
4
|
+
itemList: LayerProps[];
|
|
5
|
+
onChangeLayerVisibility: (name: string, isVisible: boolean) => void;
|
|
6
|
+
title: string;
|
|
7
|
+
fileName: string;
|
|
8
|
+
fileImageUrl: string;
|
|
9
|
+
toggleLayersLabel: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const LayerList: (props: LayerListProps) => JSX.Element;
|
|
@@ -16,7 +16,8 @@ export declare enum LOCALE {
|
|
|
16
16
|
TWO_FACTOR_AUTHENTICATION_FORM_DESCRIPTION_VALIDITY = "app.common.login.twoFactorAuthenticationForm.description.codeValidityDuration",
|
|
17
17
|
TWO_FACTOR_AUTHENTICATION_FORM_DESCRIPTION_RESEND = "app.common.login.twoFactorAuthenticationForm.description.resendCodeDuration",
|
|
18
18
|
TWO_FACTOR_AUTHENTICATION_FORM_ERROR_EMPTY = "app.common.login.twoFactorAuthenticationForm.error.empty",
|
|
19
|
-
|
|
19
|
+
NTLM_AUTHENTICATION_FORM_SUBTITLE_PROGRESS = "app.common.login.ntlmAuthenticationForm.subtitle.progress",
|
|
20
|
+
NTLM_AUTHENTICATION_FORM_SUBTITLE_ERROR = "app.common.login.ntlmAuthenticationForm.subtitle.error",
|
|
20
21
|
ACTION_LOGIN = "app.common.login.action.login",
|
|
21
22
|
ACTION_GO_BACK = "app.common.login.action.goBack",
|
|
22
23
|
ACTION_RESET_PASSWORD = "app.common.login.action.resetPassword",
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormRef } from './FormRef';
|
|
2
3
|
interface NTLMAuthenticationFormProps {
|
|
4
|
+
imageUrl: string;
|
|
5
|
+
errorMessage?: string;
|
|
3
6
|
onGoBack: () => void;
|
|
4
7
|
}
|
|
5
|
-
export declare const NTLMAuthenticationForm:
|
|
8
|
+
export declare const NTLMAuthenticationForm: React.ForwardRefExoticComponent<NTLMAuthenticationFormProps & React.RefAttributes<FormRef>>;
|
|
6
9
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
2
|
import { interfaces } from 'inversify';
|
|
3
|
+
import { ButtonProps } from '../Button/Button';
|
|
3
4
|
export interface LookupPickerProps {
|
|
4
5
|
name?: string;
|
|
5
6
|
valueList?: {
|
|
@@ -38,5 +39,6 @@ export interface LookupPickerProps {
|
|
|
38
39
|
className?: string;
|
|
39
40
|
getAllValueList?: () => Promise<any>;
|
|
40
41
|
container?: interfaces.Container;
|
|
42
|
+
valueListButton?: ButtonProps;
|
|
41
43
|
}
|
|
42
44
|
export declare const LookupPicker: React.ForwardRefExoticComponent<LookupPickerProps & React.RefAttributes<unknown>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FunctionComponentElement } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button/Button';
|
|
2
3
|
interface ValueListProps {
|
|
3
4
|
inputValue: any;
|
|
4
5
|
list: {
|
|
@@ -18,6 +19,7 @@ interface ValueListProps {
|
|
|
18
19
|
id: string;
|
|
19
20
|
}) => FunctionComponentElement<any> | null;
|
|
20
21
|
placement?: any;
|
|
22
|
+
button?: ButtonProps;
|
|
21
23
|
}
|
|
22
24
|
export declare const ValueList: (props: ValueListProps) => JSX.Element;
|
|
23
25
|
export {};
|
|
@@ -177,3 +177,14 @@ export declare enum MENU_NAME {
|
|
|
177
177
|
export declare enum PART_TYPE {
|
|
178
178
|
SIDE_BUTTON = "SideButton"
|
|
179
179
|
}
|
|
180
|
+
export declare enum TARGET {
|
|
181
|
+
OUTSIDE = "Outside"
|
|
182
|
+
}
|
|
183
|
+
export declare enum MENU_ALIGN {
|
|
184
|
+
BELOW = "below",
|
|
185
|
+
ABOVE = "above",
|
|
186
|
+
RIGHT = "right",
|
|
187
|
+
LEFT = "left",
|
|
188
|
+
NEXT = "next",
|
|
189
|
+
PREV = "prev"
|
|
190
|
+
}
|
|
@@ -28,6 +28,7 @@ export declare class TreeGridTableViewContextImpl implements TableViewContext {
|
|
|
28
28
|
get pageLength(): any;
|
|
29
29
|
get header(): TableViewRow;
|
|
30
30
|
get mainTag(): HTMLElement;
|
|
31
|
+
get event(): any;
|
|
31
32
|
setSearchCriterionList(searchCriterionList: SearchCriterion[], searchId: string): void;
|
|
32
33
|
clearSearchCriterionList(searchId: string): void;
|
|
33
34
|
getSearchCriterionList(searchId?: string): SearchCriterion[];
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import 'jstree';
|
|
3
3
|
import { TreeViewContext } from './TreeViewContext';
|
|
4
|
+
import { JsTreeViewNode } from './JsTreeViewNode';
|
|
4
5
|
export interface TreeViewProps {
|
|
5
6
|
id: string;
|
|
6
7
|
getData: (obj: any, cb: any) => any;
|
|
7
8
|
onInit: (jsTreeView: TreeViewContext) => any;
|
|
9
|
+
onDrop?: (treeView: TreeViewContext, targetNode: JsTreeViewNode, eventDetail: {
|
|
10
|
+
target: any;
|
|
11
|
+
}, e: DragEvent) => void;
|
|
8
12
|
isCheckboxSelect?: boolean;
|
|
9
13
|
isSaveCheckboxState?: boolean;
|
|
10
14
|
expandNodeIdList?: string[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ import { PdfViewerContext } from './controls/PdfViewer/PdfViewerContext';
|
|
|
35
35
|
import { Login } from './controls/Login/Login';
|
|
36
36
|
import { LoginForm } from './controls/Login/LoginForm';
|
|
37
37
|
import { LoginFormRef } from './controls/Login/LoginFormRef';
|
|
38
|
+
import { FormRef } from './controls/Login/FormRef';
|
|
38
39
|
import { TwoFactorAuthenticationForm } from './controls/Login/TwoFactorAuthenticationForm';
|
|
39
40
|
import { TwoFactorAuthenticationFormRef } from './controls/Login/TwoFactorAuthenticationFormRef';
|
|
40
41
|
import { NTLMAuthenticationForm } from './controls/Login/NTLMAuthenticationForm';
|
|
@@ -139,6 +140,9 @@ import { SlideUpPanel } from './controls/SlideUpPanel/SlideUpPanel';
|
|
|
139
140
|
import { BottomAlignControlGroup } from './controls/BottomAlignControlGroup/BottomAlignControlGroup';
|
|
140
141
|
import { LinearProgress } from './controls/LinearProgress/LinearProgress';
|
|
141
142
|
import { List } from './controls/List/List';
|
|
143
|
+
import { DxfViewer } from './controls/DxfViewer/DxfViewer';
|
|
144
|
+
import { DxfViewerContext } from './controls/DxfViewer/DxfViewerContext';
|
|
145
|
+
import { ErrorMessage } from './controls/ErrorMessage/ErrorMessage';
|
|
142
146
|
export { Breadcrumbs };
|
|
143
147
|
export { TopLevelMenu };
|
|
144
148
|
export { TreeView, TreeViewContext, TREE_VIEW, TreeViewProps, JsTreeViewNode };
|
|
@@ -151,7 +155,7 @@ export { View };
|
|
|
151
155
|
export { TabGroup };
|
|
152
156
|
export { ControlGroup, TabItem };
|
|
153
157
|
export { PdfViewer, PdfViewerContext };
|
|
154
|
-
export { Login, LoginForm, TwoFactorAuthenticationForm, LoginFormRef, TwoFactorAuthenticationFormRef, NTLMAuthenticationForm };
|
|
158
|
+
export { Login, LoginForm, TwoFactorAuthenticationForm, FormRef, LoginFormRef, TwoFactorAuthenticationFormRef, NTLMAuthenticationForm };
|
|
155
159
|
export { Input, InputProps, InputRef };
|
|
156
160
|
export { NumberInput, NUMBER_INPUT };
|
|
157
161
|
export { DatePicker, DatePickerProps };
|
|
@@ -223,3 +227,5 @@ export { ImageViewer, ImageViewerRef, ImageItem };
|
|
|
223
227
|
export { File };
|
|
224
228
|
export { LinearProgress };
|
|
225
229
|
export { List };
|
|
230
|
+
export { DxfViewer, DxfViewerContext };
|
|
231
|
+
export { ErrorMessage };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** Key for render batches. */
|
|
2
|
+
export class BatchingKey {
|
|
3
|
+
/**
|
|
4
|
+
* Components order matters for lookup by prefix.
|
|
5
|
+
* @param layerName {?String} Layer name, null if not bound to a layer (e.g. block definition).
|
|
6
|
+
* @param blockName {?String} Block name if applicable. If specified and geometryType is not
|
|
7
|
+
* BLOCK_INSTANCE, the batch is part of block definition. Otherwise it is block instance.
|
|
8
|
+
* @param geometryType {?number} One of BatchingKey.GeometryType.
|
|
9
|
+
* @param color {number} Color ARGB value.
|
|
10
|
+
* @param lineType {?number} Line type ID, null for non-lines. Zero is default type (solid
|
|
11
|
+
* line).
|
|
12
|
+
*/
|
|
13
|
+
constructor(layerName, blockName, geometryType, color, lineType) {
|
|
14
|
+
this.layerName = layerName ?? null;
|
|
15
|
+
this.blockName = blockName ?? null;
|
|
16
|
+
this.geometryType = geometryType ?? null;
|
|
17
|
+
this.color = color;
|
|
18
|
+
this.lineType = lineType ?? null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Comparator function. Fields lexical order corresponds to the constructor arguments order.
|
|
22
|
+
* Null values are always first.
|
|
23
|
+
*/
|
|
24
|
+
Compare(other) {
|
|
25
|
+
let c = CompareValues(this.layerName, other.layerName);
|
|
26
|
+
if (c !== 0) {
|
|
27
|
+
return c;
|
|
28
|
+
}
|
|
29
|
+
c = CompareValues(this.blockName, other.blockName);
|
|
30
|
+
if (c !== 0) {
|
|
31
|
+
return c;
|
|
32
|
+
}
|
|
33
|
+
c = CompareValues(this.instanceName, other.instanceName);
|
|
34
|
+
if (c !== 0) {
|
|
35
|
+
return c;
|
|
36
|
+
}
|
|
37
|
+
c = CompareValues(this.geometryType, other.geometryType);
|
|
38
|
+
if (c !== 0) {
|
|
39
|
+
return c;
|
|
40
|
+
}
|
|
41
|
+
c = CompareValues(this.color, other.color);
|
|
42
|
+
if (c !== 0) {
|
|
43
|
+
return c;
|
|
44
|
+
}
|
|
45
|
+
return CompareValues(this.lineType, other.lineType);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
IsIndexed() {
|
|
49
|
+
return this.geometryType === BatchingKey.GeometryType.INDEXED_LINES ||
|
|
50
|
+
this.geometryType === BatchingKey.GeometryType.INDEXED_TRIANGLES ||
|
|
51
|
+
this.geometryType === BatchingKey.GeometryType.POINTS;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
IsInstanced() {
|
|
55
|
+
return this.geometryType === BatchingKey.GeometryType.BLOCK_INSTANCE ||
|
|
56
|
+
this.geometryType === BatchingKey.GeometryType.POINT_INSTANCE;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
BatchingKey.GeometryType = Object.freeze({
|
|
61
|
+
POINTS: 0,
|
|
62
|
+
LINES: 1,
|
|
63
|
+
INDEXED_LINES: 2,
|
|
64
|
+
TRIANGLES: 3,
|
|
65
|
+
INDEXED_TRIANGLES: 4,
|
|
66
|
+
BLOCK_INSTANCE: 5,
|
|
67
|
+
/** Shaped point instances. */
|
|
68
|
+
POINT_INSTANCE: 6
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/** Comparator function for arbitrary types. Null is always first. This is used just to make some
|
|
72
|
+
* ordering for keys in tree structures, so no locale-aware string comparison.
|
|
73
|
+
*/
|
|
74
|
+
export function CompareValues(v1, v2) {
|
|
75
|
+
if (v1 === null) {
|
|
76
|
+
if (v2 === null) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
return -1;
|
|
80
|
+
}
|
|
81
|
+
if (v2 === null) {
|
|
82
|
+
return 1;
|
|
83
|
+
}
|
|
84
|
+
if (v1 < v2) {
|
|
85
|
+
return -1;
|
|
86
|
+
}
|
|
87
|
+
if (v1 > v2) {
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import DxfParser from "./parser/DxfParser.js"
|
|
2
|
+
|
|
3
|
+
/** Fetches and parses DXF file. */
|
|
4
|
+
export class DxfFetcher {
|
|
5
|
+
constructor(url) {
|
|
6
|
+
this.url = url
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** @param progressCbk {Function} (phase, receivedSize, totalSize) */
|
|
10
|
+
async Fetch(progressCbk = null) {
|
|
11
|
+
const response = await fetch(this.url)
|
|
12
|
+
const totalSize = +response.headers.get('Content-Length')
|
|
13
|
+
|
|
14
|
+
const reader = response.body.getReader()
|
|
15
|
+
let receivedSize = 0
|
|
16
|
+
//XXX streaming parsing is not supported in dxf-parser for now (its parseStream() method
|
|
17
|
+
// just accumulates chunks in a string buffer before parsing. Fix it later.
|
|
18
|
+
let buffer = ""
|
|
19
|
+
let decoder = new TextDecoder("utf-8")
|
|
20
|
+
while(true) {
|
|
21
|
+
const {done, value} = await reader.read()
|
|
22
|
+
if (done) {
|
|
23
|
+
buffer += decoder.decode(new ArrayBuffer(0), {stream: false})
|
|
24
|
+
break
|
|
25
|
+
}
|
|
26
|
+
buffer += decoder.decode(value, {stream: true})
|
|
27
|
+
receivedSize += value.length
|
|
28
|
+
if (progressCbk !== null) {
|
|
29
|
+
progressCbk("fetch", receivedSize, totalSize)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (progressCbk !== null) {
|
|
34
|
+
progressCbk("parse", 0, null)
|
|
35
|
+
}
|
|
36
|
+
const parser = new DxfParser()
|
|
37
|
+
return parser.parseSync(buffer)
|
|
38
|
+
}
|
|
39
|
+
}
|