@onehat/ui 0.3.342 → 0.3.344

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.3.342",
3
+ "version": "0.3.344",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -278,7 +278,6 @@ export function ComboComponent(props) {
278
278
  }
279
279
 
280
280
  setTextInputValue(value);
281
- showMenu();
282
281
 
283
282
  clearTimeout(typingTimeout.current);
284
283
  typingTimeout.current = setTimeout(() => {
@@ -409,12 +408,6 @@ export function ComboComponent(props) {
409
408
  }
410
409
  },
411
410
  searchForMatches = async (value) => {
412
- if (!isMenuShown) {
413
- showMenu();
414
- }
415
-
416
- setIsSearchMode(true);
417
-
418
411
  let found;
419
412
  if (Repository) {
420
413
  if (Repository.isLoading) {
@@ -464,6 +457,11 @@ export function ComboComponent(props) {
464
457
  });
465
458
  setFilteredData(found);
466
459
  }
460
+
461
+ if (!isMenuShown) {
462
+ showMenu();
463
+ }
464
+ setIsSearchMode(true);
467
465
  };
468
466
 
469
467
  useEffect(() => {
@@ -1,7 +1,5 @@
1
- import React, { useState, useEffect, useRef, } from 'react';
2
1
  import {
3
2
  Row,
4
- Text,
5
3
  Tooltip,
6
4
  } from 'native-base';
7
5
  import {
@@ -11,7 +9,6 @@ import {
11
9
  import UiGlobals from '../../../UiGlobals.js';
12
10
  import withComponent from '../../Hoc/withComponent.js';
13
11
  import withValue from '../../Hoc/withValue.js';
14
- import testProps from '../../../Functions/testProps.js';
15
12
  import getComponentFromType from '../../../Functions/getComponentFromType.js';
16
13
  import _ from 'lodash';
17
14
 
@@ -45,6 +42,7 @@ export function JsonElement(props) {
45
42
  flex={1}
46
43
  {...propsToPass}
47
44
  justifyContent="flex-start"
45
+ testID={testID}
48
46
  >
49
47
  <JsonEditor
50
48
  width="100%"
@@ -55,6 +53,7 @@ export function JsonElement(props) {
55
53
  onEdit={(obj) => {
56
54
  setValue(JSON.stringify(obj.updated_src));
57
55
  }}
56
+ {...props}
58
57
  />
59
58
  </Row>;
60
59
 
@@ -73,6 +73,11 @@ import Inflector from 'inflector-js';
73
73
  import _ from 'lodash';
74
74
  const $ = Cypress.$;
75
75
 
76
+ const
77
+ WINDOWED = 'WINDOWED',
78
+ INLINE = 'INLINE',
79
+ SIDE = 'SIDE';
80
+
76
81
 
77
82
  // Form fields
78
83
  export function crudCombo(selector, newData, editData, schema, ancillaryData, level = 0) {
@@ -108,6 +113,13 @@ export function crudTag(selector, newData, editData, schema, ancillaryData, leve
108
113
 
109
114
  clickTrigger(selector);
110
115
  }
116
+ export function crudJson(selector, newData, editData, schema, ancillaryData, level = 0) {
117
+ cy.then(() => {
118
+ Cypress.log({ name: 'crudJson' });
119
+ });
120
+
121
+ // do nothing for now
122
+ }
111
123
 
112
124
 
113
125
  // Grid
@@ -194,7 +206,7 @@ export function crudSideGridRecord(gridSelector, newData, editData, schema, anci
194
206
  verifyGridRecordExistsById(gridSelector, id);
195
207
 
196
208
  // edit
197
- editGridRecord(gridSelector, editData, schema, id);
209
+ editGridRecord(gridSelector, editData, schema, id, 0, SIDE);
198
210
 
199
211
  // delete
200
212
  verifyGridRecordExistsById(gridSelector, id);
@@ -290,7 +302,7 @@ export function addInlineGridRecord(gridSelector, fieldValues, schema, ancillary
290
302
  cy.wait(500); // allow window to close
291
303
  // TODO: Change this to wait until window is closed
292
304
  }
293
- export function editGridRecord(gridSelector, fieldValues, schema, id, level = 0) {
305
+ export function editGridRecord(gridSelector, fieldValues, schema, id, level = 0, whichEditor = WINDOWED) {
294
306
 
295
307
  cy.then(() => {
296
308
  Cypress.log({ name: 'editGridRecord ' + gridSelector + ' ' + id});
@@ -303,13 +315,13 @@ export function editGridRecord(gridSelector, fieldValues, schema, id, level = 0)
303
315
  viewerSelector = editorSelector + '/viewer',
304
316
  formSelector = editorSelector + '/form';
305
317
 
306
- const gridName = getLastPartOfPath(gridSelector);
307
- if (gridName.match(/SideGrid/)) { // as opposed to 'SideA' -- we want the side editor, not particular sides of another editor
308
- // side editor
318
+ if (whichEditor === SIDE) {
309
319
  // switch to Edit mode if necessary
320
+ Cypress.log({ name: 'switch to Edit mode if necessary ' + viewerSelector});
310
321
  clickToEditButtonIfExists(viewerSelector);
311
322
  } else {
312
323
  // windowed or inline editor
324
+ Cypress.log({ name: 'SHOULD NOT BE HERE!!'});
313
325
  clickEditButton(gridSelector);
314
326
  }
315
327
  cy.wait(1500); // allow form to build
@@ -334,7 +346,7 @@ export function editWindowedGridRecord(gridSelector, fieldValues, schema, id, le
334
346
  Cypress.log({ name: 'editWindowedGridRecord ' + gridSelector + ' ' + id});
335
347
  });
336
348
 
337
- editGridRecord(gridSelector, fieldValues, schema, id, level);
349
+ editGridRecord(gridSelector, fieldValues, schema, id, level, WINDOWED);
338
350
 
339
351
  const formSelector = gridSelector + '/editor/form';
340
352
  clickCloseButton(formSelector);
@@ -348,7 +360,7 @@ export function editInlineGridRecord(gridSelector, fieldValues, schema, id, leve
348
360
  Cypress.log({ name: 'editWindowedGridRecord ' + gridSelector + ' ' + id});
349
361
  });
350
362
 
351
- editGridRecord(gridSelector, fieldValues, schema, id, level);
363
+ editGridRecord(gridSelector, fieldValues, schema, id, level, INLINE);
352
364
 
353
365
  const formSelector = gridSelector + '/editor/form';
354
366
  clickCloseButton(formSelector);
@@ -811,7 +823,7 @@ export function runInlineManagerScreenCrudTests(model, schema, newData, editData
811
823
  });
812
824
 
813
825
  }
814
- export function runManagerScreenCrudTests(model, schema, newData, editData, ancillaryData) {
826
+ export function runManagerScreenCrudTests(model, schema, newData, editData, ancillaryData, fullIsInline = false) {
815
827
 
816
828
  const
817
829
  Models = fixInflector(Inflector.camelize(Inflector.pluralize(model))),
@@ -843,7 +855,11 @@ export function runManagerScreenCrudTests(model, schema, newData, editData, anci
843
855
  toFullMode(managerSelector);
844
856
  cy.wait(500); // wait for grid to load
845
857
 
846
- crudWindowedGridRecord(gridSelector, newData, editData, schema, ancillaryData);
858
+ if (fullIsInline) {
859
+ crudInlineGridRecord(gridSelector, newData, editData, schema, ancillaryData);
860
+ } else {
861
+ crudWindowedGridRecord(gridSelector, newData, editData, schema, ancillaryData);
862
+ }
847
863
 
848
864
  });
849
865
 
@@ -10,6 +10,7 @@ import {
10
10
  import {
11
11
  crudCombo,
12
12
  crudTag,
13
+ crudJson,
13
14
  } from './crud_functions.js';
14
15
  import natsort from 'natsort';
15
16
  import _ from 'lodash';
@@ -88,6 +89,9 @@ export function fillForm(selector, fieldValues, schema, level = 0) {
88
89
  } else
89
90
  if (editorType === 'File') {
90
91
  // setFileValue(selectors, value);
92
+ } else
93
+ if (editorType === 'Json') {
94
+ // do nothing for now
91
95
  } else {
92
96
  const editorFn = customFormFunctions.getCustomEditorSetFn(editorType);
93
97
  if (editorFn) {