@bigbinary/neeto-fields-frontend 1.0.7 → 1.0.8

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/README.md CHANGED
@@ -300,29 +300,31 @@ specific resource.
300
300
  1. `resourceType`: The type of resource.
301
301
  2. `fieldValues`: Field values associated with the resource obtained from the
302
302
  response.
303
- 3. `resourceId`: The ID of the resource.
304
- 4. `ownerId`:The ID of the owner. This prop is required only if the owner is not
303
+ 3. `fields`: Fields associated with resource type. This is an optional prop. If
304
+ not provided the component will fetch the fields internally.
305
+ 4. `resourceId`: The ID of the resource.
306
+ 5. `ownerId`:The ID of the owner. This prop is required only if the owner is not
305
307
  an organization.
306
- 5. `queryKeysToBeInvalidatedOnSuccess`: An array of queryKeys that should be
308
+ 6. `queryKeysToBeInvalidatedOnSuccess`: An array of queryKeys that should be
307
309
  invalidated when changing the field value.
308
- 6. `customComponents`: If the host application has any extra `kind` other than
310
+ 7. `customComponents`: If the host application has any extra `kind` other than
309
311
  the supported ones, you can specify the component to be displayed
310
312
  corresponding to that kind using this prop. It takes the `kind` name as the
311
313
  key and the component rendering callback function as the value. The callback
312
314
  function can expect the `field` object as argument.
313
- 7. `className`: Class names for styling.
314
- 8. `showBorder`: Boolean value to specify whether to show or hide borders.
315
+ 8. `className`: Class names for styling.
316
+ 9. `showBorder`: Boolean value to specify whether to show or hide borders.
315
317
  Default true.
316
- 9. `formRefs`: A React Ref object that can be used to access the Formik context
317
- of the forms corresponding to each field as key value pairs.
318
- 10. `disabled`: Boolean value to specify whether to disable all fields.
319
- 11. `isRequiredColumnName`: The name of column which holds the value which
318
+ 10. `formRefs`: A React Ref object that can be used to access the Formik context
319
+ of the forms corresponding to each field as key value pairs.
320
+ 11. `disabled`: Boolean value to specify whether to disable all fields.
321
+ 12. `isRequiredColumnName`: The name of column which holds the value which
320
322
  suggests if a field value is a `required` one or not. Default is
321
323
  `isRequired` column.
322
- 12. `fieldContainerClassName`: Class names for styling the `div` containing the
324
+ 13. `fieldContainerClassName`: Class names for styling the `div` containing the
323
325
  input field.
324
- 13. `fieldClassName`: Class names for styling the field.
325
- 14. `labelClassName`: Class names for styling the label for fields.
326
+ 14. `fieldClassName`: Class names for styling the field.
327
+ 15. `labelClassName`: Class names for styling the label for fields.
326
328
 
327
329
  #### Usage:
328
330
 
package/dist/index.cjs.js CHANGED
@@ -6323,7 +6323,7 @@ var useFormikFields = function useFormikFields(_ref) {
6323
6323
  fieldProps: _objectSpread$6(_objectSpread$6({}, formikFieldProps), {}, {
6324
6324
  required: props[isRequiredColumnName],
6325
6325
  error: meta.touched && meta.error,
6326
- options: isDropdown && buildOptionsToLabelAndValue(fieldData),
6326
+ options: isDropdown ? buildOptionsToLabelAndValue(fieldData) : undefined,
6327
6327
  value: getValueForField(formikFieldProps.value),
6328
6328
  dirty: dirty,
6329
6329
  label: !individualSubmit && pure.capitalize(name),
@@ -6395,7 +6395,7 @@ var Number$1 = function Number(props) {
6395
6395
  var showSubmitButton = props.individualSubmit && fieldProps.dirty;
6396
6396
  return /*#__PURE__*/React__default["default"].createElement(neetoui.Input, _extends({}, fieldProps, {
6397
6397
  type: "number",
6398
- suffix: showSubmitButton && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
6398
+ suffix: showSubmitButton && /*#__PURE__*/React__default["default"].createElement(formik.Button, {
6399
6399
  icon: neetoIcons.Check,
6400
6400
  style: "text",
6401
6401
  onClick: function onClick() {
@@ -11469,6 +11469,7 @@ var FieldValuesContainer = function FieldValuesContainer(_ref) {
11469
11469
  var _ref$resourceType = _ref.resourceType,
11470
11470
  resourceType = _ref$resourceType === void 0 ? "" : _ref$resourceType,
11471
11471
  fieldValues = _ref.fieldValues,
11472
+ propFields = _ref.fields,
11472
11473
  _ref$ownerId = _ref.ownerId,
11473
11474
  ownerId = _ref$ownerId === void 0 ? "" : _ref$ownerId,
11474
11475
  resourceId = _ref.resourceId,
@@ -11499,11 +11500,13 @@ var FieldValuesContainer = function FieldValuesContainer(_ref) {
11499
11500
  resourceType: ramda.isEmpty(resourceType) ? undefined : resourceType,
11500
11501
  ownerId: ramda.isEmpty(ownerId) ? undefined : ownerId,
11501
11502
  state: "active"
11503
+ }, {
11504
+ enabled: ramda.isNil(propFields)
11502
11505
  }),
11503
11506
  _useFetchFields$data = _useFetchFields.data,
11504
11507
  _useFetchFields$data2 = _useFetchFields$data === void 0 ? {} : _useFetchFields$data,
11505
11508
  _useFetchFields$data3 = _useFetchFields$data2.fields,
11506
- fields = _useFetchFields$data3 === void 0 ? [] : _useFetchFields$data3,
11509
+ fetchedFields = _useFetchFields$data3 === void 0 ? [] : _useFetchFields$data3,
11507
11510
  isFieldsLoading = _useFetchFields.isLoading;
11508
11511
  var _useCreateFieldValue = useCreateFieldValue(queryOptions),
11509
11512
  createFieldValue = _useCreateFieldValue.mutate;
@@ -11522,6 +11525,7 @@ var FieldValuesContainer = function FieldValuesContainer(_ref) {
11522
11525
  payload: payload
11523
11526
  }) : createFieldValue(payload);
11524
11527
  };
11528
+ var fields = propFields || fetchedFields;
11525
11529
  return /*#__PURE__*/React__default["default"].createElement("div", {
11526
11530
  className: classnames__default["default"]("space-y-3", {
11527
11531
  "neeto-ui-border-gray-300 rounded-lg border bg-white px-4 py-2": showBorder