Fluent UI react missing icons in Dropdown and DatePicker - office-ui-fabric-react

I'm creating an electron-app that uses Microsoft fluent-ui lib. I have added the reference #fluentui/react": "^7.107.1 to the package.json file. When I then create a Dropdown like this
<Dropdown
label='Time zone'
onChange={(e, option) => this.updateTimeZone(..)}
/>
The caret with the drop down icon is missing.
When inspecting the element, it seems as the i-tag is empty and does not have the right font applied in the css-class, when compared to examples in the documentation.
Could someone see what I'm doing wrong?

By default, the Fabric icons are not added to your bundle, in order to save bytes for scenarios where you don't care about icons, or you only care about a subset.
To make them available, you may initialize them as such:
import { initializeIcons } from 'office-ui-fabric-react/lib/Icons';
initializeIcons(/* optional base url */);

Related

Change tt_content's TCA for a subtype?

Is it possible, for a specific plugin (e.g. newspage_pi1), to configure its TCA, i.e. its back-end form display? Just for that specific plugin, because when changing tt_content's TCA for the list type (i.e. plugins) like this:
$GLOBALS['TCA']['tt_content']['types']["list"] = [
'showitem' => "
(tabs..palettes..columns..etc...)"];
It changes it for all plugins, and I only want to change it for the newspage_pi1 list_type.
Yes, I know that I can use 'subtype_value_field' => 'list_type' and then subtypes_excludelist and subtypes_addlist to add or remove fields for specific plugins. But this is not nearly as powerful as setting showitem directly, since it allows to define new tabs, palettes, position the fields how you want to, etc.
I also know about FlexForms, but these only control the Plugin Options field, not all the other ones.
Is there a way to change the showitem for a specific plugin?
Thanks a lot in advance!
Frankly said, what you actually want is not a subtype but another type, since it needs to change fields other than the usual plugin / pi_flexform configurations.
So instead of adding that subtype as a plugin you should add it as another CType to get the full power of showitem.
Basically, this is how we add any kind of plugin too, since it makes more sense to have real database fields at hand instead of faking them with XML data structures.
As mentioned in the description here https://api.typo3.org/master/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_utility_1_1_extension_management_utility.html#ab4f6c66990aca246eac5390a76f0c83c
... - or more generally use this function to add an entry to any
selectorbox/radio-button set in the FormEngine

Element Checkbox got its label always to the left and needs a link

How can I change the positions of checkbox and label and how to implement a link into the label?
$acceptGTC = new Element\Checkbox('AGBs');
$acceptGTC->setLabel('I Accept the GTC (show it).');
$this->add($acceptGTC);
regards
n00n
meanwhile:
I tried to overwrite the view helper for checkboxes.
copied
*/vendor/zendframework/zend-form/src/View/Helper/FormCheckbox.php
to
*/module/Application/src/Application/View/Helper/FormCheckbox.php
added to module.config.php
'viewhelpers' => array('checkbox'=>'Application\View\Helper'),
But it still uses the original one...
Do I have to tell zend to use my FormCheckbox?
I don't exactly know the way you are rendering your Zend_Form_Element, but in order to enhance the rendering as you want you should build a custom decorator, and add it to this element.
You should read the Zend documentation on Zend_Form_Decorators, everything is quite well explained and should lead you to a fancy solution.

How do you inspect a react element's props & state in the console?

React Developer Tools give a lot of power to inspect the React component tree, and look at props, event handlers, etc. However, what I'd really like to do is to be able to inspect those data structures in the browser console.
In chrome I can play with the currently selected DOM element in the console using $0. Is there a way to extract React component info from $0, or is it possible to do something similar with the React Dev Tools?
Using React Developer Tools you can use $r to get a reference to the selected React Component.
The following screenshot shows you that I use React Developer Tools to select a component (Explorer) which has a state-object callednodeList. In the console I can now simply write $r.state.nodeList to reference this object in the state. Same works with the props (eg.: $r.props.path)
An answer to your question can be found here in a similar question I asked:
React - getting a component from a DOM element for debugging
I'm providing an answer here because I don't have the necessary reputation points in order to mark as duplicate or to comment above.
Basically, this is possible if you are using the development build of react because you can leverage the TestUtils to accomplish your goal.
You need to do only two things:
Statically store the root level component you got from React.render().
Create a global debug helper function that you can use in the console with $0 that accesses your static component.
So the code in the console might look something like:
> getComponent($0).props
The implementation of getComponent can use React.addons.TestUtils.findAllInRenderedTree to search for match by calling getDOMNode on all the found components and matching against the passed in element.
Open console (Firefox,Chrome) and locate any reactjs rendered DOM element or alternatively execute js script to locate it:
document.getElementById('ROOT')
Then check for element properties in object property viewer for attributes with name beginning like '__reactInternalInstace$....' expand _DebugOwner and see stateNode.
The found stateNode will contain (if it has) 'state' and 'props' attributes which is used heavily in reactjs app.
Though the accepted answer works, and is a great method, in 2020 you can now do a lot of inspection without using the $r method. The Components tab of React DevTools will show you props and detailed state when you select the relevant component (make sure you're on the right level), as well as let you do other things like suspend it or inspect the matching DOM element (little icons in the top right).
Assign the state or prop object to the window object:
window.title = this.state.title
And then from the dev tools console you can try different methods on the exposed object such as:
window.title.length
8
You can attach a reference to the window object like
import { useSelector } from "react-redux";
function App() {
// Development only
window.store = useSelector((state) => state);
return (
<div className="App">
</div>
);
}
export default App;
Then access it from the console
store
{states: {…}}
states:
someProperty: false
[[Prototype]]: Object
[[Prototype]]: Object
[Console][1]
[1]: https://i.stack.imgur.com/A4agJ.png

android:background - "?attr/actionBarItemBackground" .. How it works?

I have seen two ways to set background for Android App screen.
case A:: android:background="?attr/actionBarItemBackground"
case B:: android:background="#drawable/ic_launcher_settings"
How do android:background functions in the case A? I searched code, but not able to figure out where "actionBarItemBackground" exists. I understood case B
Case A is a reference to a style attribute. It allows you to reference a particular piece of style information without knowing its actual value. There are a lot of Android-defined attributes that are used to style the Android UI, but you can also define you own attributes.
actionBarItemBackground is one such attribute. There are two ways you can use this attribute:
You can reference it to make the look and feel of UI elements consistent with action bar items:
<com.mycompany.MyView
android:id="#+id/myView"
android:background="?attr/actionBarItemBackground"/>
You can define a theme and set the value of this attribute to override the default L&F for your app:
<style name="MyTheme" parent="#android:style/Theme">
<item name="android:actionBarItemBackground">#383c44</item>
</style>
Here are some pointers to the Android documentation:
For styles an themes see:
http://developer.android.com/guide/topics/ui/themes.html.
For a list of all attributes see:
http://developer.android.com/reference/android/R.attr.html
For defining your own attributes there is no documentation. Have a look at one of the attrs.xml files in the SDK (e.g. under platforms\android-17\data\res\values) to see how style attributes are declared. You can declare attributes in the same way by putting an attrs.xml file in your res\values folder. You can then use these attributes in your own styles and themes.

Typo3: classes for elements

I have 3 different kinds of in my website, and I want to give be able to give different classes from the backend using the RTE from the Text Element. It should look like this:
<ul class="type2">
....
</ul`>
I thought I should use one of the 3 boxes from the RTE, probably "blockstyle", but im not sure how to add new options to this dropdow. Can someone please help me? Thanks!
The standard RTE editor (rtehtmlarea) populates the class list by parsing the CSS file that you set for it so all you need to do is to define ul.type2 in that CSS file. See the manual of the extension and search for contentCSS property. Example:
RTE.default.contentCSS = fileadmin/template/rte.css
Note that you might have to set it also for each table, e.g.:
RTE.config.tt_content.bodytext.contentCSS = fileadmin/template/rte.css
This depends on your configuration and whether you already have default settings (RTE.default) copied into other configurations. See Info -> [page] -> Page TSconfig -> RTE. for your current settings.