estimate-library
Advanced tools
Comparing version 0.2.12 to 0.2.13
@@ -23,2 +23,4 @@ "use strict"; | ||
Table.prototype.toggleDepartment = config_1.toggleDepartment; | ||
Table.prototype.updateSectionsOrder = core_1.updateSectionsOrder; | ||
Table.prototype.updateTasksOrder = core_1.updateTasksOrder; | ||
exports.default = Table; |
import ITable from "../types/ITable"; | ||
import ISection from "../types/ISection"; | ||
/** | ||
@@ -65,2 +66,12 @@ * create table from scratch with config parameters | ||
export declare function toggleDepartment(this: ITable, depId: number): void; | ||
/** | ||
* save section order after drag and drop event | ||
* @param sections | ||
*/ | ||
export declare function updateSectionsOrder(this: ITable, sections: Array<ISection>): void; | ||
/** | ||
* save and calculate sections after drag and drop event for some task | ||
* @param sections | ||
*/ | ||
export declare function updateTasksOrder(this: ITable, sections: Array<ISection>): void; | ||
export declare function calculateTable(this: ITable): void; |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.calculateTable = exports.toggleDepartment = exports.toggleTaskInSection = exports.updateTaskDepValue = exports.updateRowName = exports.updateSectionName = exports.duplicateRow = exports.duplicateSection = exports.deleteRow = exports.addRow = exports.deleteSection = exports.addSection = exports.createTable = void 0; | ||
exports.calculateTable = exports.updateTasksOrder = exports.updateSectionsOrder = exports.toggleDepartment = exports.toggleTaskInSection = exports.updateTaskDepValue = exports.updateRowName = exports.updateSectionName = exports.duplicateRow = exports.duplicateSection = exports.deleteRow = exports.addRow = exports.deleteSection = exports.addSection = exports.createTable = void 0; | ||
var sections_1 = require("./sections"); | ||
@@ -169,2 +169,21 @@ var row_1 = require("./row"); | ||
exports.toggleDepartment = toggleDepartment; | ||
/** | ||
* save section order after drag and drop event | ||
* @param sections | ||
*/ | ||
function updateSectionsOrder(sections) { | ||
this.sections = sections; | ||
} | ||
exports.updateSectionsOrder = updateSectionsOrder; | ||
/** | ||
* save and calculate sections after drag and drop event for some task | ||
* @param sections | ||
*/ | ||
function updateTasksOrder(sections) { | ||
var _this = this; | ||
this.sections = sections.map(function (section) { | ||
return sections_1.calculateSection.call(_this, __assign(__assign({}, section), { tasks: section.tasks.map(function (row) { return calculations_1.calculateRow.call(_this, row); }), total: calculations_1.calculateRow.call(_this, section.total) })); | ||
}); | ||
} | ||
exports.updateTasksOrder = updateTasksOrder; | ||
function calculateSubtotal() { | ||
@@ -171,0 +190,0 @@ var subtotal = (0, row_1.resetRowDepartments)(this.subtotal); |
import ITable from "./ITable"; | ||
import { IConfig } from "./IConfig"; | ||
import ISection from "./ISection"; | ||
export default interface IEstimate extends ITable { | ||
@@ -16,3 +17,5 @@ createTable: () => void; | ||
toggleDepartment: (depId: number) => void; | ||
updateSectionsOrder: (sections: Array<ISection>) => void; | ||
updateTasksOrder: (sections: Array<ISection>) => void; | ||
setConfig: (this: ITable, config?: Partial<IConfig>) => void; | ||
} |
{ | ||
"name": "estimate-library", | ||
"version": "0.2.12", | ||
"version": "0.2.13", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
31898
742