generic-ui-core 1.5.1-rc2 → 1.5.1-rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,99 @@
1
+ declare module 'generic-ui-core' {
2
+ export interface FieldTypes {
3
+ DEL_LAYER: 'Layer';
4
+ DEL_FIELD: 'Field';
5
+ DEL_SELECT: 'Select';
6
+ DEL_OPTION: 'Option';
7
+ F_CHECKBOX: 'checkbox';
8
+ F_DATE: 'date';
9
+ F_DATETIME: 'datetime';
10
+ F_DATETIME_RANGE: 'datetime-range';
11
+ F_DRAG: 'drag';
12
+ F_DRAG_ELEMENT: 'drag_element';
13
+ F_DRAG_MOLECULE: 'drag_molecule';
14
+ F_DRAG_SAMPLE: 'drag_sample';
15
+ F_DRAG_REACTION: 'drag_reaction';
16
+ F_DUMMY: 'dummy';
17
+ F_FORMULA_FIELD: 'formula-field';
18
+ F_INPUT_GROUP: 'input-group';
19
+ F_INTEGER: 'integer';
20
+ F_LABEL: 'label';
21
+ F_NUMBER: 'number';
22
+ F_ONTOLOGY_SELECT: 'ontology-select';
23
+ F_SELECT: 'select';
24
+ F_SYS_REACTION: 'sys-reaction';
25
+ F_SYSTEM_DEFINED: 'system-defined';
26
+ F_TABLE: 'table';
27
+ F_TEXT: 'text';
28
+ F_TEXTAREA: 'textarea';
29
+ F_TEXT_FORMULA: 'text-formula';
30
+ F_UPLOAD: 'upload';
31
+ F_WF_NEXT: 'wf-next';
32
+ V_BOOLEAN: 'boolean';
33
+ V_UNDEFINED: 'undefined';
34
+ }
35
+
36
+ export interface OptionMaps {
37
+ TBL_OPTS_MOLECULE: Array<{
38
+ label: 'InChiKey' | 'SMILES' | 'IUPAC' | 'Mass';
39
+ value: 'inchikey' | 'smiles' | 'iupac' | 'molecular_weight';
40
+ }>;
41
+ TBL_OPTS_SAMPLE: Array<{
42
+ label: 'Name' | 'Ext. Label' | 'Mass';
43
+ value: 'name' | 'external_label' | 'molecular_weight';
44
+ }>;
45
+ }
46
+
47
+ export interface WorkflowTypes {
48
+ ND_INPUT: 'input';
49
+ ND_OUTPUT: 'output';
50
+ ND_DEFAULT: 'default';
51
+ }
52
+
53
+ export interface Element {
54
+ properties_template: {
55
+ layers: Record<string, {
56
+ fields: Array<{
57
+ type: string;
58
+ value?: any;
59
+ sub_fields?: Array<{
60
+ type: string;
61
+ value: string;
62
+ }>;
63
+ }>;
64
+ }>;
65
+ };
66
+ }
67
+
68
+ // Common functions
69
+ export function downloadFile(file: { contents: string; name: string }): void;
70
+ export function swapAryEls<T>(ary: T[], idx1: number, idx2: number): T[];
71
+ export function buildTS(ontology: { iri: string; ontology_prefix: string; type: string } | null): string | null;
72
+ export function buildTSS(q: string | null): string | null;
73
+
74
+ // Template functions
75
+ export function clsInputGroup(el: Element): Element;
76
+ export function replaceData(data: string, spec?: string): string;
77
+ export function resetProperties(props: { layers: Record<string, any> }): { layers: Record<string, any> };
78
+ export function absOlsTermId(val: string): string;
79
+ export function absOlsTermLabel(val: string): string;
80
+ export function showProperties(dataObj: any, layers: any): any[];
81
+ export function orgLayerObject(layers?: any[]): Record<string, any>;
82
+
83
+ // Unit functions
84
+ export function getUnitSystem(externalUnits?: Record<string, any>): any[];
85
+ export function genUnit(type: string, unit: string): Record<string, string>;
86
+ export function genUnits(type: string): Array<Record<string, string>>;
87
+ export function unitConvertToBase(value: number, fromUnit: string): number;
88
+ export function unitConversion(value: number, fromUnit: string, toUnit: string): number;
89
+ export function reUnit(value: string): string;
90
+
91
+ // Workflow functions
92
+ export function isLayerInWF(element: Element, layerKey: string): boolean;
93
+ export function storeFlow(props: { elements: Element[] }): any[];
94
+
95
+ // Constants
96
+ export const FieldTypes: FieldTypes;
97
+ export const OptionMaps: OptionMaps;
98
+ export const WorkflowTypes: WorkflowTypes;
99
+ }
@@ -1438,12 +1438,8 @@ if(null==t||null===(n=t.cond_fields)||void 0===n||!n.length)return[!0,""];
1438
1438
  for(var l,a=null!==(o=t.cond_operator)&&void 0!==o?o:1,i=0,u=function(){var n,o=t.cond_fields[c]||{},l=o.layer,u=o.field,s=o.value,p=o.label;if(!u)return{v:[!0,""]};var f=(null===(n=r[l])||void 0===n||null===(n=n.fields)||void 0===n?void 0:n.find((function(e){return e.field===u})))||{};return(function(t,r){var n=(r||"false").trim().toLowerCase(),o=["false","no","f","0"].includes(n)&&!1===(t.value||!1),l=["true","yes","t","1"].includes(n)&&!0===(t.value||!1);return t.type===e.F_CHECKBOX&&(o||l)}(f,s)||function(t,r){return t.type===e.F_SELECT&&(t.value||"").trim()===(r||"").trim()}(f,s)||function(t,r){return t.type===e.F_TEXT&&(t.value||"").trim()===(r||"").trim()}(f,s))&&(i+=1,1===a)?{v:[!0,p]}:void 0},c=0;c<t.cond_fields.length;c+=1)if(l=u())return l.v;
1439
1439
  // if match NONE, return true only if no condition is met
1440
1440
  // if match ALL, return true only if all conditions are met
1441
- return 0===a?[0===i,""]:9===a?[i===t.cond_fields.length,""]:[!1,""]},j=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((function(e,t){var r=e,n=Object.keys(r);if(n.includes(t.key)){var o=n.filter((function(e){return e===t.key||e.startsWith("".concat(t.key,"."))})).length,l="".concat(t.key,".").concat(o);t.key=l,r[l]=t}else r[t.key]=t;return r}),{})},x=r(8780);
1441
+ return 0===a?[0===i,""]:9===a?[i===t.cond_fields.length,""]:[!1,""]},j=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((function(e,t){var r=e,n=Object.keys(r);if(n.includes(t.key)){var o=n.filter((function(e){return e===t.key||e.startsWith("".concat(t.key,"."))})).length,l="".concat(t.key,".").concat(o);t.key=l,r[l]=t}else r[t.key]=t;return r}),{})},x=r(8780),k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,x.genUnitsSystem)({externalUnits:e})},O=r(8055),A=r.n(O);
1442
1442
  // migrate from 'chem-generic-ui'
1443
- // ./src/kits/unit.js
1444
- function k(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,x.genUnitsSystem)({externalUnits:e})}
1445
- // EXTERNAL MODULE: ./node_modules/lodash/cloneDeep.js
1446
- var O=r(8055),A=r.n(O);
1447
1443
  /* harmony default export */const E=Object.freeze({ND_INPUT:"input",ND_OUTPUT:"output",ND_DEFAULT:"default"});// ./src/kits/workflow.js
1448
1444
  // export function findCurrentNode(_srcKey, _layerVals) {
1449
1445
  // const fs = _layerVals.filter(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "generic-ui-core",
3
- "version": "1.5.1-rc2",
4
- "main": "dist/bundle.js",
3
+ "version": "1.5.1-rc3",
4
+ "main": "dist/main.js",
5
5
  "description": "The core library for LabIMotion",
6
6
  "license": "AGPL-3.0",
7
7
  "private": false,
@@ -51,5 +51,6 @@
51
51
  "dependencies": {
52
52
  "chem-units": "^1.2.0",
53
53
  "lodash": "^4.17.21"
54
- }
55
- }
54
+ },
55
+ "types": "dist/index.d.ts"
56
+ }