Is the table-mode a possibility? #8
matheo
started this conversation in
Dynamic Forms
Replies: 1 comment 1 reply
-
Taking a look at the demo you linked + taking into consideration the question here is some ideas to bounce around:
createMatConfig('RADIO', /*top level is RADIO*/{
name: 'account',
params: {
options: [
{ text: 'Create Account', value: 'CREATE' },
{ text: 'Checkout as a Guest', value: 'GUEST' },
],
},
modes: {
display: {
control: 'INPUT', /* nested another type is defined for some sort of modes that the form will be in*/
params: {
getValue: (params: DynMatRadioParams, value: string) => {
const option = params.options.find(o => o.value === value);
return value && option ? option.text : value;
},
},
},
},
}) My suggestion would be since there is some consideration towards the visibility of an element to perhaps consider some sort of isVisible computed property
enum MODES = {
EDIT = 'EDIT',
DISPLAY = 'DISPLAY',
}
createMatConfig('RADIO', {
name: 'account',
isVisible: (mode)=>mode===MODES.EDIT // is called with the current state of the form
params: {
options: [
{ text: 'Create Account', value: 'CREATE' },
{ text: 'Checkout as a Guest', value: 'GUEST' },
],
}
})
createMatConfig('INPUT', {
name: 'account',
isVisible: (mode)=>mode===MODES.DISPLAY // is called with the current state of the form
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
dyn-form
support any kind ofmode
that we configure.It will just refresh the
DynControl
factories any time we change it with new configuration overrides.We can have a
RADIO
control in theedit
mode but change it toINPUT
indisplay
mode, as the simple-form demo shows.However, thinking about all the possibilities that we have with this Dynamic Forms library,
we could be able to build tables, and implement some inline editing of then, in a custom implementation of the config, let's say another package like
@myndpm/dyn-tables
with a specificly typed config.Is it worth to play with
ng-templates
and create columns dynamically while we also support inline cell-edition?it just sounds good and maybe it's not worth?
Beta Was this translation helpful? Give feedback.
All reactions