@laser-ui/components 1.1.1 → 1.3.0
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/CHANGELOG.md +14 -0
- package/dropdown/Dropdown.js +1 -1
- package/dropdown/internal/DropdownGroup.js +1 -1
- package/dropdown/internal/DropdownSub.js +1 -1
- package/empty/Empty.js +1 -1
- package/form/Form.js +3 -1
- package/form/FormItem.js +5 -4
- package/form/model/validators.js +2 -2
- package/form/types.d.ts +3 -0
- package/form/vars.d.ts +1 -1
- package/form/vars.js +1 -1
- package/menu/internal/MenuGroup.js +1 -1
- package/menu/internal/MenuSub.js +2 -2
- package/package.json +2 -2
- package/resources.json +4 -4
- package/select/Select.js +1 -1
- package/tree/internal/TreePanel.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
# [1.3.0](https://github.com/laser-ui/laser-ui/compare/v1.2.0...v1.3.0) (2024-09-27)
|
|
6
|
+
|
|
7
|
+
**Note:** Version bump only for package @laser-ui/components
|
|
8
|
+
|
|
9
|
+
# [1.2.0](https://github.com/laser-ui/laser-ui/compare/v1.1.1...v1.2.0) (2024-09-12)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- **components:** form support `labelWrap` ([ffeb41a](https://github.com/laser-ui/laser-ui/commit/ffeb41afb4531e33b53343f245190dfa34872188))
|
|
14
|
+
|
|
15
|
+
### Performance Improvements
|
|
16
|
+
|
|
17
|
+
- **components:** optimize `Validators.required` ([39f452c](https://github.com/laser-ui/laser-ui/commit/39f452ce964b28fe3271c0016290a8a7667cdcf0))
|
|
18
|
+
|
|
5
19
|
## [1.1.1](https://github.com/laser-ui/laser-ui/compare/v1.1.0...v1.1.1) (2024-08-30)
|
|
6
20
|
|
|
7
21
|
### Bug Fixes
|
package/dropdown/Dropdown.js
CHANGED
|
@@ -372,7 +372,7 @@ function DropdownFC(props, ref) {
|
|
|
372
372
|
}, children: renderPopup(_jsxs("div", Object.assign({}, mergeCS(styled('dropdown-popup'), {
|
|
373
373
|
style: Object.assign({ zIndex }, transitionStyle),
|
|
374
374
|
}), { ref: popupRef, children: [(() => {
|
|
375
|
-
const el = (_jsx("ul", Object.assign({}, styled('dropdown__list'), { ref: ulRef, id: id, tabIndex: -1, role: "menu", "aria-labelledby": triggerId, "aria-activedescendant": isUndefined(focusId) ? undefined : getItemId(focusId), children: list.length === 0 ? _jsx("div", Object.assign({}, styled('dropdown__empty'), { children: t('No
|
|
375
|
+
const el = (_jsx("ul", Object.assign({}, styled('dropdown__list'), { ref: ulRef, id: id, tabIndex: -1, role: "menu", "aria-labelledby": triggerId, "aria-activedescendant": isUndefined(focusId) ? undefined : getItemId(focusId), children: list.length === 0 ? _jsx("div", Object.assign({}, styled('dropdown__empty'), { children: t('No data') })) : nodes })));
|
|
376
376
|
return popupRender ? popupRender(el) : el;
|
|
377
377
|
})(), arrow && _jsx("div", Object.assign({}, styled('dropdown__arrow')))] }))) })));
|
|
378
378
|
} }) })] }));
|
|
@@ -4,5 +4,5 @@ import { mergeCS } from '../../utils';
|
|
|
4
4
|
export function DropdownGroup(props) {
|
|
5
5
|
const { children, styled, id, level, list, empty } = props;
|
|
6
6
|
const { t } = useTranslation();
|
|
7
|
-
return (_jsxs("ul", Object.assign({}, styled('dropdown__group-list'), { role: "group", "aria-labelledby": id, children: [_jsx("li", Object.assign({}, mergeCS(styled('dropdown__group-title'), { style: { paddingLeft: 12 + level * 16 } }), { id: id, role: "presentation", children: children })), empty ? _jsx("div", Object.assign({}, mergeCS(styled('dropdown__empty'), { style: { paddingLeft: 12 + (level + 1) * 16 } }), { children: t('No
|
|
7
|
+
return (_jsxs("ul", Object.assign({}, styled('dropdown__group-list'), { role: "group", "aria-labelledby": id, children: [_jsx("li", Object.assign({}, mergeCS(styled('dropdown__group-title'), { style: { paddingLeft: 12 + level * 16 } }), { id: id, role: "presentation", children: children })), empty ? _jsx("div", Object.assign({}, mergeCS(styled('dropdown__empty'), { style: { paddingLeft: 12 + (level + 1) * 16 } }), { children: t('No data') })) : list] })));
|
|
8
8
|
}
|
|
@@ -82,6 +82,6 @@ export const DropdownSub = forwardRef((props, ref) => {
|
|
|
82
82
|
}
|
|
83
83
|
return renderPopup(_jsx("div", Object.assign({}, mergeCS(styled('dropdown-popup'), {
|
|
84
84
|
style: Object.assign({ zIndex }, transitionStyle),
|
|
85
|
-
}), { ref: popupRef, children: _jsx("ul", Object.assign({}, styled('dropdown__list'), { role: "menu", "aria-labelledby": id, children: empty ? (_jsx("div", Object.assign({}, mergeCS(styled('dropdown__empty'), { style: { paddingLeft: 12 + level * 16 } }), { children: t('No
|
|
85
|
+
}), { ref: popupRef, children: _jsx("ul", Object.assign({}, styled('dropdown__list'), { role: "menu", "aria-labelledby": id, children: empty ? (_jsx("div", Object.assign({}, mergeCS(styled('dropdown__empty'), { style: { paddingLeft: 12 + level * 16 } }), { children: t('No data') }))) : (list) })) })));
|
|
86
86
|
} }) })] })) }));
|
|
87
87
|
});
|
package/empty/Empty.js
CHANGED
|
@@ -13,6 +13,6 @@ export const Empty = (props) => {
|
|
|
13
13
|
return (_jsxs("div", Object.assign({}, restProps, mergeCS(styled('empty'), {
|
|
14
14
|
className: restProps.className,
|
|
15
15
|
style: restProps.style,
|
|
16
|
-
}), { children: [(isUndefined(image) || image === SIMPLE_IMG || checkNodeExist(image)) && (_jsx("div", Object.assign({}, styled('empty__img'), { children: isUndefined(image) ? (_jsx(Icon, { size: [115, 95], children: _jsx("svg", { viewBox: "0 0 184 152", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsxs("g", { transform: "translate(24 31.67)", children: [_jsx("ellipse", { fillOpacity: ".8", fill: "#F5F5F7", cx: "67.797", cy: "106.89", rx: "67.797", ry: "12.668" }), _jsx("path", { d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z", fill: "#AEB8C2" }), _jsx("path", { d: "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z", fill: "url(#linearGradient-1)", transform: "translate(13.56)" }), _jsx("path", { d: "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z", fill: "#F5F5F7" }), _jsx("path", { d: "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z", fill: "#DCE0E6" })] }), _jsx("path", { d: "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z", fill: "#DCE0E6" }), _jsxs("g", { transform: "translate(149.65 15.383)", fill: "#FFF", children: [_jsx("ellipse", { cx: "20.654", cy: "3.167", rx: "2.849", ry: "2.815" }), _jsx("path", { d: "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" })] })] }) }) })) : image === SIMPLE_IMG ? (_jsx(Icon, { size: [64, 41], children: _jsx("svg", { viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [_jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), _jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [_jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), _jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }) })) : (image) }))), (isUndefined(description) || checkNodeExist(description)) && (_jsx("div", Object.assign({}, styled('empty__description'), { children: isUndefined(description) ? t('No
|
|
16
|
+
}), { children: [(isUndefined(image) || image === SIMPLE_IMG || checkNodeExist(image)) && (_jsx("div", Object.assign({}, styled('empty__img'), { children: isUndefined(image) ? (_jsx(Icon, { size: [115, 95], children: _jsx("svg", { viewBox: "0 0 184 152", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { fill: "none", fillRule: "evenodd", children: [_jsxs("g", { transform: "translate(24 31.67)", children: [_jsx("ellipse", { fillOpacity: ".8", fill: "#F5F5F7", cx: "67.797", cy: "106.89", rx: "67.797", ry: "12.668" }), _jsx("path", { d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z", fill: "#AEB8C2" }), _jsx("path", { d: "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z", fill: "url(#linearGradient-1)", transform: "translate(13.56)" }), _jsx("path", { d: "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z", fill: "#F5F5F7" }), _jsx("path", { d: "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z", fill: "#DCE0E6" })] }), _jsx("path", { d: "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z", fill: "#DCE0E6" }), _jsxs("g", { transform: "translate(149.65 15.383)", fill: "#FFF", children: [_jsx("ellipse", { cx: "20.654", cy: "3.167", rx: "2.849", ry: "2.815" }), _jsx("path", { d: "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" })] })] }) }) })) : image === SIMPLE_IMG ? (_jsx(Icon, { size: [64, 41], children: _jsx("svg", { viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: _jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [_jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), _jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [_jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), _jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }) })) : (image) }))), (isUndefined(description) || checkNodeExist(description)) && (_jsx("div", Object.assign({}, styled('empty__description'), { children: isUndefined(description) ? t('No data') : description }))), checkNodeExist(children) && _jsx("div", Object.assign({}, styled('empty__footer'), { children: children }))] })));
|
|
17
17
|
};
|
|
18
18
|
Empty.SIMPLE_IMG = SIMPLE_IMG;
|
package/form/Form.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { isUndefined } from 'lodash';
|
|
3
4
|
import { useEffect, useRef } from 'react';
|
|
4
5
|
import { FormItem } from './FormItem';
|
|
5
6
|
import { CLASSES, FormContext } from './vars';
|
|
@@ -7,7 +8,7 @@ import { ConfigProvider } from '../config-provider';
|
|
|
7
8
|
import { useComponentProps, useScopedProps, useStyled } from '../hooks';
|
|
8
9
|
import { mergeCS } from '../utils';
|
|
9
10
|
export const Form = (props) => {
|
|
10
|
-
const _a = useComponentProps('Form', props), { children, styleOverrides, styleProvider, vertical = false, labelWidth, labelColon, requiredType = 'required', feedbackIcon = false, size: sizeProp } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "vertical", "labelWidth", "labelColon", "requiredType", "feedbackIcon", "size"]);
|
|
11
|
+
const _a = useComponentProps('Form', props), { children, styleOverrides, styleProvider, vertical = false, labelWidth, labelWrap = false, labelColon, requiredType = 'required', feedbackIcon = false, size: sizeProp } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "vertical", "labelWidth", "labelWrap", "labelColon", "requiredType", "feedbackIcon", "size"]);
|
|
11
12
|
const styled = useStyled(CLASSES, { form: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.form }, styleOverrides);
|
|
12
13
|
const formRef = useRef(null);
|
|
13
14
|
const { size } = useScopedProps({ size: sizeProp });
|
|
@@ -35,6 +36,7 @@ export const Form = (props) => {
|
|
|
35
36
|
}, children: _jsx(ConfigProvider, { context: { componentSize: size }, children: _jsx(FormContext.Provider, { value: {
|
|
36
37
|
vertical,
|
|
37
38
|
labelWidth: labelWidth !== null && labelWidth !== void 0 ? labelWidth : (vertical ? undefined : 'auto'),
|
|
39
|
+
labelWrap: isUndefined(labelWidth) ? false : labelWrap,
|
|
38
40
|
labelColon: labelColon !== null && labelColon !== void 0 ? labelColon : !vertical,
|
|
39
41
|
requiredType,
|
|
40
42
|
feedbackIcon,
|
package/form/FormItem.js
CHANGED
|
@@ -4,7 +4,7 @@ import CancelFilled from '@material-design-icons/svg/filled/cancel.svg?react';
|
|
|
4
4
|
import CheckCircleFilled from '@material-design-icons/svg/filled/check_circle.svg?react';
|
|
5
5
|
import ErrorFilled from '@material-design-icons/svg/filled/error.svg?react';
|
|
6
6
|
import HelpOutlineOutlined from '@material-design-icons/svg/outlined/help_outline.svg?react';
|
|
7
|
-
import { isBoolean, isFunction, isNull, isNumber, isString } from 'lodash';
|
|
7
|
+
import { isBoolean, isFunction, isNull, isNumber, isString, isUndefined } from 'lodash';
|
|
8
8
|
import { useContext, useId, useRef } from 'react';
|
|
9
9
|
import { FormError } from './internal/FormError';
|
|
10
10
|
import { Validators } from './model/validators';
|
|
@@ -22,7 +22,7 @@ const ValidateState = {
|
|
|
22
22
|
Pending: 4,
|
|
23
23
|
};
|
|
24
24
|
export function FormItem(props) {
|
|
25
|
-
const _a = useComponentProps('FormItem', props), { children, styleOverrides, styleProvider, formControls, label, labelWidth: labelWidthProp, labelExtra: labelExtraProp, labelFor, required: requiredProp } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "formControls", "label", "labelWidth", "labelExtra", "labelFor", "required"]);
|
|
25
|
+
const _a = useComponentProps('FormItem', props), { children, styleOverrides, styleProvider, formControls, label, labelWidth: labelWidthProp, labelWrap: labelWrapProp, labelExtra: labelExtraProp, labelFor, required: requiredProp } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "formControls", "label", "labelWidth", "labelWrap", "labelExtra", "labelFor", "required"]);
|
|
26
26
|
const styled = useStyled(CLASSES, { form: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.form }, styleOverrides);
|
|
27
27
|
const { t } = useTranslation();
|
|
28
28
|
const formContext = useContext(FormContext);
|
|
@@ -31,6 +31,7 @@ export function FormItem(props) {
|
|
|
31
31
|
const uniqueId = useId();
|
|
32
32
|
const getErrorId = (controlName) => `${controlName}-error-${uniqueId}`;
|
|
33
33
|
const labelWidth = labelWidthProp !== null && labelWidthProp !== void 0 ? labelWidthProp : formContext.labelWidth;
|
|
34
|
+
const labelWrap = isUndefined(labelWidth) ? false : (labelWrapProp !== null && labelWrapProp !== void 0 ? labelWrapProp : formContext.labelWrap);
|
|
34
35
|
const formControlProviders = (() => {
|
|
35
36
|
const obj = {};
|
|
36
37
|
Object.keys(formControls !== null && formControls !== void 0 ? formControls : {}).forEach((controlName) => {
|
|
@@ -149,9 +150,9 @@ export function FormItem(props) {
|
|
|
149
150
|
className: restProps.className,
|
|
150
151
|
style: restProps.style,
|
|
151
152
|
}), { ref: divRef, children: _jsxs("div", Object.assign({}, styled('form__item-container'), { children: [labelWidth !== 0 && (_jsx("div", Object.assign({}, mergeCS(styled('form__item-label-wrapper'), {
|
|
152
|
-
style: { width: formContext.vertical ?
|
|
153
|
+
style: { width: formContext.vertical ? undefined : labelWidth === 'auto' ? 'var(--label-width)' : labelWidth },
|
|
153
154
|
}), { children: label && (_jsxs("label", Object.assign({}, styled('form__item-label', {
|
|
154
|
-
'form__item-label--
|
|
155
|
+
'form__item-label--wrap': labelWrap,
|
|
155
156
|
'form__item-label--required': formContext.requiredType === 'required' && required,
|
|
156
157
|
'form__item-label--colon': formContext.labelColon,
|
|
157
158
|
}), { htmlFor: labelFor, "data-l-form-label": true, children: [label, (labelExtra || (formContext.requiredType === 'optional' && !required)) && (_jsxs("div", Object.assign({}, styled('form__item-label-extra'), { children: [formContext.requiredType === 'optional' && !required && _jsx("span", { children: t('Form', 'Optional') }), labelExtra] })))] }))) }))), _jsxs("div", Object.assign({}, mergeCS(styled('form__item-content'), {
|
package/form/model/validators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray,
|
|
1
|
+
import { isArray, isNumber, isString } from 'lodash';
|
|
2
2
|
export class Validators {
|
|
3
3
|
static min(min) {
|
|
4
4
|
return (control) => {
|
|
@@ -29,7 +29,7 @@ export class Validators {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
static required(control) {
|
|
32
|
-
const isEmpty = isArray(control.value) || isString(control.value)
|
|
32
|
+
const isEmpty = control.value == null || ((isArray(control.value) || isString(control.value)) && control.value.length === 0);
|
|
33
33
|
return isEmpty ? { required: true } : null;
|
|
34
34
|
}
|
|
35
35
|
static email(control) {
|
package/form/types.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface FormControlProvider {
|
|
|
23
23
|
export interface FormContextData {
|
|
24
24
|
vertical: boolean;
|
|
25
25
|
labelWidth: number | string | undefined;
|
|
26
|
+
labelWrap: boolean;
|
|
26
27
|
labelColon: boolean;
|
|
27
28
|
requiredType: 'required' | 'optional' | 'hidden';
|
|
28
29
|
feedbackIcon: boolean | {
|
|
@@ -35,6 +36,7 @@ export interface FormContextData {
|
|
|
35
36
|
export interface FormProps extends BaseProps<'form', typeof CLASSES>, React.FormHTMLAttributes<HTMLFormElement> {
|
|
36
37
|
vertical?: boolean;
|
|
37
38
|
labelWidth?: number | string;
|
|
39
|
+
labelWrap?: boolean;
|
|
38
40
|
labelColon?: boolean;
|
|
39
41
|
requiredType?: 'required' | 'optional' | 'hidden';
|
|
40
42
|
feedbackIcon?: boolean | {
|
|
@@ -54,6 +56,7 @@ export interface FormItemProps<T extends {
|
|
|
54
56
|
formControls?: T;
|
|
55
57
|
label?: React.ReactNode;
|
|
56
58
|
labelWidth?: number | string;
|
|
59
|
+
labelWrap?: boolean;
|
|
57
60
|
labelExtra?: {
|
|
58
61
|
title: string;
|
|
59
62
|
icon?: React.ReactElement;
|
package/form/vars.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const CLASSES: {
|
|
|
11
11
|
'form__item-container': string;
|
|
12
12
|
'form__item-label-wrapper': string;
|
|
13
13
|
'form__item-label': string;
|
|
14
|
-
'form__item-label--
|
|
14
|
+
'form__item-label--wrap': string;
|
|
15
15
|
'form__item-label--required': string;
|
|
16
16
|
'form__item-label--colon': string;
|
|
17
17
|
'form__item-label-extra': string;
|
package/form/vars.js
CHANGED
|
@@ -9,7 +9,7 @@ export const CLASSES = {
|
|
|
9
9
|
'form__item-container': '^form__item-container',
|
|
10
10
|
'form__item-label-wrapper': '^form__item-label-wrapper',
|
|
11
11
|
'form__item-label': '^form__item-label',
|
|
12
|
-
'form__item-label--
|
|
12
|
+
'form__item-label--wrap': '^form__item-label--wrap',
|
|
13
13
|
'form__item-label--required': '^form__item-label--required',
|
|
14
14
|
'form__item-label--colon': '^form__item-label--colon',
|
|
15
15
|
'form__item-label-extra': '^form__item-label-extra',
|
|
@@ -4,5 +4,5 @@ import { mergeCS } from '../../utils';
|
|
|
4
4
|
export function MenuGroup(props) {
|
|
5
5
|
const { children, styled, id, level, space, step, list, empty } = props;
|
|
6
6
|
const { t } = useTranslation();
|
|
7
|
-
return (_jsxs("ul", Object.assign({}, styled('menu__group-list'), { role: "group", "aria-labelledby": id, children: [_jsx("li", Object.assign({}, mergeCS(styled('menu__group-title'), { style: { paddingLeft: space + level * step } }), { id: id, role: "presentation", children: children })), empty ? _jsx("div", Object.assign({}, mergeCS(styled('menu__empty'), { style: { paddingLeft: space + (level + 1) * step } }), { children: t('No
|
|
7
|
+
return (_jsxs("ul", Object.assign({}, styled('menu__group-list'), { role: "group", "aria-labelledby": id, children: [_jsx("li", Object.assign({}, mergeCS(styled('menu__group-title'), { style: { paddingLeft: space + level * step } }), { id: id, role: "presentation", children: children })), empty ? _jsx("div", Object.assign({}, mergeCS(styled('menu__empty'), { style: { paddingLeft: space + (level + 1) * step } }), { children: t('No data') })) : list] })));
|
|
8
8
|
}
|
package/menu/internal/MenuSub.js
CHANGED
|
@@ -107,7 +107,7 @@ export const MenuSub = forwardRef((props, ref) => {
|
|
|
107
107
|
}
|
|
108
108
|
return renderPopup(_jsx("div", Object.assign({}, mergeCS(styled('menu-popup'), {
|
|
109
109
|
style: Object.assign({ minWidth: inHorizontalNav ? undefined : 160, zIndex: `calc(var(--${namespace}-zindex-fixed) + ${maxZIndex})` }, transitionStyle),
|
|
110
|
-
}), { ref: popupRef, children: _jsx("ul", Object.assign({}, styled('menu__sub-list'), { role: "menu", "aria-labelledby": id, children: empty ? (_jsx("div", Object.assign({}, mergeCS(styled('menu__empty'), { style: { paddingLeft: space + level * step } }), { children: t('No
|
|
110
|
+
}), { ref: popupRef, children: _jsx("ul", Object.assign({}, styled('menu__sub-list'), { role: "menu", "aria-labelledby": id, children: empty ? (_jsx("div", Object.assign({}, mergeCS(styled('menu__empty'), { style: { paddingLeft: space + level * step } }), { children: t('No data') }))) : (list) })) })));
|
|
111
111
|
} }) }))] })) }), _jsx(CollapseTransition, { originalSize: {
|
|
112
112
|
height: 'auto',
|
|
113
113
|
}, collapsedSize: {
|
|
@@ -129,7 +129,7 @@ export const MenuSub = forwardRef((props, ref) => {
|
|
|
129
129
|
}
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
|
-
const node = (_jsx("ul", Object.assign({}, mergeCS(styled('menu__sub-list'), { style: collapseStyle }), { ref: listRef, role: "menu", "aria-labelledby": id, children: empty ? (_jsx("div", Object.assign({}, mergeCS(styled('menu__empty'), { style: { paddingLeft: space + (level + 1) * step } }), { children: t('No
|
|
132
|
+
const node = (_jsx("ul", Object.assign({}, mergeCS(styled('menu__sub-list'), { style: collapseStyle }), { ref: listRef, role: "menu", "aria-labelledby": id, children: empty ? (_jsx("div", Object.assign({}, mergeCS(styled('menu__empty'), { style: { paddingLeft: space + (level + 1) * step } }), { children: t('No data') }))) : (list) })));
|
|
133
133
|
if (mode === 'vertical' && inNav) {
|
|
134
134
|
dataRef.current.nodeCache = node;
|
|
135
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laser-ui/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "React components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"access": "public",
|
|
41
41
|
"directory": "../../dist/libs/components"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "4d23c9e48d8e44d78673367640d213d6f5f585ca"
|
|
44
44
|
}
|
package/resources.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"Create": "Create",
|
|
9
9
|
"Clear": "Clear",
|
|
10
10
|
"More": "More",
|
|
11
|
-
"No
|
|
11
|
+
"No data": "No data"
|
|
12
12
|
},
|
|
13
13
|
"Footer": {
|
|
14
14
|
"Cancel": "Cancel",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"Create": "创建",
|
|
72
72
|
"Clear": "清除",
|
|
73
73
|
"More": "更多",
|
|
74
|
-
"No
|
|
74
|
+
"No data": "无数据"
|
|
75
75
|
},
|
|
76
76
|
"Footer": {
|
|
77
|
-
"Cancel": "
|
|
78
|
-
"OK": "
|
|
77
|
+
"Cancel": "取消",
|
|
78
|
+
"OK": "确定"
|
|
79
79
|
},
|
|
80
80
|
"Input": {
|
|
81
81
|
"Password is visible": "密码可见",
|
package/select/Select.js
CHANGED
|
@@ -521,7 +521,7 @@ function SelectFC(props, ref) {
|
|
|
521
521
|
focusVisible && (itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.value) === itemValue && _jsx("div", { className: `${namespace}-focus-outline` }),
|
|
522
522
|
item[IS_CREATED] ? (_jsx("div", Object.assign({}, styled('select__option-prefix'), { children: _jsx(Icon, { theme: "primary", children: _jsx(AddOutlined, {}) }) }))) : multiple ? (_jsx("div", Object.assign({}, styled('select__option-prefix'), { children: _jsx(Checkbox, { model: isSelected, disabled: itemDisabled }) }))) : null,
|
|
523
523
|
_jsx("div", Object.assign({}, styled('select__option-content'), { children: node }))));
|
|
524
|
-
}, itemFocused: itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.value, itemEmptyRender: () => (_jsx("li", Object.assign({}, mergeCS(styled('select__empty'), { style: { paddingLeft: 12 + 8 } }), { children: _jsx("div", Object.assign({}, styled('select__option-content'), { children: t('No
|
|
524
|
+
}, itemFocused: itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.value, itemEmptyRender: () => (_jsx("li", Object.assign({}, mergeCS(styled('select__empty'), { style: { paddingLeft: 12 + 8 } }), { children: _jsx("div", Object.assign({}, styled('select__option-content'), { children: t('No data') })) }))), itemInAriaSetsize: (item) => !item.children, placeholder: "li", onScrollEnd: onScrollBottom, children: (vsList, onScroll) => (_jsx("ul", Object.assign({}, styled('select__list'), { ref: listRef, id: listId, tabIndex: -1, role: "listbox", "aria-multiselectable": multiple, "aria-activedescendant": isUndefined(itemFocused) ? undefined : getItemId(itemFocused.value), onScroll: onScroll, children: list.length === 0 ? _jsx(Empty, { style: { padding: '12px 0' }, image: Empty.SIMPLE_IMG }) : vsList }))) })))] })));
|
|
525
525
|
return popupRender ? popupRender(el) : el;
|
|
526
526
|
})() })));
|
|
527
527
|
} }) })] }));
|
|
@@ -156,7 +156,7 @@ function TreePanelFC(props, ref) {
|
|
|
156
156
|
onNodeClick(item);
|
|
157
157
|
} }) }))),
|
|
158
158
|
_jsx("div", Object.assign({}, styled('tree__option-content'), { children: customItem ? customItem(item.origin) : item.origin.label }))));
|
|
159
|
-
}, itemFocused: itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.id, itemEmptyRender: () => (_jsx("li", Object.assign({}, styled('tree__empty'), { children: _jsx("div", Object.assign({}, styled('tree__option-content'), { children: t('No
|
|
159
|
+
}, itemFocused: itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.id, itemEmptyRender: () => (_jsx("li", Object.assign({}, styled('tree__empty'), { children: _jsx("div", Object.assign({}, styled('tree__option-content'), { children: t('No data') })) }))), itemInAriaSetsize: (item) => !item.children, placeholder: "li", onScrollEnd: onScrollBottom, children: (vsList, onScroll) => (_jsx("ul", Object.assign({}, restProps, mergeCS(styled('tree', {
|
|
160
160
|
'tree.is-disabled': disabled,
|
|
161
161
|
'tree--line': showLine,
|
|
162
162
|
}), {
|