plain-design 1.0.0-beta.75 → 1.0.0-beta.77
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/plain-design.commonjs.min.js +2 -2
- package/dist/plain-design.min.css +30 -28
- package/dist/plain-design.min.js +2 -2
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/packages/components/Application/utils/application.utils.ts +2 -7
- package/src/packages/components/ArrowStepGroup/arrow-step.scss +13 -0
- package/src/packages/components/Box/box.scss +6 -0
- package/src/packages/components/Box/index.tsx +29 -0
- package/src/packages/components/ColorPicker/color-picker.scss +6 -0
- package/src/packages/components/DatePicker/createDateRender.multiple.tsx +1 -0
- package/src/packages/components/DatePicker/createDateRender.single.tsx +1 -0
- package/src/packages/components/DatePicker/createRangeDateRender.range.tsx +33 -25
- package/src/packages/components/DatePicker/createRangeDateRender.separate.tsx +11 -3
- package/src/packages/components/DatePicker/date.utils.tsx +2 -1
- package/src/packages/components/DatePicker/index.tsx +1 -1
- package/src/packages/components/DatePicker/useRangeDateRender.tsx +1 -0
- package/src/packages/components/Form/form.scss +17 -0
- package/src/packages/components/Form/index.tsx +9 -1
- package/src/packages/components/Form/layout/useFormLayout.tsx +3 -1
- package/src/packages/components/Form/validate/createValidation.tsx +6 -2
- package/src/packages/components/Form/validate/validate.utils.tsx +4 -1
- package/src/packages/components/FormItem/index.tsx +3 -3
- package/src/packages/components/Input/index.scss +32 -10
- package/src/packages/components/Input/index.tsx +14 -6
- package/src/packages/components/Input/input.utils.ts +1 -2
- package/src/packages/components/Input/useMultipleInput.tsx +15 -13
- package/src/packages/components/Input/useSingleInput.tsx +15 -13
- package/src/packages/components/Input/useTextareaInput.tsx +23 -20
- package/src/packages/components/Input/uses/useInputSuffixIcon.tsx +12 -8
- package/src/packages/components/InputNumber/number.scss +6 -0
- package/src/packages/components/PageCard/index.tsx +48 -0
- package/src/packages/components/PageCard/page-card.scss +124 -0
- package/src/packages/components/PageCardContent/index.tsx +44 -0
- package/src/packages/components/PageCardTitle/index.tsx +51 -0
- package/src/packages/components/PageThemeUtils/index.tsx +3 -0
- package/src/packages/components/RollingNumber/index.tsx +66 -0
- package/src/packages/components/Space/index.tsx +7 -1
- package/src/packages/components/Space/space.scss +13 -0
- package/src/packages/components/Table/standard/PlcExpand.tsx +7 -1
- package/src/packages/components/Table/table/utils/table.utils.ts +1 -0
- package/src/packages/components/TimePicker/createRangeTimeRender.tsx +11 -3
- package/src/packages/components/TimePicker/createSeparateRangeTimeRender.tsx +11 -3
- package/src/packages/components/TimePicker/createSingleTimeRender.tsx +1 -0
- package/src/packages/components/TimePicker/index.tsx +1 -1
- package/src/packages/components/TimePicker/time.utils.ts +2 -1
- package/src/packages/components/TimePicker/useRangeTimeRender.tsx +1 -0
- package/src/packages/components/Toggle/index.tsx +6 -2
- package/src/packages/components/Toggle/toggle.scss +102 -98
- package/src/packages/components/VirtualList/useVirtualList.tsx +55 -32
- package/src/packages/components/useTooltip/index.tsx +2 -1
- package/src/packages/entry.tsx +20 -2
- package/src/packages/i18n/lang/en-us.ts +2 -0
- package/src/packages/i18n/lang/zh-cn.ts +2 -0
- package/src/packages/styles/global.import.scss +16 -0
- package/src/packages/uses/useStyle.tsx +8 -4
- package/src/packages/utils/renderInputModeTextRangeValue.tsx +25 -0
package/package.json
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
import {ComputedRef, createRenderHook, inject, provide} from "plain-design-composition";
|
2
2
|
import {iThemeConfiguration} from "../theme/theme";
|
3
|
-
import {
|
3
|
+
import {UseStyleProvideData} from "../../../uses/useStyle";
|
4
4
|
|
5
5
|
export interface iApplicationConfiguration {
|
6
6
|
theme: iThemeConfiguration;
|
7
|
-
default:
|
8
|
-
size: typeof ThemeSize.TYPE,
|
9
|
-
shape: typeof ThemeShape.TYPE,
|
10
|
-
inputMode: typeof InputMode.TYPE,
|
11
|
-
buttonMode: typeof ThemeMode.TYPE,
|
12
|
-
},
|
7
|
+
default: UseStyleProvideData['default'];
|
13
8
|
}
|
14
9
|
|
15
10
|
export const ApplicationConfigurationProvider = (() => {
|
@@ -102,5 +102,18 @@
|
|
102
102
|
color: plv(error-6);
|
103
103
|
}
|
104
104
|
}
|
105
|
+
|
106
|
+
&:first-child {
|
107
|
+
.arrow-step-content {
|
108
|
+
border-top-left-radius: plv(box-size-normal-border-radius);
|
109
|
+
border-bottom-left-radius: plv(box-size-normal-border-radius);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
&:last-child {
|
113
|
+
.arrow-step-content {
|
114
|
+
border-top-right-radius: plv(box-size-normal-border-radius);
|
115
|
+
border-bottom-right-radius: plv(box-size-normal-border-radius);
|
116
|
+
}
|
117
|
+
}
|
105
118
|
}
|
106
119
|
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import {designComponent, getComponentCls, useClassCache} from "plain-design-composition";
|
2
|
+
import {StyleProps, useStyle} from "../../uses/useStyle";
|
3
|
+
import {EditProps, useEdit} from "../../uses/useEdit";
|
4
|
+
import './box.scss';
|
5
|
+
|
6
|
+
export const Box = designComponent({
|
7
|
+
props: {
|
8
|
+
...StyleProps,
|
9
|
+
...EditProps,
|
10
|
+
},
|
11
|
+
slots: ['default'],
|
12
|
+
setup({ props, slots }) {
|
13
|
+
|
14
|
+
const { styleComputed } = useStyle();
|
15
|
+
useEdit();
|
16
|
+
|
17
|
+
const classes = useClassCache(() => [
|
18
|
+
getComponentCls('box'),
|
19
|
+
`box-size-${styleComputed.value.size}`,
|
20
|
+
`box-shape-${styleComputed.value.size}`,
|
21
|
+
]);
|
22
|
+
|
23
|
+
return () => (
|
24
|
+
<div className={classes.value}>
|
25
|
+
{slots.default()}
|
26
|
+
</div>
|
27
|
+
);
|
28
|
+
},
|
29
|
+
});
|
@@ -165,6 +165,7 @@ export function createDateRenderMultiple({ props, emit, formatString, getPublicP
|
|
165
165
|
slotRender: slots.default,
|
166
166
|
defaultRender: () => (
|
167
167
|
<Input
|
168
|
+
className={getComponentCls('date-picker')}
|
168
169
|
ref={onRef.input}
|
169
170
|
suffixIcon="pi-calendar"
|
170
171
|
multiple
|
@@ -146,6 +146,7 @@ export function createDateRenderSingle({ props, emit, slots, hooks, formatString
|
|
146
146
|
slotRender: slots.default,
|
147
147
|
defaultRender: () => (
|
148
148
|
<Input
|
149
|
+
className={getComponentCls('date-picker')}
|
149
150
|
ref={onRef.input}
|
150
151
|
suffixIcon="pi-calendar"
|
151
152
|
modelValue={state.input}
|
@@ -6,6 +6,7 @@ import {DatePanel} from "./panel/DatePanel";
|
|
6
6
|
import {createPopupEditor} from "../usePopupEditor";
|
7
7
|
import {FixInput} from "../../utils/FixInput";
|
8
8
|
import {iKeyboardEvent} from "plain-design-composition";
|
9
|
+
import {renderInputModeTextRangeValue} from "../../utils/renderInputModeTextRangeValue";
|
9
10
|
|
10
11
|
/**
|
11
12
|
* 日期范围选择
|
@@ -14,7 +15,7 @@ import {iKeyboardEvent} from "plain-design-composition";
|
|
14
15
|
*/
|
15
16
|
export function createRangeDateRenderRange(params: tDateCompositionPublicParams) {
|
16
17
|
|
17
|
-
const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicDateAttrs, formatString, slots } = params;
|
18
|
+
const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicDateAttrs, formatString, slots, styleComputed } = params;
|
18
19
|
|
19
20
|
const { effects, refs, onRef, state, startModel, endModel, renderPickerFoot, getInputAttrs, handler, reference, focusRange } = useRangeDateRender({
|
20
21
|
...params,
|
@@ -66,30 +67,37 @@ export function createRangeDateRenderRange(params: tDateCompositionPublicParams)
|
|
66
67
|
slotRender: slots.default,
|
67
68
|
defaultRender: () => (
|
68
69
|
<Input{...getInputAttrs()}>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
70
|
+
{renderInputModeTextRangeValue({
|
71
|
+
styleComputed,
|
72
|
+
startValue: state.input.start,
|
73
|
+
endValue: state.input.end,
|
74
|
+
defaultRender: () => <>
|
75
|
+
<FixInput
|
76
|
+
ref={onRef.start}
|
77
|
+
type="text"
|
78
|
+
placeholder={props.startPlaceholder}
|
79
|
+
className="input-box input-fill"
|
80
|
+
value={state.input.start}
|
81
|
+
onInput={handler.onStartInputChange}
|
82
|
+
onKeyDown={customHandler.onKeyboardInput}
|
83
|
+
disabled={!!editComputed.value.disabled}
|
84
|
+
readOnly={!!editComputed.value.readonly}
|
85
|
+
onFocus={focusRange.onStartFocus}
|
86
|
+
/>
|
87
|
+
<FixInput
|
88
|
+
ref={onRef.end}
|
89
|
+
type="text"
|
90
|
+
placeholder={props.endPlaceholder}
|
91
|
+
className="input-box input-fill"
|
92
|
+
value={state.input.end}
|
93
|
+
onInput={handler.onEndInputChange}
|
94
|
+
onKeyDown={customHandler.onKeyboardInput}
|
95
|
+
disabled={!!editComputed.value.disabled}
|
96
|
+
readOnly={!!editComputed.value.readonly}
|
97
|
+
onFocus={focusRange.onEndFocus}
|
98
|
+
/>
|
99
|
+
</>
|
100
|
+
})}
|
93
101
|
</Input>
|
94
102
|
)
|
95
103
|
})
|
@@ -7,6 +7,7 @@ import {DatePanel} from "./panel/DatePanel";
|
|
7
7
|
import {createPopupEditor} from "../usePopupEditor";
|
8
8
|
import {FixInput} from "../../utils/FixInput";
|
9
9
|
import {iKeyboardEvent} from "plain-design-composition";
|
10
|
+
import {renderInputModeTextRangeValue} from "../../utils/renderInputModeTextRangeValue";
|
10
11
|
|
11
12
|
/**
|
12
13
|
* 日期范围选择(分开选择)
|
@@ -15,7 +16,7 @@ import {iKeyboardEvent} from "plain-design-composition";
|
|
15
16
|
*/
|
16
17
|
export function createRangeDateRenderSeparate(params: tDateCompositionPublicParams) {
|
17
18
|
|
18
|
-
const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicDateAttrs, formatString } = params;
|
19
|
+
const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicDateAttrs, formatString, styleComputed } = params;
|
19
20
|
|
20
21
|
const { effects, refs, onRef, startModel, endModel, state, getInputAttrs, renderPickerFoot, utils, handler } = useRangeDateRender({
|
21
22
|
...params,
|
@@ -91,8 +92,15 @@ export function createRangeDateRenderSeparate(params: tDateCompositionPublicPara
|
|
91
92
|
|
92
93
|
effects.push(hooks.onRenderInput.use(() => (
|
93
94
|
<Input{...getInputAttrs()}>
|
94
|
-
|
95
|
-
|
95
|
+
{renderInputModeTextRangeValue({
|
96
|
+
styleComputed,
|
97
|
+
startValue: state.input.start,
|
98
|
+
endValue: state.input.end,
|
99
|
+
defaultRender: () => <>
|
100
|
+
<FixInput ref={onRef.start} type="text" placeholder={props.startPlaceholder} className="input-box input-fill" value={state.input.start} onInput={handler.onStartInputChange} onKeyDown={e => customHandler.onKeyboardInput(e, TimeRangePanelType.start)} disabled={!!editComputed.value.disabled} readOnly={!!editComputed.value.readonly}/>
|
101
|
+
<FixInput ref={onRef.end} type="text" placeholder={props.endPlaceholder} className="input-box input-fill" value={state.input.end} onInput={handler.onEndInputChange} onKeyDown={e => customHandler.onKeyboardInput(e, TimeRangePanelType.end)} disabled={!!editComputed.value.disabled} readOnly={!!editComputed.value.readonly}/>
|
102
|
+
</>
|
103
|
+
})}
|
96
104
|
</Input>
|
97
105
|
)));
|
98
106
|
|
@@ -9,7 +9,7 @@ import {classnames} from "plain-utils/dom/classnames";
|
|
9
9
|
import {UseDateType} from "./panel/useDatePanel";
|
10
10
|
import {eMultipleValueType} from "../../uses/useMultipleModel";
|
11
11
|
import {EditProps, tEditComputed} from "../../uses/useEdit";
|
12
|
-
import {StyleProps} from "../../uses/useStyle";
|
12
|
+
import {StyleProps, tStyleComputed} from "../../uses/useStyle";
|
13
13
|
import {Input} from "../Input";
|
14
14
|
import i18n from "../i18n";
|
15
15
|
import {iPopupEditorUseOption} from "../usePopupEditor";
|
@@ -390,6 +390,7 @@ export type tDateCompositionPublicParams = {
|
|
390
390
|
},
|
391
391
|
getPublicPopperAttrs: () => any,
|
392
392
|
editComputed: tEditComputed,
|
393
|
+
styleComputed: tStyleComputed,
|
393
394
|
getInheritPublicDateAttrs: () => any,
|
394
395
|
displayPattern: { value: RegExp },
|
395
396
|
today: { value: PDate },
|
@@ -62,7 +62,7 @@ export const DatePicker = designComponent({
|
|
62
62
|
onReady: emit.onReady,
|
63
63
|
});
|
64
64
|
|
65
|
-
const dateCompositionPublicParams: tDateCompositionPublicParams = { props, emit, hooks, slots, formatString, getPublicPopperAttrs, editComputed, getInheritPublicDateAttrs, displayPattern, today, maxmin };
|
65
|
+
const dateCompositionPublicParams: tDateCompositionPublicParams = { props, emit, hooks, slots, formatString, getPublicPopperAttrs, editComputed, styleComputed, getInheritPublicDateAttrs, displayPattern, today, maxmin };
|
66
66
|
|
67
67
|
useWatchAutoClear(() => ({
|
68
68
|
range: props.range,
|
@@ -223,4 +223,21 @@
|
|
223
223
|
display: none;
|
224
224
|
}
|
225
225
|
}
|
226
|
+
|
227
|
+
&.form-full {
|
228
|
+
height: 100%;
|
229
|
+
width: 100%;
|
230
|
+
|
231
|
+
.form-inner {
|
232
|
+
height: 100%;
|
233
|
+
width: 100%;
|
234
|
+
margin: 0 !important;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
&.form-input-mode-text {
|
239
|
+
.form-item-label, .form-item-content {
|
240
|
+
line-height: calc(1em + 8px) !important;
|
241
|
+
}
|
242
|
+
}
|
226
243
|
}
|
@@ -13,6 +13,7 @@ export const Form = designComponent({
|
|
13
13
|
DefaultFormLabelWidth,
|
14
14
|
},
|
15
15
|
props: {
|
16
|
+
full: { type: Boolean },
|
16
17
|
...EditProps,
|
17
18
|
...StyleProps,
|
18
19
|
...FormValidatePropsOption,
|
@@ -25,7 +26,12 @@ export const Form = designComponent({
|
|
25
26
|
setup({ props, slots }) {
|
26
27
|
|
27
28
|
/*编辑控制*/
|
28
|
-
useEdit({
|
29
|
+
useEdit({
|
30
|
+
adjust: (ret) => {
|
31
|
+
ret.loading = null;
|
32
|
+
props.inputMode === 'text' && (ret.readonly = true);
|
33
|
+
}
|
34
|
+
});
|
29
35
|
|
30
36
|
/*样式控制*/
|
31
37
|
const { styleComputed } = useStyle();
|
@@ -44,6 +50,8 @@ export const Form = designComponent({
|
|
44
50
|
['form-vertical-label']: !!props.verticalLabel,
|
45
51
|
['form-column-center']: !!props.singleColumnCenter,
|
46
52
|
['form-hide-label']: !!props.hideLabel,
|
53
|
+
'form-full': props.full,
|
54
|
+
'form-input-mode-text': props.inputMode === 'text',
|
47
55
|
},
|
48
56
|
]);
|
49
57
|
|
@@ -2,7 +2,7 @@ import {computed, ExtractPropTypes, inject, PropType, provide, useStyles} from "
|
|
2
2
|
import {createEnum} from "plain-utils/utils/createEnum";
|
3
3
|
import {unit} from "plain-utils/string/unit";
|
4
4
|
import {removeUnit} from "plain-utils/string/removeUnit";
|
5
|
-
import {ThemeSize, tStyleComputed} from "../../../uses/useStyle";
|
5
|
+
import {InputMode, ThemeSize, tStyleComputed} from "../../../uses/useStyle";
|
6
6
|
|
7
7
|
/**
|
8
8
|
* 表单的文本以及内容对齐方式
|
@@ -43,6 +43,7 @@ export const FormLayoutPropsOption = {
|
|
43
43
|
rowGutter: { type: Number }, // 行间隔
|
44
44
|
validateMessagePosition: { type: String as PropType<typeof FormValidateMessagePosition.TYPE> }, // 校验消息的位置
|
45
45
|
hideLabel: { type: Boolean }, // 隐藏form-item的label
|
46
|
+
inputMode: { type: String as PropType<typeof InputMode.TYPE> }, // 内部Input的类型mode
|
46
47
|
} as const;
|
47
48
|
|
48
49
|
/**
|
@@ -107,6 +108,7 @@ export const useFormLayout = (() => {
|
|
107
108
|
});
|
108
109
|
/*行间距*/
|
109
110
|
const rowGutter = computed((): number => {
|
111
|
+
if (props.inputMode === 'text') {return 4;}
|
110
112
|
if (props.rowGutter != null) {
|
111
113
|
return removeUnit(props.rowGutter) as any;
|
112
114
|
}
|
@@ -54,7 +54,7 @@ export function createValidation() {
|
|
54
54
|
* @author 韦胜健
|
55
55
|
* @date 2022.11.5 22:43
|
56
56
|
*/
|
57
|
-
const useValidationParent = (formProps: { rules?: iFormValidatePropsType["rules"] }) => {
|
57
|
+
const useValidationParent = (formProps: { rules?: iFormValidatePropsType["rules"], anotherRules?: iFormValidatePropsType['anotherRules'] }) => {
|
58
58
|
|
59
59
|
/**
|
60
60
|
* 从FormItem等子组件中收集来的校验规则
|
@@ -68,7 +68,11 @@ export function createValidation() {
|
|
68
68
|
* @author 韦胜健
|
69
69
|
* @date 2022/8/22 18:22
|
70
70
|
*/
|
71
|
-
const rules = computed((): iValidateRule[] =>
|
71
|
+
const rules = computed((): iValidateRule[] => {
|
72
|
+
let ret = ruleGetters.value.map((i) => i()).flat(1);
|
73
|
+
!!formProps.anotherRules && (ret = [...formProps.anotherRules, ...ret]);
|
74
|
+
return ret;
|
75
|
+
});
|
72
76
|
|
73
77
|
/**
|
74
78
|
* field映射label
|
@@ -69,7 +69,8 @@ export type iFormItemValidatePropsType = ExtractPropTypes<typeof FormItemValidat
|
|
69
69
|
*/
|
70
70
|
export const FormValidatePropsOption = {
|
71
71
|
modelValue: { type: Object as PropType<PlainObject> }, // 校验的表单对象
|
72
|
-
rules: { type: Object as PropType<Record<string, iValidateRule | iValidateRule[]>> }, // 额外的校验规则,key为field,value
|
72
|
+
rules: { type: Object as PropType<Record<string, iValidateRule | iValidateRule[]>> }, // 额外的校验规则,key为field,value为校验规则,依赖于FormItem,如果对应field的FormItem不存在,则这个校验规则也不存在
|
73
|
+
anotherRules: { type: Array as PropType<iAnotherRule[]> }, // 额外的校验规则,不同于rules, 不依赖于FormItem,一直有效
|
73
74
|
validateMode: { type: String as PropType<typeof eFormValidateMode.TYPE> }, // 校验模式,看eFormValidateMode说明
|
74
75
|
// associateFields: { type: Object as PropType<Record<string, string>> }, // 校验关联字段,当key的field校验时自动校验value对应的field
|
75
76
|
hideRequiredAsterisk: { type: Boolean }, // 是否隐藏label旁边的红色必填星号标识
|
@@ -127,6 +128,8 @@ export interface iValidateRule {
|
|
127
128
|
message?: string | ((value: any, formData: PlainObject | null | undefined) => string), // 校验失败的时候的提示信息
|
128
129
|
}
|
129
130
|
|
131
|
+
export type iAnotherRule = Omit<iValidateRule, 'label' | 'field'> & { label: string, field: string }
|
132
|
+
|
130
133
|
/**
|
131
134
|
* 注册校验类型的函数类型
|
132
135
|
* @author 韦胜健
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {designComponent, getComponentCls, useClasses, useRefs} from "plain-design-composition";
|
1
|
+
import {designComponent, Fragment, getComponentCls, useClasses, useRefs} from "plain-design-composition";
|
2
2
|
import {FormItemValidatePropsOption} from "../Form/validate/validate.utils";
|
3
3
|
import {EditProps, useEdit} from "../../uses/useEdit";
|
4
4
|
import {StyleProps, ThemeStatus, useStyle} from "../../uses/useStyle";
|
@@ -98,7 +98,7 @@ export const FormItem = designComponent({
|
|
98
98
|
render: () => (
|
99
99
|
<div className={classes.value} style={formItemLayout.styles.value} ref={onRef.el}>
|
100
100
|
{props.label !== null && (
|
101
|
-
<div className="form-item-label" style={formItemLayout.labelStyles.value}>
|
101
|
+
<div className="form-item-label" style={formItemLayout.labelStyles.value} title={props.label}>
|
102
102
|
{formItemValidation.isRequired.value && <i className="form-item-required-tag">*</i>}
|
103
103
|
{slots.labelPrepend()}
|
104
104
|
{slots.labelSlot(props.label)}
|
@@ -109,7 +109,7 @@ export const FormItem = designComponent({
|
|
109
109
|
<div className="form-item-content box-message-reference" style={formItemLayout.contentStyles.value}>
|
110
110
|
{slots.prepend.isExist() && <div className="form-item-prepend-content">{slots.prepend()}</div>}
|
111
111
|
<div className="form-item-content-inner">
|
112
|
-
{slots.default()}
|
112
|
+
<Fragment key="slot_default">{slots.default()}</Fragment>
|
113
113
|
{/*校验消息放下边的时候放在 form-item-content-inner 内部使得与输入框左或者右对齐*/}
|
114
114
|
{formItemLayout.validateMessagePosition.value !== 'right' && <FormItemValidateMessage message={formItemValidation.validateMessage.value!}/>}
|
115
115
|
</div>
|
@@ -52,6 +52,16 @@
|
|
52
52
|
flex: 1;
|
53
53
|
}
|
54
54
|
|
55
|
+
.input-text {
|
56
|
+
word-break: break-all;
|
57
|
+
border: none !important;
|
58
|
+
}
|
59
|
+
|
60
|
+
.input-mode-text-separate-icon {
|
61
|
+
align-self: center;
|
62
|
+
margin: 0 0.5em;
|
63
|
+
}
|
64
|
+
|
55
65
|
/*所有的直接子节点,垂直居中,加上左右边距,除了第一个直接子节点之外,其他节点都加上左边框*/
|
56
66
|
& > div, & > span, & > input, & > textarea {
|
57
67
|
box-sizing: border-box;
|
@@ -63,6 +73,14 @@
|
|
63
73
|
}
|
64
74
|
}
|
65
75
|
|
76
|
+
&.input-mode-text {
|
77
|
+
& > div, & > span, & > input, & > textarea {
|
78
|
+
&:not(:first-child) {
|
79
|
+
border-left: none;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
66
84
|
/*prefix icon and suffix icon*/
|
67
85
|
|
68
86
|
/*prefix icon右侧的input-box不需要左边框以及左边距*/
|
@@ -191,10 +209,12 @@
|
|
191
209
|
}
|
192
210
|
|
193
211
|
/*所有的直接子节点,垂直居中,加上左右边距,除了第一个直接子节点之外,其他节点都加上左边框*/
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
212
|
+
&:not(.input-mode-text) {
|
213
|
+
& > div, & > span, & > input, & > textarea {
|
214
|
+
&:not(.input-suffix-icon-wrapper) {
|
215
|
+
padding-right: plv(input-padding-x-#{$name});
|
216
|
+
padding-left: plv(input-padding-x-#{$name});
|
217
|
+
}
|
198
218
|
}
|
199
219
|
}
|
200
220
|
}
|
@@ -211,9 +231,11 @@
|
|
211
231
|
background-color: plv(background-color);
|
212
232
|
border-color: $color-3;
|
213
233
|
}
|
214
|
-
|
215
|
-
|
216
|
-
|
234
|
+
&:not(.input-mode-text) {
|
235
|
+
@include hover(input) {
|
236
|
+
background-color: $color-light-3;
|
237
|
+
border-color: $color-light-4;
|
238
|
+
}
|
217
239
|
}
|
218
240
|
@include focus(input) {
|
219
241
|
border-color: $color-5;
|
@@ -332,7 +354,7 @@
|
|
332
354
|
}
|
333
355
|
}
|
334
356
|
|
335
|
-
&:not(.input-empty) {
|
357
|
+
&:not(.input-empty):not(.input-mode-text) {
|
336
358
|
.input-box.input-tag-container {
|
337
359
|
padding-left: 3px;
|
338
360
|
padding-right: 0;
|
@@ -360,7 +382,7 @@
|
|
360
382
|
padding: 0;
|
361
383
|
height: auto;
|
362
384
|
|
363
|
-
|
385
|
+
.input-textarea-shadow, textarea {
|
364
386
|
display: inline-block;
|
365
387
|
padding: 3px 12px;
|
366
388
|
box-sizing: border-box;
|
@@ -368,7 +390,7 @@
|
|
368
390
|
word-break: break-all;
|
369
391
|
}
|
370
392
|
|
371
|
-
|
393
|
+
.input-textarea-shadow {
|
372
394
|
opacity: 0;
|
373
395
|
pointer-events: none;
|
374
396
|
min-height: calc(30px + 2em);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {computed, designComponent, getComponentCls, iHTMLDivElement, mergeAttrs, useClasses, useRefs, useStyles} from "plain-design-composition";
|
1
|
+
import {computed, designComponent, Fragment, getComponentCls, iHTMLDivElement, mergeAttrs, useClasses, useRefs, useStyles} from "plain-design-composition";
|
2
2
|
import './index.scss';
|
3
3
|
import {ThemeStatus, useStyle} from "../../uses/useStyle";
|
4
4
|
import {useEdit} from "../../uses/useEdit";
|
@@ -29,7 +29,11 @@ export const Input = designComponent({
|
|
29
29
|
|
30
30
|
const { refs, onRef } = useRefs(InputRefsOptions);
|
31
31
|
const { styleComputed } = useStyle();
|
32
|
-
const { editComputed, editState } = useEdit(
|
32
|
+
const { editComputed, editState } = useEdit({
|
33
|
+
adjust: (ret) => {
|
34
|
+
if (styleComputed.value.inputMode === 'text') {ret.readonly = true;}
|
35
|
+
},
|
36
|
+
});
|
33
37
|
const parentPopupId = useParentPopupId();
|
34
38
|
const model = useMultipleModel(() => props.modelValue, emit.onUpdateModelValue, props);
|
35
39
|
const hooks = useInputHooks();
|
@@ -76,7 +80,7 @@ export const Input = designComponent({
|
|
76
80
|
attrs.className,
|
77
81
|
`input-size-${styleComputed.value.size}`,
|
78
82
|
`input-shape-${styleComputed.value.shape}`,
|
79
|
-
`input-mode-${
|
83
|
+
`input-mode-${styleComputed.value.inputMode}`,
|
80
84
|
{
|
81
85
|
[`input-status-${status.value}`]: !!status.value,
|
82
86
|
[`input-align-${props.align}`]: !!props.align,
|
@@ -88,8 +92,12 @@ export const Input = designComponent({
|
|
88
92
|
]));
|
89
93
|
const styles = useStyles((style) => {
|
90
94
|
style.display = 'inline-flex';
|
91
|
-
if (
|
92
|
-
style.width =
|
95
|
+
if (styleComputed.value.inputMode === 'text') {
|
96
|
+
style.width = 'unset';
|
97
|
+
} else {
|
98
|
+
if (!!props.width) {
|
99
|
+
style.width = unit(props.width);
|
100
|
+
}
|
93
101
|
}
|
94
102
|
!!attrs.style && Object.assign(style, attrs.style);
|
95
103
|
});
|
@@ -126,7 +134,7 @@ export const Input = designComponent({
|
|
126
134
|
{content}
|
127
135
|
|
128
136
|
{inputSuffixIcon.render()}
|
129
|
-
{hooks.onRenderSuffix.exec(slots.suffix())}
|
137
|
+
{hooks.onRenderSuffix.exec(<Fragment key="slot_suffix">{slots.suffix()}</Fragment>)}
|
130
138
|
</span>
|
131
139
|
);
|
132
140
|
},
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {tInputHooks} from "./uses/useInputHooks";
|
2
2
|
import {ComponentEvent, ExtractPropTypes, iMouseEvent, PropType, SimpleFunction, tRefs, tSlotsType} from "plain-design-composition";
|
3
3
|
import {createError} from "../../utils/createError";
|
4
|
-
import {
|
4
|
+
import {StyleProps, tStyleComputed} from "../../uses/useStyle";
|
5
5
|
import {EditProps, tEditComputed} from "../../uses/useEdit";
|
6
6
|
import {iSelectOptionProps} from "../Select/select.utils";
|
7
7
|
|
@@ -11,7 +11,6 @@ export const InputPropsOption = {
|
|
11
11
|
|
12
12
|
/*public*/
|
13
13
|
type: { type: String }, // input type
|
14
|
-
mode: { type: String as PropType<typeof InputMode.TYPE> }, // input的样式类型,flat填充,stroke线型
|
15
14
|
modelValue: {}, // 输入框双向绑定值
|
16
15
|
placeValue: {}, // 与modelValue一起判断当前是否有值
|
17
16
|
isFocus: { type: Boolean }, // 当前是否为获取焦点的状态
|
@@ -13,7 +13,7 @@ import {useDragHorizontalScroll} from "../../uses/useDragHorizontalScroll";
|
|
13
13
|
* @author 韦胜健
|
14
14
|
* @date 2022.5.22 10:06
|
15
15
|
*/
|
16
|
-
export const useMultipleInput = createEffectiveHandler(({ hooks, props, model, refs, editComputed, emit }: iInputCompositionData) => {
|
16
|
+
export const useMultipleInput = createEffectiveHandler(({ hooks, props, model, refs, editComputed, emit, styleComputed }: iInputCompositionData) => {
|
17
17
|
|
18
18
|
const text = useModel(() => props.multipleText as any, emit.onUpdateMultipleText);
|
19
19
|
const { effects } = createEffects();
|
@@ -22,7 +22,7 @@ export const useMultipleInput = createEffectiveHandler(({ hooks, props, model, r
|
|
22
22
|
|
23
23
|
const handler = {
|
24
24
|
onRef: (input: typeof AutoWidthInput.use.class | null) => hooks.onRefInput.exec(input?.refs.input || null),
|
25
|
-
onMousedownContainer: () => {delay(23).then(() => refs.input
|
25
|
+
onMousedownContainer: () => {delay(23).then(() => refs.input?.focus());},
|
26
26
|
onRemoveTag: async (index: number) => {
|
27
27
|
if (!editComputed.value.editable) {return;}
|
28
28
|
if (!model.value || !model.value.length) {return; }
|
@@ -103,17 +103,19 @@ export const useMultipleInput = createEffectiveHandler(({ hooks, props, model, r
|
|
103
103
|
{!!editComputed.value.editable && <Icon icon="pi-close" onClick={() => handler.onRemoveTag(index)}/>}
|
104
104
|
</span>
|
105
105
|
))}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
106
|
+
{styleComputed.value.inputMode !== 'text' && (
|
107
|
+
<AutoWidthInput
|
108
|
+
modelValue={text.value}
|
109
|
+
onChange={handler.onChange}
|
110
|
+
placeholder={!(model.value as any)?.length ? editComputed.value.placeholder : undefined}
|
111
|
+
disabled={!!editComputed.value.disabled}
|
112
|
+
readonly={!!editComputed.value.readonly || !!props.customReadonly || !!editComputed.value.loading}
|
113
|
+
{...props.nativeAttrs}
|
114
|
+
ref={handler.onRef as any}
|
115
|
+
key="auto-width-input"
|
116
|
+
minWidth="1px"
|
117
|
+
/>
|
118
|
+
)}
|
117
119
|
</span>
|
118
120
|
)));
|
119
121
|
|