From 54bdafd9c11e25f3451b29c55d48f1a8fc3aa114 Mon Sep 17 00:00:00 2001 From: NicolasRichel Date: Wed, 10 Apr 2024 15:16:31 +0200 Subject: [PATCH] MINOR: feat: add meta-buiding components --- index.js | 2 + .../BIMDataBuildingMaker.scss | 45 ++++ .../BIMDataBuildingMaker.vue | 183 +++++++++++++++ .../BuildingForm/BuildingForm.scss | 33 +++ .../BuildingForm/BuildingForm.vue | 88 ++++++++ .../BuildingStoreys/BuildingStoreys.scss | 35 +++ .../BuildingStoreys/BuildingStoreys.vue | 213 ++++++++++++++++++ .../StoreyForm/StoreyForm.scss | 25 ++ .../BuildingStoreys/StoreyForm/StoreyForm.vue | 95 ++++++++ .../StoreysTree/StoreyNode/StoreyNode.scss | 52 +++++ .../StoreysTree/StoreyNode/StoreyNode.vue | 83 +++++++ .../StoreysTree/StoreyPlans/StoreyPlans.scss | 28 +++ .../StoreysTree/StoreyPlans/StoreyPlans.vue | 70 ++++++ .../StoreysTree/StoreysTree.scss | 40 ++++ .../StoreysTree/StoreysTree.vue | 93 ++++++++ .../BuildingItem/BuildingItem.scss | 34 +++ .../BuildingItem/BuildingItem.vue | 65 ++++++ .../BuildingsList/BuildingsList.scss | 31 +++ .../BuildingsList/BuildingsList.vue | 64 ++++++ src/BIMDataBuildingMaker/config.js | 5 + src/BIMDataBuildingMaker/icon.svg | 21 ++ src/BIMDataBuildingMaker/service.js | 121 ++++++++++ src/BIMDataFileManager/BIMDataFileManager.vue | 26 +-- .../components/FileCard.vue | 9 +- .../components/PdfPageSelector.vue | 5 +- .../components/UploadFileButton.vue | 3 +- .../components/modals/DeleteModal.vue | 9 +- .../components/modals/RenameModal.vue | 11 +- .../components/newFolder/NewFolderButton.vue | 3 +- .../components/newFolder/NewFolderForm.vue | 11 +- src/BIMDataFileManager/i18n.js | 141 ------------ .../BIMDataMetaBuildingStructure.vue | 138 ++++++++++++ .../EquipmentsView/EquipmentsView.vue | 31 +++ .../StoreySelector/StoreySelector.vue | 71 ++++++ .../StructureTreeNodes/GenericTreeNode.vue | 75 ++++++ .../StructureTreeNodes/PlanNode.vue | 29 +++ .../StructureTreeNodes/SpaceNode.vue | 23 ++ .../StructureTreeNodes/StructureRootNode.vue | 46 ++++ .../StructureTreeNodes/ZoneNode.vue | 43 ++++ .../StructureView/StructureView.vue | 88 ++++++++ .../ZonesView/ZonesView.vue | 78 +++++++ .../meta-building-structure.js | 76 +++++++ src/i18n/index.js | 13 ++ src/i18n/lang/de.json | 55 +++++ src/i18n/lang/en.json | 73 ++++++ src/i18n/lang/es.json | 55 +++++ src/i18n/lang/fr.json | 74 ++++++ src/i18n/lang/it.json | 55 +++++ vue3-plugin.js | 40 ++-- 49 files changed, 2497 insertions(+), 210 deletions(-) create mode 100644 src/BIMDataBuildingMaker/BIMDataBuildingMaker.scss create mode 100644 src/BIMDataBuildingMaker/BIMDataBuildingMaker.vue create mode 100644 src/BIMDataBuildingMaker/BuildingForm/BuildingForm.scss create mode 100644 src/BIMDataBuildingMaker/BuildingForm/BuildingForm.vue create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.scss create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.vue create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.scss create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.vue create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.scss create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.vue create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.scss create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.vue create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.scss create mode 100644 src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.vue create mode 100644 src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.scss create mode 100644 src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.vue create mode 100644 src/BIMDataBuildingMaker/BuildingsList/BuildingsList.scss create mode 100644 src/BIMDataBuildingMaker/BuildingsList/BuildingsList.vue create mode 100644 src/BIMDataBuildingMaker/config.js create mode 100644 src/BIMDataBuildingMaker/icon.svg create mode 100644 src/BIMDataBuildingMaker/service.js delete mode 100644 src/BIMDataFileManager/i18n.js create mode 100644 src/BIMDataMetaBuildingStructure/BIMDataMetaBuildingStructure.vue create mode 100644 src/BIMDataMetaBuildingStructure/EquipmentsView/EquipmentsView.vue create mode 100644 src/BIMDataMetaBuildingStructure/StoreySelector/StoreySelector.vue create mode 100644 src/BIMDataMetaBuildingStructure/StructureTreeNodes/GenericTreeNode.vue create mode 100644 src/BIMDataMetaBuildingStructure/StructureTreeNodes/PlanNode.vue create mode 100644 src/BIMDataMetaBuildingStructure/StructureTreeNodes/SpaceNode.vue create mode 100644 src/BIMDataMetaBuildingStructure/StructureTreeNodes/StructureRootNode.vue create mode 100644 src/BIMDataMetaBuildingStructure/StructureTreeNodes/ZoneNode.vue create mode 100644 src/BIMDataMetaBuildingStructure/StructureView/StructureView.vue create mode 100644 src/BIMDataMetaBuildingStructure/ZonesView/ZonesView.vue create mode 100644 src/BIMDataMetaBuildingStructure/meta-building-structure.js create mode 100644 src/i18n/index.js create mode 100644 src/i18n/lang/de.json create mode 100644 src/i18n/lang/en.json create mode 100644 src/i18n/lang/es.json create mode 100644 src/i18n/lang/fr.json create mode 100644 src/i18n/lang/it.json diff --git a/index.js b/index.js index 8465848..8d66288 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,7 @@ +export { default as BIMDataBuildingMaker } from "./src/BIMDataBuildingMaker/BIMDataBuildingMaker.vue"; export { default as BIMDataFileManager } from "./src/BIMDataFileManager/BIMDataFileManager.vue"; export { default as BIMDataGuidedTour } from "./src/BIMDataGuidedTour/BIMDataGuidedTour.vue"; +export { default as BIMDataMetaBuildingStructure } from "./src/BIMDataMetaBuildingStructure/BIMDataMetaBuildingStructure.vue"; export { default as BIMDataModelPreview } from "./src/BIMDataModelPreview/BIMDataModelPreview.vue"; export { default as BIMDataPDFViewer } from "./src/BIMDataPDFViewer/BIMDataPDFViewer.vue"; export { default as BIMDataSafeZoneModal } from "./src/BIMDataSafeZoneModal/BIMDataSafeZoneModal.vue"; diff --git a/src/BIMDataBuildingMaker/BIMDataBuildingMaker.scss b/src/BIMDataBuildingMaker/BIMDataBuildingMaker.scss new file mode 100644 index 0000000..7e476a6 --- /dev/null +++ b/src/BIMDataBuildingMaker/BIMDataBuildingMaker.scss @@ -0,0 +1,45 @@ +.bimdata-building-maker { + position: relative; + height: 100%; + background-color: var(--color-white); + + &__header { + height: 44px; + padding: calc(var(--spacing-unit) / 2) 0; + + display: flex; + justify-content: center; + align-items: center; + gap: var(--spacing-unit); + + box-shadow: var(--box-shadow); + + &__btn-back { + position: absolute; + left: var(--spacing-unit); + } + } + + &__body { + height: calc(100% - 44px); + padding: calc(2 * var(--spacing-unit)); + } + + &__loader { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + + display: flex; + justify-content: center; + align-items: center; + + background-color: rgba(255, 255, 255, 0.75); + + .bimdata-spinner { + transform: scale(2); + } + } +} diff --git a/src/BIMDataBuildingMaker/BIMDataBuildingMaker.vue b/src/BIMDataBuildingMaker/BIMDataBuildingMaker.vue new file mode 100644 index 0000000..9afc342 --- /dev/null +++ b/src/BIMDataBuildingMaker/BIMDataBuildingMaker.vue @@ -0,0 +1,183 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingForm/BuildingForm.scss b/src/BIMDataBuildingMaker/BuildingForm/BuildingForm.scss new file mode 100644 index 0000000..c87119b --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingForm/BuildingForm.scss @@ -0,0 +1,33 @@ +.building-form { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + gap: calc(2 * var(--spacing-unit)); + + &__icon { + width: 36px; + } + + &__title { + margin: 0; + } + + &__text { + text-align: center; + color: var(--color-granite); + } + + &__controls { + width: 100%; + padding: 0 20%; + + .bimdata-input { + width: 100%; + } + + .bimdata-btn { + margin-left: auto; + } + } +} diff --git a/src/BIMDataBuildingMaker/BuildingForm/BuildingForm.vue b/src/BIMDataBuildingMaker/BuildingForm/BuildingForm.vue new file mode 100644 index 0000000..8578933 --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingForm/BuildingForm.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.scss b/src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.scss new file mode 100644 index 0000000..ce5c47e --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.scss @@ -0,0 +1,35 @@ +.building-storeys { + height: 100%; + + .content { + position: relative; + height: 100%; + display: flex; + flex-direction: column; + } + + &__tree, + &__dms { + flex-grow: 1; + overflow-y: auto; + } + + &__form { + position: absolute; + top: calc(var(--spacing-unit) * 2); + left: 0; + width: 100%; + } + + &:deep(.bimdata-file-manager) { + position: static; + + .bimdata-file-manager__pdf-page-selector { + position: absolute; + top: -12px; + left: -12px; + width: calc(100% + 24px); + height: calc(100% + 24px); + } + } +} diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.vue b/src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.vue new file mode 100644 index 0000000..a5bdafa --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/BuildingStoreys.vue @@ -0,0 +1,213 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.scss b/src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.scss new file mode 100644 index 0000000..e433de4 --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.scss @@ -0,0 +1,25 @@ +.storey-form { + display: flex; + flex-direction: column; + gap: calc(var(--spacing-unit) * 2); + padding: var(--spacing-unit); + + box-shadow: var(--box-shadow); + background-color: var(--color-white); + + &__title { + display: flex; + align-items: center; + gap: var(--spacing-unit); + } + + &__input { + width: 100%; + } + + &__actions { + display: flex; + flex-direction: row-reverse; + gap: var(--spacing-unit); + } +} diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.vue b/src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.vue new file mode 100644 index 0000000..87719a2 --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreyForm/StoreyForm.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.scss b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.scss new file mode 100644 index 0000000..45f7557 --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.scss @@ -0,0 +1,52 @@ +.storey-node { + &__storey { + position: relative; + display: flex; + align-items: center; + gap: var(--spacing-unit); + margin-left: calc(var(--spacing-unit) / 2); + padding: calc(var(--spacing-unit) / 3) calc(var(--spacing-unit) / 2); + + &::before { + content: ""; + position: absolute; + left: calc(0px - calc(var(--spacing-unit) / 2)); + width: calc(var(--spacing-unit) / 2); + height: 1px; + background-color: var(--color-granite-light); + } + + &:hover { + background-color: var(--color-silver-light); + } + + &__name { + width: calc(100% - 2 * var(--spacing-unit) - 16px - 23px); + } + + &__actions { + position: absolute; + top: 50%; + right: calc(23px + var(--spacing-unit) * 3 / 2); + transform: translateY(-50%); + + display: flex; + gap: calc(var(--spacing-unit) / 2); + } + } + + &__plans { + position: relative; + margin-left: 20px; + + &::before { + content: ""; + position: absolute; + top: -3px; + left: -1px; + width: 1px; + height: calc(100% - 6px); + background-color: var(--color-granite-light); + } + } +} diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.vue b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.vue new file mode 100644 index 0000000..6b2feee --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyNode/StoreyNode.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.scss b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.scss new file mode 100644 index 0000000..634b56f --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.scss @@ -0,0 +1,28 @@ +.storey-plans { + &__item { + position: relative; + display: flex; + align-items: center; + gap: calc(var(--spacing-unit) / 2); + margin-left: calc(var(--spacing-unit) / 2); + padding: 0 calc(var(--spacing-unit) / 2); + + &::before { + content: ""; + position: absolute; + left: calc(0px - calc(var(--spacing-unit) / 2)); + width: calc(var(--spacing-unit) / 2); + height: 1px; + background-color: var(--color-granite-light); + } + + &__name { + width: 70%; + } + + &__close-btn { + margin-left: auto; + margin-right: 2px; + } + } +} diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.vue b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.vue new file mode 100644 index 0000000..6dc262b --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreyPlans/StoreyPlans.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.scss b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.scss new file mode 100644 index 0000000..6dc0bf3 --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.scss @@ -0,0 +1,40 @@ +.storeys-tree { + position: relative; + display: flex; + flex-direction: column; + + &__root { + display: flex; + align-items: center; + gap: var(--spacing-unit); + margin-bottom: calc(var(--spacing-unit) / 2); + } + + &__leafs { + display: flex; + flex-direction: column; + margin-left: calc(var(--spacing-unit) / 2); + border-left: 1px solid var(--color-granite-light); + } + + &__tail { + margin-left: calc(var(--spacing-unit) / 2); + + .content { + &::before { + content: ""; + position: relative; + top: -25%; + width: calc(var(--spacing-unit) / 2); + height: 17px; + border-left: 1px solid var(--color-granite-light); + border-bottom: 1px solid var(--color-granite-light); + } + + height: 32px; + display: flex; + align-items: center; + gap: calc(var(--spacing-unit) / 2); + } + } +} diff --git a/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.vue b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.vue new file mode 100644 index 0000000..eaab201 --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingStoreys/StoreysTree/StoreysTree.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.scss b/src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.scss new file mode 100644 index 0000000..464476a --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.scss @@ -0,0 +1,34 @@ +.building-item { + position: relative; + width: 100%; + display: flex; + align-items: center; + gap: var(--spacing-unit); + padding: calc(var(--spacing-unit) / 2) var(--spacing-unit); + border-radius: 4px; + + background-color: var(--color-silver-light); + cursor: pointer; + + &__name { + width: calc(100% - 2 * var(--spacing-unit) - 22px - 32px); + } + + &__actions { + position: relative; + + &__menu { + width: 180px; + position: absolute; + z-index: 1; + top: 30px; + right: 0; + display: flex; + flex-direction: column; + padding: calc(var(--spacing-unit) / 2) 0; + + box-shadow: var(--box-shadow); + background-color: var(--color-white); + } + } +} diff --git a/src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.vue b/src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.vue new file mode 100644 index 0000000..7a2d0b9 --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingsList/BuildingItem/BuildingItem.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/BuildingsList/BuildingsList.scss b/src/BIMDataBuildingMaker/BuildingsList/BuildingsList.scss new file mode 100644 index 0000000..ef0281e --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingsList/BuildingsList.scss @@ -0,0 +1,31 @@ +.buildings-list { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + gap: calc(2 * var(--spacing-unit)); + + &__icon { + width: 36px; + } + + &__title { + margin: 0; + } + + &__text { + text-align: center; + color: var(--color-granite); + } + + &__list { + flex-grow: 1; + position: relative; + width: 100%; + padding: calc(var(--spacing-unit) / 2); + display: flex; + flex-direction: column; + gap: var(--spacing-unit); + overflow: auto; + } +} diff --git a/src/BIMDataBuildingMaker/BuildingsList/BuildingsList.vue b/src/BIMDataBuildingMaker/BuildingsList/BuildingsList.vue new file mode 100644 index 0000000..c00836c --- /dev/null +++ b/src/BIMDataBuildingMaker/BuildingsList/BuildingsList.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/src/BIMDataBuildingMaker/config.js b/src/BIMDataBuildingMaker/config.js new file mode 100644 index 0000000..16c2eed --- /dev/null +++ b/src/BIMDataBuildingMaker/config.js @@ -0,0 +1,5 @@ +const PLAN_FILE_EXTENSIONS = Object.freeze(["jpeg", "jpg", "pdf", "png"]); + +export { + PLAN_FILE_EXTENSIONS, +}; diff --git a/src/BIMDataBuildingMaker/icon.svg b/src/BIMDataBuildingMaker/icon.svg new file mode 100644 index 0000000..dd34cd1 --- /dev/null +++ b/src/BIMDataBuildingMaker/icon.svg @@ -0,0 +1,21 @@ + + + + + + + diff --git a/src/BIMDataBuildingMaker/service.js b/src/BIMDataBuildingMaker/service.js new file mode 100644 index 0000000..237cd96 --- /dev/null +++ b/src/BIMDataBuildingMaker/service.js @@ -0,0 +1,121 @@ +function createService(apiClient, space, project) { + const spaceId = space.id; + const projectId = project.id; + const modelApi = apiClient.modelApi; + + function fetchMetaBuildings() { + return modelApi.getModels( + spaceId, + projectId, + undefined, // source + undefined, // status + "METABUILDING" // type + ); + } + + function createMetaBuilding(model) { + return modelApi.createMetaBuilding(spaceId, projectId, model); + } + + function updateMetaBuilding(model) { + return modelApi.updateModel(spaceId, model.id, projectId, model); + } + + function deleteMetaBuilding(model) { + return modelApi.deleteModel(spaceId, model.id, projectId); + } + + // --- + + async function fetchStoreys(model) { + return modelApi.getStoreys(spaceId, model.id, projectId); + } + + function createStorey(model, storey) { + return modelApi.createStorey( + spaceId, + model.id, + projectId, + storey + ); + } + + function updateStorey(model, storey) { + return modelApi.updateStorey( + spaceId, + model.id, + projectId, + storey.uuid, + storey + ); + } + + function deleteStorey(model, storey) { + return modelApi.deleteStorey( + spaceId, + model.id, + projectId, + storey.uuid + ); + } + + /** + * Create a model for each given documents + */ + function createPlanModels(documents) { + return Promise.all( + documents.map(doc => + doc.model_id + ? Promise.resolve({ id: doc.model_id }) + : modelApi.createModel( + spaceId, + projectId, + { document_id: doc.id } + ) + ) + ); + } + + /** + * Link a list of models to the given meta-building storey + */ + function createStoreyPlans(model, storey, plans) { + return Promise.all( + plans.map(plan => + modelApi.createStoreyPlan( + spaceId, + model.id, + projectId, + storey.uuid, + { id: plan.id } + ) + ) + ); + } + + function deleteStoreyPlan(model, storey, plan) { + return modelApi.deleteStoreyPlan( + spaceId, + plan.plan.id, + model.id, + projectId, + storey.uuid + ); + } + + return { + fetchMetaBuildings, + createMetaBuilding, + updateMetaBuilding, + deleteMetaBuilding, + fetchStoreys, + createStorey, + updateStorey, + deleteStorey, + createPlanModels, + createStoreyPlans, + deleteStoreyPlan, + }; +} + +export { createService }; diff --git a/src/BIMDataFileManager/BIMDataFileManager.vue b/src/BIMDataFileManager/BIMDataFileManager.vue index 75becb9..7bc66fd 100644 --- a/src/BIMDataFileManager/BIMDataFileManager.vue +++ b/src/BIMDataFileManager/BIMDataFileManager.vue @@ -78,7 +78,7 @@ />
- {{ translate("dmsRoot") }} + {{ $t("FileManager.dmsRoot") }}
@@ -174,8 +174,6 @@ import PdfPageSelector from "./components/PdfPageSelector.vue"; import getFlattenTree from "./utils/flattenTree.js"; import { downloadFiles } from "./utils/files.js"; -import trads from "./i18n.js"; - const XS = 398; const S = 468; const M = 800; @@ -192,11 +190,6 @@ export default { BIMDataPDFViewer, PdfPageSelector, }, - provide() { - return { - $translate: this.translate, - }; - }, props: { locale: { type: String, @@ -400,9 +393,6 @@ export default { } } }, - translate(key) { - return (trads[this.locale] || trads["en"])[key]; - }, isFileSucess(id) { return ( this.successFileIds.includes(id) || @@ -425,7 +415,7 @@ export default { this.$emit("success", { type: "fileCreated", - message: this.translate("newFileSuccess"), + message: this.$t("FileManager.newFileSuccess"), content: loadedFile, }); @@ -466,8 +456,8 @@ export default { this.$emit("success", { type: isFolder ? "folderDeleted" : "fileDeleted", message: isFolder - ? this.translate("deleteFolderSuccess") - : this.translate("deleteFileSuccess"), + ? this.$t("FileManager.deleteFolderSuccess") + : this.$t("FileManager.deleteFileSuccess"), content: this.entityDeletable, }); @@ -482,8 +472,8 @@ export default { this.$emit("success", { type: isFolder ? "folderRenamed" : "fileRenamed", message: isFolder - ? this.translate("renameFolderSuccess") - : this.translate("renameFileSuccess"), + ? this.$t("FileManager.renameFolderSuccess") + : this.$t("FileManager.renameFileSuccess"), content: this.entityRenown, }); this.entityRenown = null; @@ -522,7 +512,7 @@ export default { this.currentFolder.children.push(newFolder); this.$emit("success", { type: "folderCreated", - message: this.translate("newFolderSuccess"), + message: this.$t("FileManager.newFolderSuccess"), content: newFolder, }); }, diff --git a/src/BIMDataFileManager/components/FileCard.vue b/src/BIMDataFileManager/components/FileCard.vue index 01fb468..673c7e6 100644 --- a/src/BIMDataFileManager/components/FileCard.vue +++ b/src/BIMDataFileManager/components/FileCard.vue @@ -78,7 +78,7 @@ width="100%" @click.stop="onViewClick" > - {{ $translate("view") }} + {{ $t("FileManager.view") }} - {{ $translate("rename") }} + {{ $t("FileManager.rename") }} - {{ $translate("download") }} + {{ $t("FileManager.download") }} - {{ $translate("delete") }} + {{ $t("FileManager.delete") }} @@ -64,7 +64,6 @@ import { computed, ref, watch } from 'vue'; export default { - inject: ["$translate"], props: { model: { type: Object, diff --git a/src/BIMDataFileManager/components/UploadFileButton.vue b/src/BIMDataFileManager/components/UploadFileButton.vue index feec8e9..62097b7 100644 --- a/src/BIMDataFileManager/components/UploadFileButton.vue +++ b/src/BIMDataFileManager/components/UploadFileButton.vue @@ -11,7 +11,7 @@ > - {{ $translate("addFileButtonText") }} + {{ $t("FileManager.addFileButtonText") }} export default { - inject: ["$translate"], props: { width: { type: String, diff --git a/src/BIMDataFileManager/components/modals/DeleteModal.vue b/src/BIMDataFileManager/components/modals/DeleteModal.vue index 5e25d5f..6b6d6dd 100644 --- a/src/BIMDataFileManager/components/modals/DeleteModal.vue +++ b/src/BIMDataFileManager/components/modals/DeleteModal.vue @@ -15,10 +15,10 @@
- {{ $translate("deleteTitle") }} + {{ $t("FileManager.eleteTitle") }}
- {{ $translate("deleteDetail") }} : + {{ $t("FileManager.deleteDetail") }} :
@@ -57,7 +57,6 @@ import getFlattenTree from "../../utils/flattenTree.js"; export default { - inject: ["$translate"], props: { projectId: { type: Number, diff --git a/src/BIMDataFileManager/components/modals/RenameModal.vue b/src/BIMDataFileManager/components/modals/RenameModal.vue index a372b39..5183d36 100644 --- a/src/BIMDataFileManager/components/modals/RenameModal.vue +++ b/src/BIMDataFileManager/components/modals/RenameModal.vue @@ -14,15 +14,15 @@
- {{ $translate("rename") }} + {{ $t("FileManager.rename") }}
- {{ $translate("cancel") }} + {{ $t("FileManager.cancel") }} - {{ $translate("submit") }} + {{ $t("FileManager.submit") }}
@@ -55,7 +55,6 @@ + + + + diff --git a/src/BIMDataMetaBuildingStructure/EquipmentsView/EquipmentsView.vue b/src/BIMDataMetaBuildingStructure/EquipmentsView/EquipmentsView.vue new file mode 100644 index 0000000..e60462d --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/EquipmentsView/EquipmentsView.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/BIMDataMetaBuildingStructure/StoreySelector/StoreySelector.vue b/src/BIMDataMetaBuildingStructure/StoreySelector/StoreySelector.vue new file mode 100644 index 0000000..efe8d82 --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/StoreySelector/StoreySelector.vue @@ -0,0 +1,71 @@ + + + diff --git a/src/BIMDataMetaBuildingStructure/StructureTreeNodes/GenericTreeNode.vue b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/GenericTreeNode.vue new file mode 100644 index 0000000..c513de0 --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/GenericTreeNode.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/BIMDataMetaBuildingStructure/StructureTreeNodes/PlanNode.vue b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/PlanNode.vue new file mode 100644 index 0000000..7c79d82 --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/PlanNode.vue @@ -0,0 +1,29 @@ + + diff --git a/src/BIMDataMetaBuildingStructure/StructureTreeNodes/SpaceNode.vue b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/SpaceNode.vue new file mode 100644 index 0000000..7b395bb --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/SpaceNode.vue @@ -0,0 +1,23 @@ + + diff --git a/src/BIMDataMetaBuildingStructure/StructureTreeNodes/StructureRootNode.vue b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/StructureRootNode.vue new file mode 100644 index 0000000..0644eaf --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/StructureRootNode.vue @@ -0,0 +1,46 @@ + + + + diff --git a/src/BIMDataMetaBuildingStructure/StructureTreeNodes/ZoneNode.vue b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/ZoneNode.vue new file mode 100644 index 0000000..175bc56 --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/StructureTreeNodes/ZoneNode.vue @@ -0,0 +1,43 @@ + + + + diff --git a/src/BIMDataMetaBuildingStructure/StructureView/StructureView.vue b/src/BIMDataMetaBuildingStructure/StructureView/StructureView.vue new file mode 100644 index 0000000..c493cf6 --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/StructureView/StructureView.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/BIMDataMetaBuildingStructure/ZonesView/ZonesView.vue b/src/BIMDataMetaBuildingStructure/ZonesView/ZonesView.vue new file mode 100644 index 0000000..b61e6eb --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/ZonesView/ZonesView.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/src/BIMDataMetaBuildingStructure/meta-building-structure.js b/src/BIMDataMetaBuildingStructure/meta-building-structure.js new file mode 100644 index 0000000..397cd7b --- /dev/null +++ b/src/BIMDataMetaBuildingStructure/meta-building-structure.js @@ -0,0 +1,76 @@ +import { ref } from "vue"; + +export function buildStructureTree(model, storey) { + return [ + { + id: 1, + text: "Zones", + children: buildZonesTree(model, storey), + }, + { + id: 2, + text: "Plans", + children: buildPlansTree(model, storey), + } + ]; +} + +export function buildZonesTree(model, storey) { + if (!model || !storey) return []; + + const zones = model.zones.filter(zone => zone.storey_uuid === storey.uuid); + + return zones.map(zoneNode); +} + +export function buildPlansTree(model, storey) { + if (!model || !storey) return []; + + return storey.plans.map(planNode); +} + +export function setupTree(tree, parent) { + if (Array.isArray(tree)) { + tree = tree.map(t => setupTree(t, parent)); + } else { + tree.visibleRef = ref(true); + tree.expandedRef = ref(true); + tree.selectedRef = ref(true); + tree.parent = parent; + + tree.ancestors = () => tree.parent ? [tree.parent].concat(tree.parent.ancestors()) : []; + + const children = () => tree.children ?? []; + tree.descendants = () => children().concat(children().flatMap(child => child.descendants())); + + tree.children = tree.children?.map(child => setupTree(child, tree)) ?? []; + } + return tree; +} + +export function flattenTree(tree) { + if (Array.isArray(tree)) { + return tree.flatMap(t => flattenTree(t)); + } else { + return [tree].concat(tree.descendants()); + } +} + +const zoneNode = zone => ({ + id: zone.id, + text: zone.name, + children: zone.zones.map(zoneNode).concat(zone.spaces.map(spaceNode)), + zone, +}); + +const spaceNode = space => ({ + id: space.id, + text: space.name, + space, +}); + +const planNode = plan => ({ + id: plan.plan.id, + text: plan.plan.name, + plan, +}); diff --git a/src/i18n/index.js b/src/i18n/index.js new file mode 100644 index 0000000..efd1383 --- /dev/null +++ b/src/i18n/index.js @@ -0,0 +1,13 @@ +import de from "./lang/de.json"; +import en from "./lang/en.json"; +import es from "./lang/es.json"; +import fr from "./lang/fr.json"; +import it from "./lang/it.json"; + +export default { + de, + en, + es, + fr, + it, +}; diff --git a/src/i18n/lang/de.json b/src/i18n/lang/de.json new file mode 100644 index 0000000..8d6fbbd --- /dev/null +++ b/src/i18n/lang/de.json @@ -0,0 +1,55 @@ +{ + "BuildingMaker": { + "title": "Building Maker", + "back": "Zurück", + "list": { + "text": "Erstellen und bearbeiten Sie die Etagen und laden Sie anschließend Ihre PDFs herunter.", + "createButton": "Neues Projekt", + "updateButton": "Umbenennen", + "deleteButton": "Löschen" + }, + "form": { + "text": "Erstellen und bearbeiten Sie die Etagen und laden Sie anschließend Ihre PDFs herunter.", + "input": "Name des Gebäudes", + "error": "Ungültiger Name", + "createButton": "Erstellen", + "updateButton": "Bestätigen" + }, + "storeys": { + "addStoreyButton": "Etage", + "addFileButton": "Grundriss", + "closeButton": "Fertigstellen", + "submitFilesButton": "Bestätigen" + }, + "storeyForm": { + "title": "Neue Etage", + "input": "Name", + "error": "Ungültiger Name", + "cancelButton": "Abbrechen", + "submitButton": "Bestätigen" + } + }, + "FileManager": { + "creationFormTitle": "Ordner erstellen", + "renameFormPlaceholder": "Datei- / Ordnernam", + "nameInputPlaceholder": "Ordnername", + "emptyFolder": "Dieser Ordner ist leer", + "newFolderSuccess": "Neuer Ordner erstellt", + "renameFolderSuccess": "Umbenannter Ordner", + "deleteFolderSuccess": "Ordner gelöscht", + "newFileSuccess": "Datei hinzugefügt", + "renameFileSuccess": "Umbenannte Datei", + "deleteFileSuccess": "Datei gelöscht", + "nameInputErrorMessage": "Ungültiger name", + "cancel": "Abbrechen", + "submit": "Bestätigen", + "buttonText": "Neuer Ordner", + "addFileButtonText": "Datei laden", + "rename": "Umbenennen", + "view": "Sehen", + "download": "Herunterladen", + "delete": "Löschen", + "deleteTitle": "Dateien löschen", + "deleteDetail": "Sie sind im Begriff, die folgenden Dateien / Ordner endgültig zu löschen" + } +} \ No newline at end of file diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json new file mode 100644 index 0000000..a8c59b9 --- /dev/null +++ b/src/i18n/lang/en.json @@ -0,0 +1,73 @@ +{ + "BuildingMaker": { + "title": "Building", + "back": "Back", + "list": { + "text": "Create and edit the layers, then download your PDFs.", + "createButton": "New project", + "updateButton": "Rename", + "deleteButton": "Delete" + }, + "form": { + "text": "Create and edit the layers, then download your PDFs.", + "input": "Building name", + "error": "Invalid", + "createButton": "Create", + "updateButton": "Confirm" + }, + "storeys": { + "addStoreyButton": "Storey", + "addFileButton": "Plan", + "closeButton": "Finish", + "submitFilesButton": "Validate" + }, + "storeyForm": { + "title": "New storey", + "input": "Name", + "error": "Invalid name", + "cancelButton": "Cancel", + "submitButton": "Validate" + } + }, + "FileManager": { + "creationFormTitle": "Create folder", + "renameFormPlaceholder": "Folder/File name", + "nameInputPlaceholder": "Folder name", + "emptyFolder": "This folder is empty", + "newFolderSuccess": "New folder created", + "renameFolderSuccess": "Folder renamed", + "deleteFolderSuccess": "Folder deleted", + "newFileSuccess": "File added", + "renameFileSuccess": "File renamed", + "deleteFileSuccess": "File deleted", + "nameInputErrorMessage": "Invalid name", + "cancel": "Cancel", + "submit": "Submit", + "buttonText": "New folder", + "addFileButtonText": "Upload a file", + "rename": "Rename", + "view": "View", + "download": "Download", + "delete": "Delete", + "deleteTitle": "Deleting Files", + "deleteDetail":"You are about to permanently delete the following files / folders", + "dmsRoot": "Root of the project's DMS", + "validate": "Validate", + "back": "Back", + "pdfPageSelectorTitle": "Select a page" + }, + "MetaBuildingStructure": { + "title": "Meta-Building Structure", + "tab": { + "structure": "Structure", + "zones": "Zones", + "equipments": "Equipments" + }, + "StoreySelector": { + "placeholder": "Select a storey" + }, + "StructureView": { + "search": "Search" + } + } +} \ No newline at end of file diff --git a/src/i18n/lang/es.json b/src/i18n/lang/es.json new file mode 100644 index 0000000..e6ab67d --- /dev/null +++ b/src/i18n/lang/es.json @@ -0,0 +1,55 @@ +{ + "BuildingMaker": { + "title": "Building Maker", + "back": "Vuelta", + "list": { + "text": "Cree y edite los pisos después cargue los PDF.", + "createButton": "Nuevo proyecto", + "updateButton": "Renombrar", + "deleteButton": "Suprimir" + }, + "form": { + "text": "Cree y edite los pisos después cargue los PDF.", + "input": "Nombre del edificio", + "error": "Nombre no válido", + "createButton": "Crear", + "updateButton": "Validar" + }, + "storeys": { + "addStoreyButton": "Piso", + "addFileButton": "Plano", + "closeButton": "Terminar", + "submitFilesButton": "Validar" + }, + "storeyForm": { + "title": "Nuevo piso", + "input": "Nombre", + "error": "Nombre no válido", + "cancelButton": "Anular", + "submitButton": "Validar" + } + }, + "FileManager": { + "creationFormTitle": "Crear un archivo", + "renameFormPlaceholder": "Nombre de archivo / carpeta", + "nameInputPlaceholder": "Nombre de la carpeta", + "emptyFolder": "Esta carpeta está vacía", + "newFolderSuccess": "Nueva carpeta creada", + "renameFolderSuccess": "Carpeta renombrada", + "deleteFolderSuccess": "Carpeta eliminada", + "newFileSuccess": "Archivo agregado", + "renameFileSuccess": "Archivo renombrado", + "deleteFileSuccess": "Archivo eliminado", + "nameInputErrorMessage": "Nombre inválida", + "cancel": "Cancelar", + "submit": "Validar", + "buttonText": "Carpeta nueva", + "addFileButtonText": "Cargar un archivo", + "rename": "Renombrar", + "view": "Ver", + "download": "Descargar", + "delete": "Borrar", + "deleteTitle": "Eliminar archivos", + "deleteDetail": "Está a punto de eliminar permanentemente los siguientes archivos / carpetas" + } +} \ No newline at end of file diff --git a/src/i18n/lang/fr.json b/src/i18n/lang/fr.json new file mode 100644 index 0000000..dea3021 --- /dev/null +++ b/src/i18n/lang/fr.json @@ -0,0 +1,74 @@ +{ + "BuildingMaker": { + "title": "Building Maker", + "back": "Retour", + "list": { + "text": "Créez et éditez les étages puis téléchagez vos PDF.", + "createButton": "Nouveau projet", + "updateButton": "Renommer", + "deleteButton": "Supprimer" + }, + "form": { + "text": "Créez et éditez les étages puis téléchagez vos PDF.", + "input": "Nom du bâtiment", + "error": "Nom invalide", + "createButton": "Créer", + "updateButton": "Valider" + }, + "storeys": { + "addStoreyButton": "Étage", + "addFileButton": "Plan", + "closeButton": "Terminer", + "submitFilesButton": "Valider" + }, + "storeyForm": { + "title": "Nouvel étage", + "input": "Nom", + "error": "Nom invalide", + "cancelButton": "Annuler", + "submitButton": "Valider" + } + }, + "FileManager": { + "creationFormTitle": "Créer un dossier", + "renameFormPlaceholder": "Nom du fichier/dosier", + "nameInputPlaceholder": "Nom du dossier", + "emptyFolder": "Ce dossier est vide", + "newFolderSuccess": "Nouveau dossier créé", + "renameFolderSuccess": "Dossier renommé", + "deleteFolderSuccess": "Dossier supprimé", + "newFileSuccess": "Fichier ajouté", + "renameFileSuccess": "Fichier renommé", + "deleteFileSuccess": "Fichier supprimé", + "nameInputErrorMessage": "Nom invalide", + "cancel": "Annuler", + "submit": "Valider", + "buttonText": "Nouveau dossier", + "addFileButtonText": "Charger un fichier", + "rename": "Renommer", + "view": "Voir", + "download": "Télécharger", + "delete": "Supprimer", + "deleteTitle": "Supression de fichiers", + "deleteDetail": + "Vous êtes sur le point de supprimer définitivement les fichiers/dossiers suivants", + "dmsRoot": "Racine de la GED du projet", + "validate": "Valider", + "back": "Retour", + "pdfPageSelectorTitle": "Sélectionner une page" + }, + "MetaBuildingStructure": { + "title": "Structure Méta-Building", + "tab": { + "structure": "Structure", + "zones": "Zones", + "equipments": "Equipements" + }, + "StoreySelector": { + "placeholder": "Sélectionner un étage" + }, + "StructureView": { + "search": "Rechercher" + } + } +} \ No newline at end of file diff --git a/src/i18n/lang/it.json b/src/i18n/lang/it.json new file mode 100644 index 0000000..feaef57 --- /dev/null +++ b/src/i18n/lang/it.json @@ -0,0 +1,55 @@ +{ + "BuildingMaker": { + "title": "Building Maker", + "back": "Reso", + "list": { + "text": "Crea e modifica i piani e poi scarica i tuoi PDF.", + "createButton": "Nuovo progetto", + "updateButton": "Rinominare", + "deleteButton": "Eliminare" + }, + "form": { + "text": "Crea e modifica i piani e poi scarica i tuoi PDF.", + "input": "Nome della costruzione", + "error": "Nome non corretto", + "createButton": "Creare", + "updateButton": "Convalidare" + }, + "storeys": { + "addStoreyButton": "Piano", + "addFileButton": "Progetto", + "closeButton": "Finire", + "submitFilesButton": "Convalidare" + }, + "storeyForm": { + "title": "Nuovo piano", + "input": "Nome", + "error": "Nome non corretto", + "cancelButton": "Annullare", + "submitButton": "Convalidare" + } + }, + "FileManager": { + "creationFormTitle": "Crea una cartella", + "renameFormPlaceholder": "Nome file/cartella", + "nameInputPlaceholder": "Nome della cartella", + "emptyFolder": "Questa cartella è vuota", + "newFolderSuccess": "Nuova cartella creata", + "renameFolderSuccess": "Cartella rinominata", + "deleteFolderSuccess": "Cartella eliminata", + "newFileSuccess": "File aggiunto", + "renameFileSuccess": "File rinominato", + "deleteFileSuccess": "File cancellato", + "nameInputErrorMessage": "Nome non valido", + "cancel": "Annulla", + "submit": "Invia", + "buttonText": "Nuova cartella", + "addFileButtonText": "Carica un file", + "rename": "Rinominare", + "view": "Vedere", + "download": "Scaricare", + "delete": "Cancellare", + "deleteTitle": "Eliminazione di file", + "deleteDetail": "Stai per eliminare definitivamente i seguenti file/cartelle" + } +} \ No newline at end of file diff --git a/vue3-plugin.js b/vue3-plugin.js index a012f34..e683390 100644 --- a/vue3-plugin.js +++ b/vue3-plugin.js @@ -1,36 +1,32 @@ +import messages from "./src/i18n/index.js"; import * as Components from "./index.js"; /** * Register BIMData components globally. * * @param { -* { -* includedComponents?: string[], -* excludedComponents?: string[] -* } -* } [cfg] + * { + * i18nPlugin: Object + * } + * } [cfg] */ -const pluginFactory = (cfg) => { +const pluginFactory = ({ i18nPlugin }) => { return { install(app) { - // COMPONENTS - Object.entries(Components).forEach(([componentName, component]) => { - if ( - cfg && - cfg.excludedComponents && - cfg.excludedComponents.length > 0 && - cfg.excludedComponents.includes(componentName) - ) { - return; - } + if (i18nPlugin) { + Object.entries(messages).forEach(([locale, translations]) => { + i18nPlugin.global.mergeLocaleMessage(locale, translations); + }); + } else { + console.warn( + "[BIMData Components Plugin] No i18n instance provided. " + + "You should either provide an i18n instance or define " + + "your own translations in order have text displayed properly." + ); + } - if ( - !cfg || - !cfg.includedComponents || - cfg.includedComponents.includes(componentName) - ) { + Object.entries(Components).forEach(([componentName, component]) => { app.component(componentName, component); - } }); }, };