@onehat/ui 0.3.110 → 0.3.112
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
|
@@ -143,13 +143,13 @@ function TagComponent(props) {
|
|
|
143
143
|
key={ix}
|
|
144
144
|
text={val.text}
|
|
145
145
|
onView={() => onView(val)}
|
|
146
|
-
onDelete={
|
|
146
|
+
onDelete={() => onDelete(val)}
|
|
147
147
|
/>;
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
let WhichCombo =
|
|
151
|
-
if (
|
|
152
|
-
WhichCombo =
|
|
150
|
+
let WhichCombo = Combo;
|
|
151
|
+
if (_combo.isEditor) {
|
|
152
|
+
WhichCombo = ComboEditor;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
const sizeProps = {};
|
|
@@ -164,7 +164,7 @@ function TagComponent(props) {
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
if (
|
|
167
|
+
if (propsToPass.selectorId) {
|
|
168
168
|
_combo.selectorId = propsToPass.selectorId;
|
|
169
169
|
_combo.selectorSelected = propsToPass.selectorSelected;
|
|
170
170
|
}
|
|
@@ -187,15 +187,14 @@ function TagComponent(props) {
|
|
|
187
187
|
minHeight={10}
|
|
188
188
|
flexWrap="wrap"
|
|
189
189
|
>{valueBoxes}</Row>
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
/>}
|
|
190
|
+
<WhichCombo
|
|
191
|
+
Repository={props.Repository}
|
|
192
|
+
Editor={props.Editor}
|
|
193
|
+
onChangeValue={onChangeComboValue}
|
|
194
|
+
parent={self}
|
|
195
|
+
reference="combo"
|
|
196
|
+
{..._combo}
|
|
197
|
+
/>
|
|
199
198
|
</Column>
|
|
200
199
|
{isViewerShown &&
|
|
201
200
|
<Modal
|
|
@@ -245,24 +244,12 @@ export const Tag = withAdditionalProps(
|
|
|
245
244
|
function withAdditionalEditorProps(WrappedComponent) {
|
|
246
245
|
return (props) => {
|
|
247
246
|
return <WrappedComponent
|
|
248
|
-
|
|
249
|
-
isValueAlwaysArray={true}
|
|
250
|
-
isValueAsStringifiedJson={true}
|
|
247
|
+
_combo={{ isEditor: true }}
|
|
251
248
|
{...props}
|
|
252
249
|
/>;
|
|
253
250
|
};
|
|
254
251
|
}
|
|
255
252
|
|
|
256
|
-
export const TagEditor = withAdditionalEditorProps(
|
|
257
|
-
withComponent(
|
|
258
|
-
withAlert(
|
|
259
|
-
withData(
|
|
260
|
-
withValue(
|
|
261
|
-
TagComponent
|
|
262
|
-
)
|
|
263
|
-
)
|
|
264
|
-
)
|
|
265
|
-
)
|
|
266
|
-
);
|
|
253
|
+
export const TagEditor = withAdditionalEditorProps(Tag);
|
|
267
254
|
|
|
268
255
|
export default Tag;
|
|
@@ -75,6 +75,7 @@ function Form(props) {
|
|
|
75
75
|
disableDirtyIcon = false,
|
|
76
76
|
onBack,
|
|
77
77
|
onReset,
|
|
78
|
+
onInit,
|
|
78
79
|
onViewMode,
|
|
79
80
|
submitBtnLabel,
|
|
80
81
|
onSubmit,
|
|
@@ -614,19 +615,25 @@ function Form(props) {
|
|
|
614
615
|
alert(errors.message);
|
|
615
616
|
}
|
|
616
617
|
},
|
|
618
|
+
doReset = (values) => {
|
|
619
|
+
reset(values);
|
|
620
|
+
if (onReset) {
|
|
621
|
+
onReset(values, formSetValue, formGetValues);
|
|
622
|
+
}
|
|
623
|
+
},
|
|
617
624
|
onSaveDecorated = async (data, e) => {
|
|
618
625
|
// reset the form after a save
|
|
619
626
|
const result = await onSave(data, e);
|
|
620
627
|
if (result) {
|
|
621
628
|
const values = record.submitValues;
|
|
622
|
-
|
|
629
|
+
doReset(values);
|
|
623
630
|
}
|
|
624
631
|
},
|
|
625
632
|
onSubmitDecorated = async (data, e) => {
|
|
626
633
|
const result = await onSubmit(data, e);
|
|
627
634
|
if (result) {
|
|
628
635
|
const values = record.submitValues;
|
|
629
|
-
|
|
636
|
+
doReset(values);
|
|
630
637
|
}
|
|
631
638
|
},
|
|
632
639
|
onLayoutDecorated = (e) => {
|
|
@@ -638,9 +645,13 @@ function Form(props) {
|
|
|
638
645
|
};
|
|
639
646
|
|
|
640
647
|
useEffect(() => {
|
|
641
|
-
if (record
|
|
648
|
+
if (record === previousRecord) {
|
|
649
|
+
if (onInit) {
|
|
650
|
+
onInit(initialValues, formSetValue, formGetValues);
|
|
651
|
+
}
|
|
652
|
+
} else {
|
|
642
653
|
setPreviousRecord(record);
|
|
643
|
-
|
|
654
|
+
doReset(defaultValues);
|
|
644
655
|
}
|
|
645
656
|
if (formSetup) {
|
|
646
657
|
formSetup(formSetValue, formGetValues, formState)
|
|
@@ -849,12 +860,7 @@ function Form(props) {
|
|
|
849
860
|
{showResetBtn &&
|
|
850
861
|
<IconButton
|
|
851
862
|
key="resetBtn"
|
|
852
|
-
onPress={() =>
|
|
853
|
-
if (onReset) {
|
|
854
|
-
onReset();
|
|
855
|
-
}
|
|
856
|
-
reset();
|
|
857
|
-
}}
|
|
863
|
+
onPress={() => doReset()}
|
|
858
864
|
icon={Rotate}
|
|
859
865
|
_icon={{
|
|
860
866
|
color: !formState.isDirty ? 'trueGray.400' : '#000',
|