bruce-models 1.9.8 → 1.9.9
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/dist/bruce-models.es5.js +20 -14
- package/dist/bruce-models.es5.js.map +1 -1
- package/dist/bruce-models.umd.js +20 -14
- package/dist/bruce-models.umd.js.map +1 -1
- package/dist/lib/account/account-settings.js +2 -2
- package/dist/lib/account/account.js +185 -185
- package/dist/lib/ann-document/ann-document.js +86 -86
- package/dist/lib/api/abstract-api.js +246 -246
- package/dist/lib/api/api-getters.js +134 -134
- package/dist/lib/api/api.js +93 -93
- package/dist/lib/api/bruce-api.js +216 -216
- package/dist/lib/api/cam-api.js +85 -82
- package/dist/lib/api/cam-api.js.map +1 -1
- package/dist/lib/api/global-api.js +81 -81
- package/dist/lib/api/idm-api.js +85 -82
- package/dist/lib/api/idm-api.js.map +1 -1
- package/dist/lib/bruce-models.js +86 -86
- package/dist/lib/calculator/calculator.js +341 -341
- package/dist/lib/client-file/client-file.js +245 -245
- package/dist/lib/common/bounds.js +61 -61
- package/dist/lib/common/bruce-event.js +46 -46
- package/dist/lib/common/bruce-variable.js +60 -60
- package/dist/lib/common/cache.js +165 -165
- package/dist/lib/common/camera.js +11 -11
- package/dist/lib/common/cartes.js +123 -123
- package/dist/lib/common/carto.js +60 -60
- package/dist/lib/common/color.js +86 -86
- package/dist/lib/common/delay-queue.js +56 -56
- package/dist/lib/common/dictionary.js +2 -2
- package/dist/lib/common/geometry.js +120 -120
- package/dist/lib/common/transform.js +2 -2
- package/dist/lib/common/utc.js +39 -39
- package/dist/lib/custom-form/custom-form-content.js +26 -26
- package/dist/lib/custom-form/custom-form.js +106 -106
- package/dist/lib/data-lab/data-lab.js +49 -49
- package/dist/lib/entity/entity-attachment-type.js +83 -83
- package/dist/lib/entity/entity-attachment.js +122 -122
- package/dist/lib/entity/entity-attribute.js +29 -29
- package/dist/lib/entity/entity-comment.js +82 -82
- package/dist/lib/entity/entity-coords.js +149 -149
- package/dist/lib/entity/entity-link.js +82 -82
- package/dist/lib/entity/entity-lod-category.js +100 -100
- package/dist/lib/entity/entity-lod.js +185 -185
- package/dist/lib/entity/entity-relation-type.js +109 -109
- package/dist/lib/entity/entity-relation.js +132 -132
- package/dist/lib/entity/entity-source.js +136 -136
- package/dist/lib/entity/entity-tag.js +149 -149
- package/dist/lib/entity/entity-type-visual-settings.js +13 -13
- package/dist/lib/entity/entity-type.js +113 -113
- package/dist/lib/entity/entity.js +319 -319
- package/dist/lib/entity/getters/batched-data-getter.js +84 -84
- package/dist/lib/entity/getters/entity-filter-getter.js +303 -303
- package/dist/lib/entity/getters/entity-globe.js +211 -211
- package/dist/lib/entity/getters/view-monitor.js +2 -2
- package/dist/lib/import/import-cad.js +53 -53
- package/dist/lib/import/import-csv.js +23 -23
- package/dist/lib/import/import-json.js +23 -23
- package/dist/lib/import/import-kml.js +23 -23
- package/dist/lib/import/imported-file.js +91 -91
- package/dist/lib/internal/uploader.js +76 -76
- package/dist/lib/markup/markup.js +185 -185
- package/dist/lib/plugin/plugin.js +83 -83
- package/dist/lib/program-key/program-key.js +111 -111
- package/dist/lib/project/menu-item.js +121 -121
- package/dist/lib/project/project-view-bookmark.js +147 -147
- package/dist/lib/project/project-view-legacy-tile.js +77 -77
- package/dist/lib/project/project-view-tile.js +125 -125
- package/dist/lib/project/project-view.js +133 -133
- package/dist/lib/project/zoom-control.js +17 -17
- package/dist/lib/server/message-broker.js +142 -142
- package/dist/lib/server/pending-action.js +71 -71
- package/dist/lib/server/task.js +63 -63
- package/dist/lib/style/style.js +117 -117
- package/dist/lib/tileset/tileset.js +415 -415
- package/dist/lib/user/permission.js +20 -20
- package/dist/lib/user/session.js +137 -137
- package/dist/lib/user/user-group.js +94 -94
- package/dist/lib/user/user.js +446 -446
- package/dist/lib/util/encrypt-utils.js +19 -19
- package/dist/lib/util/math-utils.js +40 -40
- package/dist/lib/util/object-utils.js +17 -17
- package/dist/lib/util/path-utils.js +61 -61
- package/dist/lib/util/url-utils.js +94 -94
- package/package.json +3 -2
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Geometry = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Describes vector geometry that Bruce uses.
|
|
6
|
-
*/
|
|
7
|
-
var Geometry;
|
|
8
|
-
(function (Geometry) {
|
|
9
|
-
let EPolygonRingType;
|
|
10
|
-
(function (EPolygonRingType) {
|
|
11
|
-
EPolygonRingType["Boundaries"] = "out";
|
|
12
|
-
EPolygonRingType["Hole"] = "in";
|
|
13
|
-
})(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
|
|
14
|
-
/**
|
|
15
|
-
* Turns an array of points into string vector geometry that Bruce can use.
|
|
16
|
-
* This is used for saving polyline and polygon data.
|
|
17
|
-
* @param points
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
function LineStrFromPoints(points) {
|
|
21
|
-
if (!points.length) {
|
|
22
|
-
throw ("points is empty.");
|
|
23
|
-
}
|
|
24
|
-
let carto = points[0];
|
|
25
|
-
let lineString = `${carto.longitude},${carto.latitude}` + (carto.altitude != null ? `,${carto.altitude}` : "");
|
|
26
|
-
for (let i = 1; i < points.length; i++) {
|
|
27
|
-
carto = points[i];
|
|
28
|
-
lineString += ` ${carto.longitude},${carto.latitude}` + (carto.altitude != null ? `,${carto.altitude}` : "");
|
|
29
|
-
}
|
|
30
|
-
return lineString;
|
|
31
|
-
}
|
|
32
|
-
Geometry.LineStrFromPoints = LineStrFromPoints;
|
|
33
|
-
/**
|
|
34
|
-
* Removes same points that occur in a row.
|
|
35
|
-
* This will not modify the original array.
|
|
36
|
-
* @param positions
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
function RemoveRepeatPoints(positions) {
|
|
40
|
-
const filteredList = [];
|
|
41
|
-
for (let i = 0; i < positions.length; i++) {
|
|
42
|
-
const pos = positions[i];
|
|
43
|
-
const lastPos = filteredList.length > 0 ? filteredList[filteredList.length - 1] : null;
|
|
44
|
-
if (!lastPos || (pos.latitude != lastPos.latitude || pos.longitude != lastPos.longitude || pos.altitude != lastPos.altitude)) {
|
|
45
|
-
filteredList.push(pos);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return filteredList;
|
|
49
|
-
}
|
|
50
|
-
Geometry.RemoveRepeatPoints = RemoveRepeatPoints;
|
|
51
|
-
function ParsePoints(pointsStr) {
|
|
52
|
-
pointsStr = pointsStr.replace(/[^\d.,-\s]/g, "");
|
|
53
|
-
let splitterCoordinates = " ";
|
|
54
|
-
let splitterAxis = ",";
|
|
55
|
-
const commaIndex = pointsStr.indexOf(",");
|
|
56
|
-
const spaceIndex = pointsStr.indexOf(" ");
|
|
57
|
-
if ((spaceIndex > -1 && commaIndex > spaceIndex) || commaIndex <= -1) {
|
|
58
|
-
splitterCoordinates = ",";
|
|
59
|
-
splitterAxis = " ";
|
|
60
|
-
}
|
|
61
|
-
let points = pointsStr.trim().split(splitterCoordinates);
|
|
62
|
-
points = points.filter(a => a != "");
|
|
63
|
-
const result = [];
|
|
64
|
-
for (let i = 0; i < points.length; i++) {
|
|
65
|
-
const pointData = points[i];
|
|
66
|
-
const coords = pointData.trim().split(splitterAxis);
|
|
67
|
-
if (coords.length == 2 || coords.length == 3) {
|
|
68
|
-
const longitude = Number(coords[0]);
|
|
69
|
-
const latitude = Number(coords[1]);
|
|
70
|
-
const altitude = Number(coords.length >= 3 ? coords[2] : 0);
|
|
71
|
-
if (longitude != null && latitude != null) {
|
|
72
|
-
result.push({
|
|
73
|
-
altitude: altitude,
|
|
74
|
-
latitude: latitude,
|
|
75
|
-
longitude: longitude
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
console.warn("Invalid point data detected.", pointData);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
Geometry.ParsePoints = ParsePoints;
|
|
86
|
-
/**
|
|
87
|
-
* Parses both string and object Bruce geometry.
|
|
88
|
-
* String geometry is legacy Bruce data.
|
|
89
|
-
* @param geometry
|
|
90
|
-
* @returns
|
|
91
|
-
*/
|
|
92
|
-
function ParseGeometry(geometry) {
|
|
93
|
-
if (typeof geometry == "string") {
|
|
94
|
-
let positions = [];
|
|
95
|
-
const geometryParsed = (geometry || "").split(";");
|
|
96
|
-
for (let i = 0; i < geometryParsed.length; i++) {
|
|
97
|
-
const data = geometryParsed[i];
|
|
98
|
-
const points = ParsePoints(data);
|
|
99
|
-
if (points && points.length > 0) {
|
|
100
|
-
positions = positions.concat(points);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
positions = RemoveRepeatPoints(positions);
|
|
104
|
-
const newGeometry = {};
|
|
105
|
-
if (positions.length > 0) {
|
|
106
|
-
const topPoint = positions[0];
|
|
107
|
-
newGeometry.Point = `${topPoint.latitude},${topPoint.longitude}` + (topPoint.altitude != null ? `,${topPoint.altitude}` : "");
|
|
108
|
-
if (positions.length > 1) {
|
|
109
|
-
newGeometry.Polygon = [{ Facing: EPolygonRingType.Boundaries, LinearRing: LineStrFromPoints(positions) }];
|
|
110
|
-
}
|
|
111
|
-
if (positions.length > 2) {
|
|
112
|
-
newGeometry.LineString = LineStrFromPoints(positions);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return newGeometry;
|
|
116
|
-
}
|
|
117
|
-
return geometry;
|
|
118
|
-
}
|
|
119
|
-
Geometry.ParseGeometry = ParseGeometry;
|
|
120
|
-
})(Geometry = exports.Geometry || (exports.Geometry = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Geometry = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Describes vector geometry that Bruce uses.
|
|
6
|
+
*/
|
|
7
|
+
var Geometry;
|
|
8
|
+
(function (Geometry) {
|
|
9
|
+
let EPolygonRingType;
|
|
10
|
+
(function (EPolygonRingType) {
|
|
11
|
+
EPolygonRingType["Boundaries"] = "out";
|
|
12
|
+
EPolygonRingType["Hole"] = "in";
|
|
13
|
+
})(EPolygonRingType = Geometry.EPolygonRingType || (Geometry.EPolygonRingType = {}));
|
|
14
|
+
/**
|
|
15
|
+
* Turns an array of points into string vector geometry that Bruce can use.
|
|
16
|
+
* This is used for saving polyline and polygon data.
|
|
17
|
+
* @param points
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
function LineStrFromPoints(points) {
|
|
21
|
+
if (!points.length) {
|
|
22
|
+
throw ("points is empty.");
|
|
23
|
+
}
|
|
24
|
+
let carto = points[0];
|
|
25
|
+
let lineString = `${carto.longitude},${carto.latitude}` + (carto.altitude != null ? `,${carto.altitude}` : "");
|
|
26
|
+
for (let i = 1; i < points.length; i++) {
|
|
27
|
+
carto = points[i];
|
|
28
|
+
lineString += ` ${carto.longitude},${carto.latitude}` + (carto.altitude != null ? `,${carto.altitude}` : "");
|
|
29
|
+
}
|
|
30
|
+
return lineString;
|
|
31
|
+
}
|
|
32
|
+
Geometry.LineStrFromPoints = LineStrFromPoints;
|
|
33
|
+
/**
|
|
34
|
+
* Removes same points that occur in a row.
|
|
35
|
+
* This will not modify the original array.
|
|
36
|
+
* @param positions
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
function RemoveRepeatPoints(positions) {
|
|
40
|
+
const filteredList = [];
|
|
41
|
+
for (let i = 0; i < positions.length; i++) {
|
|
42
|
+
const pos = positions[i];
|
|
43
|
+
const lastPos = filteredList.length > 0 ? filteredList[filteredList.length - 1] : null;
|
|
44
|
+
if (!lastPos || (pos.latitude != lastPos.latitude || pos.longitude != lastPos.longitude || pos.altitude != lastPos.altitude)) {
|
|
45
|
+
filteredList.push(pos);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return filteredList;
|
|
49
|
+
}
|
|
50
|
+
Geometry.RemoveRepeatPoints = RemoveRepeatPoints;
|
|
51
|
+
function ParsePoints(pointsStr) {
|
|
52
|
+
pointsStr = pointsStr.replace(/[^\d.,-\s]/g, "");
|
|
53
|
+
let splitterCoordinates = " ";
|
|
54
|
+
let splitterAxis = ",";
|
|
55
|
+
const commaIndex = pointsStr.indexOf(",");
|
|
56
|
+
const spaceIndex = pointsStr.indexOf(" ");
|
|
57
|
+
if ((spaceIndex > -1 && commaIndex > spaceIndex) || commaIndex <= -1) {
|
|
58
|
+
splitterCoordinates = ",";
|
|
59
|
+
splitterAxis = " ";
|
|
60
|
+
}
|
|
61
|
+
let points = pointsStr.trim().split(splitterCoordinates);
|
|
62
|
+
points = points.filter(a => a != "");
|
|
63
|
+
const result = [];
|
|
64
|
+
for (let i = 0; i < points.length; i++) {
|
|
65
|
+
const pointData = points[i];
|
|
66
|
+
const coords = pointData.trim().split(splitterAxis);
|
|
67
|
+
if (coords.length == 2 || coords.length == 3) {
|
|
68
|
+
const longitude = Number(coords[0]);
|
|
69
|
+
const latitude = Number(coords[1]);
|
|
70
|
+
const altitude = Number(coords.length >= 3 ? coords[2] : 0);
|
|
71
|
+
if (longitude != null && latitude != null) {
|
|
72
|
+
result.push({
|
|
73
|
+
altitude: altitude,
|
|
74
|
+
latitude: latitude,
|
|
75
|
+
longitude: longitude
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.warn("Invalid point data detected.", pointData);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
Geometry.ParsePoints = ParsePoints;
|
|
86
|
+
/**
|
|
87
|
+
* Parses both string and object Bruce geometry.
|
|
88
|
+
* String geometry is legacy Bruce data.
|
|
89
|
+
* @param geometry
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
function ParseGeometry(geometry) {
|
|
93
|
+
if (typeof geometry == "string") {
|
|
94
|
+
let positions = [];
|
|
95
|
+
const geometryParsed = (geometry || "").split(";");
|
|
96
|
+
for (let i = 0; i < geometryParsed.length; i++) {
|
|
97
|
+
const data = geometryParsed[i];
|
|
98
|
+
const points = ParsePoints(data);
|
|
99
|
+
if (points && points.length > 0) {
|
|
100
|
+
positions = positions.concat(points);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
positions = RemoveRepeatPoints(positions);
|
|
104
|
+
const newGeometry = {};
|
|
105
|
+
if (positions.length > 0) {
|
|
106
|
+
const topPoint = positions[0];
|
|
107
|
+
newGeometry.Point = `${topPoint.latitude},${topPoint.longitude}` + (topPoint.altitude != null ? `,${topPoint.altitude}` : "");
|
|
108
|
+
if (positions.length > 1) {
|
|
109
|
+
newGeometry.Polygon = [{ Facing: EPolygonRingType.Boundaries, LinearRing: LineStrFromPoints(positions) }];
|
|
110
|
+
}
|
|
111
|
+
if (positions.length > 2) {
|
|
112
|
+
newGeometry.LineString = LineStrFromPoints(positions);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return newGeometry;
|
|
116
|
+
}
|
|
117
|
+
return geometry;
|
|
118
|
+
}
|
|
119
|
+
Geometry.ParseGeometry = ParseGeometry;
|
|
120
|
+
})(Geometry = exports.Geometry || (exports.Geometry = {}));
|
|
121
121
|
//# sourceMappingURL=geometry.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=transform.js.map
|
package/dist/lib/common/utc.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UTC = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Describes a Bruce stored date.
|
|
6
|
-
*/
|
|
7
|
-
var UTC;
|
|
8
|
-
(function (UTC) {
|
|
9
|
-
let EMonth;
|
|
10
|
-
(function (EMonth) {
|
|
11
|
-
EMonth[EMonth["January"] = 1] = "January";
|
|
12
|
-
EMonth[EMonth["February"] = 2] = "February";
|
|
13
|
-
EMonth[EMonth["March"] = 3] = "March";
|
|
14
|
-
EMonth[EMonth["April"] = 4] = "April";
|
|
15
|
-
EMonth[EMonth["May"] = 5] = "May";
|
|
16
|
-
EMonth[EMonth["June"] = 6] = "June";
|
|
17
|
-
EMonth[EMonth["July"] = 7] = "July";
|
|
18
|
-
EMonth[EMonth["August"] = 8] = "August";
|
|
19
|
-
EMonth[EMonth["September"] = 9] = "September";
|
|
20
|
-
EMonth[EMonth["October"] = 10] = "October";
|
|
21
|
-
EMonth[EMonth["November"] = 11] = "November";
|
|
22
|
-
EMonth[EMonth["December"] = 12] = "December";
|
|
23
|
-
})(EMonth = UTC.EMonth || (UTC.EMonth = {}));
|
|
24
|
-
function ToDate(utc) {
|
|
25
|
-
return new Date(utc.y, utc.m - 1, utc.d, utc.hh, utc.mm, utc.ss, 0);
|
|
26
|
-
}
|
|
27
|
-
UTC.ToDate = ToDate;
|
|
28
|
-
function FromDate(date) {
|
|
29
|
-
return {
|
|
30
|
-
y: date.getUTCFullYear(),
|
|
31
|
-
m: date.getUTCMonth() + 1,
|
|
32
|
-
d: date.getUTCDate(),
|
|
33
|
-
hh: date.getUTCHours(),
|
|
34
|
-
mm: date.getUTCMinutes(),
|
|
35
|
-
ss: date.getUTCSeconds()
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
UTC.FromDate = FromDate;
|
|
39
|
-
})(UTC = exports.UTC || (exports.UTC = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UTC = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Describes a Bruce stored date.
|
|
6
|
+
*/
|
|
7
|
+
var UTC;
|
|
8
|
+
(function (UTC) {
|
|
9
|
+
let EMonth;
|
|
10
|
+
(function (EMonth) {
|
|
11
|
+
EMonth[EMonth["January"] = 1] = "January";
|
|
12
|
+
EMonth[EMonth["February"] = 2] = "February";
|
|
13
|
+
EMonth[EMonth["March"] = 3] = "March";
|
|
14
|
+
EMonth[EMonth["April"] = 4] = "April";
|
|
15
|
+
EMonth[EMonth["May"] = 5] = "May";
|
|
16
|
+
EMonth[EMonth["June"] = 6] = "June";
|
|
17
|
+
EMonth[EMonth["July"] = 7] = "July";
|
|
18
|
+
EMonth[EMonth["August"] = 8] = "August";
|
|
19
|
+
EMonth[EMonth["September"] = 9] = "September";
|
|
20
|
+
EMonth[EMonth["October"] = 10] = "October";
|
|
21
|
+
EMonth[EMonth["November"] = 11] = "November";
|
|
22
|
+
EMonth[EMonth["December"] = 12] = "December";
|
|
23
|
+
})(EMonth = UTC.EMonth || (UTC.EMonth = {}));
|
|
24
|
+
function ToDate(utc) {
|
|
25
|
+
return new Date(utc.y, utc.m - 1, utc.d, utc.hh, utc.mm, utc.ss, 0);
|
|
26
|
+
}
|
|
27
|
+
UTC.ToDate = ToDate;
|
|
28
|
+
function FromDate(date) {
|
|
29
|
+
return {
|
|
30
|
+
y: date.getUTCFullYear(),
|
|
31
|
+
m: date.getUTCMonth() + 1,
|
|
32
|
+
d: date.getUTCDate(),
|
|
33
|
+
hh: date.getUTCHours(),
|
|
34
|
+
mm: date.getUTCMinutes(),
|
|
35
|
+
ss: date.getUTCSeconds()
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
UTC.FromDate = FromDate;
|
|
39
|
+
})(UTC = exports.UTC || (exports.UTC = {}));
|
|
40
40
|
//# sourceMappingURL=utc.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CustomFormContent = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Describes content of a GENERIC type custom form.
|
|
6
|
-
* The alternative type is MARKUP (Markup.IMarkup).
|
|
7
|
-
*/
|
|
8
|
-
var CustomFormContent;
|
|
9
|
-
(function (CustomFormContent) {
|
|
10
|
-
let ECellType;
|
|
11
|
-
(function (ECellType) {
|
|
12
|
-
ECellType[ECellType["StaticText"] = 0] = "StaticText";
|
|
13
|
-
ECellType[ECellType["DataValue"] = 1] = "DataValue";
|
|
14
|
-
ECellType[ECellType["StaticPicture"] = 2] = "StaticPicture";
|
|
15
|
-
ECellType[ECellType["SubSection"] = 3] = "SubSection";
|
|
16
|
-
ECellType[ECellType["ButtonMore"] = 4] = "ButtonMore";
|
|
17
|
-
ECellType[ECellType["EntityPhoto"] = 5] = "EntityPhoto";
|
|
18
|
-
ECellType[ECellType["EmbeddedMedia"] = 6] = "EmbeddedMedia";
|
|
19
|
-
ECellType[ECellType["Chart"] = 7] = "Chart";
|
|
20
|
-
})(ECellType = CustomFormContent.ECellType || (CustomFormContent.ECellType = {}));
|
|
21
|
-
let EFlowDirection;
|
|
22
|
-
(function (EFlowDirection) {
|
|
23
|
-
EFlowDirection["Vertically"] = "v";
|
|
24
|
-
EFlowDirection["Horizontally"] = "h";
|
|
25
|
-
})(EFlowDirection = CustomFormContent.EFlowDirection || (CustomFormContent.EFlowDirection = {}));
|
|
26
|
-
})(CustomFormContent = exports.CustomFormContent || (exports.CustomFormContent = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomFormContent = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Describes content of a GENERIC type custom form.
|
|
6
|
+
* The alternative type is MARKUP (Markup.IMarkup).
|
|
7
|
+
*/
|
|
8
|
+
var CustomFormContent;
|
|
9
|
+
(function (CustomFormContent) {
|
|
10
|
+
let ECellType;
|
|
11
|
+
(function (ECellType) {
|
|
12
|
+
ECellType[ECellType["StaticText"] = 0] = "StaticText";
|
|
13
|
+
ECellType[ECellType["DataValue"] = 1] = "DataValue";
|
|
14
|
+
ECellType[ECellType["StaticPicture"] = 2] = "StaticPicture";
|
|
15
|
+
ECellType[ECellType["SubSection"] = 3] = "SubSection";
|
|
16
|
+
ECellType[ECellType["ButtonMore"] = 4] = "ButtonMore";
|
|
17
|
+
ECellType[ECellType["EntityPhoto"] = 5] = "EntityPhoto";
|
|
18
|
+
ECellType[ECellType["EmbeddedMedia"] = 6] = "EmbeddedMedia";
|
|
19
|
+
ECellType[ECellType["Chart"] = 7] = "Chart";
|
|
20
|
+
})(ECellType = CustomFormContent.ECellType || (CustomFormContent.ECellType = {}));
|
|
21
|
+
let EFlowDirection;
|
|
22
|
+
(function (EFlowDirection) {
|
|
23
|
+
EFlowDirection["Vertically"] = "v";
|
|
24
|
+
EFlowDirection["Horizontally"] = "h";
|
|
25
|
+
})(EFlowDirection = CustomFormContent.EFlowDirection || (CustomFormContent.EFlowDirection = {}));
|
|
26
|
+
})(CustomFormContent = exports.CustomFormContent || (exports.CustomFormContent = {}));
|
|
27
27
|
//# sourceMappingURL=custom-form-content.js.map
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CustomForm = void 0;
|
|
13
|
-
const api_1 = require("../api/api");
|
|
14
|
-
/**
|
|
15
|
-
* Describes the "Custom Form" concept within Bruce.
|
|
16
|
-
* Custom forms are dynamic dialogs that get populated with Entity data.
|
|
17
|
-
*/
|
|
18
|
-
var CustomForm;
|
|
19
|
-
(function (CustomForm) {
|
|
20
|
-
function GetCacheKey(id) {
|
|
21
|
-
return api_1.Api.ECacheKey.CustomForm + api_1.Api.ECacheKey.Id + id;
|
|
22
|
-
}
|
|
23
|
-
CustomForm.GetCacheKey = GetCacheKey;
|
|
24
|
-
function GetListCacheKey(typeId) {
|
|
25
|
-
if (typeId) {
|
|
26
|
-
return api_1.Api.ECacheKey.CustomForm + api_1.Api.ECacheKey.EntityType + api_1.Api.ECacheKey.Id + typeId;
|
|
27
|
-
}
|
|
28
|
-
return api_1.Api.ECacheKey.CustomForm;
|
|
29
|
-
}
|
|
30
|
-
CustomForm.GetListCacheKey = GetListCacheKey;
|
|
31
|
-
let EType;
|
|
32
|
-
(function (EType) {
|
|
33
|
-
EType["Form"] = "GENERIC";
|
|
34
|
-
EType["Markup"] = "MARKUP";
|
|
35
|
-
})(EType = CustomForm.EType || (CustomForm.EType = {}));
|
|
36
|
-
function Get(params) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const { api, formId: id, req: reqParams } = params;
|
|
39
|
-
if (!id) {
|
|
40
|
-
throw ("Id is required.");
|
|
41
|
-
}
|
|
42
|
-
const cacheData = api.GetCacheItem(GetCacheKey(id), reqParams);
|
|
43
|
-
if (cacheData) {
|
|
44
|
-
return cacheData;
|
|
45
|
-
}
|
|
46
|
-
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
try {
|
|
48
|
-
const data = yield api.GET(`customForm/${id}`, api_1.Api.PrepReqParams(reqParams));
|
|
49
|
-
res({
|
|
50
|
-
form: data
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
catch (err) {
|
|
54
|
-
rej(err);
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
|
-
api.Cache.Set(GetCacheKey(id), prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
58
|
-
return prom;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
CustomForm.Get = Get;
|
|
62
|
-
function Delete(params) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const { api, formId: id, req: reqParams } = params;
|
|
65
|
-
if (!id) {
|
|
66
|
-
throw ("Id is required.");
|
|
67
|
-
}
|
|
68
|
-
yield api.DELETE(`customForm/${id}`, api_1.Api.PrepReqParams(reqParams));
|
|
69
|
-
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.CustomForm);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
CustomForm.Delete = Delete;
|
|
73
|
-
function GetList(params) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const { api, entityTypeId: typeId, req: reqParams } = params;
|
|
76
|
-
const url = typeId ? `entityType/${typeId}/customForms` : "customForms";
|
|
77
|
-
const cacheData = api.GetCacheItem(GetListCacheKey(typeId), reqParams);
|
|
78
|
-
if (cacheData) {
|
|
79
|
-
return cacheData;
|
|
80
|
-
}
|
|
81
|
-
const req = api.GET(url, api_1.Api.PrepReqParams(reqParams));
|
|
82
|
-
const prom = req.then((data) => {
|
|
83
|
-
return {
|
|
84
|
-
forms: data.Items
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
api.Cache.Set(GetListCacheKey(typeId), prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
88
|
-
return prom;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
CustomForm.GetList = GetList;
|
|
92
|
-
function Update(params) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const { api, form: data, reqParams } = params;
|
|
95
|
-
if (!data.ID) {
|
|
96
|
-
data.ID = 0;
|
|
97
|
-
}
|
|
98
|
-
const res = yield api.POST(`customForm/${data.ID}`, data, api_1.Api.PrepReqParams(reqParams));
|
|
99
|
-
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.CustomForm);
|
|
100
|
-
return {
|
|
101
|
-
form: res
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
CustomForm.Update = Update;
|
|
106
|
-
})(CustomForm = exports.CustomForm || (exports.CustomForm = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CustomForm = void 0;
|
|
13
|
+
const api_1 = require("../api/api");
|
|
14
|
+
/**
|
|
15
|
+
* Describes the "Custom Form" concept within Bruce.
|
|
16
|
+
* Custom forms are dynamic dialogs that get populated with Entity data.
|
|
17
|
+
*/
|
|
18
|
+
var CustomForm;
|
|
19
|
+
(function (CustomForm) {
|
|
20
|
+
function GetCacheKey(id) {
|
|
21
|
+
return api_1.Api.ECacheKey.CustomForm + api_1.Api.ECacheKey.Id + id;
|
|
22
|
+
}
|
|
23
|
+
CustomForm.GetCacheKey = GetCacheKey;
|
|
24
|
+
function GetListCacheKey(typeId) {
|
|
25
|
+
if (typeId) {
|
|
26
|
+
return api_1.Api.ECacheKey.CustomForm + api_1.Api.ECacheKey.EntityType + api_1.Api.ECacheKey.Id + typeId;
|
|
27
|
+
}
|
|
28
|
+
return api_1.Api.ECacheKey.CustomForm;
|
|
29
|
+
}
|
|
30
|
+
CustomForm.GetListCacheKey = GetListCacheKey;
|
|
31
|
+
let EType;
|
|
32
|
+
(function (EType) {
|
|
33
|
+
EType["Form"] = "GENERIC";
|
|
34
|
+
EType["Markup"] = "MARKUP";
|
|
35
|
+
})(EType = CustomForm.EType || (CustomForm.EType = {}));
|
|
36
|
+
function Get(params) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const { api, formId: id, req: reqParams } = params;
|
|
39
|
+
if (!id) {
|
|
40
|
+
throw ("Id is required.");
|
|
41
|
+
}
|
|
42
|
+
const cacheData = api.GetCacheItem(GetCacheKey(id), reqParams);
|
|
43
|
+
if (cacheData) {
|
|
44
|
+
return cacheData;
|
|
45
|
+
}
|
|
46
|
+
const prom = new Promise((res, rej) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
try {
|
|
48
|
+
const data = yield api.GET(`customForm/${id}`, api_1.Api.PrepReqParams(reqParams));
|
|
49
|
+
res({
|
|
50
|
+
form: data
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
rej(err);
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
api.Cache.Set(GetCacheKey(id), prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
58
|
+
return prom;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
CustomForm.Get = Get;
|
|
62
|
+
function Delete(params) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const { api, formId: id, req: reqParams } = params;
|
|
65
|
+
if (!id) {
|
|
66
|
+
throw ("Id is required.");
|
|
67
|
+
}
|
|
68
|
+
yield api.DELETE(`customForm/${id}`, api_1.Api.PrepReqParams(reqParams));
|
|
69
|
+
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.CustomForm);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
CustomForm.Delete = Delete;
|
|
73
|
+
function GetList(params) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const { api, entityTypeId: typeId, req: reqParams } = params;
|
|
76
|
+
const url = typeId ? `entityType/${typeId}/customForms` : "customForms";
|
|
77
|
+
const cacheData = api.GetCacheItem(GetListCacheKey(typeId), reqParams);
|
|
78
|
+
if (cacheData) {
|
|
79
|
+
return cacheData;
|
|
80
|
+
}
|
|
81
|
+
const req = api.GET(url, api_1.Api.PrepReqParams(reqParams));
|
|
82
|
+
const prom = req.then((data) => {
|
|
83
|
+
return {
|
|
84
|
+
forms: data.Items
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
api.Cache.Set(GetListCacheKey(typeId), prom, api_1.Api.DEFAULT_CACHE_DURATION);
|
|
88
|
+
return prom;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
CustomForm.GetList = GetList;
|
|
92
|
+
function Update(params) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const { api, form: data, reqParams } = params;
|
|
95
|
+
if (!data.ID) {
|
|
96
|
+
data.ID = 0;
|
|
97
|
+
}
|
|
98
|
+
const res = yield api.POST(`customForm/${data.ID}`, data, api_1.Api.PrepReqParams(reqParams));
|
|
99
|
+
api.Cache.RemoveByStartsWith(api_1.Api.ECacheKey.CustomForm);
|
|
100
|
+
return {
|
|
101
|
+
form: res
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
CustomForm.Update = Update;
|
|
106
|
+
})(CustomForm = exports.CustomForm || (exports.CustomForm = {}));
|
|
107
107
|
//# sourceMappingURL=custom-form.js.map
|