@canlooks/can-ui 0.0.78 → 0.0.80
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/cjs/components/calendar/calendar.style.js +124 -124
- package/dist/cjs/components/cascade/cascade.js +1 -1
- package/dist/cjs/components/clickAway/clickAway.d.ts +1 -1
- package/dist/cjs/components/inputBase/inputBase.js +2 -5
- package/dist/cjs/components/popper/popper.js +3 -2
- package/dist/cjs/components/select/select.js +1 -1
- package/dist/cjs/components/status/status.d.ts +6 -6
- package/dist/cjs/components/treeSelect/treeSelect.js +1 -1
- package/dist/cjs/extensions/reactiveForm/reactiveForm.d.ts +2 -2
- package/dist/cjs/utils/utils.d.ts +7 -2
- package/dist/cjs/utils/utils.js +17 -3
- package/dist/esm/components/calendar/calendar.style.js +124 -124
- package/dist/esm/components/cascade/cascade.js +2 -2
- package/dist/esm/components/clickAway/clickAway.d.ts +1 -1
- package/dist/esm/components/inputBase/inputBase.js +3 -6
- package/dist/esm/components/popper/popper.js +3 -2
- package/dist/esm/components/select/select.js +2 -2
- package/dist/esm/components/status/status.d.ts +6 -6
- package/dist/esm/components/treeSelect/treeSelect.js +2 -2
- package/dist/esm/extensions/reactiveForm/reactiveForm.d.ts +2 -2
- package/dist/esm/utils/utils.d.ts +7 -2
- package/dist/esm/utils/utils.js +16 -3
- package/extensions/curd.cjs +5 -5
- package/extensions/documentViewer.cjs +5 -5
- package/extensions/textFormatter.cjs +5 -5
- package/package.json +1 -1
- package/documentation/dist/assets/index-DvrKS6Tv.js +0 -7747
- package/documentation/dist/atom-one-dark.min.css +0 -1
- package/documentation/dist/components/accordion.md +0 -38
- package/documentation/dist/components/actionSheet.md +0 -49
- package/documentation/dist/components/alert.md +0 -38
- package/documentation/dist/components/anchorList.md +0 -36
- package/documentation/dist/components/autocomplete.md +0 -68
- package/documentation/dist/components/avatar.md +0 -79
- package/documentation/dist/components/badge.md +0 -33
- package/documentation/dist/components/bottomNavigation.md +0 -39
- package/documentation/dist/components/breadcrumb.md +0 -28
- package/documentation/dist/components/bubbleConfirm.md +0 -34
- package/documentation/dist/components/button.md +0 -62
- package/documentation/dist/components/card.md +0 -30
- package/documentation/dist/components/cascade.md +0 -48
- package/documentation/dist/components/checkbox.md +0 -36
- package/documentation/dist/components/colorPicker.md +0 -27
- package/documentation/dist/components/contextMenu.md +0 -27
- package/documentation/dist/components/counter.md +0 -29
- package/documentation/dist/components/dataGrid.md +0 -112
- package/documentation/dist/components/dateTimePicker.md +0 -35
- package/documentation/dist/components/dateTimeRangePicker.md +0 -36
- package/documentation/dist/components/descriptions.md +0 -35
- package/documentation/dist/components/dialog.md +0 -56
- package/documentation/dist/components/divider.md +0 -26
- package/documentation/dist/components/drawer.md +0 -40
- package/documentation/dist/components/flex.md +0 -20
- package/documentation/dist/components/form.md +0 -131
- package/documentation/dist/components/formDialog.md +0 -36
- package/documentation/dist/components/grid.md +0 -34
- package/documentation/dist/components/highlight.md +0 -26
- package/documentation/dist/components/image.md +0 -90
- package/documentation/dist/components/input.md +0 -39
- package/documentation/dist/components/loading.md +0 -46
- package/documentation/dist/components/menu.md +0 -85
- package/documentation/dist/components/pagination.md +0 -38
- package/documentation/dist/components/pickerDialog.md +0 -56
- package/documentation/dist/components/placeholder.md +0 -30
- package/documentation/dist/components/progress.md +0 -43
- package/documentation/dist/components/radio.md +0 -37
- package/documentation/dist/components/rating.md +0 -35
- package/documentation/dist/components/resizable.md +0 -41
- package/documentation/dist/components/scrollbar.md +0 -31
- package/documentation/dist/components/segmented.md +0 -57
- package/documentation/dist/components/select.md +0 -30
- package/documentation/dist/components/skeleton.md +0 -26
- package/documentation/dist/components/slidableActions.md +0 -53
- package/documentation/dist/guide/appComponent.md +0 -30
- package/documentation/dist/guide/globalMethods.md +0 -238
- package/documentation/dist/guide/icon.md +0 -57
- package/documentation/dist/guide/introduction.md +0 -2
- package/documentation/dist/guide/overrideProps.md +0 -0
- package/documentation/dist/guide/startup.md +0 -23
- package/documentation/dist/guide/theme.md +0 -249
- package/documentation/dist/index.html +0 -13
- package/documentation/dist/logo.png +0 -0
|
@@ -13,128 +13,128 @@ export const classes = defineInnerClasses('calendar', [
|
|
|
13
13
|
'yearItem',
|
|
14
14
|
'foot'
|
|
15
15
|
]);
|
|
16
|
-
export const style = defineCss(({ divider, text, spacing }) => css `
|
|
17
|
-
.${classes.head} {
|
|
18
|
-
height: 40px;
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
border-bottom: 1px solid ${divider};
|
|
23
|
-
padding: 0 ${menuListPadding}px;
|
|
24
|
-
position: relative;
|
|
25
|
-
|
|
26
|
-
.${classes.headSide} {
|
|
27
|
-
z-index: 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.${classes.headControl} {
|
|
31
|
-
color: ${text.placeholder};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.${classes.headCenter} {
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
position: absolute;
|
|
39
|
-
inset: 0;
|
|
40
|
-
|
|
41
|
-
.${classes.headButton} {
|
|
42
|
-
font-weight: bold;
|
|
43
|
-
color: ${text.primary};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.${classes.body} {
|
|
49
|
-
padding: ${spacing[3]}px ${spacing[4]}px;
|
|
50
|
-
display: grid;
|
|
51
|
-
place-items: center;
|
|
52
|
-
|
|
53
|
-
&[data-view-type=date] {
|
|
54
|
-
font-size: ${13 / 14}em;
|
|
55
|
-
grid-template-columns: repeat(7, 36px);
|
|
56
|
-
grid-template-rows: repeat(7, 36px);
|
|
57
|
-
|
|
58
|
-
.${classes.dateItem} {
|
|
59
|
-
width: 24px;
|
|
60
|
-
height: 24px;
|
|
61
|
-
|
|
62
|
-
&:not([data-variant=filled]) {
|
|
63
|
-
color: ${text.primary};
|
|
64
|
-
border-color: ${text.disabled};
|
|
65
|
-
|
|
66
|
-
&[data-other-month=true] {
|
|
67
|
-
color: ${text.placeholder};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&:disabled {
|
|
72
|
-
width: 100%;
|
|
73
|
-
border-radius: 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
79
|
-
grid-template-columns: repeat(3, 84px);
|
|
80
|
-
grid-template-rows: repeat(4, 63px);
|
|
81
|
-
|
|
82
|
-
.${classes.monthItem},
|
|
83
|
-
.${classes.yearItem} {
|
|
84
|
-
width: 72px;
|
|
85
|
-
padding-inline: 0;
|
|
86
|
-
|
|
87
|
-
&:not([data-variant=filled]) {
|
|
88
|
-
color: ${text.primary};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&[data-size=small] {
|
|
95
|
-
.${classes.body} {
|
|
96
|
-
&[data-view-type=date] {
|
|
97
|
-
grid-template-columns: repeat(7, 30px);
|
|
98
|
-
grid-template-rows: repeat(7, 30px);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
102
|
-
grid-template-columns: repeat(3, 70px);
|
|
103
|
-
grid-template-rows: repeat(4, 52.5px);
|
|
104
|
-
|
|
105
|
-
.${classes.monthItem},
|
|
106
|
-
.${classes.yearItem} {
|
|
107
|
-
width: 60px;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&[data-size=large] {
|
|
114
|
-
.${classes.body} {
|
|
115
|
-
&[data-view-type=date] {
|
|
116
|
-
font-size: 1em;
|
|
117
|
-
grid-template-columns: repeat(7, 42px);
|
|
118
|
-
grid-template-rows: repeat(7, 42px);
|
|
119
|
-
|
|
120
|
-
.${classes.dateItem} {
|
|
121
|
-
width: 32px;
|
|
122
|
-
height: 32px;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
127
|
-
grid-template-columns: repeat(3, 98px);
|
|
128
|
-
grid-template-rows: repeat(4, 73.5px);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.${classes.foot} {
|
|
134
|
-
height: 41px;
|
|
135
|
-
display: flex;
|
|
136
|
-
align-items: center;
|
|
137
|
-
justify-content: center;
|
|
138
|
-
border-top: 1px solid ${divider};
|
|
139
|
-
}
|
|
16
|
+
export const style = defineCss(({ divider, text, spacing }) => css `
|
|
17
|
+
.${classes.head} {
|
|
18
|
+
height: 40px;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
border-bottom: 1px solid ${divider};
|
|
23
|
+
padding: 0 ${menuListPadding}px;
|
|
24
|
+
position: relative;
|
|
25
|
+
|
|
26
|
+
.${classes.headSide} {
|
|
27
|
+
z-index: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.${classes.headControl} {
|
|
31
|
+
color: ${text.placeholder};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.${classes.headCenter} {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
position: absolute;
|
|
39
|
+
inset: 0;
|
|
40
|
+
|
|
41
|
+
.${classes.headButton} {
|
|
42
|
+
font-weight: bold;
|
|
43
|
+
color: ${text.primary};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.${classes.body} {
|
|
49
|
+
padding: ${spacing[3]}px ${spacing[4]}px;
|
|
50
|
+
display: grid;
|
|
51
|
+
place-items: center;
|
|
52
|
+
|
|
53
|
+
&[data-view-type=date] {
|
|
54
|
+
font-size: ${13 / 14}em;
|
|
55
|
+
grid-template-columns: repeat(7, 36px);
|
|
56
|
+
grid-template-rows: repeat(7, 36px);
|
|
57
|
+
|
|
58
|
+
.${classes.dateItem} {
|
|
59
|
+
width: 24px;
|
|
60
|
+
height: 24px;
|
|
61
|
+
|
|
62
|
+
&:not([data-variant=filled]) {
|
|
63
|
+
color: ${text.primary};
|
|
64
|
+
border-color: ${text.disabled};
|
|
65
|
+
|
|
66
|
+
&[data-other-month=true] {
|
|
67
|
+
color: ${text.placeholder};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:disabled {
|
|
72
|
+
width: 100%;
|
|
73
|
+
border-radius: 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
79
|
+
grid-template-columns: repeat(3, 84px);
|
|
80
|
+
grid-template-rows: repeat(4, 63px);
|
|
81
|
+
|
|
82
|
+
.${classes.monthItem},
|
|
83
|
+
.${classes.yearItem} {
|
|
84
|
+
width: 72px;
|
|
85
|
+
padding-inline: 0;
|
|
86
|
+
|
|
87
|
+
&:not([data-variant=filled]) {
|
|
88
|
+
color: ${text.primary};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&[data-size=small] {
|
|
95
|
+
.${classes.body} {
|
|
96
|
+
&[data-view-type=date] {
|
|
97
|
+
grid-template-columns: repeat(7, 30px);
|
|
98
|
+
grid-template-rows: repeat(7, 30px);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
102
|
+
grid-template-columns: repeat(3, 70px);
|
|
103
|
+
grid-template-rows: repeat(4, 52.5px);
|
|
104
|
+
|
|
105
|
+
.${classes.monthItem},
|
|
106
|
+
.${classes.yearItem} {
|
|
107
|
+
width: 60px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&[data-size=large] {
|
|
114
|
+
.${classes.body} {
|
|
115
|
+
&[data-view-type=date] {
|
|
116
|
+
font-size: 1em;
|
|
117
|
+
grid-template-columns: repeat(7, 42px);
|
|
118
|
+
grid-template-rows: repeat(7, 42px);
|
|
119
|
+
|
|
120
|
+
.${classes.dateItem} {
|
|
121
|
+
width: 32px;
|
|
122
|
+
height: 32px;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
127
|
+
grid-template-columns: repeat(3, 98px);
|
|
128
|
+
grid-template-rows: repeat(4, 73.5px);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.${classes.foot} {
|
|
134
|
+
height: 41px;
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
border-top: 1px solid ${divider};
|
|
139
|
+
}
|
|
140
140
|
`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { createContext, memo, useContext, useDeferredValue, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { useControlled, useLoading, useKeyboard, joinNodes, clsx,
|
|
3
|
+
import { useControlled, useLoading, useKeyboard, joinNodes, clsx, mergeComponentProps, isNoValue } from '../../utils';
|
|
4
4
|
import { Input } from '../input';
|
|
5
5
|
import { InputBase } from '../inputBase';
|
|
6
6
|
import { Popper } from '../popper';
|
|
@@ -56,7 +56,7 @@ loading, options, labelKey = 'label', primaryKey = 'value', childrenKey = 'child
|
|
|
56
56
|
setInnerOptions(await loadOptions(searchValue, parent));
|
|
57
57
|
}, loading);
|
|
58
58
|
useEffect(() => {
|
|
59
|
-
if (loadOptions && !searchable && !innerOpen.current &&
|
|
59
|
+
if (loadOptions && !searchable && !innerOpen.current && !isNoValue(innerValue)) {
|
|
60
60
|
// 第一次渲染就有value,需要请求数据
|
|
61
61
|
innerLoadOptions(innerSearchValue.current);
|
|
62
62
|
}
|
|
@@ -60,7 +60,7 @@ export declare function ClickAway({ ref, container, eventType, onClickAway, disa
|
|
|
60
60
|
results: number;
|
|
61
61
|
security: string;
|
|
62
62
|
unselectable: "off" | "on";
|
|
63
|
-
popover: "" | "auto" | "manual";
|
|
63
|
+
popover: "" | "auto" | "manual" | "hint";
|
|
64
64
|
popoverTargetAction: "toggle" | "hide" | "show";
|
|
65
65
|
popoverTarget: string;
|
|
66
66
|
inert: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useImperativeHandle, useRef } from 'react';
|
|
3
3
|
import { classes, useStyle } from './inputBase.style';
|
|
4
|
-
import { fixInputNumber,
|
|
4
|
+
import { fixInputNumber, isNoValue, mergeComponentProps, useControlled } from '../../utils';
|
|
5
5
|
import { useTheme } from '../theme';
|
|
6
6
|
import { Button } from '../button';
|
|
7
7
|
import { LoadingIndicator } from '../loadingIndicator';
|
|
@@ -54,13 +54,10 @@ min, max, step, precision, placeholder, disabled, readOnly, autoFocus, defaultVa
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
const shouldRenderClearButton = () => {
|
|
57
|
-
if (!clearable || disabled || readOnly
|
|
57
|
+
if (!clearable || disabled || readOnly) {
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
return !!innerValue.current.length;
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
60
|
+
return isNoValue(innerValue.current);
|
|
64
61
|
};
|
|
65
62
|
return (_jsxs("div", { ...mergeComponentProps(props, {
|
|
66
63
|
ref: innerRef,
|
|
@@ -465,9 +465,10 @@ export function Popper({ ref, popperRef, anchorElement, container = document.bod
|
|
|
465
465
|
const click = () => {
|
|
466
466
|
setOpenForce(false);
|
|
467
467
|
};
|
|
468
|
-
anchorRef.current
|
|
468
|
+
const anchorEl = anchorRef.current;
|
|
469
|
+
anchorEl.addEventListener('click', click);
|
|
469
470
|
return () => {
|
|
470
|
-
|
|
471
|
+
anchorEl.removeEventListener('click', click);
|
|
471
472
|
};
|
|
472
473
|
}
|
|
473
474
|
}, [clickToClose]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { Children, isValidElement, memo, useCallback, useDeferredValue, useMemo, useRef } from 'react';
|
|
3
3
|
import { InputBase } from '../inputBase';
|
|
4
|
-
import {
|
|
4
|
+
import { isNoValue, mergeComponentProps, useControlled } from '../../utils';
|
|
5
5
|
import { classes, style } from './select.style';
|
|
6
6
|
import { Popper } from '../popper';
|
|
7
7
|
import { MenuItem } from '../menuItem';
|
|
@@ -112,7 +112,7 @@ showCheckbox = !!multiple, loading, options, labelKey = 'label', primaryKey = 'v
|
|
|
112
112
|
value: innerValue,
|
|
113
113
|
onClear,
|
|
114
114
|
onBlur
|
|
115
|
-
}), "data-focused": innerOpen.current, children: inputBaseProps => _jsxs("div", { className: classes.contentWrap, children: [
|
|
115
|
+
}), "data-focused": innerOpen.current, children: inputBaseProps => _jsxs("div", { className: classes.contentWrap, children: [isNoValue(innerValue)
|
|
116
116
|
? _jsx("div", { className: classes.placeholder, children: props.placeholder ?? '请选择' })
|
|
117
117
|
: _jsx("div", { className: classes.backfill, children: renderBackfillFn() }), _jsx("input", { size: 1, ...mergeComponentProps(inputBaseProps, inputProps), "data-hidden": "true" }), _jsx("div", { className: classes.arrow, "data-open": innerOpen.current, children: loading
|
|
118
118
|
? _jsx(LoadingIndicator, {})
|
|
@@ -3,12 +3,12 @@ import { DivProps, Status as IStatus } from '../../types';
|
|
|
3
3
|
import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
4
4
|
export type StatusType = IStatus | 'confirm' | 'unknown';
|
|
5
5
|
export declare const statusMapToIconDefinition: {
|
|
6
|
-
info: import("@fortawesome/
|
|
7
|
-
success: import("@fortawesome/
|
|
8
|
-
warning: import("@fortawesome/
|
|
9
|
-
error: import("@fortawesome/
|
|
10
|
-
confirm: import("@fortawesome/
|
|
11
|
-
unknown: import("@fortawesome/
|
|
6
|
+
info: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
7
|
+
success: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
8
|
+
warning: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
9
|
+
error: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
10
|
+
confirm: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
11
|
+
unknown: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
12
12
|
};
|
|
13
13
|
export interface StatusIconProps extends Partial<FontAwesomeIconProps> {
|
|
14
14
|
status?: StatusType;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import { Children, isValidElement, memo, useMemo } from 'react';
|
|
3
3
|
import { Popper } from '../popper';
|
|
4
4
|
import { Tree, TreeNode } from '../tree';
|
|
5
|
-
import { useControlled, toArray, clsx, mergeComponentProps } from '../../utils';
|
|
5
|
+
import { useControlled, toArray, clsx, mergeComponentProps, isNoValue } from '../../utils';
|
|
6
6
|
import { InputBase } from '../inputBase';
|
|
7
7
|
import { LoadingIndicator } from '../loadingIndicator';
|
|
8
8
|
import { popperStyle } from '../popper/popper.style';
|
|
@@ -71,7 +71,7 @@ placeholder = '请选择', autoFocus, clearable, onClear, ...props }) => {
|
|
|
71
71
|
return (_jsx(Popper, { css: popperStyle, open: innerOpen.current, onOpenChange: openChangeHandler, placement: "bottom", variant: "collapse", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, sizeAdaptable: sizeAdaptable, content: _jsx(Tree, { ...props, nodes: options, value: innerValue, onChange: setInnerValue }), ...popperProps, popperRef: popperRef, onPointerDown: e => {
|
|
72
72
|
popperProps?.onPointerDown?.(e);
|
|
73
73
|
e.preventDefault();
|
|
74
|
-
}, children: _jsx(InputBase, { clearable: !!props.multiple, css: style, className: clsx(classes.root, props.className), "data-focused": open, value: innerValue, onClear: clearHandler, placeholder: placeholder, autoFocus: autoFocus, disabled: props.disabled, readOnly: props.readOnly, children: inputBaseProps => _jsxs("div", { className: classes.contentWrap, children: [
|
|
74
|
+
}, children: _jsx(InputBase, { clearable: !!props.multiple, css: style, className: clsx(classes.root, props.className), "data-focused": open, value: innerValue, onClear: clearHandler, placeholder: placeholder, autoFocus: autoFocus, disabled: props.disabled, readOnly: props.readOnly, children: inputBaseProps => _jsxs("div", { className: classes.contentWrap, children: [isNoValue(innerValue)
|
|
75
75
|
? _jsx("div", { className: classes.placeholder, children: placeholder })
|
|
76
76
|
: _jsx("div", { className: classes.backfill, children: renderBackfillFn() }), _jsx("input", { size: 1, ...mergeComponentProps(inputBaseProps, inputProps), "data-hidden": "true" }), _jsx("div", { className: classes.arrow, "data-open": open, children: loading
|
|
77
77
|
? _jsx(LoadingIndicator, {})
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
import { FormProps, FormRef } from '../../components/form';
|
|
23
23
|
import { ReactElement, Ref } from 'react';
|
|
24
24
|
import { ReactiveFormItem } from './reactiveFormItem';
|
|
25
|
-
export type
|
|
25
|
+
export type ReactiveFormRef = Pick<FormRef, 'submit' | 'getFormErrors' | 'getFieldError' | 'resetForm' | 'resetField' | 'isFormTouched' | 'isFieldTouched'>;
|
|
26
26
|
export interface ReactiveFormProps extends Omit<FormProps, 'ref' | 'initialValue' | 'onChange' | 'onFinish' | 'items'> {
|
|
27
|
-
ref?: Ref<
|
|
27
|
+
ref?: Ref<ReactiveFormRef>;
|
|
28
28
|
onChange?(): void;
|
|
29
29
|
onFinish?(): void;
|
|
30
30
|
}
|
|
@@ -80,13 +80,18 @@ export declare function isPromise<T>(it: any): it is Promise<T>;
|
|
|
80
80
|
* @param promise
|
|
81
81
|
*/
|
|
82
82
|
export declare function getPromiseState(promise: Promise<any>): Promise<'pending' | 'fulfilled' | 'rejected'>;
|
|
83
|
+
/**
|
|
84
|
+
* 判断表单控件是否为空值
|
|
85
|
+
* @param value
|
|
86
|
+
*/
|
|
87
|
+
export declare function isNoValue(value: any): boolean;
|
|
83
88
|
/**
|
|
84
89
|
* 将节点用某个分隔符拼接起来,通常用于渲染多选项
|
|
85
90
|
* @param arr
|
|
86
91
|
* @param callback
|
|
87
|
-
* @param
|
|
92
|
+
* @param separator
|
|
88
93
|
*/
|
|
89
|
-
export declare function joinNodes<T>(arr: T[], callback: (item: T, index: number) => ReactNode,
|
|
94
|
+
export declare function joinNodes<T>(arr: T[], callback: (item: T, index: number) => ReactNode, separator?: ReactNode): (string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined)[];
|
|
90
95
|
/**
|
|
91
96
|
* 修复数字输入框的值,包括最大值最小值限制,以及小数点精度
|
|
92
97
|
* @param value
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -191,16 +191,29 @@ export function getPromiseState(promise) {
|
|
|
191
191
|
return res === s ? 'pending' : 'fulfilled';
|
|
192
192
|
}).catch(() => 'rejected');
|
|
193
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* 判断表单控件是否为空值
|
|
196
|
+
* @param value
|
|
197
|
+
*/
|
|
198
|
+
export function isNoValue(value) {
|
|
199
|
+
if (isUnset(value)) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
if (Array.isArray(value) || typeof value === 'string') {
|
|
203
|
+
return !value.length;
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
194
207
|
/**
|
|
195
208
|
* 将节点用某个分隔符拼接起来,通常用于渲染多选项
|
|
196
209
|
* @param arr
|
|
197
210
|
* @param callback
|
|
198
|
-
* @param
|
|
211
|
+
* @param separator
|
|
199
212
|
*/
|
|
200
|
-
export function joinNodes(arr, callback,
|
|
213
|
+
export function joinNodes(arr, callback, separator = ' / ') {
|
|
201
214
|
return arr.flatMap((item, index) => {
|
|
202
215
|
return index > 0
|
|
203
|
-
? [
|
|
216
|
+
? [separator, callback(item, index)]
|
|
204
217
|
: callback(item, index);
|
|
205
218
|
});
|
|
206
219
|
}
|
package/extensions/curd.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
tslib_1.__exportStar(require("../dist/cjs/extensions/curd"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
tslib_1.__exportStar(require("../dist/cjs/extensions/curd"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
tslib_1.__exportStar(require("../dist/cjs/extensions/documentViewer"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
tslib_1.__exportStar(require("../dist/cjs/extensions/documentViewer"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
tslib_1.__exportStar(require("../dist/cjs/extensions/textFormatter"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
tslib_1.__exportStar(require("../dist/cjs/extensions/textFormatter"), exports);
|