fulcro

janezj 2024-09-18T11:34:07.333919Z

@tony.kay I would like to add support for toggle? and label-top? to boolean-field to be similar to boolean-control. There is a PR but here I am posting visual differences, in case of label-top? there is better alignment. I am not sure that fo/field-style-configs is best choice for options

fo/field-style-configs {
 :client/scc {:toggle? true :label-top? true}
 :client/avio {:toggle? false :label-top? true}} 

tony.kay 2024-09-18T16:57:12.963479Z

So you’re talking about patching the SUI plugin?

tony.kay 2024-09-18T16:59:59.675359Z

I would consider :toggle to be a field style, on type boolean. But, the label fix would be very nice indeed, and would apply probably to both renderings (toggle vs button vs whatever) So, I’d say that the label position is a reasonable style config, but I’d probably call it :label-position and give it values like :inline and :above so that the concept could be used for later expansions, such as :below and :right or :left.

janezj 2024-09-18T18:24:01.576979Z

There is already label-top? https://github.com/fulcrologic/fulcro-rad-semantic-ui/blob/main/src/main/com/fulcrologic/rad/rendering/semantic_ui/controls/boolean_control.cljc#L13 This feature is hard to find and I am probably the only user. Can we unify field and control? Label above should be the default, but this is probably not allowed.

tony.kay 2024-09-19T02:22:45.272819Z

That’s for controls…what about form fields?

tony.kay 2024-09-19T02:23:06.704139Z

(and I did not remember that even existing :D)

tony.kay 2024-09-19T02:25:27.640269Z

well, it would be a very minor breaking change to make it the default, and I tend to agree with you. Controls are a bit more “loose” than the official options on forms and reports, so I’m not sure I would copy over a controls option to the form…The SUI plugin really isn’t meant to be the end-all for anyone, just really more of a placeholder until you write your own multimethod rendering for your stuff…so, I guess perhaps it’s ok

janezj 2024-09-19T08:47:18.723739Z

OK, so can we make it even simpler? Can we just silently change it to label-top without configuration options, because current misalignment is a bug. Toggle is not important for me, It might be interesting as app default. it is not RAD if you have to fine tune all checkboxes.

tony.kay 2024-09-19T13:27:02.961119Z

Sure

sheluchin 2024-09-18T17:52:43.246449Z

In RAD, if I have a standard defsc, what's the right way to render one of the prop values using the ao/style defined on the corresponding RAD model attribute?

janezj 2024-09-18T22:10:27.895749Z

This is my guess. I am not sure it is correct. If you look into renderers: https://github.com/fulcrologic/fulcro-rad-semantic-ui/tree/main/src/main/com/fulcrologic/rad/rendering/semantic_ui you will find form, report plumbing everywhere. So convert defsc into form to get attributes

;; bring exisitng props into form
fo/query-inclusion [{:gram (comp/get-query Pentagram)}]
fo/controls (merge {::hacker {:action (fn [this]
                                           (gram-dlg/show-dlg (second (comp/get-ident this))))
                                 :type :button
                                 :label "Pentagram"}}
                      form/standard-controls)
   fo/initialize-ui-props {:gram {}}}
And then you do a normal rendering of the defsh. I guess you will be able to call com.fulcrologic.rad.rendering.semantic-ui.boolean-field/render-field. (pr-str (comp/component-options this)) and (pr-str props) could help you.

sheluchin 2024-09-19T12:42:06.589109Z

Thank you for the tip, @jj974. I'll try this out shortly.