@onehat/ui 0.3.85 → 0.3.86

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.85",
3
+ "version": "0.3.86",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -121,6 +121,7 @@ function Form(props) {
121
121
  record = props.record?.length === 1 ? props.record[0] : props.record,
122
122
  isMultiple = _.isArray(record),
123
123
  isSingle = !isMultiple, // for convenience
124
+ isPhantom = !!record?.isPhantom,
124
125
  forceUpdate = useForceUpdate(),
125
126
  [previousRecord, setPreviousRecord] = useState(record),
126
127
  [containerWidth, setContainerWidth] = useState(),
@@ -157,6 +158,7 @@ function Form(props) {
157
158
  // shouldUnregister: false,
158
159
  // shouldUseNativeValidation: false,
159
160
  resolver: yupResolver(validator || (isMultiple ? disableRequiredYupFields(Repository?.schema?.model?.validator) : Repository?.schema?.model?.validator) || yup.object()),
161
+ context: { isPhantom },
160
162
  }),
161
163
  buildFromColumnsConfig = () => {
162
164
  // For InlineEditor
@@ -738,7 +740,7 @@ function Form(props) {
738
740
  isSaveDisabled = true;
739
741
  isSubmitDisabled = true;
740
742
  }
741
- if (_.isEmpty(formState.dirtyFields) && !record?.isPhantom) {
743
+ if (_.isEmpty(formState.dirtyFields) && !isPhantom) {
742
744
  isSaveDisabled = true;
743
745
  }
744
746
 
@@ -759,12 +761,10 @@ function Form(props) {
759
761
  if (isEditorViewOnly) {
760
762
  showCloseBtn = true;
761
763
  } else {
762
- const
763
- formIsDirty = formState.isDirty,
764
- recordIsPhantom = record?.isPhantom;
764
+ const formIsDirty = formState.isDirty;
765
765
  // console.log('formIsDirty', formIsDirty);
766
- // console.log('recordIsPhantom', recordIsPhantom);
767
- if (formIsDirty || recordIsPhantom) {
766
+ // console.log('isPhantom', isPhantom);
767
+ if (formIsDirty || isPhantom) {
768
768
  if (isSingle && onCancel) {
769
769
  showCancelBtn = true;
770
770
  }