0.0.36 • Published 1 year ago

@prestojs/ui v0.0.36

Weekly downloads
1
License
MIT
Repository
-
Last release
1 year ago

UI

Base types and components for UI integration with prestojs.

To use wrap your app with the UiProvider:

import { render } from 'react-dom';
import { UiProvider } from '@prestojs/ui';
import { getWidgetForField as getDateWidget } from 'customdatepackage';
import { getWidgetForField as getAntdWidget } from '@prestojs/ui-antd';

import App from './App';

function getWidgetForField(field) {
    // Add any app specific customisations here
    if (field instanceof BooleanField) {
        return CustomBooleanWidget;
    }
    // Otherwise fall back to specific UI library defaults
    let widget;
    if ((widget = getDateWidget(field))) return widget;
    if ((widget = getAntdWidget(field))) return widget;

    // Fall through to any parent UiProvider. If there is none or they
    // don't provide a widget for this field then an error will be thrown
}

render(
    <UiProvider getWidgetForField={getWidgetFromField}>
        <App />
    </UiProvider>,
    document.getElementById('root')
);
0.0.36

1 year ago

0.0.35

1 year ago

0.0.34

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.31

3 years ago

0.0.30

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.22

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago