@dartech/arsenal-ui 1.4.49 → 1.4.51
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +80 -43
- package/package.json +1 -1
- package/src/lib/Property/UpsertProperty/{CreatePropertiesList.d.ts → CreatePropertiesList/CreatePropertiesList.d.ts} +1 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList/ListItem.d.ts +29 -0
- package/src/lib/Property/UpsertProperty/CreatePropertiesList/index.d.ts +2 -0
package/index.js
CHANGED
@@ -6029,6 +6029,70 @@ const CreatePropertyFormFields = /*#__PURE__*/memo(({
|
|
6029
6029
|
}));
|
6030
6030
|
});
|
6031
6031
|
|
6032
|
+
const ListItem$1 = ({
|
6033
|
+
entityDefinition,
|
6034
|
+
globalParameter,
|
6035
|
+
customPropertyFields,
|
6036
|
+
index,
|
6037
|
+
arrLength,
|
6038
|
+
entityReferenceDefinitionSources,
|
6039
|
+
entityReferenceValueComponent,
|
6040
|
+
control,
|
6041
|
+
setValue,
|
6042
|
+
fileReferenceValueComponent,
|
6043
|
+
handleRemoveParameter,
|
6044
|
+
error,
|
6045
|
+
item,
|
6046
|
+
extRefs
|
6047
|
+
}) => {
|
6048
|
+
const [open, setOpen] = useState(index === arrLength && !item.key);
|
6049
|
+
return jsx(Grid, Object.assign({
|
6050
|
+
sm: 12,
|
6051
|
+
ref: ref => extRefs.current[index] = ref
|
6052
|
+
}, {
|
6053
|
+
children: jsxs(Accordion, Object.assign({
|
6054
|
+
expanded: open,
|
6055
|
+
onChange: () => setOpen(!open),
|
6056
|
+
elevation: 3
|
6057
|
+
}, {
|
6058
|
+
children: [jsx(AccordionSummary, Object.assign({
|
6059
|
+
expandIcon: jsx(ExpandMore, {})
|
6060
|
+
}, {
|
6061
|
+
children: jsx(Typography, Object.assign({
|
6062
|
+
color: error && error[index] ? 'secondary' : 'initial',
|
6063
|
+
style: {
|
6064
|
+
wordBreak: 'break-word'
|
6065
|
+
}
|
6066
|
+
}, {
|
6067
|
+
children: item.name || `Property ${index + 1}`
|
6068
|
+
}))
|
6069
|
+
})), jsx(AccordionDetails, {
|
6070
|
+
children: open && jsx(CreatePropertyFormFields, {
|
6071
|
+
control: control,
|
6072
|
+
setValue: setValue,
|
6073
|
+
propertyFieldName: `properties.${index}`,
|
6074
|
+
entityDefinition: entityDefinition,
|
6075
|
+
globalParameter: globalParameter,
|
6076
|
+
customPropertyFields: customPropertyFields,
|
6077
|
+
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
6078
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
6079
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
6080
|
+
})
|
6081
|
+
}), jsx(AccordionActions, {
|
6082
|
+
children: jsx(Button, Object.assign({
|
6083
|
+
variant: "contained",
|
6084
|
+
size: "small",
|
6085
|
+
color: "secondary",
|
6086
|
+
onClick: () => handleRemoveParameter(index)
|
6087
|
+
}, {
|
6088
|
+
children: "Remove"
|
6089
|
+
}))
|
6090
|
+
})]
|
6091
|
+
}))
|
6092
|
+
}));
|
6093
|
+
};
|
6094
|
+
var ListItem$2 = ListItem$1;
|
6095
|
+
|
6032
6096
|
const defaultPropertyValues$1 = {
|
6033
6097
|
key: '',
|
6034
6098
|
propertyType: null,
|
@@ -6135,49 +6199,22 @@ const CreatePropertiesList = /*#__PURE__*/forwardRef(({
|
|
6135
6199
|
}, {
|
6136
6200
|
children: error.message
|
6137
6201
|
}))
|
6138
|
-
})), Array.isArray(fields) && fields.map((item, index, array) => jsx(
|
6139
|
-
|
6140
|
-
|
6141
|
-
|
6142
|
-
|
6143
|
-
|
6144
|
-
|
6145
|
-
|
6146
|
-
|
6147
|
-
|
6148
|
-
|
6149
|
-
|
6150
|
-
|
6151
|
-
|
6152
|
-
|
6153
|
-
|
6154
|
-
}, {
|
6155
|
-
children: item.name || `Property ${index + 1}`
|
6156
|
-
}))
|
6157
|
-
})), jsx(AccordionDetails, {
|
6158
|
-
children: jsx(CreatePropertyFormFields, {
|
6159
|
-
control: control,
|
6160
|
-
setValue: setValue,
|
6161
|
-
propertyFieldName: `properties.${index}`,
|
6162
|
-
entityDefinition: _entityDefinition,
|
6163
|
-
globalParameter: _globalParameter,
|
6164
|
-
customPropertyFields: _customPropertyFields,
|
6165
|
-
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
6166
|
-
entityReferenceValueComponent: entityReferenceValueComponent,
|
6167
|
-
fileReferenceValueComponent: fileReferenceValueComponent
|
6168
|
-
})
|
6169
|
-
}), jsx(AccordionActions, {
|
6170
|
-
children: jsx(Button, Object.assign({
|
6171
|
-
variant: "contained",
|
6172
|
-
size: "small",
|
6173
|
-
color: "secondary",
|
6174
|
-
onClick: () => handleRemoveParameter(index)
|
6175
|
-
}, {
|
6176
|
-
children: "Remove"
|
6177
|
-
}))
|
6178
|
-
})]
|
6179
|
-
}))
|
6180
|
-
}), item.id)), !hideAddButton && jsxs(Grid, Object.assign({
|
6202
|
+
})), Array.isArray(fields) && fields.map((item, index, array) => jsx(ListItem$2, {
|
6203
|
+
item: item,
|
6204
|
+
index: index,
|
6205
|
+
arrLength: array.length - 1,
|
6206
|
+
control: control,
|
6207
|
+
setValue: setValue,
|
6208
|
+
customPropertyFields: _customPropertyFields,
|
6209
|
+
entityDefinition: _entityDefinition,
|
6210
|
+
globalParameter: _globalParameter,
|
6211
|
+
error: error,
|
6212
|
+
handleRemoveParameter: handleRemoveParameter,
|
6213
|
+
fileReferenceValueComponent: fileReferenceValueComponent,
|
6214
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
6215
|
+
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
6216
|
+
extRefs: refs
|
6217
|
+
}, item.id)), !hideAddButton && jsxs(Grid, Object.assign({
|
6181
6218
|
xs: 12
|
6182
6219
|
}, {
|
6183
6220
|
children: [jsx(Button, Object.assign({
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { UseFormTrigger } from 'react-hook-form';
|
3
|
-
import { CustomPropertyFieldProps, EntityReferenceProperty, PropertiesArrayType } from '
|
3
|
+
import { CustomPropertyFieldProps, EntityReferenceProperty, PropertiesArrayType } from '../../../../interfaces';
|
4
4
|
type Props = {
|
5
5
|
properties: PropertiesArrayType<any>;
|
6
6
|
parentFieldName?: string;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { MutableRefObject } from 'react';
|
2
|
+
import { Control, UseFormSetValue } from 'react-hook-form';
|
3
|
+
import { CustomPropertyFieldProps, EntityReferenceProperty } from '../../../../interfaces';
|
4
|
+
type Props = {
|
5
|
+
entityDefinition?: boolean;
|
6
|
+
globalParameter?: boolean;
|
7
|
+
customPropertyFields?: CustomPropertyFieldProps[];
|
8
|
+
index: number;
|
9
|
+
arrLength: number;
|
10
|
+
entityReferenceDefinitionSources?: {
|
11
|
+
label: string;
|
12
|
+
value: string;
|
13
|
+
}[];
|
14
|
+
entityReferenceValueComponent?: React.ElementType<{
|
15
|
+
name: string;
|
16
|
+
property: EntityReferenceProperty;
|
17
|
+
}>;
|
18
|
+
fileReferenceValueComponent?: React.ElementType<{
|
19
|
+
name: string;
|
20
|
+
}>;
|
21
|
+
control: Control<any>;
|
22
|
+
setValue: UseFormSetValue<any>;
|
23
|
+
handleRemoveParameter: (index: number) => void;
|
24
|
+
error: any;
|
25
|
+
item: any;
|
26
|
+
extRefs: MutableRefObject<any[]>;
|
27
|
+
};
|
28
|
+
declare const ListItem: ({ entityDefinition, globalParameter, customPropertyFields, index, arrLength, entityReferenceDefinitionSources, entityReferenceValueComponent, control, setValue, fileReferenceValueComponent, handleRemoveParameter, error, item, extRefs }: Props) => JSX.Element;
|
29
|
+
export default ListItem;
|