@yuntijs/ui 1.0.0-beta.6 → 1.0.0-beta.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/es/MonacoEditor/assets/img/full-screen-cancel-icon.png +0 -0
- package/es/MonacoEditor/assets/img/full-screen-icon.png +0 -0
- package/es/MonacoEditor/index.d.ts +4 -0
- package/es/MonacoEditor/index.js +54 -9
- package/es/MonacoEditor/style.d.ts +10 -0
- package/es/MonacoEditor/style.js +24 -0
- package/es/SliderInput/index.d.ts +54 -0
- package/es/SliderInput/index.js +74 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/typings.d.ts +1 -0
- package/package.json +1 -1
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -20,6 +20,10 @@ export interface BaseMonacoEditorProps extends IGeneralManacoEditorProps {
|
|
|
20
20
|
export declare const BaseMonacoEditor: React.FC<BaseMonacoEditorProps & {
|
|
21
21
|
/** Only for BaseMonacoEditor. */
|
|
22
22
|
type?: 'single' | 'diff';
|
|
23
|
+
/** Is show fullscreen button */
|
|
24
|
+
supportFullScreen?: boolean;
|
|
25
|
+
/** className of diff editor wrapper */
|
|
26
|
+
diffEditorWrapperClassName?: boolean;
|
|
23
27
|
}>;
|
|
24
28
|
export type MonacoEditorProps = ISingleMonacoEditorProps & BaseMonacoEditorProps;
|
|
25
29
|
export declare const MonacoEditor: React.FC<MonacoEditorProps>;
|
package/es/MonacoEditor/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["type", "editorDidMount", "readOnly", "lineNumbers", "wordWrap", "contextmenu", "theme", "minimapEnabled", "version", "requireConfig", "options", "onChange"],
|
|
4
|
+
var _excluded = ["type", "editorDidMount", "readOnly", "lineNumbers", "wordWrap", "contextmenu", "theme", "minimapEnabled", "version", "requireConfig", "options", "onChange", "className", "diffEditorWrapperClassName", "supportFullScreen", "width", "height"],
|
|
5
5
|
_excluded2 = ["inlineView", "options"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -9,7 +9,9 @@ import { SingleMonacoEditorComponent } from '@alilc/lowcode-plugin-base-monaco-e
|
|
|
9
9
|
import { useThemeMode } from 'antd-style';
|
|
10
10
|
import React, { useMemo, useState } from 'react';
|
|
11
11
|
import { useCdnFn } from '..';
|
|
12
|
+
import { useStyles } from "./style";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
15
|
export { Controller as MonacoController } from '@alilc/lowcode-plugin-base-monaco-editor/es/controller';
|
|
14
16
|
export var BaseMonacoEditor = function BaseMonacoEditor(props) {
|
|
15
17
|
var _props$type = props.type,
|
|
@@ -32,6 +34,11 @@ export var BaseMonacoEditor = function BaseMonacoEditor(props) {
|
|
|
32
34
|
requireConfigFromProps = _props$requireConfig === void 0 ? {} : _props$requireConfig,
|
|
33
35
|
options = props.options,
|
|
34
36
|
onChange = props.onChange,
|
|
37
|
+
className = props.className,
|
|
38
|
+
diffEditorWrapperClassName = props.diffEditorWrapperClassName,
|
|
39
|
+
supportFullScreen = props.supportFullScreen,
|
|
40
|
+
width = props.width,
|
|
41
|
+
height = props.height,
|
|
35
42
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
36
43
|
var _useThemeMode = useThemeMode(),
|
|
37
44
|
isDarkMode = _useThemeMode.isDarkMode;
|
|
@@ -82,14 +89,52 @@ export var BaseMonacoEditor = function BaseMonacoEditor(props) {
|
|
|
82
89
|
}, requireConfigFromProps.paths)
|
|
83
90
|
});
|
|
84
91
|
}, [requireConfigFromProps, version]);
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
var _useState3 = useState(false),
|
|
93
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
|
+
isFullScreen = _useState4[0],
|
|
95
|
+
setIsFullScreen = _useState4[1];
|
|
96
|
+
var _useStyles = useStyles({
|
|
97
|
+
minimapEnabled: minimapEnabled,
|
|
98
|
+
isFullScreen: isFullScreen
|
|
99
|
+
}),
|
|
100
|
+
styles = _useStyles.styles,
|
|
101
|
+
cx = _useStyles.cx;
|
|
102
|
+
if (type !== 'diff') {
|
|
103
|
+
return /*#__PURE__*/_jsx(SingleMonacoEditorComponent, _objectSpread({
|
|
104
|
+
className: cx(styles.base, className),
|
|
105
|
+
editorDidMount: handleEditorDidMount,
|
|
106
|
+
height: height,
|
|
107
|
+
onChange: onChange,
|
|
108
|
+
options: editorOptions,
|
|
109
|
+
requireConfig: requireConfig,
|
|
110
|
+
supportFullScreen: editorInstance && supportFullScreen,
|
|
111
|
+
theme: theme,
|
|
112
|
+
width: width
|
|
113
|
+
}, otherProps));
|
|
114
|
+
}
|
|
115
|
+
var fullScreen = function fullScreen() {
|
|
116
|
+
setIsFullScreen(!isFullScreen);
|
|
117
|
+
editorInstance === null || editorInstance === void 0 || editorInstance.layout();
|
|
118
|
+
};
|
|
119
|
+
var fullScreenClassName = cx({
|
|
120
|
+
'base-monaco-full-screen-icon': !isFullScreen,
|
|
121
|
+
'base-monaco-full-screen-icon-cancel': isFullScreen
|
|
122
|
+
});
|
|
123
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
124
|
+
className: cx(styles.diff, diffEditorWrapperClassName),
|
|
125
|
+
children: [/*#__PURE__*/_jsx(SingleMonacoEditorComponent.MonacoDiffEditor, _objectSpread({
|
|
126
|
+
className: cx(styles.base, className),
|
|
127
|
+
editorDidMount: handleEditorDidMount,
|
|
128
|
+
height: isFullScreen ? 'auto' : height,
|
|
129
|
+
options: editorOptions,
|
|
130
|
+
requireConfig: requireConfig,
|
|
131
|
+
theme: theme,
|
|
132
|
+
width: isFullScreen ? 'auto' : width
|
|
133
|
+
}, otherProps)), editorInstance && supportFullScreen && /*#__PURE__*/_jsx("div", {
|
|
134
|
+
className: fullScreenClassName,
|
|
135
|
+
onClick: fullScreen
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
93
138
|
};
|
|
94
139
|
export var MonacoEditor = function MonacoEditor(props) {
|
|
95
140
|
return /*#__PURE__*/_jsx(BaseMonacoEditor, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* styles from https://github.com/alibaba/lowcode-plugins/blob/main/packages/base-monaco-editor/src/index.scss
|
|
3
|
+
*/
|
|
4
|
+
export declare const useStyles: (props?: {
|
|
5
|
+
minimapEnabled?: boolean | undefined;
|
|
6
|
+
isFullScreen?: boolean | undefined;
|
|
7
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
8
|
+
base: import("antd-style").SerializedStyles;
|
|
9
|
+
diff: import("antd-style").SerializedStyles;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
3
|
+
import { createStyles, keyframes } from 'antd-style';
|
|
4
|
+
import fullScreenCancelIcon from "./assets/img/full-screen-cancel-icon.png";
|
|
5
|
+
import fullScreenIcon from "./assets/img/full-screen-icon.png";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* styles from https://github.com/alibaba/lowcode-plugins/blob/main/packages/base-monaco-editor/src/index.scss
|
|
9
|
+
*/
|
|
10
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
11
|
+
var css = _ref.css;
|
|
12
|
+
var _ref2$minimapEnabled = _ref2.minimapEnabled,
|
|
13
|
+
minimapEnabled = _ref2$minimapEnabled === void 0 ? false : _ref2$minimapEnabled,
|
|
14
|
+
_ref2$isFullScreen = _ref2.isFullScreen,
|
|
15
|
+
isFullScreen = _ref2$isFullScreen === void 0 ? false : _ref2$isFullScreen;
|
|
16
|
+
var dots = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% { content: '.'; }\n 20% { content: '..'; }\n 40% { content: '...'; }\n 60% { content: '....'; }\n 80% { content: '.....'; }\n "])));
|
|
17
|
+
var fullScreenStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .base-monaco-full-screen-icon,\n .base-monaco-full-screen-icon-cancel {\n cursor: pointer;\n\n position: absolute;\n\n width: 20px;\n height: 20px;\n\n background-size: 20px 20px;\n }\n\n .base-monaco-full-screen-icon {\n top: 40px;\n right: ", ";\n background-image: url(", ");\n }\n\n .base-monaco-full-screen-icon-cancel {\n z-index: 9999;\n top: 10px;\n right: 138px;\n background-image: url(", ");\n }\n "])), minimapEnabled ? '64px' : '20px', fullScreenIcon, fullScreenCancelIcon);
|
|
18
|
+
return {
|
|
19
|
+
base: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n\n box-sizing: content-box;\n min-height: 100px;\n\n border: 1px solid transparent;\n border-radius: 3px;\n &:hover {\n border-color: var(--color-field-border-hover, rgba(31, 56, 88, 0.1));\n }\n &.ve-focused {\n border-color: var(--color-field-border-active, rgba(31, 56, 88, 0.15));\n }\n &.ve-outline {\n border: 1px solid var(--color-field-border, rgba(31, 56, 88, 0.05)) !important;\n }\n\n .react-monaco-editor-container {\n width: 100%;\n height: 100%;\n min-height: 100px;\n background: transparent;\n }\n\n ", "\n\n .loading {\n position: absolute;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--color-text, rgba(0, 0, 0, 0.3));\n\n background-color: transparent;\n\n &::after {\n content: '';\n display: inline;\n animation: ", " steps(3) 1s infinite;\n }\n }\n\n .syntaxTips {\n position: absolute;\n bottom: 0;\n left: 0;\n\n box-sizing: border-box;\n width: 100%;\n max-height: 0;\n margin: 0;\n padding: 10px 30px;\n\n color: red;\n\n background: rgba(255, 234, 234, 0.8);\n\n transition: 0.2s ease max-height;\n }\n\n .syntaxTips:hover {\n overflow: auto;\n max-height: 50%;\n }\n\n .syntaxTips .infoIcon {\n position: absolute;\n top: 2px;\n right: 5px;\n transform: rotateY(180deg);\n\n width: 20px;\n height: 16px;\n }\n "])), fullScreenStyle, dots),
|
|
20
|
+
diff: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n box-sizing: content-box;\n\n .react-monaco-editor-container {\n ", "\n }\n\n ", "\n\n .base-monaco-full-screen-icon {\n right: 64px;\n }\n\n .base-monaco-full-screen-icon-cancel {\n position: fixed;\n right: 64px;\n }\n "])), isFullScreen && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: fixed;\n z-index: 9998;\n inset: 0;\n\n width: auto;\n height: auto;\n "]))), fullScreenStyle)
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
hashPriority: 'low'
|
|
24
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ColProps } from 'antd';
|
|
2
|
+
import type { InputNumberProps, SliderSingleProps } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface SliderInputProps {
|
|
5
|
+
/** The current value */
|
|
6
|
+
value?: number;
|
|
7
|
+
/** The initial value */
|
|
8
|
+
defaultValue?: number;
|
|
9
|
+
/** The min value */
|
|
10
|
+
min?: number;
|
|
11
|
+
/** The max value */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** The number to which the current value is increased or decreased. It can be an integer or decimal */
|
|
14
|
+
step?: number;
|
|
15
|
+
/** Spacing between grids, could be a number or a object like { xs: 8, sm: 16, md: 24}. Or you can use array to make horizontal and vertical spacing work at the same time [horizontal, vertical] */
|
|
16
|
+
gutter?: number;
|
|
17
|
+
/**
|
|
18
|
+
* @description Slider layout, like <Col> component. Set span offset value like {span: 3, offset: 12} or sm: {span: 3, offset: 12}
|
|
19
|
+
* @type ColProps
|
|
20
|
+
* @default { span: 12 }
|
|
21
|
+
*/
|
|
22
|
+
sliderCol?: ColProps;
|
|
23
|
+
/**
|
|
24
|
+
* @description The layout for input controls, same as sliderCol, see https://ant.design/components/grid#row for detail
|
|
25
|
+
* @type ColProps
|
|
26
|
+
* @default { span: 5 }
|
|
27
|
+
*/
|
|
28
|
+
inputCol?: ColProps;
|
|
29
|
+
/** The label text displayed before (on the left side of) the input field */
|
|
30
|
+
addonAfter?: React.ReactNode;
|
|
31
|
+
/** The label text displayed before (on the left side of) the input field */
|
|
32
|
+
addonBefore?: React.ReactNode;
|
|
33
|
+
/** placeholder */
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
/** The callback triggered when the value is changed */
|
|
36
|
+
onChange?: (value: number) => void;
|
|
37
|
+
/** style */
|
|
38
|
+
style?: React.CSSProperties;
|
|
39
|
+
/** className */
|
|
40
|
+
className?: string;
|
|
41
|
+
/**
|
|
42
|
+
* @description the props of slider, see https://ant.design/components/slider#api for detail
|
|
43
|
+
* @type SliderSingleProps
|
|
44
|
+
* @default {}
|
|
45
|
+
*/
|
|
46
|
+
sliderProps?: SliderSingleProps;
|
|
47
|
+
/**
|
|
48
|
+
* @description the props of input, see https://ant.design/components/input-number#api for detail
|
|
49
|
+
* @type InputNumberProps
|
|
50
|
+
* @default {}
|
|
51
|
+
*/
|
|
52
|
+
inputProps?: InputNumberProps;
|
|
53
|
+
}
|
|
54
|
+
export declare const SliderInput: React.FC<SliderInputProps>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
import { Col, InputNumber, Row, Slider } from 'antd';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export var SliderInput = function SliderInput(_ref) {
|
|
10
|
+
var value = _ref.value,
|
|
11
|
+
defaultValue = _ref.defaultValue,
|
|
12
|
+
_ref$min = _ref.min,
|
|
13
|
+
min = _ref$min === void 0 ? 0 : _ref$min,
|
|
14
|
+
max = _ref.max,
|
|
15
|
+
step = _ref.step,
|
|
16
|
+
_ref$gutter = _ref.gutter,
|
|
17
|
+
gutter = _ref$gutter === void 0 ? 16 : _ref$gutter,
|
|
18
|
+
_ref$sliderCol = _ref.sliderCol,
|
|
19
|
+
sliderCol = _ref$sliderCol === void 0 ? {
|
|
20
|
+
span: 12
|
|
21
|
+
} : _ref$sliderCol,
|
|
22
|
+
_ref$inputCol = _ref.inputCol,
|
|
23
|
+
inputCol = _ref$inputCol === void 0 ? {
|
|
24
|
+
span: 5
|
|
25
|
+
} : _ref$inputCol,
|
|
26
|
+
addonAfter = _ref.addonAfter,
|
|
27
|
+
addonBefore = _ref.addonBefore,
|
|
28
|
+
placeholder = _ref.placeholder,
|
|
29
|
+
onChange = _ref.onChange,
|
|
30
|
+
style = _ref.style,
|
|
31
|
+
className = _ref.className,
|
|
32
|
+
_ref$sliderProps = _ref.sliderProps,
|
|
33
|
+
sliderProps = _ref$sliderProps === void 0 ? {} : _ref$sliderProps,
|
|
34
|
+
_ref$inputProps = _ref.inputProps,
|
|
35
|
+
inputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps;
|
|
36
|
+
var _useState = useState(),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
number = _useState2[0],
|
|
39
|
+
setNumber = _useState2[1];
|
|
40
|
+
var onNumberChange = function onNumberChange(newNumber) {
|
|
41
|
+
if (Number.isNaN(newNumber)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setNumber(newNumber);
|
|
45
|
+
onChange === null || onChange === void 0 || onChange(newNumber);
|
|
46
|
+
};
|
|
47
|
+
return /*#__PURE__*/_jsxs(Row, {
|
|
48
|
+
className: className,
|
|
49
|
+
gutter: gutter,
|
|
50
|
+
style: style,
|
|
51
|
+
children: [/*#__PURE__*/_jsx(Col, _objectSpread(_objectSpread({}, sliderCol), {}, {
|
|
52
|
+
children: /*#__PURE__*/_jsx(Slider, _objectSpread(_objectSpread({}, sliderProps), {}, {
|
|
53
|
+
defaultValue: defaultValue,
|
|
54
|
+
max: max,
|
|
55
|
+
min: min,
|
|
56
|
+
onChange: onNumberChange,
|
|
57
|
+
step: step,
|
|
58
|
+
value: value || number
|
|
59
|
+
}))
|
|
60
|
+
})), /*#__PURE__*/_jsx(Col, _objectSpread(_objectSpread({}, inputCol), {}, {
|
|
61
|
+
children: /*#__PURE__*/_jsx(InputNumber, _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
62
|
+
addonAfter: addonAfter,
|
|
63
|
+
addonBefore: addonBefore,
|
|
64
|
+
defaultValue: defaultValue,
|
|
65
|
+
max: max,
|
|
66
|
+
min: min,
|
|
67
|
+
onChange: onNumberChange,
|
|
68
|
+
placeholder: placeholder,
|
|
69
|
+
step: step,
|
|
70
|
+
value: value || number
|
|
71
|
+
}))
|
|
72
|
+
}))]
|
|
73
|
+
});
|
|
74
|
+
};
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/typings.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.png';
|