@dartech/arsenal-ui 1.4.49 → 1.4.50

Sign up to get free protection for your applications and to get access to all the features.
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,19 @@ const CreatePropertiesList = /*#__PURE__*/forwardRef(({
6135
6199
  }, {
6136
6200
  children: error.message
6137
6201
  }))
6138
- })), Array.isArray(fields) && fields.map((item, index, array) => jsx(Grid, Object.assign({
6139
- sm: 12,
6140
- ref: ref => refs.current[index] = ref
6141
- }, {
6142
- children: jsxs(Accordion, Object.assign({
6143
- defaultExpanded: index === array.length - 1 && !item.key,
6144
- elevation: 3
6145
- }, {
6146
- children: [jsx(AccordionSummary, Object.assign({
6147
- expandIcon: jsx(ExpandMore, {})
6148
- }, {
6149
- children: jsx(Typography, Object.assign({
6150
- color: error && error[index] ? 'secondary' : 'initial',
6151
- style: {
6152
- wordBreak: 'break-word'
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
+ error: error,
6209
+ handleRemoveParameter: handleRemoveParameter,
6210
+ fileReferenceValueComponent: fileReferenceValueComponent,
6211
+ entityReferenceValueComponent: entityReferenceValueComponent,
6212
+ entityReferenceDefinitionSources: entityReferenceDefinitionSources,
6213
+ extRefs: refs
6214
+ }, item.id)), !hideAddButton && jsxs(Grid, Object.assign({
6181
6215
  xs: 12
6182
6216
  }, {
6183
6217
  children: [jsx(Button, Object.assign({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.4.49",
3
+ "version": "1.4.50",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { UseFormTrigger } from 'react-hook-form';
3
- import { CustomPropertyFieldProps, EntityReferenceProperty, PropertiesArrayType } from '../../../interfaces';
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;
@@ -0,0 +1,2 @@
1
+ export * from './CreatePropertiesList';
2
+ export { default } from './CreatePropertiesList';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Control } from 'react-hook-form';
3
2
  type Props = {
4
3
  control: Control<any>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  label?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  format: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  label?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type Props = {
3
2
  name: string;
4
3
  label?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PropertyUnion } from '../../../interfaces';
3
2
  type PropertyItemProps = {
4
3
  property: PropertyUnion;