From 67359e9f0bfeed45db377b8fe6c11d6aadf4ea60 Mon Sep 17 00:00:00 2001 From: BenWirachot Date: Thu, 11 Jun 2026 12:54:24 +0700 Subject: [PATCH] Remove ABViewDocxBuilderCore and comment out its reference in the view manager --- ABViewManagerCore.js | 2 +- views/ABViewDocxBuilderCore.js | 102 --------------------------------- 2 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 views/ABViewDocxBuilderCore.js diff --git a/ABViewManagerCore.js b/ABViewManagerCore.js index ec87a3d6..dfb0f620 100644 --- a/ABViewManagerCore.js +++ b/ABViewManagerCore.js @@ -22,7 +22,7 @@ var AllViews = [ require("../platform/views/ABViewDataFilter"), // require("../platform/views/ABViewDataSelect"), require("../platform/views/ABViewDataview"), - require("../platform/views/ABViewDocxBuilder"), + // require("../platform/views/ABViewDocxBuilder"), // require("../platform/views/ABViewGrid"), // require("../platform/views/ABViewImage"), // require("../platform/views/ABViewLabel"), diff --git a/views/ABViewDocxBuilderCore.js b/views/ABViewDocxBuilderCore.js deleted file mode 100644 index b8fc33d5..00000000 --- a/views/ABViewDocxBuilderCore.js +++ /dev/null @@ -1,102 +0,0 @@ -const ABViewWidget = require("../../platform/views/ABViewWidget"); - -const ABViewDocxBuilderPropertyComponentDefaults = { - buttonlabel: "Download DOCX", - dataviewID: null, - width: 0, - filename: "", // uuid - filelabel: "output.docx", - language: "en", // en - toolbarBackground: "ab-background-default", - buttonPosition: "left", -}; - -const ABViewDefaults = { - key: "docxBuilder", // {string} unique key for this view - icon: "file-word-o", // {string} fa-[icon] reference for this view - labelKey: "DOCX Builder", // {string} the multilingual label key for the class label -}; - -module.exports = class ABViewDocxBuilderCore extends ABViewWidget { - constructor(values, application, parent, defaultValues) { - super(values, application, parent, defaultValues || ABViewDefaults); - } - - static common() { - return ABViewDefaults; - } - - static defaultValues() { - return ABViewDocxBuilderPropertyComponentDefaults; - } - - /// - /// Instance Methods - /// - - /** - * @method toObj() - * - * properly compile the current state of this ABViewLabel instance - * into the values needed for saving. - * - * @return {json} - */ - toObj() { - this.unTranslate(this, this, ["filelabel", "buttonlabel"]); - - let obj = super.toObj(); - obj.viewIDs = []; - return obj; - } - - /** - * @method fromValues() - * - * initialze this object with the given set of values. - * @param {obj} values - */ - fromValues(values) { - super.fromValues(values); - - // convert from "0" => 0 - this.settings.width = parseInt( - this.settings.width || ABViewDocxBuilderPropertyComponentDefaults.width - ); - - this.translate(this, this, ["filelabel", "buttonlabel"]); - } - - uploadUrl() { - // TODO: Convert this to use ABFactory.urlFileUpload() or a ABFieldFile - // to get the URL: - - // support uploading template when more than one data source is selected - const object = this.datacollections[0].datasource; - - // NOTE: file-upload API needs to have the id of ANY field. - const field = object ? object.fields()[0] : null; - - return `/file/upload/${object?.id}/${field?.id}/1`; - } - - downloadUrl() { - return `/file/${this.settings.filename}`; - } - - get languageCode() { - return ( - this.settings.language || - ABViewDocxBuilderPropertyComponentDefaults.language - ); - } - - get datacollections() { - let dataviewID = (this.settings || {}).dataviewID; - if (!dataviewID) return []; - - let dvList = dataviewID.split(",") || []; - - return this.AB.datacollections((dv) => dvList.indexOf(dv.id) > -1) || []; - } -};