react-admin-base-bootstrap 0.8.17 → 0.8.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/modules.xml +8 -0
- package/.idea/react-admin-base-bootstrap.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/lib/esm/Components/ApiSelect.d.ts +2 -4
- package/lib/esm/Components/ApiSelect.js +18 -20
- package/package.json +2 -2
- package/src/Components/ApiSelect.tsx +0 -1
- package/lib/esm/Components/DragDrop.d.ts +0 -2
- package/lib/esm/Components/DragDrop.js +0 -11
- package/lib/esm/Components/RichTextEditor.d.ts +0 -4
- package/lib/esm/Components/RichTextEditor.js +0 -52
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/react-admin-base-bootstrap.iml" filepath="$PROJECT_DIR$/.idea/react-admin-base-bootstrap.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
export interface ApiSelectProps<Option = any> {
|
|
5
3
|
url?: string;
|
|
@@ -19,8 +17,8 @@ export interface ApiSelectProps<Option = any> {
|
|
|
19
17
|
onAddOrEdit?: (item: any) => void;
|
|
20
18
|
getNewOptionData?: (name: string, elem: React.ReactNode) => any | null;
|
|
21
19
|
}
|
|
22
|
-
export default function ApiSelect<Option = any>(props: ApiSelectProps<Option>):
|
|
20
|
+
export default function ApiSelect<Option = any>(props: ApiSelectProps<Option>): React.JSX.Element;
|
|
23
21
|
export interface CreateSelectProps<Option = any> extends ApiSelectProps<Option> {
|
|
24
22
|
Component: any;
|
|
25
23
|
}
|
|
26
|
-
export declare function CreateSelect(props: CreateSelectProps):
|
|
24
|
+
export declare function CreateSelect(props: CreateSelectProps): React.JSX.Element;
|
|
@@ -7,25 +7,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
/** @jsx jsx */
|
|
11
|
-
import { jsx } from '@emotion/react';
|
|
12
10
|
import React, { Fragment, useCallback, useMemo, useState } from 'react';
|
|
13
11
|
import { RefreshScope, useFetch, useRefresh } from 'react-admin-base';
|
|
14
12
|
import { FormattedMessage, useIntl } from 'react-intl';
|
|
15
13
|
import Select, { components } from "react-select";
|
|
16
14
|
import CreatableSelect from 'react-select/creatable';
|
|
17
15
|
function Option(props) {
|
|
18
|
-
return
|
|
16
|
+
return React.createElement(components.Option, Object.assign({}, props), (props.selectProps.children && props.selectProps.children(props.data)) || (props.data.__isNew__ ? React.createElement(FormattedMessage, { id: "CREATE_VALUE", values: { text: props.children } }) : props.children));
|
|
19
17
|
}
|
|
20
18
|
function SingleValue(props) {
|
|
21
|
-
return
|
|
19
|
+
return React.createElement(components.SingleValue, Object.assign({}, props), (props.selectProps.children && props.selectProps.children(props.data)) || (props.data.__isNew__ ? React.createElement(FormattedMessage, { id: "CREATE_VALUE", values: { text: props.children } }) : props.children));
|
|
22
20
|
}
|
|
23
21
|
function MultiValue(props) {
|
|
24
|
-
return
|
|
22
|
+
return React.createElement(components.MultiValue, Object.assign({}, props), (props.selectProps.children && props.selectProps.children(props.data)) || props.children);
|
|
25
23
|
}
|
|
26
24
|
function EditOrAddIndicator(props) {
|
|
27
25
|
const { className, cx, getStyles, innerProps, isMulti } = props;
|
|
28
|
-
return (
|
|
26
|
+
return (React.createElement("div", Object.assign({}, innerProps, { className: cx({
|
|
29
27
|
indicator: true,
|
|
30
28
|
'clear-indicator': true
|
|
31
29
|
}, className), css: getStyles('clearIndicator', props), onMouseDown: e => {
|
|
@@ -33,20 +31,20 @@ function EditOrAddIndicator(props) {
|
|
|
33
31
|
e.preventDefault();
|
|
34
32
|
props.selectProps.onAddOrEdit();
|
|
35
33
|
} }),
|
|
36
|
-
|
|
34
|
+
React.createElement("i", { className: "fas " + (props.hasValue && !isMulti ? 'fa-pencil-alt' : 'fa-plus') })));
|
|
37
35
|
}
|
|
38
36
|
function IndicatorsContainer(props) {
|
|
39
|
-
return
|
|
40
|
-
props.selectProps.onAddOrEdit &&
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
return React.createElement(components.IndicatorsContainer, Object.assign({}, props),
|
|
38
|
+
props.selectProps.onAddOrEdit && React.createElement(React.Fragment, null,
|
|
39
|
+
React.createElement(EditOrAddIndicator, Object.assign({}, props)),
|
|
40
|
+
React.createElement(components.IndicatorSeparator, Object.assign({}, props))),
|
|
43
41
|
props.children);
|
|
44
42
|
}
|
|
45
43
|
function MultiValueRemove(props) {
|
|
46
|
-
return
|
|
47
|
-
props.selectProps.onAddOrEdit &&
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
return React.createElement(Fragment, null,
|
|
45
|
+
props.selectProps.onAddOrEdit && React.createElement(components.MultiValueRemove, Object.assign({}, props, { innerProps: Object.assign(Object.assign({}, props.innerProps), { onClick: () => props.selectProps.onAddOrEdit(props.data) }) }),
|
|
46
|
+
React.createElement("i", { className: "fas fa-pencil", style: { fontSize: '.75em' } })),
|
|
47
|
+
React.createElement(components.MultiValueRemove, Object.assign({}, props)));
|
|
50
48
|
}
|
|
51
49
|
const Components = { Option, SingleValue, MultiValue, IndicatorsContainer, MultiValueRemove };
|
|
52
50
|
export default function ApiSelect(props) {
|
|
@@ -89,8 +87,8 @@ export default function ApiSelect(props) {
|
|
|
89
87
|
setIsMenuOpen(false);
|
|
90
88
|
}, [setIsMenuOpen]);
|
|
91
89
|
const Component = onCreateOption ? CreatableSelect : Select;
|
|
92
|
-
return
|
|
93
|
-
|
|
90
|
+
return React.createElement(RefreshScope, { update: update },
|
|
91
|
+
React.createElement(Component, Object.assign({}, props, { className: 'react-select-container', classNamePrefix: "react-select", onCreateOption: onCreateOption && handleCreateOption, getNewOptionData: (onCreateOption && (getNewOptionData || ((inputValue) => ({ [nameKey || 'name']: inputValue, __isNew__: true })))) || undefined, inputValue: search, onInputChange: a => setSearch(a), components: Components, isLoading: !!loading || creating, getOptionLabel: getOptionLabel || ((row) => row[nameKey || 'name']), getOptionValue: getOptionValue || ((row) => row[idKey || 'id']), isDisabled: !!disabled || creating, isClearable: true, isSearchable: true, placeholder: placeholder || intl.formatMessage({ id: 'SELECT' }), options: !options ? [] : ((filter && options.filter(filter)) || options), onMenuOpen: onMenuOpen, onMenuClose: onMenuClose })));
|
|
94
92
|
}
|
|
95
93
|
export function CreateSelect(props) {
|
|
96
94
|
const { Component, onChange, value, isMulti, idKey } = props;
|
|
@@ -102,7 +100,7 @@ export function CreateSelect(props) {
|
|
|
102
100
|
data && onChange(isMulti ? isOpenId ? value.map(b => b.id === isOpenId ? data : b) : (value || []).concat([data]) : data);
|
|
103
101
|
update && update();
|
|
104
102
|
}, [value, onChange, isMulti, isOpenId, isOpen, update, setIsOpen]);
|
|
105
|
-
return
|
|
106
|
-
isOpen &&
|
|
107
|
-
|
|
103
|
+
return React.createElement(Fragment, null,
|
|
104
|
+
isOpen && React.createElement(Component, { id: isOpenId || (!isMulti && value && value[idKey || "id"]), onReload: onReload }),
|
|
105
|
+
React.createElement(ApiSelect, Object.assign({}, props, { onAddOrEdit: item => setIsOpen(item || true) })));
|
|
108
106
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-admin-base-bootstrap",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"react": "^18.2.0",
|
|
29
29
|
"react-dom": "^18.2.0",
|
|
30
30
|
"react-intl": "^6.2.10",
|
|
31
|
-
"react-router-dom": "^6.
|
|
31
|
+
"react-router-dom": "^6.18.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@emotion/react": "^11.11.1",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Button } from "reactstrap";
|
|
3
|
-
import { useDragContext } from "react-admin-base";
|
|
4
|
-
export function DragAndDropArrow(props) {
|
|
5
|
-
const [ref, isDragging] = useDragContext();
|
|
6
|
-
if (!ref)
|
|
7
|
-
return null;
|
|
8
|
-
return React.createElement(Button, Object.assign({ type: "button", innerRef: ref, outline: true, size: "sm", color: "primary" }, props),
|
|
9
|
-
React.createElement("i", { className: "fas fa-arrows-up-down-left-right" }),
|
|
10
|
-
props.children);
|
|
11
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
3
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
4
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
5
|
-
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
6
|
-
import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
7
|
-
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
8
|
-
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
9
|
-
import { ListItemNode, ListNode } from "@lexical/list";
|
|
10
|
-
import { CodeHighlightNode, CodeNode } from "@lexical/code";
|
|
11
|
-
import { AutoLinkNode, LinkNode } from "@lexical/link";
|
|
12
|
-
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
13
|
-
import { ListPlugin } from "@lexical/react/LexicalListPlugin";
|
|
14
|
-
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
15
|
-
import { TRANSFORMERS } from "@lexical/markdown";
|
|
16
|
-
import ToolbarPlugin from '../Lexical/ToolbarPlugin';
|
|
17
|
-
function Placeholder() {
|
|
18
|
-
return React.createElement("div", { className: "editor-placeholder" }, "Enter some rich text...");
|
|
19
|
-
}
|
|
20
|
-
const editorConfig = {
|
|
21
|
-
namespace: '',
|
|
22
|
-
// Handling of errors during update
|
|
23
|
-
onError(error) {
|
|
24
|
-
throw error;
|
|
25
|
-
},
|
|
26
|
-
// Any custom nodes go here
|
|
27
|
-
nodes: [
|
|
28
|
-
HeadingNode,
|
|
29
|
-
ListNode,
|
|
30
|
-
ListItemNode,
|
|
31
|
-
QuoteNode,
|
|
32
|
-
CodeNode,
|
|
33
|
-
CodeHighlightNode,
|
|
34
|
-
TableNode,
|
|
35
|
-
TableCellNode,
|
|
36
|
-
TableRowNode,
|
|
37
|
-
AutoLinkNode,
|
|
38
|
-
LinkNode
|
|
39
|
-
]
|
|
40
|
-
};
|
|
41
|
-
export default function RichTextEditor({ value, onChange }) {
|
|
42
|
-
return React.createElement(LexicalComposer, { initialConfig: editorConfig },
|
|
43
|
-
React.createElement("div", { className: "editor-container" },
|
|
44
|
-
React.createElement(ToolbarPlugin, null),
|
|
45
|
-
React.createElement("div", { className: "editor-inner" },
|
|
46
|
-
React.createElement(RichTextPlugin, { contentEditable: React.createElement(ContentEditable, { className: "editor-input" }), placeholder: React.createElement(Placeholder, null) }),
|
|
47
|
-
React.createElement(HistoryPlugin, null),
|
|
48
|
-
React.createElement(AutoFocusPlugin, null),
|
|
49
|
-
React.createElement(ListPlugin, null),
|
|
50
|
-
React.createElement(LinkPlugin, null),
|
|
51
|
-
React.createElement(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }))));
|
|
52
|
-
}
|