@knovator/pagecreator-admin 0.5.7 → 0.5.8
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/index.cjs +52 -3
- package/index.css +417 -405
- package/index.js +51 -3
- package/package.json +4 -2
- package/src/lib/components/common/Input/HTMLEditor.d.ts +4 -0
- package/src/lib/components/common/Input/index.d.ts +2 -0
- package/src/lib/types/components.d.ts +12 -1
package/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import fetchUrl, { setAPIConfig } from '@knovator/api';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import ReactSelect from 'react-select/async';
|
|
5
5
|
import { useFieldArray, useForm, Controller } from 'react-hook-form';
|
|
6
|
+
import SunEditor from 'suneditor-react';
|
|
6
7
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
7
8
|
import CSSTransition from 'react-transition-group/CSSTransition';
|
|
8
9
|
import { useDropzone } from 'react-dropzone';
|
|
@@ -1698,7 +1699,7 @@ const TRANSLATION_PAIRS_WIDGET = {
|
|
|
1698
1699
|
'widget.nameRequired': 'Name is required',
|
|
1699
1700
|
'widget.widgetTitle': 'Widget Title',
|
|
1700
1701
|
'widget.widgetTitlePlaceholder': 'Enter Widget Title',
|
|
1701
|
-
'widget.widgetTitleRequired': '
|
|
1702
|
+
'widget.widgetTitleRequired': 'Widget Title is required',
|
|
1702
1703
|
'widget.itemsType': 'Items Type',
|
|
1703
1704
|
'widget.itemsTypePlaceholder': 'Select Items Type',
|
|
1704
1705
|
'widget.widgetType': 'Widget Type',
|
|
@@ -3459,11 +3460,38 @@ const SrcSet = ({
|
|
|
3459
3460
|
}, error));
|
|
3460
3461
|
};
|
|
3461
3462
|
|
|
3463
|
+
const App = ({
|
|
3464
|
+
label,
|
|
3465
|
+
wrapperClassName,
|
|
3466
|
+
required,
|
|
3467
|
+
value,
|
|
3468
|
+
error,
|
|
3469
|
+
onChange
|
|
3470
|
+
}) => {
|
|
3471
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
3472
|
+
className: classNames('khb_input-wrapper', wrapperClassName)
|
|
3473
|
+
}, label && /*#__PURE__*/React.createElement("label", {
|
|
3474
|
+
className: "khb_input-label"
|
|
3475
|
+
}, label, required ? /*#__PURE__*/React.createElement("span", {
|
|
3476
|
+
className: "khb_input-label-required"
|
|
3477
|
+
}, "*") : null), /*#__PURE__*/React.createElement(SunEditor, {
|
|
3478
|
+
setContents: value,
|
|
3479
|
+
onChange: onChange,
|
|
3480
|
+
setOptions: {
|
|
3481
|
+
defaultStyle: 'font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial; font-size: 0.875rem;',
|
|
3482
|
+
buttonList: [['undo', 'redo', 'align'], ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'], ['fontColor', 'hiliteColor'], ['removeFormat']]
|
|
3483
|
+
}
|
|
3484
|
+
}), error && /*#__PURE__*/React.createElement("p", {
|
|
3485
|
+
className: "khb_input-error "
|
|
3486
|
+
}, error));
|
|
3487
|
+
};
|
|
3488
|
+
|
|
3462
3489
|
var Input = Object.assign(Input$1, {
|
|
3463
3490
|
Select,
|
|
3464
3491
|
ReactSelect: CustomReactSelect,
|
|
3465
3492
|
Checkbox,
|
|
3466
|
-
SrcSet
|
|
3493
|
+
SrcSet,
|
|
3494
|
+
HTML: App
|
|
3467
3495
|
});
|
|
3468
3496
|
|
|
3469
3497
|
const PageSearch = () => {
|
|
@@ -3882,6 +3910,26 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3882
3910
|
}
|
|
3883
3911
|
});
|
|
3884
3912
|
break;
|
|
3913
|
+
case 'html':
|
|
3914
|
+
input = /*#__PURE__*/React.createElement(Controller, {
|
|
3915
|
+
control: control,
|
|
3916
|
+
name: schema.accessor,
|
|
3917
|
+
rules: schema.validations,
|
|
3918
|
+
render: ({
|
|
3919
|
+
field
|
|
3920
|
+
}) => {
|
|
3921
|
+
var _a, _b;
|
|
3922
|
+
return /*#__PURE__*/React.createElement(Input.HTML, {
|
|
3923
|
+
label: schema.label,
|
|
3924
|
+
error: (_b = (_a = errors[schema.accessor]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
3925
|
+
onInput: schema.onInput,
|
|
3926
|
+
required: schema.required,
|
|
3927
|
+
value: field.value,
|
|
3928
|
+
onChange: field.onChange
|
|
3929
|
+
});
|
|
3930
|
+
}
|
|
3931
|
+
});
|
|
3932
|
+
break;
|
|
3885
3933
|
case 'text':
|
|
3886
3934
|
case 'number':
|
|
3887
3935
|
case 'url':
|
|
@@ -7034,7 +7082,7 @@ const WidgetForm = ({
|
|
|
7034
7082
|
label: `${t('widget.widgetTitle')}`,
|
|
7035
7083
|
accessor: 'widgetTitle',
|
|
7036
7084
|
required: true,
|
|
7037
|
-
type: '
|
|
7085
|
+
type: 'html',
|
|
7038
7086
|
onInput: handleCapitalize,
|
|
7039
7087
|
placeholder: t('widget.widgetTitlePlaceholder'),
|
|
7040
7088
|
validations: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knovator/pagecreator-admin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"classnames": "^2.3.1",
|
|
6
6
|
"react-beautiful-dnd": "^13.1.0",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"react-dropzone": "^14.2.2",
|
|
10
10
|
"react-select": "^5.4.0",
|
|
11
11
|
"react-tabs": "^6.0.0",
|
|
12
|
-
"react-tiny-popover": "^7.2.0"
|
|
12
|
+
"react-tiny-popover": "^7.2.0",
|
|
13
|
+
"suneditor": "^2.44.3",
|
|
14
|
+
"suneditor-react": "^3.4.1"
|
|
13
15
|
},
|
|
14
16
|
"peerDependencies": {
|
|
15
17
|
"react": "^18 | ^17",
|
|
@@ -3,10 +3,12 @@ import Checkbox from "./Checkbox";
|
|
|
3
3
|
import Select from "./Select";
|
|
4
4
|
import ReactSelect from "./ReactSelect";
|
|
5
5
|
import SrcSet from './SrcSet';
|
|
6
|
+
import HTMLEditor from './HTMLEditor';
|
|
6
7
|
declare const _default: (({ label, id, placeholder, type, size, required, error, className, disabled, rest, onInput, onBlur, value, onChange, wrapperClassName, }: import("../../../types").InputProps) => JSX.Element) & {
|
|
7
8
|
Select: typeof Select;
|
|
8
9
|
ReactSelect: typeof ReactSelect;
|
|
9
10
|
Checkbox: typeof Checkbox;
|
|
10
11
|
SrcSet: typeof SrcSet;
|
|
12
|
+
HTML: typeof HTMLEditor;
|
|
11
13
|
};
|
|
12
14
|
export default _default;
|
|
@@ -53,6 +53,17 @@ export interface InputProps {
|
|
|
53
53
|
register?: any;
|
|
54
54
|
info?: string;
|
|
55
55
|
}
|
|
56
|
+
export interface HTMLEditorProps {
|
|
57
|
+
id?: string;
|
|
58
|
+
label?: string;
|
|
59
|
+
placeholder?: string;
|
|
60
|
+
value?: string;
|
|
61
|
+
wrapperClassName?: string;
|
|
62
|
+
onChange: (value: string) => void;
|
|
63
|
+
onInput?: (e: any) => void;
|
|
64
|
+
required?: boolean;
|
|
65
|
+
error?: string;
|
|
66
|
+
}
|
|
56
67
|
export interface CheckboxProps {
|
|
57
68
|
rest?: any;
|
|
58
69
|
label?: string;
|
|
@@ -146,7 +157,7 @@ export interface SchemaType extends ReactSelectProps {
|
|
|
146
157
|
validations?: RegisterOptions;
|
|
147
158
|
editable?: boolean;
|
|
148
159
|
onInput?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
149
|
-
type?: 'text' | 'number' | 'select' | 'checkbox' | 'textarea' | 'file' | 'url' | 'ReactSelect' | 'srcset' | 'color';
|
|
160
|
+
type?: 'text' | 'number' | 'select' | 'checkbox' | 'textarea' | 'file' | 'url' | 'ReactSelect' | 'srcset' | 'color' | 'html';
|
|
150
161
|
options?: {
|
|
151
162
|
value: string;
|
|
152
163
|
label: string;
|