plain-design 1.0.0-beta.74 → 1.0.0-beta.76

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/dist/plain-design.commonjs.min.js +2 -2
  2. package/dist/plain-design.min.css +30 -28
  3. package/dist/plain-design.min.js +2 -2
  4. package/dist/report.html +2 -2
  5. package/package.json +1 -1
  6. package/src/packages/components/Application/utils/application.utils.ts +2 -7
  7. package/src/packages/components/ArrowStepGroup/arrow-step.scss +13 -0
  8. package/src/packages/components/Box/box.scss +6 -0
  9. package/src/packages/components/Box/index.tsx +29 -0
  10. package/src/packages/components/ColorPicker/color-picker.scss +6 -0
  11. package/src/packages/components/DatePicker/createDateRender.multiple.tsx +1 -0
  12. package/src/packages/components/DatePicker/createDateRender.single.tsx +1 -0
  13. package/src/packages/components/DatePicker/createRangeDateRender.range.tsx +33 -25
  14. package/src/packages/components/DatePicker/createRangeDateRender.separate.tsx +11 -3
  15. package/src/packages/components/DatePicker/date.utils.tsx +2 -1
  16. package/src/packages/components/DatePicker/index.tsx +1 -1
  17. package/src/packages/components/DatePicker/useRangeDateRender.tsx +1 -0
  18. package/src/packages/components/Form/form.scss +17 -0
  19. package/src/packages/components/Form/index.tsx +9 -1
  20. package/src/packages/components/Form/layout/useFormLayout.tsx +3 -1
  21. package/src/packages/components/Form/validate/createValidation.tsx +6 -2
  22. package/src/packages/components/Form/validate/validate.utils.tsx +4 -1
  23. package/src/packages/components/FormItem/index.tsx +1 -1
  24. package/src/packages/components/Input/index.scss +32 -10
  25. package/src/packages/components/Input/index.tsx +12 -4
  26. package/src/packages/components/Input/input.utils.ts +1 -2
  27. package/src/packages/components/Input/useMultipleInput.tsx +15 -13
  28. package/src/packages/components/Input/useSingleInput.tsx +15 -13
  29. package/src/packages/components/Input/useTextareaInput.tsx +23 -20
  30. package/src/packages/components/Input/uses/useInputSuffixIcon.tsx +12 -8
  31. package/src/packages/components/InputNumber/number.scss +6 -0
  32. package/src/packages/components/PageCard/index.tsx +48 -0
  33. package/src/packages/components/PageCard/page-card.scss +124 -0
  34. package/src/packages/components/PageCardContent/index.tsx +44 -0
  35. package/src/packages/components/PageCardTitle/index.tsx +51 -0
  36. package/src/packages/components/PageThemeUtils/index.tsx +3 -0
  37. package/src/packages/components/RollingNumber/index.tsx +66 -0
  38. package/src/packages/components/Space/index.tsx +7 -1
  39. package/src/packages/components/Space/space.scss +13 -0
  40. package/src/packages/components/Table/table/utils/table.utils.ts +1 -0
  41. package/src/packages/components/TimePicker/createRangeTimeRender.tsx +11 -3
  42. package/src/packages/components/TimePicker/createSeparateRangeTimeRender.tsx +11 -3
  43. package/src/packages/components/TimePicker/createSingleTimeRender.tsx +1 -0
  44. package/src/packages/components/TimePicker/index.tsx +1 -1
  45. package/src/packages/components/TimePicker/time.utils.ts +2 -1
  46. package/src/packages/components/TimePicker/useRangeTimeRender.tsx +1 -0
  47. package/src/packages/components/Toggle/index.tsx +6 -2
  48. package/src/packages/components/Toggle/toggle.scss +102 -98
  49. package/src/packages/components/VirtualList/useVirtualList.tsx +31 -14
  50. package/src/packages/components/useTooltip/index.tsx +2 -1
  51. package/src/packages/entry.tsx +43 -1
  52. package/src/packages/i18n/lang/en-us.ts +2 -0
  53. package/src/packages/i18n/lang/zh-cn.ts +2 -0
  54. package/src/packages/styles/global.import.scss +16 -0
  55. package/src/packages/uses/useStyle.tsx +8 -4
  56. package/src/packages/utils/renderInputModeTextRangeValue.tsx +25 -0
@@ -4,7 +4,7 @@ import {unit} from "plain-utils/string/unit";
4
4
  import {createEffects} from "plain-utils/utils/createEffects";
5
5
  import {ClientZoom} from "../ClientZoom";
6
6
 
7
- const _Textarea = fixInputCursor('textarea')
7
+ const _Textarea = fixInputCursor('textarea');
8
8
 
9
9
  export function useTextareaInput(data: iInputCompositionData) {
10
10
 
@@ -56,24 +56,27 @@ export function useTextareaInput(data: iInputCompositionData) {
56
56
 
57
57
  effects.push(hooks.onRenderDefault.use(() => (
58
58
  <span className={classes.value}>
59
- <span style={takeoverStyles.value}>
60
- {(model.value?.split('\n') as string[] | undefined)?.map((item, index) => (
61
- <div key={index}>
62
- {item}
63
- </div>
64
- ))}
65
- {!model.value && <>&nbsp;</>}
66
- </span>
67
- <_Textarea
68
- ref={handler.onRef}
69
- value={model.value}
70
- onInput={handler.onInput}
71
- onKeyDown={handler.onKeydown}
72
- placeholder={editComputed.value.placeholder!}
73
- disabled={!!editComputed.value.disabled}
74
- readOnly={!!editComputed.value.readonly || !!props.customReadonly || !!editComputed.value.loading}
75
- {...props.nativeAttrs}
76
- />
59
+ {data.styleComputed.value.inputMode === 'text' ?
60
+ <span className="input-text">{model.value}</span> : <>
61
+ <span style={takeoverStyles.value} className="input-textarea-shadow">
62
+ {(model.value?.split('\n') as string[] | undefined)?.map((item, index) => (
63
+ <div key={index}>
64
+ {item}
65
+ </div>
66
+ ))}
67
+ {!model.value && <>&nbsp;</>}
68
+ </span>
69
+ <_Textarea
70
+ ref={handler.onRef}
71
+ value={model.value}
72
+ onInput={handler.onInput}
73
+ onKeyDown={handler.onKeydown}
74
+ placeholder={editComputed.value.placeholder!}
75
+ disabled={!!editComputed.value.disabled}
76
+ readOnly={!!editComputed.value.readonly || !!props.customReadonly || !!editComputed.value.loading}
77
+ {...props.nativeAttrs}
78
+ />
79
+ </>}
77
80
  </span>
78
81
  )));
79
82
 
@@ -100,7 +103,7 @@ function useTextareaResize({ hooks, onResize }: iInputCompositionData & { onResi
100
103
  mousedown: (e: MouseEvent) => {
101
104
  const { offsetX, offsetY, clientY } = ClientZoom.getClientPosition(e);
102
105
  let { offsetWidth, offsetHeight } = e.target as any;
103
- const dragSize = 12
106
+ const dragSize = 12;
104
107
  if (!(offsetWidth - offsetX < dragSize && offsetHeight - offsetY < dragSize)) {
105
108
  return;
106
109
  }
@@ -4,7 +4,7 @@ import Icon from "../../Icon";
4
4
  import Loading from "../../Loading";
5
5
  import {delay} from "plain-utils/utils/delay";
6
6
 
7
- export function useInputSuffixIcon({ slots, hooks, props, editComputed, model, emit, methods, isEmpty }: iInputCompositionData) {
7
+ export function useInputSuffixIcon({ slots, hooks, props, editComputed, model, emit, methods, isEmpty, styleComputed }: iInputCompositionData) {
8
8
 
9
9
  const hasSuffixClear = computed(() => !props.textarea && !props.noClear && (!editComputed.value.disabled && !editComputed.value.readonly));
10
10
  const hasSuffixIcon = computed(() => !props.textarea && (slots.suffixIconContent.isExist() || !!props.suffixIcon));
@@ -51,13 +51,17 @@ export function useInputSuffixIcon({ slots, hooks, props, editComputed, model, e
51
51
  }
52
52
  ]);
53
53
 
54
- const render = () => (hasSuffixIcon.value || hasSuffixClear.value || editComputed.value.loading) && !props.textarea && (
55
- <span className="input-suffix-icon-wrapper" onMouseDown={handler.onMousedownSuffix}>
56
- {hasSuffixIcon.value && slots.suffixIconContent(<Icon icon={props.suffixIcon} className="input-suffix-icon"/>)}
57
- {hasSuffixClear.value && (<Icon icon="pi-close-circle-fill" className="input-suffix-clear"/>)}
58
- {editComputed.value.loading && <Loading/>}
59
- </span>
60
- );
54
+ const render = () =>
55
+ (hasSuffixIcon.value || hasSuffixClear.value || editComputed.value.loading) &&
56
+ styleComputed.value.inputMode !== 'text' &&
57
+ !props.textarea &&
58
+ (
59
+ <span className="input-suffix-icon-wrapper" onMouseDown={handler.onMousedownSuffix}>
60
+ {hasSuffixIcon.value && slots.suffixIconContent(<Icon icon={props.suffixIcon} className="input-suffix-icon"/>)}
61
+ {hasSuffixClear.value && (<Icon icon="pi-close-circle-fill" className="input-suffix-clear"/>)}
62
+ {editComputed.value.loading && <Loading/>}
63
+ </span>
64
+ );
61
65
 
62
66
  return { render };
63
67
  }
@@ -62,6 +62,12 @@
62
62
  .input-box {
63
63
  align-self: center;
64
64
  }
65
+
66
+ &.input-mode-text {
67
+ .number-prepend-button, .number-append-button, .number-button-container {
68
+ display: none;
69
+ }
70
+ }
65
71
  }
66
72
 
67
73
  @include prefix(number-resize) {
@@ -0,0 +1,48 @@
1
+ import {designComponent, getComponentCls, useClassCache, useModel} from "plain-design-composition";
2
+ import {StyleProps, useStyle} from "../../uses/useStyle";
3
+ import {Box} from "../Box";
4
+ import './page-card.scss';
5
+
6
+ export const PageCard = designComponent({
7
+ name: 'page-card',
8
+ inheritPropsType: Box,
9
+ provideRefer: true,
10
+ props: {
11
+ modelValue: { type: Boolean, default: null },
12
+ collapsable: { type: Boolean },
13
+ full: { type: Boolean },
14
+ ...StyleProps,
15
+ },
16
+ slots: ['default'],
17
+ emits: {
18
+ onUpdateModelValue: (val: boolean) => true,
19
+ },
20
+ setup({ props, slots, event: { emit } }) {
21
+
22
+ const model = useModel(() => props.modelValue, emit.onUpdateModelValue);
23
+
24
+ const { styleComputed } = useStyle();
25
+
26
+ const classes = useClassCache(() => [
27
+ getComponentCls('page-card'),
28
+ `page-card-size-${styleComputed.value.size}`,
29
+ {
30
+ 'page-card-full': props.full,
31
+ }
32
+ ]);
33
+
34
+ return {
35
+ refer: {
36
+ props,
37
+ model,
38
+ },
39
+ render: () => (
40
+ <div className={classes.value}>
41
+ {slots.default()}
42
+ </div>
43
+ )
44
+ };
45
+ },
46
+ });
47
+
48
+ export default PageCard;
@@ -0,0 +1,124 @@
1
+ @include comp(page-card) {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: stretch;
5
+
6
+ & > * {
7
+ background-color: plv(bg-2);
8
+
9
+ & + * {
10
+ border-top: solid 1px plv(border-color);
11
+ }
12
+ }
13
+
14
+ &.page-card-full {
15
+ height: 100%;
16
+ width: 100%;
17
+ }
18
+
19
+ .#{componentName(page-card-title)} {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+
24
+ .page-card-title-left {
25
+ display: flex;
26
+ align-items: center;
27
+
28
+ .page-card-title-icon {
29
+ color: plv(primary-6);
30
+ height: 1em;
31
+ width: 1em;
32
+ position: relative;
33
+ margin-right: 0.75em;
34
+
35
+ .page-card-title-icon-inner {
36
+ position: absolute;
37
+ inset: -4px;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ background-color: plv(primary-1);
42
+ }
43
+
44
+ &.page-card-title-icon-collapse {
45
+ .page-card-title-icon-inner {
46
+ cursor: pointer;
47
+ user-select: none;
48
+ background-color: transparent;
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ .page-card-title-right {
55
+ color: plv(primary-6);
56
+ cursor: pointer;
57
+ }
58
+ }
59
+
60
+ /*@formatter:off*/
61
+ @include comp(page-card-content) {
62
+ box-sizing: border-box;
63
+ &.page-card-content-align-left{text-align: left}
64
+ &.page-card-content-align-center{text-align: center}
65
+ &.page-card-content-align-right{text-align: right}
66
+ @include sizeMixin(page-card-content, ()) {}
67
+ &.page-card-content-full {
68
+ flex: 1;
69
+ position: relative;
70
+ .page-card-content-full-inner{
71
+ position: absolute;
72
+ inset: 0;
73
+ padding: inherit;
74
+ }
75
+ }
76
+ }
77
+ @include comp(page-card-title) {
78
+ box-sizing: border-box;
79
+ @include sizeMixin(page-card-title, ()) {}
80
+ }
81
+ /*@formatter:on*/
82
+
83
+ @include sizeMixin(page-card, (font-size)) {
84
+ & + * {
85
+ margin-top: $margin;
86
+ }
87
+
88
+ & > *:not(.no-padding) {
89
+ padding: $margin;
90
+ }
91
+
92
+ & > * {
93
+ &:first-child {
94
+ border-top-left-radius: $border-radius;
95
+ border-top-right-radius: $border-radius;
96
+ }
97
+
98
+ &:last-child {
99
+ border-bottom-left-radius: $border-radius;
100
+ border-bottom-right-radius: $border-radius;
101
+ }
102
+ }
103
+
104
+ .#{componentName(page-card-title)} {
105
+
106
+ .page-card-title-left {
107
+ .page-card-title-icon-inner {
108
+ border-radius: $border-radius;
109
+ }
110
+ }
111
+
112
+ .page-card-title-right {
113
+ & > * + * {
114
+ margin-left: $margin;
115
+ }
116
+ }
117
+ }
118
+
119
+ .#{componentName(page-card-content)} {
120
+ }
121
+ }
122
+
123
+
124
+ }
@@ -0,0 +1,44 @@
1
+ import {designComponent, getComponentCls, PropType, useClassCache} from "plain-design-composition";
2
+ import {StyleProps, useStyle} from "../../uses/useStyle";
3
+ import PageCard from "../PageCard";
4
+
5
+ export const PageCardContent = designComponent({
6
+ name: 'page-card-content',
7
+ props: {
8
+ align: { type: String as PropType<'left' | 'center' | 'right'> },
9
+ full: { type: Boolean },
10
+ noPadding: { type: Boolean },
11
+ ...StyleProps,
12
+ },
13
+ slots: ['default'],
14
+ setup({ props, slots }) {
15
+
16
+ const pageCard = PageCard.use.inject();
17
+
18
+ const { styleComputed } = useStyle();
19
+
20
+ const classes = useClassCache(() => [
21
+ getComponentCls('page-card-content'),
22
+ `page-card-content-size-${styleComputed.value.size}`,
23
+ {
24
+ [`page-card-content-align-${props.align}`]: !!props.align,
25
+ 'page-card-content-full': props.full,
26
+ 'no-padding': props.noPadding,
27
+ }
28
+ ]);
29
+
30
+ return () => (
31
+ pageCard.model.value != false && (
32
+ <div className={classes.value}>
33
+ {
34
+ props.full ?
35
+ (<div className="page-card-content-full-inner">
36
+ {slots.default()}
37
+ </div>) :
38
+ slots.default()
39
+ }
40
+ </div>
41
+ )
42
+ );
43
+ },
44
+ });
@@ -0,0 +1,51 @@
1
+ import {designComponent, getComponentCls, useClassCache} from "plain-design-composition";
2
+ import {StyleProps, useStyle} from "../../uses/useStyle";
3
+ import Icon from "../Icon";
4
+ import PageCard from "../PageCard";
5
+
6
+ export const PageCardTitle = designComponent({
7
+ name: 'page-card-title',
8
+ props: {
9
+ title: { type: String },
10
+ icon: { type: String },
11
+ ...StyleProps,
12
+ },
13
+ slots: ['default', 'titleContent'],
14
+ setup({ props, slots }) {
15
+
16
+ const pageCard = PageCard.use.inject();
17
+
18
+ const { styleComputed } = useStyle();
19
+
20
+ const classes = useClassCache(() => [
21
+ getComponentCls('page-card-title'),
22
+ `page-card-title-size-${styleComputed.value.size}`
23
+ ]);
24
+
25
+ return () => (
26
+ <div className={classes.value}>
27
+ <div className="page-card-title-left">
28
+ {pageCard.props.collapsable && (
29
+ <div className="page-card-title-icon page-card-title-icon-collapse">
30
+ <div className="page-card-title-icon-inner" onClick={() => pageCard.model.value = pageCard.model.value === false}>
31
+ <Icon icon={pageCard.model.value == false ? 'pi-caret-right' : 'pi-caret-down'}/>
32
+ </div>
33
+ </div>
34
+ )}
35
+ {!!props.icon && (
36
+ <div className="page-card-title-icon">
37
+ <div className="page-card-title-icon-inner">
38
+ <Icon icon={props.icon}/>
39
+ </div>
40
+ </div>
41
+ )}
42
+ <span>{slots.titleContent(props.title)}</span>
43
+ </div>
44
+ <div className="page-card-title-right">
45
+ {slots.default()}
46
+ </div>
47
+ </div>
48
+ );
49
+
50
+ },
51
+ });
@@ -128,6 +128,8 @@ export const PageThemeUtils = (() => {
128
128
  window.location.reload();
129
129
  };
130
130
 
131
+ const variable = (varName: string) => `var(--${getComponentCls(varName)})`;
132
+
131
133
  return {
132
134
  configuration,
133
135
  toggle,
@@ -139,6 +141,7 @@ export const PageThemeUtils = (() => {
139
141
  buttonMode,
140
142
  zoom,
141
143
  clear,
144
+ variable,
142
145
  };
143
146
  })();
144
147
 
@@ -0,0 +1,66 @@
1
+ import {delay, designComponent, onBeforeUnmount, onMounted, reactive, watch} from "plain-design-composition";
2
+ import {createEffects} from "plain-utils/utils/createEffects";
3
+
4
+ export const RollingNumber = designComponent({
5
+ name: 'rolling-number',
6
+ props: {
7
+ val: { type: Number }
8
+ },
9
+ setup({ props }) {
10
+
11
+ const state = reactive({ val: 0 });
12
+
13
+ const utils = {
14
+ update: (space = 1) => {
15
+ // console.log('update');
16
+ space = Math.abs(space);
17
+ const val = state.val;
18
+ if (props.val == null) {
19
+ state.val = 0;
20
+ return;
21
+ }
22
+ if (val == props.val) {
23
+ return;
24
+ }
25
+ if (val > props.val) {
26
+ state.val = Math.max(val - space, props.val);
27
+ delay(20).then(() => utils.update(space));
28
+ } else {
29
+ state.val = Math.min(val + space, props.val);
30
+ delay(20).then(() => utils.update(space));
31
+ }
32
+ },
33
+ format: (num: number) => {
34
+ const [prepend, append] = String(num).split('.');
35
+ const list = String(prepend).split('').reverse();
36
+ const lastIndex = list.length - 1;
37
+ return list.reduce((prev, item, index) => {
38
+ return (lastIndex != index && (index + 1) % 3 == 0 ? ',' : '') + item + prev;
39
+ }, '') + (!append ? '' : `.${append}`);
40
+ },
41
+ };
42
+
43
+ const { effects } = createEffects();
44
+
45
+ onMounted(() => {
46
+ effects.push(
47
+ watch(() => props.val, () => {
48
+ const curVal = state.val || 0;
49
+ const newVal = props.val == null ? 0 : props.val;
50
+ const space = Math.ceil((newVal - curVal) / 50);
51
+ utils.update(space);
52
+ }, { immediate: true })
53
+ );
54
+ });
55
+
56
+ onBeforeUnmount(effects.clear);
57
+
58
+ return () => (
59
+ props.val != null && (
60
+ <span>{utils.format(state.val)}</span>
61
+ )
62
+ );
63
+ },
64
+ });
65
+
66
+ export default RollingNumber;
@@ -1,11 +1,13 @@
1
1
  import './space.scss';
2
- import {designComponent, getComponentCls, useClasses} from "plain-design-composition";
2
+ import {designComponent, getComponentCls, PropType, useClasses} from "plain-design-composition";
3
3
  import {StyleProps, useStyle} from "../../uses/useStyle";
4
4
 
5
5
  export const Space = designComponent({
6
6
  name: 'space',
7
7
  props: {
8
8
  vertical: { type: Boolean },
9
+ inlineBlock: { type: Boolean },
10
+ align: { type: String as PropType<'left' | 'center' | 'right'> },
9
11
  ...StyleProps,
10
12
  },
11
13
  slots: ['default'],
@@ -17,6 +19,10 @@ export const Space = designComponent({
17
19
  getComponentCls('space'),
18
20
  `space-${props.vertical ? 'vertical' : 'horizontal'}`,
19
21
  `space-size-${styleComputed.value.size}`,
22
+ {
23
+ 'space-inline-block': props.inlineBlock,
24
+ [`space-align-${props.align}`]: !!props.align,
25
+ }
20
26
  ]);
21
27
 
22
28
  return () => (
@@ -23,4 +23,17 @@
23
23
  flex-direction: column;
24
24
  }
25
25
 
26
+ &.space-inline-block {
27
+ display: inline-block;
28
+ }
29
+
30
+ &.space-align-left {
31
+ text-align: left
32
+ }
33
+ &.space-align-center {
34
+ text-align: center
35
+ }
36
+ &.space-align-right {
37
+ text-align: right
38
+ }
26
39
  }
@@ -35,6 +35,7 @@ export const TablePropsOptions = {
35
35
  rowDraggable: { type: Boolean }, // 行是否可以拖拽移动
36
36
  sort: { type: [Object, Array] as PropType<TablePropsSort> }, // 当前排序字段
37
37
  rules: { type: Object as PropType<iFormValidatePropsType["rules"]> }, // 校验规则
38
+ anotherRules: { type: Object as PropType<iFormValidatePropsType["anotherRules"]> }, // 校验规则
38
39
  spanMethod: { type: Function as PropType<TablePropsSpanMethod> }, // 合并表体单元格的方法
39
40
  size: { ...StyleProps["size"] }, // 表格尺寸
40
41
  loading: { type: Boolean }, // 开启加载状态
@@ -6,10 +6,11 @@ import {useRangeTimeRender} from "./useRangeTimeRender";
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
  export function createRangeTimeRender(params: tTimeCompositionParams,) {
11
12
 
12
- const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicTimeAttrs, slots } = params;
13
+ const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicTimeAttrs, slots, styleComputed } = params;
13
14
 
14
15
  const { effects, refs, onRef, state, startModel, endModel, renderPickerFoot, getInputAttrs, handler, reference } = useRangeTimeRender({
15
16
  ...params,
@@ -59,8 +60,15 @@ export function createRangeTimeRender(params: tTimeCompositionParams,) {
59
60
  slotRender: slots.default,
60
61
  defaultRender: () => (
61
62
  <Input{...getInputAttrs()}>
62
- <FixInput ref={onRef.start} type="text" placeholder={props.startPlaceholder} className="input-box input-fill" value={state.input.start} onInput={handler.onStartInputChange} onKeyDown={customHandler.onKeyboardInput} disabled={!!editComputed.value.disabled} readOnly={!!editComputed.value.readonly}/>
63
- <FixInput ref={onRef.end} type="text" placeholder={props.endPlaceholder} className="input-box input-fill" value={state.input.end} onInput={handler.onEndInputChange} onKeyDown={customHandler.onKeyboardInput} disabled={!!editComputed.value.disabled} readOnly={!!editComputed.value.readonly}/>
63
+ {renderInputModeTextRangeValue({
64
+ styleComputed,
65
+ startValue: state.input.start,
66
+ endValue: state.input.end,
67
+ defaultRender: () => <>
68
+ <FixInput ref={onRef.start} type="text" placeholder={props.startPlaceholder} className="input-box input-fill" value={state.input.start} onInput={handler.onStartInputChange} onKeyDown={customHandler.onKeyboardInput} disabled={!!editComputed.value.disabled} readOnly={!!editComputed.value.readonly}/>
69
+ <FixInput ref={onRef.end} type="text" placeholder={props.endPlaceholder} className="input-box input-fill" value={state.input.end} onInput={handler.onEndInputChange} onKeyDown={customHandler.onKeyboardInput} disabled={!!editComputed.value.disabled} readOnly={!!editComputed.value.readonly}/>
70
+ </>
71
+ })}
64
72
  </Input>
65
73
  )
66
74
  })
@@ -7,10 +7,11 @@ import {useRangeTimeRender} from "./useRangeTimeRender";
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
  export function createSeparateRangeTimeRender(params: tTimeCompositionParams) {
12
13
 
13
- const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicTimeAttrs } = params;
14
+ const { props, hooks, editComputed, getPublicPopperAttrs, getInheritPublicTimeAttrs, styleComputed } = params;
14
15
 
15
16
  const { effects, refs, onRef, startModel, endModel, state, getInputAttrs, renderPickerFoot, utils, handler } = useRangeTimeRender({
16
17
  ...params,
@@ -82,8 +83,15 @@ export function createSeparateRangeTimeRender(params: tTimeCompositionParams) {
82
83
 
83
84
  effects.push(hooks.onRenderInput.use(() => (
84
85
  <Input{...getInputAttrs()}>
85
- <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}/>
86
- <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}/>
86
+ {renderInputModeTextRangeValue({
87
+ styleComputed,
88
+ startValue: state.input.start,
89
+ endValue: state.input.end,
90
+ defaultRender: () => <>
91
+ <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}/>
92
+ <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}/>
93
+ </>
94
+ })}
87
95
  </Input>
88
96
  )));
89
97
 
@@ -181,6 +181,7 @@ export function createSingleTimeRender({ emit, props, hooks, displayPattern, tod
181
181
  slotRender: slots.default,
182
182
  defaultRender: () => (
183
183
  <Input
184
+ className={getComponentCls('time-picker')}
184
185
  ref={onRef.input}
185
186
  suffixIcon="pi-clock-circle"
186
187
  modelValue={state.input}
@@ -46,7 +46,7 @@ export const TimePicker = designComponent({
46
46
  return prev;
47
47
  }, {} as any));
48
48
 
49
- const timeCompositionParams: tTimeCompositionParams = { props, emit, hooks, displayPattern, maxmin, today, editComputed, slots, getPublicPopperAttrs, getInheritPublicTimeAttrs, formatString, layoutArray };
49
+ const timeCompositionParams: tTimeCompositionParams = { props, emit, hooks, displayPattern, maxmin, today, editComputed,styleComputed, slots, getPublicPopperAttrs, getInheritPublicTimeAttrs, formatString, layoutArray };
50
50
 
51
51
  useWatchAutoClear(() => ({ range: props.range, separate: props.separate }), (data) => {
52
52
  if (!data || (!data.range && !data.separate)) {
@@ -2,7 +2,7 @@ import {useTimeHooks} from "./useTimeHooks";
2
2
  import {PDate} from "../../utils/plainDate";
3
3
  import {ComponentEvent, ComponentPropsType, computed, ExtractPropTypes, PropType, tSlotsType} from "plain-design-composition";
4
4
  import {EditProps, tEditComputed} from "../../uses/useEdit";
5
- import {StyleProps} from "../../uses/useStyle";
5
+ import {StyleProps, tStyleComputed} from "../../uses/useStyle";
6
6
  import {TimePanelProps} from "./panel/TimePanel";
7
7
  import Input from "../Input";
8
8
  import {iPopupEditorUseOption} from "../usePopupEditor";
@@ -39,6 +39,7 @@ export type tTimeCompositionParams = {
39
39
  emit: ComponentEvent<typeof TimeEmitsOption>["emit"],
40
40
  props: iTimePropsType,
41
41
  editComputed: tEditComputed,
42
+ styleComputed: tStyleComputed,
42
43
  slots: tSlotsType<typeof TimeSlotsOption>,
43
44
  /*获取popper公共的属性设置*/
44
45
  getPublicPopperAttrs: () => any,
@@ -209,6 +209,7 @@ export function useRangeTimeRender({ props, emit, onBlur, slots, displayPattern,
209
209
  );
210
210
 
211
211
  const getInputAttrs = () => ({
212
+ className: getComponentCls('time-picker'),
212
213
  ref: onRef.input,
213
214
  suffixIcon: 'pi-clock-circle',
214
215
  placeValue: [startModel.value, endModel.value].join('-'),
@@ -4,6 +4,7 @@ import './toggle.scss';
4
4
  import {EditProps, useEdit} from "../../uses/useEdit";
5
5
  import {StyleProps, ThemeStatus, useStyle} from "../../uses/useStyle";
6
6
  import {getKey, KEY} from "../KeyboardService";
7
+ import i18n from "../i18n";
7
8
 
8
9
  export const Toggle = designComponent({
9
10
  name: '-toggle',
@@ -14,7 +15,7 @@ export const Toggle = designComponent({
14
15
  modelValue: {}, // 双向绑定值
15
16
  trueValue: { default: true as any }, // 选中时绑定的值
16
17
  falseValue: { default: false as any }, // 未选中时绑定的值
17
- square: { type: Boolean }, // 方形开关
18
+ square: { type: Boolean }, // 方形开关
18
19
  },
19
20
  inheritPropsType: HTMLDivElement,
20
21
  emits: {
@@ -53,6 +54,7 @@ export const Toggle = designComponent({
53
54
  'toggle-active': state.isActive,
54
55
  'toggle-disabled': editComputed.value.disabled,
55
56
  'toggle-square': props.square,
57
+ 'toggle-input-mode-text': styleComputed.value.inputMode === 'text',
56
58
  },
57
59
  ]));
58
60
 
@@ -93,7 +95,9 @@ export const Toggle = designComponent({
93
95
  return {
94
96
  refer: { refs },
95
97
  render: () => (
96
- <div
98
+ styleComputed.value.inputMode === 'text' ? (
99
+ <span className={classes.value}>{isChecked.value ? i18n.$it('base.yes').d('是') : i18n.$it('base.no').d('否')}</span>
100
+ ) : <div
97
101
  ref={onRef.el}
98
102
  className={classes.value}
99
103
  tabIndex={0}