Skip to content

Commit

Permalink
Merge pull request #183 from digi-serve/widget/pdfImporter
Browse files Browse the repository at this point in the history
+Add PDF Importer widget
  • Loading branch information
wongpratan authored Aug 15, 2023
2 parents 22604f7 + 5f22395 commit c77fd48
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions ABViewManagerCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var AllViews = [
require("../platform/views/ABViewList"),
require("../platform/views/ABViewMenu"),
require("../platform/views/ABViewPage"),
require("../platform/views/ABViewPDFImporter"),
require("../platform/views/ABViewPivot"),
require("../platform/views/ABViewTab"),
require("../platform/views/ABViewText"),
Expand Down
84 changes: 84 additions & 0 deletions views/ABViewPDFImporterCore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
const ABViewWidget = require("../../platform/views/ABViewWidget");

const ABViewPDFImporterPropertyComponentDefaults = {
dataviewID: null,
fieldID: null,
};

const ABViewDefaults = {
key: "pdfImporter", // {string} unique key for this view
icon: "file-pdf-o", // {string} fa-[icon] reference for this view
labelKey: "PDF Importer", // {string} the multilingual label key for the class label
};

module.exports = class ABViewPDFImporterCore extends ABViewWidget {
constructor(values, application, parent, defaultValues) {
super(values, application, parent, defaultValues || ABViewDefaults);
}

static common() {
return ABViewDefaults;
}

static defaultValues() {
return ABViewPDFImporterPropertyComponentDefaults;
}

///
/// Instance Methods
///

/**
* @method fromValues()
*
* initialze this object with the given set of values.
* @param {obj} values
*/
fromValues(values) {
super.fromValues(values);

this.settings.dataviewID =
this.settings.dataviewID ??
ABViewPDFImporterPropertyComponentDefaults.dataviewID;

this.settings.fieldID =
this.settings.fieldID ??
ABViewPDFImporterPropertyComponentDefaults.fieldID;

// Convert to boolean
// this.settings.removeMissed = JSON.parse(
// this.settings.removeMissed ||
// ABViewPDFImporterPropertyComponentDefaults.removeMissed
// );

// "0" -> 0
// this.settings.height = parseInt(
// this.settings.height ||
// ABViewPDFImporterPropertyComponentDefaults.height
// );
}

/**
* @method toObj()
*
* properly compile the current state of this ABViewLabel instance
* into the values needed for saving.
*
* @return {json}
*/
toObj() {
var obj = super.toObj();

obj.settings = obj.settings ?? {};

return obj;
}

/**
* @method componentList
* return the list of components available on this view to display in the editor.
*/
componentList() {
return [];
}
};

0 comments on commit c77fd48

Please sign in to comment.