Skip to content

Commit

Permalink
Merge branch 'acceptance' into feat/richtext-supports-pagevariables-P…
Browse files Browse the repository at this point in the history
…AGE-4131
  • Loading branch information
JorisPannekeet authored Mar 8, 2024
2 parents 81702c7 + 19f5409 commit 9d4a034
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# [2.183.0](https://github.com/bettyblocks/material-ui-component-set/compare/v2.182.2...v2.183.0) (2024-03-08)


### Bug Fixes

* remove console ([91dd925](https://github.com/bettyblocks/material-ui-component-set/commit/91dd925faa0cd93a1c367f7a5491799739ce22c5))


### Features

* added pagevariable belongsto support for radio, select and autocomplete components ([3658315](https://github.com/bettyblocks/material-ui-component-set/commit/365831587307934ebeef96e0ff19e53f56e1c23b))

## [2.182.2](https://github.com/bettyblocks/material-ui-component-set/compare/v2.182.1...v2.182.2) (2024-03-04)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "component-set",
"version": "2.182.2",
"version": "2.183.0",
"main": "dist/templates.json",
"license": "UNLICENSED",
"private": false,
Expand Down
4 changes: 4 additions & 0 deletions src/components/autocompleteInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@
(hasDefaultLabelProperty && defaultLabelProperty) ||
idProperty;

useEffect(() => {
setValue(defaultValue.replace(/\n/g, ''));
}, [defaultValue]);

/*
* This component only works with relational or list properties.
* the value of a list property is the list item itself.
Expand Down
9 changes: 9 additions & 0 deletions src/components/radioinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@

const isListProperty = kind === 'list' || kind === 'LIST';
const isObjectProperty = kind === 'object' || kind === 'OBJECT';
const isPageVariableProperty = prefabValue.find(
(item) => item.type === 'PAGE_VARIABLE_MODEL_PROPERTY',
);

const isPropertyArray = Boolean(
prefabValue.length && prefabValue.some((p) => p.type === 'PROPERTY'),
Expand All @@ -76,6 +79,8 @@
resolvedCurrentValue = defaultValueText;
} else if (isPropertyArray && !isObjectProperty) {
resolvedCurrentValue = parseInt(defaultValueText, 10) || '';
} else if (isPageVariableProperty) {
resolvedCurrentValue = getValue(defaultValueText);
} else if (kind === undefined) {
// if kind is undefined, it is non property based
resolvedCurrentValue = '';
Expand All @@ -84,6 +89,10 @@
}
const [currentValue, setCurrentValue] = useState(resolvedCurrentValue);

useEffect(() => {
setCurrentValue(resolvedCurrentValue);
}, [defaultValueText]);

B.defineFunction('Clear', () => setCurrentValue(''));
B.defineFunction('Enable', () => setIsDisabled(false));
B.defineFunction('Disable', () => setIsDisabled(true));
Expand Down
5 changes: 5 additions & 0 deletions src/components/selectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
: defaultValueText || placeholderLabelText;

const [currentValue, setCurrentValue] = useState(resolvedCurrentValue);

useEffect(() => {
setCurrentValue(resolvedCurrentValue);
}, [defaultValueText]);

B.defineFunction('Clear', () => setCurrentValue(''));
B.defineFunction('Enable', () => setIsDisabled(false));
B.defineFunction('Disable', () => setIsDisabled(true));
Expand Down

0 comments on commit 9d4a034

Please sign in to comment.