ish-ui 1.0.18 → 1.0.20
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/dist/colorPicker/ColorPicker.d.ts +3 -10
- package/dist/colorPicker/ColorPicker.js +11 -7
- package/dist/fieldMessage/ErrorMessage.d.ts +1 -1
- package/dist/fieldMessage/WarningMessage.d.ts +1 -1
- package/dist/fieldMessage/styles.d.ts +1 -1
- package/dist/formFields/FilePreview.d.ts +1 -1
- package/dist/formFields/SelectCustomComponents.d.ts +1 -1
- package/dist/formFields/Switch.d.ts +1 -1
- package/dist/model/Fields.d.ts +8 -0
- package/package.json +1 -1
- package/dist/Demo.d.ts +0 -4
- package/dist/Demo.js +0 -41
- package/dist/DemoField.d.ts +0 -3
- package/dist/DemoField.js +0 -87
- package/dist/dev.d.ts +0 -1
- package/dist/dev.js +0 -9
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
input?: FieldInputProps;
|
|
6
|
-
classes?: any;
|
|
7
|
-
theme?: Theme;
|
|
8
|
-
placement?: PopperPlacementType;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: React.JSXElementConstructor<Omit<ColorPickerWrapperProps, "theme" | "classes"> & import("@mui/styles").StyledComponentProps<never>>;
|
|
11
|
-
export default _default;
|
|
2
|
+
import { ColorPickerWrapperProps } from '../model';
|
|
3
|
+
declare const ColorPickerWrapper: React.NamedExoticComponent<ColorPickerWrapperProps>;
|
|
4
|
+
export default ColorPickerWrapper;
|
|
@@ -9,13 +9,14 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
9
9
|
import ButtonBase from '@mui/material/ButtonBase';
|
|
10
10
|
import Popper from '@mui/material/Popper';
|
|
11
11
|
import { AlphaPicker, HuePicker } from 'react-color';
|
|
12
|
-
import { createStyles, withStyles } from '@mui/styles';
|
|
13
12
|
import { ClickAwayListener } from '@mui/base';
|
|
14
13
|
import Paper from '@mui/material/Paper';
|
|
15
14
|
import Grow from '@mui/material/Grow';
|
|
16
15
|
import clsx from 'clsx';
|
|
17
16
|
import { stopEventPropagation } from '../utils/events';
|
|
18
|
-
|
|
17
|
+
import { makeAppStyles } from '../styles';
|
|
18
|
+
import { useAppTheme } from '../themes';
|
|
19
|
+
const useStyles = makeAppStyles(({ spacing, palette, zIndex, transitions }) => ({
|
|
19
20
|
paper: {
|
|
20
21
|
width: 200,
|
|
21
22
|
padding: spacing(2),
|
|
@@ -81,7 +82,8 @@ const styles = createStyles(({ spacing, transitions, palette, zIndex }) => ({
|
|
|
81
82
|
},
|
|
82
83
|
opened: {}
|
|
83
84
|
}));
|
|
84
|
-
const ColorPickerBase = React.memo(({
|
|
85
|
+
const ColorPickerBase = React.memo(({ color, input: { value, onChange }, TransitionProps, setAnchorEl, placement }) => {
|
|
86
|
+
const classes = useStyles();
|
|
85
87
|
const [hueColor, setHueColor] = useState(color);
|
|
86
88
|
const [alfaColor, setAlfaColor] = useState(color);
|
|
87
89
|
const hueRef = useRef();
|
|
@@ -119,14 +121,16 @@ const ColorPickerBase = React.memo(({ classes, color, input: { value, onChange }
|
|
|
119
121
|
React.createElement(HuePicker, { ref: hueRef, color: hueColor, onChange: onHueChange, onChangeComplete: onChangeComplete, width: "168", className: classes.bottomOffset }),
|
|
120
122
|
React.createElement(AlphaPicker, { className: classes.customAlfa, color: alfaColor, width: "168", onChange: onAlfaChange, onChangeComplete: onChangeComplete }))))));
|
|
121
123
|
});
|
|
122
|
-
const ColorPickerWrapper = React.memo(({
|
|
124
|
+
const ColorPickerWrapper = React.memo(({ input, placement = 'top', width }) => {
|
|
125
|
+
const classes = useStyles();
|
|
126
|
+
const theme = useAppTheme();
|
|
123
127
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
124
128
|
const handleClick = useCallback((event) => {
|
|
125
129
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
126
130
|
}, [anchorEl]);
|
|
127
131
|
const color = useMemo(() => (input.value ? '#' + input.value : theme.palette.primary.main), [theme, input.value]);
|
|
128
132
|
return (React.createElement("div", { className: "d-flex", onClick: stopEventPropagation },
|
|
129
|
-
React.createElement(ButtonBase, { onClick: handleClick, className: clsx(classes.colorPickerButton, anchorEl && classes.opened), style: { backgroundColor: color } }),
|
|
130
|
-
React.createElement(Popper, { open: Boolean(anchorEl), anchorEl: anchorEl, placement: placement, className: classes.popper, transition: true }, ({ TransitionProps }) => (React.createElement(ColorPickerBase, {
|
|
133
|
+
React.createElement(ButtonBase, { onClick: handleClick, className: clsx(classes.colorPickerButton, anchorEl && classes.opened), style: { backgroundColor: color, width, height: width } }),
|
|
134
|
+
React.createElement(Popper, { open: Boolean(anchorEl), anchorEl: anchorEl, placement: placement, className: classes.popper, transition: true }, ({ TransitionProps }) => (React.createElement(ColorPickerBase, { color: color, input: input, TransitionProps: TransitionProps, setAnchorEl: setAnchorEl, placement: placement })))));
|
|
131
135
|
});
|
|
132
|
-
export default
|
|
136
|
+
export default ColorPickerWrapper;
|
|
@@ -4,5 +4,5 @@ interface Props {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
message: string;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"
|
|
7
|
+
declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"icon" | "root">>;
|
|
8
8
|
export default _default;
|
|
@@ -4,5 +4,5 @@ interface Props {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
warning: string;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"
|
|
7
|
+
declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"icon" | "root">>;
|
|
8
8
|
export default _default;
|
|
@@ -13,5 +13,5 @@ interface Props {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
avatarSize?: number;
|
|
15
15
|
}
|
|
16
|
-
declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles").StyledComponentProps<"
|
|
16
|
+
declare const _default: React.JSXElementConstructor<Omit<Props, "classes"> & import("@mui/styles").StyledComponentProps<"active" | "root" | "rounded" | "backdrop" | "actionButton" | "noValue" | "avatarRoot">>;
|
|
17
17
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const selectStyles: (theme: any) => import("@mui/styles").StyleRules<{}, "
|
|
2
|
+
export declare const selectStyles: (theme: any) => import("@mui/styles").StyleRules<{}, "label" | "inline" | "multiple" | "error" | "root" | "expandIcon" | "menuItem" | "inputWrapper" | "readonly" | "inputEndAdornment" | "editIcon" | "bottomMargin" | "bottomPadding" | "topMargin" | "editable" | "valid" | "autoWidthSelect" | "emptySelect" | "validUnderline" | "menuItemActive" | "menuList" | "hasPopup" | "hasClear">;
|
|
3
3
|
export declare const ListRow: React.MemoExoticComponent<any>;
|
|
4
4
|
export declare const ListboxComponent: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
|
|
5
5
|
export declare const NoWrapOption: (content: any, data: any, search: any, parentProps: any) => React.JSX.Element;
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* */
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { FieldInputProps, FormSwitchProps } from '../model';
|
|
6
|
-
export declare const Switch: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles").StyledComponentProps<"default" | "
|
|
6
|
+
export declare const Switch: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles").StyledComponentProps<"default" | "icon" | "bar" | "inline" | "disabled" | "checked" | "root" | "focusVisible">>;
|
|
7
7
|
export declare function FormSwitch<InputProps extends FieldInputProps>({ input, color, disabled, stringValue, label, className, inline, onChangeHandler, onClick }: FormSwitchProps<InputProps>): React.JSX.Element;
|
package/dist/model/Fields.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Dispatch } from 'redux';
|
|
|
3
3
|
import { InputProps } from '@mui/material/Input/Input';
|
|
4
4
|
import { AnyArgFunction } from '../model/CommonFunctions';
|
|
5
5
|
import { ShowConfirmCaller } from '../model/Confirm';
|
|
6
|
+
import { PopperPlacementType } from '@mui/material';
|
|
6
7
|
export type EventHandler<Event> = (event: Event, name?: string) => void;
|
|
7
8
|
export interface EventOrValueHandler<Event> extends EventHandler<Event> {
|
|
8
9
|
(value: any): void;
|
|
@@ -229,6 +230,11 @@ export interface FormFieldBaseProps {
|
|
|
229
230
|
onClick?: AnyArgFunction;
|
|
230
231
|
debounced?: boolean;
|
|
231
232
|
}
|
|
233
|
+
export interface ColorPickerWrapperProps {
|
|
234
|
+
input?: Partial<FieldInputProps>;
|
|
235
|
+
placement?: PopperPlacementType;
|
|
236
|
+
width?: number;
|
|
237
|
+
}
|
|
232
238
|
export type FormFieldProps = ({
|
|
233
239
|
type: 'phone' | 'duration' | 'text' | 'multilineText' | 'password' | 'number' | 'file' | 'money';
|
|
234
240
|
} & FormFieldBaseProps & EditInPlaceFieldProps<FieldInputProps, FieldMetaProps>) | ({
|
|
@@ -246,5 +252,7 @@ export type FormFieldProps = ({
|
|
|
246
252
|
} & FormFieldBaseProps & CheckboxFieldProps<FieldInputProps>) | ({
|
|
247
253
|
type: 'tags';
|
|
248
254
|
} & FormFieldBaseProps & TagsFieldProps<TagLike, FieldInputProps, FieldMetaProps>) | ({
|
|
255
|
+
type: 'color';
|
|
256
|
+
} & ColorPickerWrapperProps) | ({
|
|
249
257
|
type: 'stub';
|
|
250
258
|
});
|
package/package.json
CHANGED
package/dist/Demo.d.ts
DELETED
package/dist/Demo.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
|
|
3
|
-
* No copying or use of this code is allowed without permission in writing from ish.
|
|
4
|
-
*/
|
|
5
|
-
import React, { useRef, useState } from 'react';
|
|
6
|
-
import { CacheProvider } from '@emotion/react';
|
|
7
|
-
import createCache from '@emotion/cache';
|
|
8
|
-
import { ThemeProvider } from '@mui/material/styles';
|
|
9
|
-
import { Box, Grid } from '@mui/material';
|
|
10
|
-
import CssBaseline from '@mui/material/CssBaseline';
|
|
11
|
-
import { defaultTheme } from './themes';
|
|
12
|
-
import { GlobalStylesProvider } from './styles';
|
|
13
|
-
import { DemoField } from './DemoField';
|
|
14
|
-
import { WysiwygEditor } from './markdownEditor';
|
|
15
|
-
export const muiCache = createCache({
|
|
16
|
-
key: 'mui',
|
|
17
|
-
prepend: true,
|
|
18
|
-
});
|
|
19
|
-
function Demo() {
|
|
20
|
-
const wysiwygRef = useRef();
|
|
21
|
-
const [draftContent, setDraftContent] = useState('');
|
|
22
|
-
return (React.createElement(CacheProvider, { value: muiCache },
|
|
23
|
-
React.createElement(ThemeProvider, { theme: defaultTheme },
|
|
24
|
-
React.createElement(CssBaseline, null),
|
|
25
|
-
React.createElement(GlobalStylesProvider, null,
|
|
26
|
-
React.createElement(Box, { sx: {
|
|
27
|
-
width: '100vw',
|
|
28
|
-
height: '100vh',
|
|
29
|
-
padding: 4
|
|
30
|
-
} },
|
|
31
|
-
React.createElement(Grid, { container: true, columnSpacing: 3, rowSpacing: 2 },
|
|
32
|
-
React.createElement(Grid, { item: true, xs: 6 },
|
|
33
|
-
React.createElement(DemoField, { label: "Test phone", type: "phone" })),
|
|
34
|
-
React.createElement(Grid, { item: true, xs: 6 },
|
|
35
|
-
React.createElement(DemoField, { label: "Test text", type: "text" })),
|
|
36
|
-
React.createElement(Grid, { item: true, xs: 12 },
|
|
37
|
-
React.createElement(WysiwygEditor, { value: draftContent, onChange: setDraftContent, wysiwygRef: wysiwygRef })),
|
|
38
|
-
React.createElement(Grid, { item: true, xs: 6 }),
|
|
39
|
-
React.createElement(Grid, { item: true, xs: 6 })))))));
|
|
40
|
-
}
|
|
41
|
-
export default Demo;
|
package/dist/DemoField.d.ts
DELETED
package/dist/DemoField.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright ish group pty ltd 2023.
|
|
3
|
-
*
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
5
|
-
*
|
|
6
|
-
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
7
|
-
*/
|
|
8
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
9
|
-
var t = {};
|
|
10
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
11
|
-
t[p] = s[p];
|
|
12
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
13
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
14
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
15
|
-
t[p[i]] = s[p[i]];
|
|
16
|
-
}
|
|
17
|
-
return t;
|
|
18
|
-
};
|
|
19
|
-
import React, { useMemo, useState } from 'react';
|
|
20
|
-
import { stubFunction } from './utils';
|
|
21
|
-
import { CheckboxField, CodeEditorField, ColoredCheckBox, EditInPlaceDateTimeField, EditInPlaceDurationField, EditInPlaceField, EditInPlaceFileField, EditInPlaceMoneyField, EditInPlacePhoneField, EditInPlaceSearchSelect, FormSwitch } from './formFields';
|
|
22
|
-
import { TagInputList } from './tagsInput';
|
|
23
|
-
const stubFieldMocks = { input: { onChange: stubFunction, onBlur: stubFunction }, format: null, debounced: null };
|
|
24
|
-
export function DemoField(props) {
|
|
25
|
-
const { type } = props, rest = __rest(props, ["type"]);
|
|
26
|
-
const { input, format, debounced = true } = type !== 'stub'
|
|
27
|
-
? props
|
|
28
|
-
: stubFieldMocks;
|
|
29
|
-
// const currencySymbol = useAppSelector(state => state.currency?.shortCurrencySymbol);
|
|
30
|
-
// const processActionId = useAppSelector(state => state.fieldProcessing[input?.name]);
|
|
31
|
-
//
|
|
32
|
-
// const entity = type === "remoteDataSelect" ? props.entity : null;
|
|
33
|
-
//
|
|
34
|
-
// const color = type === "coloredCheckbox" ? props.color : null;
|
|
35
|
-
//
|
|
36
|
-
// const rootEntity = type === "aql" ? props.rootEntity : null;
|
|
37
|
-
//
|
|
38
|
-
// const tags = type === "tags" ? props.tags : null;
|
|
39
|
-
const [value, setValue] = useState(undefined);
|
|
40
|
-
const inputProxy = useMemo(() => (Object.assign(Object.assign({}, input || {}), { value, onChange: e => {
|
|
41
|
-
const val = (e === null || e === void 0 ? void 0 : e.target) ? e.target.value : e;
|
|
42
|
-
setValue(format ? format(val) : val);
|
|
43
|
-
}, onBlur: e => {
|
|
44
|
-
const val = (e === null || e === void 0 ? void 0 : e.target) ? e.target.value : e;
|
|
45
|
-
setValue(format ? format(val) : val);
|
|
46
|
-
} })), [value, input]);
|
|
47
|
-
const sharedProps = Object.assign(Object.assign(Object.assign({}, rest), debounced ? { input: inputProxy } : {}), { meta: {} });
|
|
48
|
-
switch (type) {
|
|
49
|
-
case 'phone':
|
|
50
|
-
return React.createElement(EditInPlacePhoneField, Object.assign({}, sharedProps));
|
|
51
|
-
case 'duration':
|
|
52
|
-
return React.createElement(EditInPlaceDurationField, Object.assign({}, sharedProps));
|
|
53
|
-
case 'file':
|
|
54
|
-
return React.createElement(EditInPlaceFileField, Object.assign({}, sharedProps));
|
|
55
|
-
case 'money':
|
|
56
|
-
return React.createElement(EditInPlaceMoneyField, Object.assign({}, sharedProps, { currencySymbol: "$" }));
|
|
57
|
-
case 'select':
|
|
58
|
-
return React.createElement(EditInPlaceSearchSelect, Object.assign({}, sharedProps));
|
|
59
|
-
case 'number':
|
|
60
|
-
return React.createElement(EditInPlaceField, Object.assign({}, sharedProps, { type: "number" }));
|
|
61
|
-
case 'date':
|
|
62
|
-
return React.createElement(EditInPlaceDateTimeField, Object.assign({}, sharedProps, { type: "date" }));
|
|
63
|
-
case 'time':
|
|
64
|
-
return React.createElement(EditInPlaceDateTimeField, Object.assign({}, sharedProps, { type: "time" }));
|
|
65
|
-
case 'dateTime':
|
|
66
|
-
return React.createElement(EditInPlaceDateTimeField, Object.assign({}, sharedProps, { type: "datetime" }));
|
|
67
|
-
case 'code':
|
|
68
|
-
return React.createElement(CodeEditorField, Object.assign({}, sharedProps));
|
|
69
|
-
case 'coloredCheckbox':
|
|
70
|
-
return React.createElement(ColoredCheckBox, Object.assign({}, sharedProps, { color: "red" }));
|
|
71
|
-
case 'password':
|
|
72
|
-
return React.createElement(EditInPlaceField, Object.assign({}, sharedProps, { type: "password" }));
|
|
73
|
-
case 'switch':
|
|
74
|
-
return React.createElement(FormSwitch, Object.assign({}, sharedProps));
|
|
75
|
-
case 'checkbox':
|
|
76
|
-
return React.createElement(CheckboxField, Object.assign({}, sharedProps));
|
|
77
|
-
case 'multilineText':
|
|
78
|
-
return React.createElement(EditInPlaceField, Object.assign({}, sharedProps, { multiline: true }));
|
|
79
|
-
case 'stub':
|
|
80
|
-
return React.createElement("div", { className: "invisible" });
|
|
81
|
-
case 'tags':
|
|
82
|
-
return React.createElement(TagInputList, Object.assign({}, sharedProps, { tags: [] }));
|
|
83
|
-
case 'text':
|
|
84
|
-
default:
|
|
85
|
-
return React.createElement(EditInPlaceField, Object.assign({}, sharedProps));
|
|
86
|
-
}
|
|
87
|
-
}
|
package/dist/dev.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/dev.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright ish group pty ltd. All rights reserved. https://www.ish.com.au
|
|
3
|
-
* No copying or use of this code is allowed without permission in writing from ish.
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { createRoot } from 'react-dom/client';
|
|
7
|
-
import Demo from './Demo';
|
|
8
|
-
const root = createRoot(document.getElementById('dev-demo'));
|
|
9
|
-
root.render(React.createElement(Demo, null));
|