@bimdata/bcf-components 6.0.0-rc.8 → 6.0.0
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 +0 -6
- package/package.json +15 -20
- package/src/components/bcf-filters/BcfFilters.scss +67 -0
- package/src/components/bcf-filters/BcfFilters.vue +228 -0
- package/src/components/bcf-settings/BcfSettings.scss +28 -0
- package/src/components/bcf-settings/BcfSettings.vue +117 -0
- package/src/components/bcf-settings/setting-card/SettingCard.scss +59 -0
- package/src/components/bcf-settings/setting-card/SettingCard.vue +140 -0
- package/src/components/bcf-settings/setting-card/SettingCardItem.scss +48 -0
- package/src/components/bcf-settings/setting-card/SettingCardItem.vue +151 -0
- package/src/components/bcf-statistics/BcfStatistics.scss +56 -0
- package/src/components/bcf-statistics/BcfStatistics.vue +112 -0
- package/src/components/bcf-topic-card/BcfTopicCard.scss +96 -0
- package/src/components/bcf-topic-card/BcfTopicCard.vue +150 -0
- package/src/components/bcf-topic-card/BcfTopicDefaultImage.vue +90 -0
- package/src/components/bcf-topic-creation-card/BcfTopicCreationCard.scss +15 -0
- package/src/components/bcf-topic-creation-card/BcfTopicCreationCard.vue +37 -0
- package/src/components/bcf-topic-creation-card/BcfTopicCreationCardImage.vue +55 -0
- package/src/components/bcf-topic-form/BcfTopicForm.scss +124 -0
- package/src/components/bcf-topic-form/BcfTopicForm.vue +541 -0
- package/src/components/bcf-topic-form/bcf-topic-images/BcfTopicImages.scss +88 -0
- package/src/components/bcf-topic-form/bcf-topic-images/BcfTopicImages.vue +101 -0
- package/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.scss +50 -0
- package/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.vue +71 -0
- package/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.scss +9 -0
- package/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.vue +69 -0
- package/src/components/bcf-topic-overview/BcfTopicOverview.scss +94 -0
- package/src/components/bcf-topic-overview/BcfTopicOverview.vue +350 -0
- package/src/components/bcf-topic-overview/bcf-topic-comments/BcfTopicComments.scss +39 -0
- package/src/components/bcf-topic-overview/bcf-topic-comments/BcfTopicComments.vue +268 -0
- package/src/components/bcf-topic-overview/bcf-topic-comments/topic-comment/TopicComment.scss +79 -0
- package/src/components/bcf-topic-overview/bcf-topic-comments/topic-comment/TopicComment.vue +357 -0
- package/src/components/bcf-topic-overview/bcf-topic-viewpoints/BcfTopicViewpoints.scss +73 -0
- package/src/components/bcf-topic-overview/bcf-topic-viewpoints/BcfTopicViewpoints.vue +84 -0
- package/src/components/bcf-topics-table/BcfTopicsTable.vue +148 -0
- package/src/components/bcf-topics-table/bcf-topic-actions-cell/BcfTopicActionsCell.vue +43 -0
- package/src/components/bcf-topics-table/bcf-topic-index-cell/BcfTopicIndexCell.vue +55 -0
- package/src/components/bcf-topics-table/bcf-topic-priority-cell/BcfTopicPriorityCell.vue +47 -0
- package/src/components/bcf-topics-table/bcf-topic-status-cell/BcfTopicStatusCell.vue +52 -0
- package/src/components/bcf-topics-table/columns.js +38 -0
- package/src/components/user-avatar/UserAvatar.scss +30 -0
- package/src/components/user-avatar/UserAvatar.vue +66 -0
- package/src/composables/filter.js +58 -0
- package/src/composables/search.js +42 -0
- package/src/composables/sort.js +64 -0
- package/src/config.js +87 -0
- package/{dist → src}/i18n/lang/en.json +3 -1
- package/{dist → src}/i18n/lang/fr.json +5 -1
- package/src/index.js +59 -0
- package/src/service.js +206 -0
- package/src/utils/browser.js +12 -0
- package/src/utils/download.js +15 -0
- package/src/utils/extensions.js +14 -0
- package/src/utils/topic.js +23 -0
- package/src/utils/viewer.js +21 -0
- package/src/utils/viewpoints.js +28 -0
- package/vue3-plugin.js +4 -5
- package/dist/bcf-components.mjs +0 -10311
- package/dist/style.css +0 -1
- /package/{dist → src}/i18n/index.js +0 -0
- /package/{dist → src}/i18n/lang/de.json +0 -0
- /package/{dist → src}/i18n/lang/es.json +0 -0
- /package/{dist → src}/i18n/lang/it.json +0 -0
- /package/{dist → src}/i18n/lang/nl.json +0 -0
- /package/{dist → src}/i18n/lang/no.json +0 -0
package/src/config.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const EXTENSION_TYPES = Object.freeze([
|
|
2
|
+
"Priority",
|
|
3
|
+
"Type",
|
|
4
|
+
"Stage",
|
|
5
|
+
"Status",
|
|
6
|
+
"Label"
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
const EXTENSION_WITH_COLOR = Object.freeze([
|
|
10
|
+
"Priority",
|
|
11
|
+
"Status"
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const EXTENSION_FIELDS = Object.freeze({
|
|
15
|
+
Priority: "priority",
|
|
16
|
+
Type: "topic_type",
|
|
17
|
+
Stage: "stage",
|
|
18
|
+
Status: "topic_status",
|
|
19
|
+
Label: "label",
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const EXTENSION_LIST_FIELDS = Object.freeze({
|
|
23
|
+
Priority: "priorities",
|
|
24
|
+
Type: "topic_types",
|
|
25
|
+
Stage: "stages",
|
|
26
|
+
Status: "topic_statuses",
|
|
27
|
+
Label: "topic_labels",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const DEFAULT_PRIORITY_COLOR = "D8D8D8";
|
|
31
|
+
const DEFAULT_STATUS_COLOR = "D8D8D8";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Viewpoint config
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const VIEWPOINT_TYPES = Object.freeze({
|
|
38
|
+
IFC3D: "ifc3d",
|
|
39
|
+
POINT_CLOUD: "pointCloud",
|
|
40
|
+
IFC2D: "ifc2d",
|
|
41
|
+
DWG: "dwg",
|
|
42
|
+
PLAN: "plan",
|
|
43
|
+
PANORAMA: "panorama",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const VIEWPOINT_CONFIG = Object.freeze({
|
|
47
|
+
[VIEWPOINT_TYPES.IFC3D]: {
|
|
48
|
+
window: "3d",
|
|
49
|
+
plugin: "viewer3d",
|
|
50
|
+
icon: "fileIfcPolychrome",
|
|
51
|
+
},
|
|
52
|
+
[VIEWPOINT_TYPES.POINT_CLOUD]: {
|
|
53
|
+
window: "pointCloud",
|
|
54
|
+
plugin: "pointCloud",
|
|
55
|
+
},
|
|
56
|
+
[VIEWPOINT_TYPES.IFC2D]: {
|
|
57
|
+
window: "2d",
|
|
58
|
+
plugin: "viewer2d",
|
|
59
|
+
icon: "fileIfcPolychrome",
|
|
60
|
+
},
|
|
61
|
+
[VIEWPOINT_TYPES.DWG]: {
|
|
62
|
+
window: "dwg",
|
|
63
|
+
plugin: "dwg",
|
|
64
|
+
icon: "fileDwgPolychrome",
|
|
65
|
+
},
|
|
66
|
+
[VIEWPOINT_TYPES.PLAN]: {
|
|
67
|
+
window: "plan",
|
|
68
|
+
plugin: "plan",
|
|
69
|
+
icon: "filePlanPolychrome",
|
|
70
|
+
},
|
|
71
|
+
[VIEWPOINT_TYPES.PANORAMA]: {
|
|
72
|
+
window: "panorama",
|
|
73
|
+
plugin: "panorama",
|
|
74
|
+
icon: "filePlanPolychrome",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
DEFAULT_PRIORITY_COLOR,
|
|
80
|
+
DEFAULT_STATUS_COLOR,
|
|
81
|
+
EXTENSION_FIELDS,
|
|
82
|
+
EXTENSION_LIST_FIELDS,
|
|
83
|
+
EXTENSION_TYPES,
|
|
84
|
+
EXTENSION_WITH_COLOR,
|
|
85
|
+
VIEWPOINT_CONFIG,
|
|
86
|
+
VIEWPOINT_TYPES,
|
|
87
|
+
};
|
|
@@ -65,7 +65,9 @@
|
|
|
65
65
|
"cancelButton": "Discard changes",
|
|
66
66
|
"continueButton": "Continue editing",
|
|
67
67
|
"createTitle": "Report a problem",
|
|
68
|
-
"dragDropImageTextTablet": "Take a picture"
|
|
68
|
+
"dragDropImageTextTablet": "Take a picture",
|
|
69
|
+
"searchPlaceholder": "Search",
|
|
70
|
+
"emptySearch": "No result"
|
|
69
71
|
},
|
|
70
72
|
"BcfTopicOverview": {
|
|
71
73
|
"openViewer": "Open in viewer",
|
|
@@ -65,7 +65,11 @@
|
|
|
65
65
|
"updateButton": "Modifier ce BCF",
|
|
66
66
|
"modalText": "Vous êtes sur le point de quitter l'édition de l'issue {name} mais il y'a des modifications non enregistrées.",
|
|
67
67
|
"cancelButton": "Annuler les modifications",
|
|
68
|
-
"continueButton": "Continuer les modifications"
|
|
68
|
+
"continueButton": "Continuer les modifications",
|
|
69
|
+
"takeSnapshot": "Prendre un snapshot",
|
|
70
|
+
"importFile": "Importer un fichier",
|
|
71
|
+
"searchPlaceholder": "Rechercher",
|
|
72
|
+
"emptySearch": "Pas de résultat"
|
|
69
73
|
},
|
|
70
74
|
"BcfTopicOverview": {
|
|
71
75
|
"openViewer": "Ouvrir dans le viewer",
|
package/src/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as config from "./config.js";
|
|
2
|
+
import { createService, setService, useService } from "./service.js";
|
|
3
|
+
|
|
4
|
+
import { useBcfFilter } from "./composables/filter.js";
|
|
5
|
+
import { useBcfSearch } from "./composables/search.js";
|
|
6
|
+
import { useBcfSort } from "./composables/sort.js";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
getPriorityColor,
|
|
10
|
+
getStatusColor
|
|
11
|
+
} from "./utils/topic.js";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
getViewpointConfig
|
|
15
|
+
} from "./utils/viewpoints.js";
|
|
16
|
+
|
|
17
|
+
import BcfFilters from "./components/bcf-filters/BcfFilters.vue";
|
|
18
|
+
import BcfSettings from "./components/bcf-settings/BcfSettings.vue";
|
|
19
|
+
import BcfStatistics from "./components/bcf-statistics/BcfStatistics.vue";
|
|
20
|
+
import BcfTopicCard from "./components/bcf-topic-card/BcfTopicCard.vue";
|
|
21
|
+
import BcfTopicCreationCard from "./components/bcf-topic-creation-card/BcfTopicCreationCard.vue";
|
|
22
|
+
import BcfTopicForm from "./components/bcf-topic-form/BcfTopicForm.vue";
|
|
23
|
+
import BcfTopicOverview from "./components/bcf-topic-overview/BcfTopicOverview.vue";
|
|
24
|
+
import BcfTopicsTable from "./components/bcf-topics-table/BcfTopicsTable.vue";
|
|
25
|
+
|
|
26
|
+
const components = {
|
|
27
|
+
BcfFilters,
|
|
28
|
+
BcfSettings,
|
|
29
|
+
BcfStatistics,
|
|
30
|
+
BcfTopicCard,
|
|
31
|
+
BcfTopicCreationCard,
|
|
32
|
+
BcfTopicForm,
|
|
33
|
+
BcfTopicOverview,
|
|
34
|
+
BcfTopicsTable,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
config,
|
|
39
|
+
createService,
|
|
40
|
+
setService,
|
|
41
|
+
useService,
|
|
42
|
+
useBcfFilter,
|
|
43
|
+
useBcfSearch,
|
|
44
|
+
useBcfSort,
|
|
45
|
+
getPriorityColor,
|
|
46
|
+
getStatusColor,
|
|
47
|
+
getViewpointConfig,
|
|
48
|
+
components,
|
|
49
|
+
|
|
50
|
+
// Export components individually
|
|
51
|
+
BcfFilters,
|
|
52
|
+
BcfSettings,
|
|
53
|
+
BcfStatistics,
|
|
54
|
+
BcfTopicCard,
|
|
55
|
+
BcfTopicCreationCard,
|
|
56
|
+
BcfTopicForm,
|
|
57
|
+
BcfTopicOverview,
|
|
58
|
+
BcfTopicsTable,
|
|
59
|
+
};
|
package/src/service.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { getRandomHexColor } from "@bimdata/design-system/src/BIMDataComponents/BIMDataColorSelector/colors.js";
|
|
2
|
+
import eachLimit from "async/eachLimit";
|
|
3
|
+
import { getExtensionField } from "./utils/extensions.js";
|
|
4
|
+
import { getPriorityColor } from "./utils/topic.js";
|
|
5
|
+
import { downloadBlobAs } from "./utils/download.js";
|
|
6
|
+
|
|
7
|
+
let libService = null;
|
|
8
|
+
|
|
9
|
+
function createService(apiClient, { fetchUsers }) {
|
|
10
|
+
const getUsers = fetchUsers
|
|
11
|
+
? (project) => fetchUsers(project)
|
|
12
|
+
: (project) => apiClient.collaborationApi.getProjectUsers(project.cloud.id, project.id);
|
|
13
|
+
|
|
14
|
+
const fetchCurrentUser = () => apiClient.bcfApi.getUser();
|
|
15
|
+
|
|
16
|
+
// --- BCF Topics API ---
|
|
17
|
+
|
|
18
|
+
const fetchTopics = async (project, { extensions, users } = {}) => {
|
|
19
|
+
const _extensions = extensions ?? (await apiClient.bcfApi.getDetailedExtensions(project.id));
|
|
20
|
+
const _users = users ?? (await getUsers(project));
|
|
21
|
+
|
|
22
|
+
const topics = await apiClient.bcfApi.getTopics(project.id);
|
|
23
|
+
topics.sort((a, b) => b.index - a.index);
|
|
24
|
+
topics.forEach((topic) => {
|
|
25
|
+
topic.color = getPriorityColor(topic, _extensions);
|
|
26
|
+
topic.creator = _users.find((u) => u.email === topic.creation_author);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return topics;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const fecthTopicByGuid = async (project, guid) => {
|
|
33
|
+
const extensions = await apiClient.bcfApi.getDetailedExtensions(project.id);
|
|
34
|
+
const topic = await apiClient.bcfApi.getFullTopic(guid, project.id, "url");
|
|
35
|
+
topic.color = getPriorityColor(topic, extensions);
|
|
36
|
+
return topic;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const createTopic = (project, topic) => {
|
|
40
|
+
return apiClient.bcfApi.createTopic(project.id, topic);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const updateTopic = (project, topic) => {
|
|
44
|
+
return apiClient.bcfApi.updateTopic(topic.guid, project.id, topic);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const deleteTopic = (project, topic) => {
|
|
48
|
+
return apiClient.bcfApi.deleteTopic(topic.guid, project.id);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const importBcf = async (project, file) => {
|
|
52
|
+
const formData = new FormData();
|
|
53
|
+
formData.append("name", file.name);
|
|
54
|
+
formData.append("file", file);
|
|
55
|
+
await fetch(`${apiClient.config.basePath}/bcf/2.1/projects/${project.id}/import`, {
|
|
56
|
+
method: "POST",
|
|
57
|
+
credentials: "include",
|
|
58
|
+
headers: {
|
|
59
|
+
...apiClient.authHeader,
|
|
60
|
+
},
|
|
61
|
+
body: formData,
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const exportBcf = async (project, topics) => {
|
|
66
|
+
const response = await apiClient.bcfApi.downloadBcfExport(
|
|
67
|
+
project.id,
|
|
68
|
+
undefined, // Format
|
|
69
|
+
topics.map((t) => t.guid).join(",")
|
|
70
|
+
);
|
|
71
|
+
downloadBlobAs(`${project.name}.bcf`, response);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const exportBcfXLSX = async (project, topics) => {
|
|
75
|
+
const response = await apiClient.bcfApi.downloadBcfExportXlsx(
|
|
76
|
+
project.id,
|
|
77
|
+
undefined, // Format
|
|
78
|
+
undefined, // Locale
|
|
79
|
+
topics.map((t) => t.guid).join(",")
|
|
80
|
+
);
|
|
81
|
+
downloadBlobAs(`${project.name}.xlsx`, response);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// --- BCF Topic Viewpoints API ---
|
|
85
|
+
|
|
86
|
+
const loadTopicsViewpoints = async (project, topics) => {
|
|
87
|
+
await eachLimit(topics, 10, (topic, cb) => {
|
|
88
|
+
fetchTopicViewpoints(project, topic).then(viewpoints => {
|
|
89
|
+
topic.viewpoints = viewpoints;
|
|
90
|
+
cb();
|
|
91
|
+
}, cb);
|
|
92
|
+
});
|
|
93
|
+
return topics;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const fetchTopicViewpoints = (project, topic) => {
|
|
97
|
+
return apiClient.bcfApi.getTopicViewpoints(project.id, topic.guid, "url");
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const fetchTopicCommentViewpoint = (project, topic, comment) => {
|
|
101
|
+
return apiClient.bcfApi.getViewpoint(comment.viewpoint_guid, project.id, topic.guid);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const createViewpoint = (project, topic, viewpoint) => {
|
|
105
|
+
return apiClient.bcfApi.createViewpoint(project.id, topic.guid, "url", viewpoint);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const updateViewpoint = (project, topic, viewpoint) => {
|
|
109
|
+
return apiClient.bcfApi.updateViewpoint(viewpoint.guid, project.id, topic.guid, "url", viewpoint);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const deleteViewpoint = (project, topic, viewpoint) => {
|
|
113
|
+
return apiClient.bcfApi.deleteViewpoint(viewpoint.guid, project.id, topic.guid);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// --- BCF Topic Comments API ---
|
|
117
|
+
|
|
118
|
+
const fetchTopicComments = async (project, topic) => {
|
|
119
|
+
const users = await getUsers(project);
|
|
120
|
+
|
|
121
|
+
const comments = await apiClient.bcfApi.getComments(project.id, topic.guid);
|
|
122
|
+
comments.sort((a, b) => (a.date > b.date ? -1 : 1));
|
|
123
|
+
comments.forEach((c) => {
|
|
124
|
+
c.user = users.find((u) => u.email === c.author);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return comments;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const createComment = (project, topic, data) => {
|
|
131
|
+
return apiClient.bcfApi.createComment(project.id, topic.guid, data);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const updateComment = (project, topic, comment, data) => {
|
|
135
|
+
return apiClient.bcfApi.updateComment(comment.guid, project.id, topic.guid, data);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const deleteComment = (project, topic, comment) => {
|
|
139
|
+
return apiClient.bcfApi.deleteComment(comment.guid, project.id, topic.guid);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// --- BCF Extensions API ---
|
|
143
|
+
|
|
144
|
+
const fetchExtensions = (project) => {
|
|
145
|
+
return apiClient.bcfApi.getExtensions(project.id);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const fetchDetailedExtensions = (project) => {
|
|
149
|
+
return apiClient.bcfApi.getDetailedExtensions(project.id);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const createExtension = async (project, type, data) => {
|
|
153
|
+
return await apiClient.bcfApi[`createExtension${type}`](project.id, {
|
|
154
|
+
[getExtensionField(type)]: data.value,
|
|
155
|
+
color: getRandomHexColor(),
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const updateExtension = async (project, type, extension, data) => {
|
|
160
|
+
return await apiClient.bcfApi[`updateExtension${type}`](extension.id, project.id, {
|
|
161
|
+
[getExtensionField(type)]: data.value,
|
|
162
|
+
color: data.color,
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const deleteExtension = async (project, type, extension) => {
|
|
167
|
+
await apiClient.bcfApi[`deleteExtension${type}`](extension.id, project.id);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
fetchCurrentUser,
|
|
172
|
+
fetchTopics,
|
|
173
|
+
fecthTopicByGuid,
|
|
174
|
+
createTopic,
|
|
175
|
+
updateTopic,
|
|
176
|
+
deleteTopic,
|
|
177
|
+
importBcf,
|
|
178
|
+
exportBcf,
|
|
179
|
+
exportBcfXLSX,
|
|
180
|
+
loadTopicsViewpoints,
|
|
181
|
+
fetchTopicViewpoints,
|
|
182
|
+
fetchTopicCommentViewpoint,
|
|
183
|
+
createViewpoint,
|
|
184
|
+
updateViewpoint,
|
|
185
|
+
deleteViewpoint,
|
|
186
|
+
fetchTopicComments,
|
|
187
|
+
createComment,
|
|
188
|
+
updateComment,
|
|
189
|
+
deleteComment,
|
|
190
|
+
fetchExtensions,
|
|
191
|
+
fetchDetailedExtensions,
|
|
192
|
+
createExtension,
|
|
193
|
+
updateExtension,
|
|
194
|
+
deleteExtension,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function setService(service) {
|
|
199
|
+
libService = service;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function useService() {
|
|
203
|
+
return libService;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export { createService, setService, useService };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const isMobileRegex = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i;
|
|
2
|
+
const isTabletRegex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;
|
|
3
|
+
|
|
4
|
+
function isTabletOrMobile() {
|
|
5
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
6
|
+
const isMobile = isMobileRegex.test(userAgent);
|
|
7
|
+
const isTablet = isTabletRegex.test(userAgent);
|
|
8
|
+
|
|
9
|
+
return isMobile || isTablet
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { isTabletOrMobile };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
async function downloadBlobAs(name, blob) {
|
|
2
|
+
const { URL } = window;
|
|
3
|
+
const link = document.createElement("a");
|
|
4
|
+
link.rel = "noopener";
|
|
5
|
+
link.download = name;
|
|
6
|
+
// Create object url from blob
|
|
7
|
+
link.href = URL.createObjectURL(blob);
|
|
8
|
+
|
|
9
|
+
// Trigger "Save As" dialog
|
|
10
|
+
setTimeout(() => link.click(), 0);
|
|
11
|
+
// Revoke object url after 30 seconds
|
|
12
|
+
setTimeout(() => URL.revokeObjectURL(link.href), 3e4);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { downloadBlobAs };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EXTENSION_FIELDS, EXTENSION_LIST_FIELDS } from "../config.js";
|
|
2
|
+
|
|
3
|
+
function getExtensionField(type) {
|
|
4
|
+
return EXTENSION_FIELDS[type];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getAvailableExtensions(type, detailedExtensions) {
|
|
8
|
+
return detailedExtensions[EXTENSION_LIST_FIELDS[type]].slice();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
getExtensionField,
|
|
13
|
+
getAvailableExtensions,
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_PRIORITY_COLOR,
|
|
3
|
+
DEFAULT_STATUS_COLOR
|
|
4
|
+
} from "../config.js";
|
|
5
|
+
|
|
6
|
+
function getPriorityColor(topic, detailedExtensions) {
|
|
7
|
+
const priorityDetail = detailedExtensions.priorities.find(
|
|
8
|
+
p => p.priority === topic.priority
|
|
9
|
+
);
|
|
10
|
+
return priorityDetail?.color || DEFAULT_PRIORITY_COLOR;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getStatusColor(topic, detailedExtensions) {
|
|
14
|
+
const statusDetail = detailedExtensions.topic_statuses.find(
|
|
15
|
+
s => s.topic_status === topic.topic_status
|
|
16
|
+
);
|
|
17
|
+
return statusDetail?.color || DEFAULT_STATUS_COLOR;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
getPriorityColor,
|
|
22
|
+
getStatusColor,
|
|
23
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getViewerList(viewers) {
|
|
2
|
+
return Object.values(viewers).flat();
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function getViewerOptions(viewers) {
|
|
6
|
+
return Object.entries(viewers)
|
|
7
|
+
.map(([id, list]) => list.map((v, i) => ({ key: `${id}-${i}`, id, index: i, viewer: v })))
|
|
8
|
+
.flat();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function highlightViewer(viewer) {
|
|
12
|
+
viewer.$viewer.localContext.el.style.boxSizing = "border-box";
|
|
13
|
+
viewer.$viewer.localContext.el.style.border = "2px solid var(--color-primary)";
|
|
14
|
+
viewer.$viewer.localContext.el.style.opacity = ".85";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function unhighlightViewer(viewer) {
|
|
18
|
+
viewer.$viewer.localContext.el.style.boxSizing = "";
|
|
19
|
+
viewer.$viewer.localContext.el.style.border = "";
|
|
20
|
+
viewer.$viewer.localContext.el.style.opacity = "";
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { VIEWPOINT_CONFIG } from "../config.js";
|
|
2
|
+
|
|
3
|
+
function getViewpointConfig(viewpoint) {
|
|
4
|
+
return VIEWPOINT_CONFIG[viewpoint.originating_system];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function setViewpointDefaults(viewpoint) {
|
|
8
|
+
if (!viewpoint.components.selection) {
|
|
9
|
+
viewpoint.components.selection = [];
|
|
10
|
+
}
|
|
11
|
+
if (!viewpoint.components.visibility) {
|
|
12
|
+
viewpoint.components.visibility = {
|
|
13
|
+
default_visibility: true,
|
|
14
|
+
exceptions: [],
|
|
15
|
+
view_setup_hints: {
|
|
16
|
+
spaces_visible: false,
|
|
17
|
+
space_boundaries_visible: false,
|
|
18
|
+
openings_visible: false,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return viewpoint;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
getViewpointConfig,
|
|
27
|
+
setViewpointDefaults,
|
|
28
|
+
};
|
package/vue3-plugin.js
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
components,
|
|
3
3
|
createService,
|
|
4
4
|
setService,
|
|
5
|
-
} from "./
|
|
6
|
-
import messages from "./
|
|
5
|
+
} from "./src/index.js";
|
|
6
|
+
import messages from "./src/i18n/index.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* BCF Components library plugin for Vue 3.
|
|
10
|
-
*
|
|
10
|
+
* The plugin will perform the following actions in order:
|
|
11
11
|
* - initialize library service
|
|
12
12
|
* - register components translations
|
|
13
13
|
* - globally register BCF components
|
|
@@ -33,8 +33,7 @@ const pluginFactory = ({
|
|
|
33
33
|
} else {
|
|
34
34
|
console.error(
|
|
35
35
|
"[BCF Components Plugin] No api client provided. " +
|
|
36
|
-
"You must provide an api client for the components "
|
|
37
|
-
"to work properly."
|
|
36
|
+
"You must provide an api client for the components to work properly."
|
|
38
37
|
);
|
|
39
38
|
}
|
|
40
39
|
|