Skip to content

Commit

Permalink
Create a new dist version 0.0.31-1.2.1 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan7empest authored Dec 18, 2022
1 parent d8562da commit c2d2743
Show file tree
Hide file tree
Showing 15 changed files with 475 additions and 241 deletions.
8 changes: 4 additions & 4 deletions dist/components/FormChipCell/FormChip/FormChip.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var FormChip = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
handleRemoveChip = _ref.handleRemoveChip,
handleToEditMode = _ref.handleToEditMode,
isDeleteMode = _ref.isDeleteMode,
isEditable = _ref.isEditable,
isEditMode = _ref.isEditMode,
keyName = _ref.keyName,
meta = _ref.meta,
setChipsSizes = _ref.setChipsSizes,
Expand Down Expand Up @@ -69,7 +69,7 @@ var FormChip = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
className: "input-label-key",
editConfig: editConfig,
handleRemoveChip: handleRemoveChip,
isEditable: isEditable,
isEditMode: isEditMode,
keyName: keyName,
meta: meta,
onChange: handleEditChip,
Expand All @@ -91,7 +91,7 @@ FormChip.defaultProps = {
font: 'purple'
},
isDeleteMode: false,
isEditable: false,
isEditMode: false,
keyName: '',
validationRules: {},
valueName: ''
Expand All @@ -105,7 +105,7 @@ FormChip.propTypes = {
handleRemoveChip: _propTypes.default.func.isRequired,
handleToEditMode: _propTypes.default.func.isRequired,
isDeleteMode: _propTypes.default.bool,
isEditable: _propTypes.default.bool,
isEditMode: _propTypes.default.bool,
keyName: _propTypes.default.string,
meta: _propTypes.default.object.isRequired,
setChipsSizes: _propTypes.default.func.isRequired,
Expand Down
28 changes: 14 additions & 14 deletions dist/components/FormChipCell/FormChipCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var FormChipCell = function FormChipCell(_ref) {
delimiter = _ref.delimiter,
formState = _ref.formState,
initialValues = _ref.initialValues,
isEditable = _ref.isEditable,
isEditMode = _ref.isEditMode,
label = _ref.label,
name = _ref.name,
onClick = _ref.onClick,
Expand Down Expand Up @@ -103,20 +103,20 @@ var FormChipCell = function FormChipCell(_ref) {
var chipsCellRef = (0, _react.useRef)();
var chipsWrapperRef = (0, _react.useRef)();
var handleShowElements = (0, _react.useCallback)(function () {
if (!isEditable || isEditable && visibleChipsMaxLength) {
if (!isEditMode || isEditMode && visibleChipsMaxLength) {
setShowHiddenChips(function (state) {
return !state;
});
}
}, [isEditable, visibleChipsMaxLength]);
}, [isEditMode, visibleChipsMaxLength]);
var chips = (0, _react.useMemo)(function () {
return isEditable || visibleChipsMaxLength === 'all' ? {
return isEditMode || visibleChipsMaxLength === 'all' ? {
visibleChips: (0, _lodash.get)(formState.values, name),
hiddenChips: []
} : (0, _generateChipsList.generateChipsList)((0, _lodash.get)(formState.values, name), visibleChipsMaxLength ? visibleChipsMaxLength : visibleChipsCount);
}, [visibleChipsMaxLength, isEditable, visibleChipsCount, formState.values, name]);
}, [visibleChipsMaxLength, isEditMode, visibleChipsCount, formState.values, name]);
var handleResize = (0, _react.useCallback)(function () {
if (!isEditable && !(0, _common.isEveryObjectValueEmpty)(chipsSizes)) {
if (!isEditMode && !(0, _common.isEveryObjectValueEmpty)(chipsSizes)) {
var _chipsCellRef$current;

var parentSize = (_chipsCellRef$current = chipsCellRef.current) === null || _chipsCellRef$current === void 0 ? void 0 : _chipsCellRef$current.getBoundingClientRect().width;
Expand All @@ -140,18 +140,18 @@ var FormChipCell = function FormChipCell(_ref) {
setVisibleChipsCount(chipIndex);
setShowChips(true);
}
}, [chipsSizes, isEditable]);
}, [chipsSizes, isEditMode]);
(0, _react.useEffect)(function () {
handleResize();
}, [handleResize, showChips]);
(0, _react.useEffect)(function () {
if (!isEditable) {
if (!isEditMode) {
window.addEventListener('resize', handleResize);
return function () {
return window.removeEventListener('resize', handleResize);
};
}
}, [handleResize, isEditable]);
}, [handleResize, isEditMode]);
(0, _react.useEffect)(function () {
window.addEventListener('mainResize', handleResize);
return function () {
Expand Down Expand Up @@ -262,7 +262,7 @@ var FormChipCell = function FormChipCell(_ref) {
event && event.preventDefault();
}, [editConfig.chipIndex, handleRemoveChip, checkChipsList, formState.values, name]);
var handleToEditMode = (0, _react.useCallback)(function (event, index) {
if (isEditable) {
if (isEditMode) {
event.stopPropagation();
setEditConfig(function (preState) {
return _objectSpread(_objectSpread({}, preState), {}, {
Expand All @@ -275,7 +275,7 @@ var FormChipCell = function FormChipCell(_ref) {
}

onClick && onClick();
}, [isEditable, onClick]);
}, [isEditMode, onClick]);

var validateFields = function validateFields(fieldsArray) {
var uniquenessValidator = function uniquenessValidator(newValue, idx) {
Expand Down Expand Up @@ -378,7 +378,7 @@ var FormChipCell = function FormChipCell(_ref) {
handleRemoveChip: handleRemoveChip,
handleShowElements: handleShowElements,
handleToEditMode: handleToEditMode,
isEditable: isEditable,
isEditMode: isEditMode,
name: name,
ref: {
chipsCellRef: chipsCellRef,
Expand Down Expand Up @@ -406,7 +406,7 @@ FormChipCell.defaultProps = {
font: 'purple'
},
delimiter: null,
isEditable: false,
isEditMode: false,
label: null,
onClick: function onClick() {},
shortChips: false,
Expand All @@ -419,7 +419,7 @@ FormChipCell.propTypes = {
delimiter: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
formState: _propTypes.default.shape({}).isRequired,
initialValues: _propTypes.default.object.isRequired,
isEditable: _propTypes.default.bool,
isEditMode: _propTypes.default.bool,
label: _propTypes.default.string,
name: _propTypes.default.string.isRequired,
onClick: _propTypes.default.func,
Expand Down
16 changes: 8 additions & 8 deletions dist/components/FormChipCell/FormChipCellView.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
_handleRemoveChip = _ref.handleRemoveChip,
handleShowElements = _ref.handleShowElements,
handleToEditMode = _ref.handleToEditMode,
isEditable = _ref.isEditable,
isEditMode = _ref.isEditMode,
name = _ref.name,
setChipsSizes = _ref.setChipsSizes,
setEditConfig = _ref.setEditConfig,
Expand All @@ -70,8 +70,8 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
var chipsCellRef = _ref2.chipsCellRef,
chipsWrapperRef = _ref2.chipsWrapperRef;
var buttonAddClassNames = (0, _classnames.default)('button-add', chipOptions.background && "button-add-background_".concat(chipOptions.background), chipOptions.borderColor && "button-add-border_".concat(chipOptions.borderColor), chipOptions.font && "button-add-font_".concat(chipOptions.font), chipOptions.density && "button-add-density_".concat(chipOptions.density));
var wrapperClassNames = (0, _classnames.default)('chips-wrapper', isEditable && 'fixed-max-width');
var chipClassNames = (0, _classnames.default)('chip', 'chip__content', isEditable && 'data-ellipsis', shortChips && 'chip_short', chips.hiddenChips && 'chip_hidden', chipOptions.density && "chip-density_".concat(chipOptions.density), chipOptions.borderRadius && "chip-border_".concat(chipOptions.borderRadius), chipOptions.background && "chip-background_".concat(chipOptions.background), chipOptions.borderColor && "chip-border_".concat(chipOptions.borderColor), chipOptions.font && "chip-font_".concat(chipOptions.font), isEditable && 'editable', (showChips || isEditable) && 'chip_visible');
var wrapperClassNames = (0, _classnames.default)('chips-wrapper', isEditMode && 'fixed-max-width');
var chipClassNames = (0, _classnames.default)('chip', 'chip__content', isEditMode && 'data-ellipsis', shortChips && 'chip_short', chips.hiddenChips && 'chip_hidden', chipOptions.density && "chip-density_".concat(chipOptions.density), chipOptions.borderRadius && "chip-border_".concat(chipOptions.borderRadius), chipOptions.background && "chip-background_".concat(chipOptions.background), chipOptions.borderColor && "chip-border_".concat(chipOptions.borderColor), chipOptions.font && "chip-font_".concat(chipOptions.font), isEditMode && 'editable', (showChips || isEditMode) && 'chip_visible');
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
name: name,
validate: validateFields,
Expand All @@ -85,7 +85,7 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
validationRules.key.push(_formChipCell.uniquenessError);
}

return (isEditable || !(0, _common.isEveryObjectValueEmpty)(fields)) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
return (isEditMode || !(0, _common.isEveryObjectValueEmpty)(fields)) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "chips-cell",
ref: chipsCellRef,
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
Expand Down Expand Up @@ -118,7 +118,7 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
return _handleRemoveChip(event, fields, index);
},
handleToEditMode: handleToEditMode,
isEditable: isEditable,
isEditMode: isEditMode,
keyName: "".concat(contentItem, ".key"),
meta: meta,
ref: chipsCellRef,
Expand All @@ -143,7 +143,7 @@ var FormChipCellView = /*#__PURE__*/_react.default.forwardRef(function (_ref, _r
onClick: handleShowElements,
children: chips.hiddenChipsNumber
})]
}), isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
}), isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
className: buttonAddClassNames,
onClick: function onClick(e) {
return handleAddNewChip(e, fields);
Expand All @@ -165,7 +165,7 @@ FormChipCellView.defaultProps = {
density: 'dense',
font: 'purple'
},
isEditable: false,
isEditMode: false,
shortChips: false,
validationRules: {}
};
Expand All @@ -178,7 +178,7 @@ FormChipCellView.propTypes = {
handleRemoveChip: _propTypes.default.func.isRequired,
handleShowElements: _propTypes.default.func.isRequired,
handleToEditMode: _propTypes.default.func.isRequired,
isEditable: _propTypes.default.bool,
isEditMode: _propTypes.default.bool,
name: _propTypes.default.string.isRequired,
setChipsSizes: _propTypes.default.func.isRequired,
setEditConfig: _propTypes.default.func.isRequired,
Expand Down
14 changes: 7 additions & 7 deletions dist/components/FormChipCell/NewChipForm/NewChipForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
className = _ref.className,
editConfig = _ref.editConfig,
handleRemoveChip = _ref.handleRemoveChip,
isEditable = _ref.isEditable,
isEditMode = _ref.isEditMode,
keyName = _ref.keyName,
meta = _ref.meta,
onChange = _ref.onChange,
Expand Down Expand Up @@ -187,7 +187,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
var focusChip = (0, _react.useCallback)(function (event) {
event.stopPropagation();

if (editConfig.chipIndex === chipIndex && isEditable) {
if (editConfig.chipIndex === chipIndex && isEditMode) {
if (!event.shiftKey && event.key === _constants.TAB && editConfig.isValueFocused) {
onChange(event, _constants.TAB);
} else if (event.shiftKey && event.key === _constants.TAB && editConfig.isKeyFocused) {
Expand All @@ -203,7 +203,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
});
}
}
}, [editConfig, onChange, chipIndex, isEditable]);
}, [editConfig, onChange, chipIndex, isEditMode]);
var handleOnFocus = (0, _react.useCallback)(function (event) {
if (editConfig.chipIndex === chipIndex) {
if (event.target.name === keyName) {
Expand Down Expand Up @@ -292,7 +292,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
ref: refInputContainer,
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_NewChipInput.default, {
className: labelKeyClassName,
disabled: !isEditable || editConfig.chipIndex !== chipIndex,
disabled: !isEditMode || editConfig.chipIndex !== chipIndex,
name: keyName,
onChange: handleOnChange,
onFocus: handleOnFocus,
Expand All @@ -306,7 +306,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
children: ":"
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_NewChipInput.default, {
className: labelValueClassName,
disabled: !isEditable || editConfig.chipIndex !== chipIndex,
disabled: !isEditMode || editConfig.chipIndex !== chipIndex,
name: valueName,
onChange: handleOnChange,
onFocus: handleOnFocus,
Expand All @@ -315,7 +315,7 @@ var NewChipForm = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
style: {
width: chipData.valueFieldWidth
}
}), editConfig.chipIndex !== chipIndex && isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
}), editConfig.chipIndex !== chipIndex && isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
className: "edit-chip__icon-close",
onClick: function onClick(event) {
return handleRemoveChip(event, chipIndex);
Expand All @@ -340,7 +340,7 @@ NewChipForm.propTypes = {
className: _propTypes.default.string,
editConfig: _propTypes.default.shape({}).isRequired,
handleRemoveChip: _propTypes.default.func.isRequired,
isEditable: _propTypes.default.bool.isRequired,
isEditMode: _propTypes.default.bool.isRequired,
keyName: _propTypes.default.string.isRequired,
meta: _propTypes.default.object.isRequired,
onChange: _propTypes.default.func.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion dist/components/FormCombobox/FormCombobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ var FormCombobox = function FormCombobox(_ref) {
setIsInvalid(meta.invalid && (meta.validating || meta.modified || meta.submitFailed && meta.touched));
}, [meta.invalid, meta.modified, meta.submitFailed, meta.touched, meta.validating]);
var handleOutsideClick = (0, _react.useCallback)(function (event) {
if (comboboxRef.current && !comboboxRef.current.contains(event.target) && suggestionListRef.current && !suggestionListRef.current.contains(event.target)) {
if (comboboxRef.current && !comboboxRef.current.contains(event.target)) {
setSearchIsFocused(false);
setShowSelectDropdown(false);
setShowSuggestionList(false);
Expand Down
Loading

0 comments on commit c2d2743

Please sign in to comment.