@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
49 lines (48 loc) • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoteApiImpl = void 0;
const tslib_1 = require("tslib");
const ApiBase_1 = require("./ApiBase");
const NoteRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/NoteRedux"));
const NoteInternalApi_1 = require("../Internal/NoteInternalApi");
class NoteApiImpl extends ApiBase_1.ApiBase {
constructor(_adaptable) {
super(_adaptable);
this.internalApi = new NoteInternalApi_1.NoteInternalApi(_adaptable);
}
addNote(noteStr, primaryKeyValue, columnId) {
const note = {
Text: noteStr,
PrimaryKeyValue: primaryKeyValue,
ColumnId: columnId,
Timestamp: Date.now(),
};
this.dispatchAction(NoteRedux.NoteAdd(note));
}
editNote(note) {
note.Timestamp = Date.now();
this.dispatchAction(NoteRedux.NoteEdit(note));
}
updateNoteText(noteStr, note) {
this.editNote({
...note,
Text: noteStr,
});
}
deleteNote(note) {
this.dispatchAction(NoteRedux.NoteDelete(note));
}
getNoteState() {
return this.getAdaptableState().Note;
}
getAllNotes() {
return this.getNoteState().Notes;
}
getNoteForCell(address) {
return NoteRedux.GetNoteSelector(this.getAdaptableState().Note, address);
}
getNoteByUuid(uuid) {
return this.getAllNotes().find((note) => note.Uuid === uuid);
}
}
exports.NoteApiImpl = NoteApiImpl;