Skip to content

Commit

Permalink
Merge pull request #3394 from bettyblocks/feat/update-inputs-pagevar-…
Browse files Browse the repository at this point in the history
…belongsto-support-PAGE-4109

Feat/update inputs pagevar belongsto support page 4109
  • Loading branch information
JorisPannekeet authored Mar 8, 2024
2 parents e90b842 + 91dd925 commit 9d153e1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/publish_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ jobs:
AZURE_BLOB_ACCOUNT: ${{ secrets.AZURE_BLOB_ACCOUNT_US2 }}
AZURE_BLOB_ACCOUNT_KEY: ${{ secrets.AZURE_BLOB_ACCOUNT_KEY_US2 }}
run: yarn upload
- name: upload vabi
env:
AZURE_BLOB_ACCOUNT: ${{ secrets.AZURE_BLOB_ACCOUNT_VABI }}
AZURE_BLOB_ACCOUNT_KEY: ${{ secrets.AZURE_BLOB_ACCOUNT_KEY_VABI }}
run: yarn upload
- name: upload vvv
env:
AZURE_BLOB_ACCOUNT: ${{ secrets.AZURE_BLOB_ACCOUNT_VVV }}
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 9d153e1

Please sign in to comment.