@ledvance/base 1.3.34 → 1.3.35

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.
@@ -300,6 +300,11 @@ interface DialogProps {
300
300
  onCancel?: () => void
301
301
  }
302
302
 
303
+ // 获取文本的默认值
304
+ const getText = (text: string | undefined, defaultText: string | undefined, show: boolean) => {
305
+ return show ? text || defaultText || '' : '';
306
+ };
307
+
303
308
  export function showDialog(props: DialogProps) {
304
309
  const {
305
310
  method,
@@ -312,31 +317,21 @@ export function showDialog(props: DialogProps) {
312
317
  onConfirm,
313
318
  onCancel
314
319
  } = props
320
+
321
+ const defDialogProps = {
322
+ title,
323
+ confirmText: getText(confirmText, I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_yes_text'), showConfirmText),
324
+ cancelText: getText(cancelText, I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_no_text'), showCancelText),
325
+ subTitle,
326
+ onConfirm,
327
+ motionConfig: {
328
+ hideDuration: 0,
329
+ showDuration: 100
330
+ }
331
+ }
332
+ const cancelProps = onCancel ? { onCancel } : {};
315
333
  return (
316
- method === 'confirm' ?
317
- Dialog.confirm({
318
- title: title,
319
- cancelText: showCancelText && (cancelText || I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_no_text')) || '',
320
- confirmText: showConfirmText && (confirmText || I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_yes_text')) || '',
321
- subTitle,
322
- onConfirm,
323
- onCancel,
324
- motionConfig: {
325
- hideDuration: 0,
326
- showDuration: 100
327
- }
328
- })
329
- :
330
- Dialog.alert({
331
- title: title,
332
- confirmText: showConfirmText && (confirmText || I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_yes_text')) || '',
333
- subTitle,
334
- onConfirm,
335
- motionConfig: {
336
- hideDuration: 0,
337
- showDuration: 100
338
- }
339
- })
334
+ method === 'confirm' ? Dialog.confirm({ ...defDialogProps, ...cancelProps }) : Dialog.alert(defDialogProps)
340
335
  )
341
336
  }
342
337
 
package/translateKey.txt CHANGED
@@ -1012,3 +1012,4 @@ legend_humidity
1012
1012
  battery_status_normal
1013
1013
  battery_status_low
1014
1014
  battery_status_empty
1015
+ push_notifications_contact_sensor_door_closing_title