Skip to content

Commit

Permalink
Merge branch '333-localization-i18n' of https://github.com/cidgoh/Dat…
Browse files Browse the repository at this point in the history
…aHarmonizer into 333-localization-i18n
  • Loading branch information
ddooley committed Nov 21, 2023
2 parents 95deae1 + de79f0e commit 2a569fc
Show file tree
Hide file tree
Showing 35 changed files with 938 additions and 1,033 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
Expand Down
10 changes: 0 additions & 10 deletions .idea/DataHarmonizer.iml

This file was deleted.

30 changes: 0 additions & 30 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

40 changes: 0 additions & 40 deletions lib/DataHarmonizer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '@selectize/selectize';
import Handsontable from 'handsontable';
import SheetClip from 'sheetclip';
import $ from 'jquery';
import i18next from 'i18next';
import { utils as XlsxUtils, read as xlsxRead } from 'xlsx/xlsx.mjs';
Expand Down Expand Up @@ -488,9 +487,6 @@ class DataHarmonizer {
createHot() {
const self = this;

this.clipboardCache = '';
this.sheetclip = new SheetClip();

this.invalid_cells = {};
if (this.hot) {
this.hot.destroy(); // handles already existing data
Expand All @@ -506,42 +502,6 @@ class DataHarmonizer {
rowHeaders: true,
copyPaste: true,
manualColumnResize: true,
//colWidths: [100], //Just fixes first column width
afterCopy: function (changes) {
self.clipboardCache = self.sheetclip.stringify(changes);
},
afterCut: function (changes) {
self.clipboardCache = self.sheetclip.stringify(changes);
},
afterPaste: function (changes) {
// we want to be sure that our cache is up to date, even if someone pastes data from another source than our tables.
self.clipboardCache = self.sheetclip.stringify(changes);
},
contextMenu: [
'copy',
'cut',
{
key: 'paste',
name: 'Paste',
disabled: function () {
return self.clipboardCache.length === 0;
},
callback: function () {
var plugin = this.getPlugin('copyPaste');

this.listen();
// BUG: It seems like extra lf is added by sheetclip, causing
// empty last row to be added and pasted. Exception is pasting
// of single empty cell
if (self.clipboardCache.length > 0)
self.clipboardCache = self.clipboardCache.slice(0, -1);
plugin.paste(self.clipboardCache);
},
},
'remove_row',
'row_above',
'row_below',
],
minRows: 100,
minSpareRows: 100,
width: '100%',
Expand Down
35 changes: 24 additions & 11 deletions lib/editors/FlatpickrEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import flatpickr from 'flatpickr';
import 'flatpickr/dist/themes/light.css';
import { format, parse } from 'date-fns';

const REF_DATE = new Date(0);
const REF_DATE = new Date();
REF_DATE.setHours(0, 0, 0, 0);

class FlatpickrEditor extends Handsontable.editors.TextEditor {
/**
Expand All @@ -29,12 +30,14 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor {
createElements() {
super.createElements();

this.TEXTAREA.remove();
this.TEXTAREA = this.hot.rootDocument.createElement('input');
this.TEXTAREA.className = 'handsontableInput';
this.TEXTAREA.setAttribute('data-hot-input', true);
this.textareaStyle = this.TEXTAREA.style;
this.textareaStyle.width = 0;
this.textareaStyle.height = 0;
Handsontable.dom.empty(this.TEXTAREA_PARENT);
this.TEXTAREA_PARENT.innerText = '';
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);

this.datePicker = this.hot.rootDocument.createElement('DIV');
Expand All @@ -52,10 +55,10 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor {
*/
const eventManager = new Handsontable.EventManager(this);
eventManager.addEventListener(this.datePicker, 'mousedown', (event) => {
Handsontable.dom.stopImmediatePropagation(event);
event.stopPropagation();
});
eventManager.addEventListener(this.datePicker, 'keydown', (event) => {
Handsontable.dom.stopImmediatePropagation(event);
event.stopPropagation();
});
eventManager.addEventListener(this.TEXTAREA, 'keydown', (event) => {
if (event.keyCode === Handsontable.helper.KEY_CODES.ENTER) {
Expand All @@ -75,7 +78,9 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor {
destroyElements() {
const datePickerParentElement = this.datePicker.parentNode;

this.fp.destroy();
if (this.fp?.destroy) {
this.fp.destroy();
}

if (datePickerParentElement) {
datePickerParentElement.removeChild(this.datePicker);
Expand Down Expand Up @@ -141,8 +146,10 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor {
*/
showDatepicker(event) {
const offset = this.TD.getBoundingClientRect();
const isMouseDown = this.instance.view.isMouseDown();
const isMeta = event ? Handsontable.helper.isMetaKey(event.keyCode) : false;
const isMouseDown = this.hot.view.isMouseDown();
const isMeta = event
? Handsontable.helper.isFunctionKey(event.keyCode)
: false;

const defaultConfig = this.getFlatpickrConfig();
const cellConfig =
Expand All @@ -153,14 +160,20 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor {
const mandatoryConfig = {
appendTo: this.datePicker,
allowInput: true,
allowInvalidPreload: true,
allowInvalidPreload: false,
inline: true,
clickOpens: false,
// Inject date-fns formatter & parser here for better consistency when
// parsing and formatting of exported data
formatDate: format,
parseDate: (dateString, formatString) =>
parse(dateString, formatString, REF_DATE),
formatDate: (dateObj, formatString) => {
if (!(dateObj instanceof Date && !isNaN(dateObj.getTime()))) {
return '';
}
return format(dateObj, formatString);
},
parseDate: (dateString, formatString) => {
return parse(dateString, formatString, REF_DATE);
},
onChange: (dates, datestr) => {
this.setValue(datestr);
},
Expand Down
Binary file modified lib/images/changeTemplate.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/doubleClickHeaders.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/editCopyPasteDelete.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/exportingFiles.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/fillColumn.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/jumpToColumn.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/moreInfo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/provenance.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/selectingVals.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/showRows.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/showSection.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/toggleRequiredCols.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/validatingCells.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/images/versionUpdate.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/utils/files.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { utils as XlsxUtils, writeFile } from 'xlsx';
import { utils as XlsxUtils, writeFile } from 'xlsx/xlsx.mjs';
import { saveAs } from 'file-saver';

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-harmonizer",
"version": "1.6.0",
"version": "1.6.1",
"description": "A standardized spreadsheet editor and validator that can be run offline and locally",
"repository": "[email protected]:cidgoh/DataHarmonizer.git",
"license": "MIT",
Expand Down
8 changes: 7 additions & 1 deletion web/templates/canada_covid19/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "CanCOGeN_Covid-19",
"description": "",
"id": "https://example.com/CanCOGeN_Covid-19",
"version": "2.1.3",
"version": "2.2.3",
"prefixes": {
"linkml": {
"prefix_prefix": "linkml",
Expand Down Expand Up @@ -4128,6 +4128,9 @@
"Newfoundland and Labrador - Eastern Health": {
"text": "Newfoundland and Labrador - Eastern Health"
},
"Newfoundland and Labrador - Newfoundland and Labrador Health Services": {
"text": "Newfoundland and Labrador - Newfoundland and Labrador Health Services"
},
"Nova Scotia Health Authority": {
"text": "Nova Scotia Health Authority"
},
Expand Down Expand Up @@ -4220,6 +4223,9 @@
"Newfoundland and Labrador - Eastern Health": {
"text": "Newfoundland and Labrador - Eastern Health"
},
"Newfoundland and Labrador - Newfoundland and Labrador Health Services": {
"text": "Newfoundland and Labrador - Newfoundland and Labrador Health Services"
},
"Nova Scotia Health Authority": {
"text": "Nova Scotia Health Authority"
},
Expand Down
6 changes: 5 additions & 1 deletion web/templates/canada_covid19/schema.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: https://example.com/CanCOGeN_Covid-19
name: CanCOGeN_Covid-19
description: ''
version: 2.1.3
version: 2.2.3
imports:
- linkml:types
prefixes:
Expand Down Expand Up @@ -5762,6 +5762,8 @@ enums:
text: "New Brunswick - Vitalit\xE9 Health Network"
Newfoundland and Labrador - Eastern Health:
text: Newfoundland and Labrador - Eastern Health
Newfoundland and Labrador - Newfoundland and Labrador Health Services:
text: Newfoundland and Labrador - Newfoundland and Labrador Health Services
Nova Scotia Health Authority:
text: Nova Scotia Health Authority
Ontario Institute for Cancer Research (OICR):
Expand Down Expand Up @@ -5823,6 +5825,8 @@ enums:
text: "New Brunswick - Vitalit\xE9 Health Network"
Newfoundland and Labrador - Eastern Health:
text: Newfoundland and Labrador - Eastern Health
Newfoundland and Labrador - Newfoundland and Labrador Health Services:
text: Newfoundland and Labrador - Newfoundland and Labrador Health Services
Nova Scotia Health Authority:
text: Nova Scotia Health Authority
Nunavut:
Expand Down
2 changes: 1 addition & 1 deletion web/templates/canada_covid19/schema_core.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: https://example.com/CanCOGeN_Covid-19
name: CanCOGeN_Covid-19
description: ""
version: 2.1.3
version: 2.2.3
imports:
- 'linkml:types'
prefixes:
Expand Down
6 changes: 3 additions & 3 deletions web/templates/canada_covid19/schema_enums.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@ sequence submitted by menu Alberta Precision Labs (APL)
National Microbiology Laboratory (NML)
New Brunswick - Vitalité Health Network
Newfoundland and Labrador - Eastern Health
Newfoundland and Labrador - Newfoundland and Labrador Health Services
Nova Scotia Health Authority
Ontario Institute for Cancer Research (OICR)
Prince Edward Island - Health PEI
Expand Down Expand Up @@ -917,6 +918,7 @@ sequence submitted by menu Alberta Precision Labs (APL)
National Microbiology Laboratory (NML)
New Brunswick - Vitalité Health Network
Newfoundland and Labrador - Eastern Health
Newfoundland and Labrador - Newfoundland and Labrador Health Services
Nova Scotia Health Authority
Nunavut
Ontario Institute for Cancer Research (OICR)
Expand Down Expand Up @@ -1202,6 +1204,4 @@ geo_loc_name (country) menu GAZ:00006882 Afghanistan
GAZ:00000564 Western Sahara
GAZ:00005284 Yemen
GAZ:00001107 Zambia
GAZ:00001106 Zimbabwe


GAZ:00001106 Zimbabwe
3 changes: 1 addition & 2 deletions web/templates/canada_covid19/schema_slots.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,4 @@ CanCOGeN Covid-19 GENEPIO:0001122 Database Identifiers

GENEPIO:0001516 Contributor acknowledgement
Contributor acknowledgement GENEPIO:0001517 authors WhitespaceMinimizedString TRUE Names of individuals contributing to the processes of sample collection, sequence generation, analysis, and data submission. Include the first and last names of all individuals that should be attributed, separated by a comma. Tejinder Singh, Fei Hu, Joe Blogs Authors Authors PH_CANCOGEN_AUTHORS
Contributor acknowledgement GENEPIO:0001518 DataHarmonizer provenance Provenance The DataHarmonizer software and template version provenance. The current software and template version information will be automatically generated in this field after the user utilizes the "validate" function. This information will be generated regardless as to whether the row is valid of not. DataHarmonizer v1.4.3, CanCOGeN Covid-19 v1.0.0 DataHarmonizer provenance Additional Comments HC_COMMENTS

Contributor acknowledgement GENEPIO:0001518 DataHarmonizer provenance Provenance The DataHarmonizer software and template version provenance. The current software and template version information will be automatically generated in this field after the user utilizes the "validate" function. This information will be generated regardless as to whether the row is valid of not. DataHarmonizer v1.4.3, CanCOGeN Covid-19 v1.0.0 DataHarmonizer provenance Additional Comments HC_COMMENTS
Loading

0 comments on commit 2a569fc

Please sign in to comment.