plain-design 1.0.0-beta.17 → 1.0.0-beta.18

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.17",
3
+ "version": "1.0.0-beta.18",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -10,6 +10,7 @@ import Icon from "../Icon";
10
10
  import {ThemeStatusIcons} from "../Application/theme/theme.utils";
11
11
  import Input from "../Input";
12
12
  import InputNumber from "../InputNumber";
13
+ import $message from "../$message";
13
14
 
14
15
  /**
15
16
  * 弹框服务单个组件
@@ -133,7 +134,15 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
133
134
  const dialogProps = { ...targetOption.value.dialogProps };
134
135
 
135
136
  /*wrap handleConfirm*/
136
- dialogProps.handleConfirm = async (close: () => void) => targetOption.value.customOption.handleConfirm?.({ close, editValue: state.editValue });
137
+ dialogProps.handleConfirm = async (close: () => void) => {
138
+ if (!!targetOption.value.customOption.editRequired) {
139
+ if (state.editValue == null || !state.editValue.trim().length) {
140
+ $message.warn('不能为空!');
141
+ return false;
142
+ }
143
+ }
144
+ return targetOption.value.customOption.handleConfirm?.({ close, editValue: state.editValue });
145
+ };
137
146
 
138
147
  /*wrap onClose*/
139
148
  dialogProps.onClose = () => onClose.exec(undefined);
@@ -165,6 +174,7 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
165
174
  v-model={state.editValue}
166
175
  readonly={option.editReadonly}
167
176
  onEnter={onEnter}
177
+ status={option.editRequired ? 'warn' : undefined}
168
178
  />
169
179
  );
170
180
  break;
@@ -176,6 +186,7 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
176
186
  v-model={state.editValue}
177
187
  readonly={option.editReadonly}
178
188
  onEnter={onEnter}
189
+ status={option.editRequired ? 'warn' : undefined}
179
190
  />
180
191
  );
181
192
  break;
@@ -189,6 +200,7 @@ export const DialogService = createApplicationServiceComponent<iDialogServiceOpt
189
200
  v-model={state.editValue}
190
201
  readonly={option.editReadonly}
191
202
  onEnter={onEnter}
203
+ status={option.editRequired ? 'warn' : undefined}
192
204
  />
193
205
  );
194
206
  break;
@@ -195,6 +195,7 @@ export const demoInput = designPage(() => {
195
195
  <Button label={'input'} onClick={() => $dialog({
196
196
  editType: 'input',
197
197
  editValue: inputValue,
198
+ editRequired: true,
198
199
  handleConfirm: ({ editValue }) => {
199
200
  inputValue = editValue;
200
201
  $message(String(editValue));