@etsoo/react 1.4.71 → 1.4.75
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/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mu/DnDList.js +2 -2
- package/lib/mu/MobileListItemRenderer.js +0 -1
- package/lib/mu/SelectBool.d.ts +14 -0
- package/lib/mu/SelectBool.js +21 -0
- package/lib/mu/Tiplist.js +2 -1
- package/lib/mu/pages/ViewPage.js +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/mu/DnDList.tsx +5 -2
- package/src/mu/MobileListItemRenderer.tsx +0 -2
- package/src/mu/SelectBool.tsx +31 -0
- package/src/mu/Tiplist.tsx +3 -1
- package/src/mu/pages/ViewPage.tsx +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export * from './mu/ScrollTopFab';
|
|
|
64
64
|
export * from './mu/SearchBar';
|
|
65
65
|
export * from './mu/SearchField';
|
|
66
66
|
export * from './mu/SearchOptionGroup';
|
|
67
|
+
export * from './mu/SelectBool';
|
|
67
68
|
export * from './mu/SelectEx';
|
|
68
69
|
export * from './mu/Switch';
|
|
69
70
|
export * from './mu/SwitchAnt';
|
package/lib/index.js
CHANGED
|
@@ -67,6 +67,7 @@ export * from './mu/ScrollTopFab';
|
|
|
67
67
|
export * from './mu/SearchBar';
|
|
68
68
|
export * from './mu/SearchField';
|
|
69
69
|
export * from './mu/SearchOptionGroup';
|
|
70
|
+
export * from './mu/SelectBool';
|
|
70
71
|
export * from './mu/SelectEx';
|
|
71
72
|
export * from './mu/Switch';
|
|
72
73
|
export * from './mu/SwitchAnt';
|
package/lib/mu/DnDList.js
CHANGED
|
@@ -102,12 +102,12 @@ export function DnDList(props) {
|
|
|
102
102
|
// Layout
|
|
103
103
|
return (React.createElement(React.Fragment, null,
|
|
104
104
|
sideRenderer && sideRenderer(true, addItem, addItems, reloadItems),
|
|
105
|
-
React.createElement(Component, { ...componentProps }, disabled ? (React.createElement("div",
|
|
105
|
+
React.createElement(Component, { ...componentProps }, disabled ? (React.createElement("div", { style: getListStyle(false) }, items.map((item, index) => {
|
|
106
106
|
// Id
|
|
107
107
|
const id = DataTypes.convert(item[labelField], 'string');
|
|
108
108
|
if (id == null)
|
|
109
109
|
return;
|
|
110
|
-
return (React.createElement("div",
|
|
110
|
+
return (React.createElement("div", { key: id, style: getItemStyle(false, index) }, children(item, index, deleteItem, editItem)));
|
|
111
111
|
}))) : (React.createElement(DragDropContext, { onDragEnd: onDragEndLocal },
|
|
112
112
|
React.createElement(Droppable, { droppableId: name }, (provided, snapshot) => (React.createElement("div", { ...provided.droppableProps, ref: provided.innerRef, style: getListStyle(snapshot.isDraggingOver) },
|
|
113
113
|
items.map((item, index) => {
|
|
@@ -22,7 +22,6 @@ export function MobileListItemRenderer({ data, itemHeight, margins }, renderer)
|
|
|
22
22
|
// Loading
|
|
23
23
|
if (data == null)
|
|
24
24
|
return React.createElement(LinearProgress, null);
|
|
25
|
-
console.log('margins', margins);
|
|
26
25
|
// Elements
|
|
27
26
|
const [title, subheader, actions, children, cardActions] = renderer(data);
|
|
28
27
|
return (React.createElement(Card, { sx: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IdLabelDto } from '@etsoo/appscript';
|
|
3
|
+
import { SelectExProps } from './SelectEx';
|
|
4
|
+
/**
|
|
5
|
+
* SelectBool props
|
|
6
|
+
*/
|
|
7
|
+
export interface SelectBoolProps extends Omit<SelectExProps<IdLabelDto<string>>, 'options' | 'loadData'> {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* SelectBool (yes/no)
|
|
11
|
+
* @param props Props
|
|
12
|
+
* @returns Component
|
|
13
|
+
*/
|
|
14
|
+
export declare function SelectBool(props: SelectBoolProps): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { globalApp } from '..';
|
|
3
|
+
import { SelectEx } from './SelectEx';
|
|
4
|
+
/**
|
|
5
|
+
* SelectBool (yes/no)
|
|
6
|
+
* @param props Props
|
|
7
|
+
* @returns Component
|
|
8
|
+
*/
|
|
9
|
+
export function SelectBool(props) {
|
|
10
|
+
// Destruct
|
|
11
|
+
const { search = true, ...rest } = props;
|
|
12
|
+
// Options
|
|
13
|
+
const options = [
|
|
14
|
+
{ id: 'false', label: globalApp.get('no') },
|
|
15
|
+
{ id: 'true', label: globalApp.get('yes') }
|
|
16
|
+
];
|
|
17
|
+
if (search)
|
|
18
|
+
options.unshift({ id: '', label: '---' });
|
|
19
|
+
// Layout
|
|
20
|
+
return React.createElement(SelectEx, { options: options, search: search, ...rest });
|
|
21
|
+
}
|
package/lib/mu/Tiplist.js
CHANGED
|
@@ -10,6 +10,7 @@ import { SearchField } from './SearchField';
|
|
|
10
10
|
* @returns Component
|
|
11
11
|
*/
|
|
12
12
|
export function Tiplist(props) {
|
|
13
|
+
var _a;
|
|
13
14
|
// Destruct
|
|
14
15
|
const { search = false, idField = 'id', idValue, inputAutoComplete = 'off', inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputVariant, label, loadData, defaultValue, value, name, readOnly, onChange, openOnFocus = true, sx = { minWidth: '180px' }, ...rest } = props;
|
|
15
16
|
// Value input ref
|
|
@@ -133,7 +134,7 @@ export function Tiplist(props) {
|
|
|
133
134
|
}, []);
|
|
134
135
|
// Layout
|
|
135
136
|
return (React.createElement("div", null,
|
|
136
|
-
React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: 'none' }, name: name, value:
|
|
137
|
+
React.createElement("input", { ref: inputRef, "data-reset": "true", type: "text", style: { display: 'none' }, name: name, value: (_a = (states.value && Reflect.get(states.value, idField))) !== null && _a !== void 0 ? _a : '', readOnly: true, onChange: inputOnChange }),
|
|
137
138
|
React.createElement(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
138
139
|
// Set value
|
|
139
140
|
setInputValue(value);
|
package/lib/mu/pages/ViewPage.js
CHANGED
|
@@ -86,6 +86,6 @@ export function ViewPage(props) {
|
|
|
86
86
|
":"),
|
|
87
87
|
React.createElement(Typography, { variant: "subtitle2" }, itemData)));
|
|
88
88
|
})),
|
|
89
|
-
actions != null && (React.createElement(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", paddingTop: paddings, paddingBottom: paddings, gap: paddings }, Utils.getResult(actions, data))),
|
|
89
|
+
actions != null && (React.createElement(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "flex-end", paddingTop: paddings, paddingBottom: paddings, gap: paddings }, Utils.getResult(actions, data))),
|
|
90
90
|
Utils.getResult(children, data)))));
|
|
91
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.75",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
51
51
|
"@emotion/style": "^0.8.0",
|
|
52
52
|
"@emotion/styled": "^11.6.0",
|
|
53
|
-
"@etsoo/appscript": "^1.2.
|
|
53
|
+
"@etsoo/appscript": "^1.2.28",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.0",
|
|
55
55
|
"@etsoo/shared": "^1.1.6",
|
|
56
56
|
"@mui/icons-material": "^5.3.1",
|
package/src/index.ts
CHANGED
|
@@ -71,6 +71,7 @@ export * from './mu/ScrollTopFab';
|
|
|
71
71
|
export * from './mu/SearchBar';
|
|
72
72
|
export * from './mu/SearchField';
|
|
73
73
|
export * from './mu/SearchOptionGroup';
|
|
74
|
+
export * from './mu/SelectBool';
|
|
74
75
|
export * from './mu/SelectEx';
|
|
75
76
|
export * from './mu/Switch';
|
|
76
77
|
export * from './mu/SwitchAnt';
|
package/src/mu/DnDList.tsx
CHANGED
|
@@ -234,7 +234,7 @@ export function DnDList<
|
|
|
234
234
|
{sideRenderer && sideRenderer(true, addItem, addItems, reloadItems)}
|
|
235
235
|
<Component {...componentProps}>
|
|
236
236
|
{disabled ? (
|
|
237
|
-
<div>
|
|
237
|
+
<div style={getListStyle(false)}>
|
|
238
238
|
{items.map((item, index) => {
|
|
239
239
|
// Id
|
|
240
240
|
const id = DataTypes.convert(
|
|
@@ -244,7 +244,10 @@ export function DnDList<
|
|
|
244
244
|
if (id == null) return;
|
|
245
245
|
|
|
246
246
|
return (
|
|
247
|
-
<div
|
|
247
|
+
<div
|
|
248
|
+
key={id}
|
|
249
|
+
style={getItemStyle(false, index)}
|
|
250
|
+
>
|
|
248
251
|
{children(
|
|
249
252
|
item,
|
|
250
253
|
index,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IdLabelDto } from '@etsoo/appscript';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { globalApp } from '..';
|
|
4
|
+
import { SelectEx, SelectExProps } from './SelectEx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SelectBool props
|
|
8
|
+
*/
|
|
9
|
+
export interface SelectBoolProps
|
|
10
|
+
extends Omit<SelectExProps<IdLabelDto<string>>, 'options' | 'loadData'> {}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SelectBool (yes/no)
|
|
14
|
+
* @param props Props
|
|
15
|
+
* @returns Component
|
|
16
|
+
*/
|
|
17
|
+
export function SelectBool(props: SelectBoolProps) {
|
|
18
|
+
// Destruct
|
|
19
|
+
const { search = true, ...rest } = props;
|
|
20
|
+
|
|
21
|
+
// Options
|
|
22
|
+
const options: IdLabelDto<string>[] = [
|
|
23
|
+
{ id: 'false', label: globalApp.get('no')! },
|
|
24
|
+
{ id: 'true', label: globalApp.get('yes')! }
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
if (search) options.unshift({ id: '', label: '---' });
|
|
28
|
+
|
|
29
|
+
// Layout
|
|
30
|
+
return <SelectEx options={options} search={search} {...rest} />;
|
|
31
|
+
}
|
package/src/mu/Tiplist.tsx
CHANGED
|
@@ -219,7 +219,9 @@ export function Tiplist<T extends {} = IdLabelDto>(props: TiplistProps<T>) {
|
|
|
219
219
|
type="text"
|
|
220
220
|
style={{ display: 'none' }}
|
|
221
221
|
name={name}
|
|
222
|
-
value={
|
|
222
|
+
value={
|
|
223
|
+
(states.value && Reflect.get(states.value, idField)) ?? ''
|
|
224
|
+
}
|
|
223
225
|
readOnly
|
|
224
226
|
onChange={inputOnChange}
|
|
225
227
|
/>
|