@onehat/ui 0.3.218 → 0.3.221

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.218",
3
+ "version": "0.3.221",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -464,6 +464,8 @@ function GridComponent(props) {
464
464
  rowDragProps.isDropTarget = true;
465
465
  rowDragProps.dropTargetAccept = dropTargetAccept;
466
466
  rowDragProps.onDrop = (droppedItem) => {
467
+ // TODO: the item is somehow getting stale
468
+ // might have something to do with memoization
467
469
  onRowDrop(item, droppedItem);
468
470
  };
469
471
  }
@@ -298,7 +298,7 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
298
298
  const
299
299
  entity = secondarySelection[0],
300
300
  idProperty = SecondaryRepository.getSchema().model.idProperty,
301
- rawValues = _.omit(entity.rawValues, idProperty),
301
+ rawValues = _.omit(entity.getOriginalData(), idProperty),
302
302
  duplicate = await SecondaryRepository.add(rawValues, false, true);
303
303
  setSecondaryIsIgnoreNextSelectionChange(true);
304
304
  secondarySetSelection([duplicate]);
@@ -302,7 +302,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
302
302
  const
303
303
  entity = selection[0],
304
304
  idProperty = Repository.getSchema().model.idProperty,
305
- rawValues = _.omit(entity.rawValues, idProperty),
305
+ rawValues = _.omit(entity.getOriginalData(), idProperty),
306
306
  duplicate = await Repository.add(rawValues, false, true);
307
307
  setIsIgnoreNextSelectionChange(true);
308
308
  setSelection([duplicate]);
@@ -321,10 +321,17 @@ export default function withEditor(WrappedComponent, isTree = false) {
321
321
  doEditorSave = async (data, e) => {
322
322
  // NOTE: The Form submits onSave for both adds (when not isAutoSsave) and edits.
323
323
  const isSingle = selection.length === 1;
324
+ let useStaged = false;
324
325
  if (isSingle) {
325
326
  // just update this one entity
326
327
  selection[0].setValues(data);
327
328
 
329
+ // If this is a remote phantom, and nothing is dirty, stage it so it actually gets saved to server and solidified
330
+ if (selection[0].isRemotePhantom && !selection[0].isDirty) {
331
+ selection[0].markStaged();
332
+ useStaged = true;
333
+ }
334
+
328
335
  } else if (selection.length > 1) {
329
336
  // Edit multiple entities
330
337
 
@@ -349,7 +356,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
349
356
  setIsSaving(true);
350
357
  let success;
351
358
  try {
352
- await Repository.save();
359
+ await Repository.save(null, useStaged);
353
360
  success = true;
354
361
  } catch (e) {
355
362
  // alert(e.context);
@@ -0,0 +1,13 @@
1
+ // Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.
2
+ import * as React from "react"
3
+ import Svg, { Path } from "react-native-svg"
4
+
5
+ function SvgComponent(props) {
6
+ return (
7
+ <Svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" {...props}>
8
+ <Path d="M579.8 267.7c56.5-56.5 56.5-148 0-204.5-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6 31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0l112.3-112.3zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5 50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5l112.2-112.3c31.5-31.5 82.5-31.5 114 0 27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z" />
9
+ </Svg>
10
+ )
11
+ }
12
+
13
+ export default SvgComponent
@@ -93,6 +93,7 @@ import Info from '../Components/Icons/Info.js';
93
93
  import ItunesNote from '../Components/Icons/ItunesNote.js';
94
94
  import Js from '../Components/Icons/Js.js';
95
95
  import Leaf from '../Components/Icons/Leaf.js';
96
+ import Link from '../Components/Icons/Link.js';
96
97
  import List from '../Components/Icons/List.js';
97
98
  import ListCheck from '../Components/Icons/ListCheck.js';
98
99
  import LocationDot from '../Components/Icons/LocationDot.js';
@@ -326,6 +327,7 @@ const components = {
326
327
  ItunesNote,
327
328
  Js,
328
329
  Leaf,
330
+ Link,
329
331
  List,
330
332
  ListCheck,
331
333
  LocationDot,