@sdata/web-vue 1.13.0 → 1.14.0
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/es/_hooks/use-config-provider-prop.d.ts +10 -0
- package/es/_hooks/use-config-provider-prop.js +19 -0
- package/es/config-provider/config-provider.vue.d.ts +19 -0
- package/es/config-provider/config-provider.vue_vue_type_script_lang.js +19 -1
- package/es/config-provider/context.d.ts +49 -1
- package/es/config-provider/index.d.ts +27 -0
- package/es/date-picker/index.d.ts +13 -13
- package/es/date-picker/picker.vue.d.ts +7 -7
- package/es/date-picker/picker.vue_vue_type_script_lang.js +62 -11
- package/es/date-picker/range-picker.vue.d.ts +92 -92
- package/es/date-picker/range-picker.vue_vue_type_script_lang.js +54 -10
- package/es/drawer/drawer.js +9 -9
- package/es/drawer/drawer.vue.d.ts +10 -0
- package/es/drawer/drawer.vue_vue_type_script_lang.js +118 -9
- package/es/drawer/index.d.ts +30 -0
- package/es/modal/index.d.ts +24 -0
- package/es/modal/modal.js +8 -8
- package/es/modal/modal.vue.d.ts +8 -0
- package/es/modal/modal.vue_vue_type_script_lang.js +134 -12
- package/json/vetur-attributes.json +9 -0
- package/json/vetur-tags.json +3 -0
- package/json/web-types.json +29 -5
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import { useI18n } from "../locale/index.js";
|
|
|
15
15
|
import client_only_default from "../_components/client-only.js";
|
|
16
16
|
import usePopupManager from "../_hooks/use-popup-manager.js";
|
|
17
17
|
import { useTeleportContainer } from "../_hooks/use-teleport-container.js";
|
|
18
|
+
import { useConfigProviderProp } from "../_hooks/use-config-provider-prop.js";
|
|
18
19
|
import { useOverflow } from "../_hooks/use-overflow.js";
|
|
19
20
|
import { useDraggable } from "./hooks/use-draggable.js";
|
|
20
21
|
import { computed, defineComponent, onBeforeUnmount, onMounted, ref, toRefs, watch } from "vue";
|
|
@@ -339,11 +340,123 @@ var modal_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
|
339
340
|
* @slot footer
|
|
340
341
|
*/
|
|
341
342
|
setup(props, { emit }) {
|
|
342
|
-
const { fullscreen, popupContainer, alignCenter } = toRefs(props);
|
|
343
|
+
const { fullscreen, popupContainer, alignCenter, mask, maskClosable, maskStyle, closable, titleAlign, top, footer, hideCancel, escToClose, draggable, okText, cancelText, okButtonProps, cancelButtonProps, width } = toRefs(props);
|
|
343
344
|
const prefixCls = getPrefixCls("modal");
|
|
344
345
|
const { t } = useI18n();
|
|
345
346
|
const wrapperRef = ref();
|
|
346
347
|
const modalRef = ref();
|
|
348
|
+
const { mergedValue: mergedMask } = useConfigProviderProp(mask, {
|
|
349
|
+
propNames: ["mask"],
|
|
350
|
+
getGlobalValue: (configProviderCtx) => {
|
|
351
|
+
var _configProviderCtx$mo;
|
|
352
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo = configProviderCtx.modal) === null || _configProviderCtx$mo === void 0 ? void 0 : _configProviderCtx$mo.mask;
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
const { mergedValue: mergedMaskClosable } = useConfigProviderProp(maskClosable, {
|
|
356
|
+
propNames: ["maskClosable", "mask-closable"],
|
|
357
|
+
getGlobalValue: (configProviderCtx) => {
|
|
358
|
+
var _configProviderCtx$mo2;
|
|
359
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo2 = configProviderCtx.modal) === null || _configProviderCtx$mo2 === void 0 ? void 0 : _configProviderCtx$mo2.maskClosable;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
const { mergedValue: mergedMaskStyle } = useConfigProviderProp(maskStyle, {
|
|
363
|
+
propNames: ["maskStyle", "mask-style"],
|
|
364
|
+
getGlobalValue: (configProviderCtx) => {
|
|
365
|
+
var _configProviderCtx$mo3;
|
|
366
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo3 = configProviderCtx.modal) === null || _configProviderCtx$mo3 === void 0 ? void 0 : _configProviderCtx$mo3.maskStyle;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
const { mergedValue: mergedAlignCenter } = useConfigProviderProp(alignCenter, {
|
|
370
|
+
propNames: ["alignCenter", "align-center"],
|
|
371
|
+
getGlobalValue: (configProviderCtx) => {
|
|
372
|
+
var _configProviderCtx$mo4;
|
|
373
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo4 = configProviderCtx.modal) === null || _configProviderCtx$mo4 === void 0 ? void 0 : _configProviderCtx$mo4.alignCenter;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
const { mergedValue: mergedEscToClose } = useConfigProviderProp(escToClose, {
|
|
377
|
+
propNames: ["escToClose", "esc-to-close"],
|
|
378
|
+
getGlobalValue: (configProviderCtx) => {
|
|
379
|
+
var _configProviderCtx$mo5;
|
|
380
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo5 = configProviderCtx.modal) === null || _configProviderCtx$mo5 === void 0 ? void 0 : _configProviderCtx$mo5.escToClose;
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
const { mergedValue: mergedDraggableBase } = useConfigProviderProp(draggable, {
|
|
384
|
+
propNames: ["draggable"],
|
|
385
|
+
getGlobalValue: (configProviderCtx) => {
|
|
386
|
+
var _configProviderCtx$mo6;
|
|
387
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo6 = configProviderCtx.modal) === null || _configProviderCtx$mo6 === void 0 ? void 0 : _configProviderCtx$mo6.draggable;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
const { mergedValue: mergedClosable } = useConfigProviderProp(closable, {
|
|
391
|
+
propNames: ["closable"],
|
|
392
|
+
getGlobalValue: (configProviderCtx) => {
|
|
393
|
+
var _configProviderCtx$mo7;
|
|
394
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo7 = configProviderCtx.modal) === null || _configProviderCtx$mo7 === void 0 ? void 0 : _configProviderCtx$mo7.closable;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
const { mergedValue: mergedTitleAlign } = useConfigProviderProp(titleAlign, {
|
|
398
|
+
propNames: ["titleAlign", "title-align"],
|
|
399
|
+
getGlobalValue: (configProviderCtx) => {
|
|
400
|
+
var _configProviderCtx$mo8;
|
|
401
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo8 = configProviderCtx.modal) === null || _configProviderCtx$mo8 === void 0 ? void 0 : _configProviderCtx$mo8.titleAlign;
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
const { mergedValue: mergedTop } = useConfigProviderProp(top, {
|
|
405
|
+
propNames: ["top"],
|
|
406
|
+
getGlobalValue: (configProviderCtx) => {
|
|
407
|
+
var _configProviderCtx$mo9;
|
|
408
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo9 = configProviderCtx.modal) === null || _configProviderCtx$mo9 === void 0 ? void 0 : _configProviderCtx$mo9.top;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
const { mergedValue: mergedFooter } = useConfigProviderProp(footer, {
|
|
412
|
+
propNames: ["footer"],
|
|
413
|
+
getGlobalValue: (configProviderCtx) => {
|
|
414
|
+
var _configProviderCtx$mo10;
|
|
415
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo10 = configProviderCtx.modal) === null || _configProviderCtx$mo10 === void 0 ? void 0 : _configProviderCtx$mo10.footer;
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
const { mergedValue: mergedHideCancel } = useConfigProviderProp(hideCancel, {
|
|
419
|
+
propNames: ["hideCancel", "hide-cancel"],
|
|
420
|
+
getGlobalValue: (configProviderCtx) => {
|
|
421
|
+
var _configProviderCtx$mo11;
|
|
422
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo11 = configProviderCtx.modal) === null || _configProviderCtx$mo11 === void 0 ? void 0 : _configProviderCtx$mo11.hideCancel;
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
const { mergedValue: mergedOkText } = useConfigProviderProp(okText, {
|
|
426
|
+
propNames: ["okText", "ok-text"],
|
|
427
|
+
getGlobalValue: (configProviderCtx) => {
|
|
428
|
+
var _configProviderCtx$mo12;
|
|
429
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo12 = configProviderCtx.modal) === null || _configProviderCtx$mo12 === void 0 ? void 0 : _configProviderCtx$mo12.okText;
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
const { mergedValue: mergedCancelText } = useConfigProviderProp(cancelText, {
|
|
433
|
+
propNames: ["cancelText", "cancel-text"],
|
|
434
|
+
getGlobalValue: (configProviderCtx) => {
|
|
435
|
+
var _configProviderCtx$mo13;
|
|
436
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo13 = configProviderCtx.modal) === null || _configProviderCtx$mo13 === void 0 ? void 0 : _configProviderCtx$mo13.cancelText;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
const { mergedValue: mergedOkButtonProps } = useConfigProviderProp(okButtonProps, {
|
|
440
|
+
propNames: ["okButtonProps", "ok-button-props"],
|
|
441
|
+
getGlobalValue: (configProviderCtx) => {
|
|
442
|
+
var _configProviderCtx$mo14;
|
|
443
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo14 = configProviderCtx.modal) === null || _configProviderCtx$mo14 === void 0 ? void 0 : _configProviderCtx$mo14.okButtonProps;
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
const { mergedValue: mergedCancelButtonProps } = useConfigProviderProp(cancelButtonProps, {
|
|
447
|
+
propNames: ["cancelButtonProps", "cancel-button-props"],
|
|
448
|
+
getGlobalValue: (configProviderCtx) => {
|
|
449
|
+
var _configProviderCtx$mo15;
|
|
450
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo15 = configProviderCtx.modal) === null || _configProviderCtx$mo15 === void 0 ? void 0 : _configProviderCtx$mo15.cancelButtonProps;
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
const { mergedValue: mergedWidth } = useConfigProviderProp(width, {
|
|
454
|
+
propNames: ["width"],
|
|
455
|
+
getGlobalValue: (configProviderCtx) => {
|
|
456
|
+
var _configProviderCtx$mo16;
|
|
457
|
+
return configProviderCtx === null || configProviderCtx === void 0 || (_configProviderCtx$mo16 = configProviderCtx.modal) === null || _configProviderCtx$mo16 === void 0 ? void 0 : _configProviderCtx$mo16.width;
|
|
458
|
+
}
|
|
459
|
+
});
|
|
347
460
|
const _visible = ref(props.defaultVisible);
|
|
348
461
|
const computedVisible = computed(() => {
|
|
349
462
|
var _props$visible;
|
|
@@ -351,21 +464,22 @@ var modal_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
|
351
464
|
});
|
|
352
465
|
const _okLoading = ref(false);
|
|
353
466
|
const mergedOkLoading = computed(() => props.okLoading || _okLoading.value);
|
|
354
|
-
const mergedDraggable = computed(() =>
|
|
467
|
+
const mergedDraggable = computed(() => Boolean(mergedDraggableBase.value) && !props.fullscreen);
|
|
468
|
+
const mergedAlignCenterBoolean = computed(() => Boolean(mergedAlignCenter.value));
|
|
355
469
|
const { teleportContainer, containerRef } = useTeleportContainer({
|
|
356
470
|
popupContainer,
|
|
357
471
|
visible: computedVisible
|
|
358
472
|
});
|
|
359
473
|
const mounted = ref(computedVisible.value);
|
|
360
|
-
const okDisplayText = computed(() =>
|
|
361
|
-
const cancelDisplayText = computed(() =>
|
|
474
|
+
const okDisplayText = computed(() => mergedOkText.value || t("modal.okText"));
|
|
475
|
+
const cancelDisplayText = computed(() => mergedCancelText.value || t("modal.cancelText"));
|
|
362
476
|
const { zIndex, isLastDialog } = usePopupManager("dialog", { visible: computedVisible });
|
|
363
477
|
let globalKeyDownListener = false;
|
|
364
478
|
const handleGlobalKeyDown = (ev) => {
|
|
365
|
-
if (
|
|
479
|
+
if (mergedEscToClose.value && ev.key === KEYBOARD_KEY.ESC && isLastDialog()) handleCancel(ev);
|
|
366
480
|
};
|
|
367
481
|
const addGlobalKeyDownListener = () => {
|
|
368
|
-
if (
|
|
482
|
+
if (mergedEscToClose.value && !globalKeyDownListener) {
|
|
369
483
|
globalKeyDownListener = true;
|
|
370
484
|
on(document.documentElement, "keydown", handleGlobalKeyDown);
|
|
371
485
|
}
|
|
@@ -379,7 +493,7 @@ var modal_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
|
379
493
|
wrapperRef,
|
|
380
494
|
modalRef,
|
|
381
495
|
draggable: mergedDraggable,
|
|
382
|
-
alignCenter
|
|
496
|
+
alignCenter: mergedAlignCenterBoolean
|
|
383
497
|
});
|
|
384
498
|
const close = () => {
|
|
385
499
|
promiseNumber++;
|
|
@@ -436,7 +550,7 @@ var modal_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
|
436
550
|
if (ev.target === wrapperRef.value) currentIsMask.value = true;
|
|
437
551
|
};
|
|
438
552
|
const handleMaskClick = (e) => {
|
|
439
|
-
if (
|
|
553
|
+
if (mergedMask.value && mergedMaskClosable.value && currentIsMask.value) handleCancel(e);
|
|
440
554
|
};
|
|
441
555
|
const handleOpen = () => {
|
|
442
556
|
if (computedVisible.value) {
|
|
@@ -457,7 +571,7 @@ var modal_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
|
457
571
|
containerRef.value = getElement(props.popupContainer);
|
|
458
572
|
if (computedVisible.value) {
|
|
459
573
|
setOverflowHidden();
|
|
460
|
-
if (
|
|
574
|
+
if (mergedEscToClose.value) addGlobalKeyDownListener();
|
|
461
575
|
}
|
|
462
576
|
});
|
|
463
577
|
onBeforeUnmount(() => {
|
|
@@ -481,7 +595,7 @@ var modal_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
|
481
595
|
if (position.value) position.value = void 0;
|
|
482
596
|
});
|
|
483
597
|
const wrapperCls = computed(() => [`${prefixCls}-wrapper`, {
|
|
484
|
-
[`${prefixCls}-wrapper-align-center`]:
|
|
598
|
+
[`${prefixCls}-wrapper-align-center`]: mergedAlignCenterBoolean.value && !props.fullscreen,
|
|
485
599
|
[`${prefixCls}-wrapper-moved`]: Boolean(position.value)
|
|
486
600
|
}]);
|
|
487
601
|
const modalCls = computed(() => [
|
|
@@ -501,13 +615,21 @@ var modal_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
|
501
615
|
wrapperRef,
|
|
502
616
|
mergedModalStyle: computed(() => {
|
|
503
617
|
const style = _objectSpread2({}, props.modalStyle);
|
|
504
|
-
if (
|
|
505
|
-
if (!
|
|
618
|
+
if (mergedWidth.value && !props.fullscreen) style.width = isNumber(mergedWidth.value) ? `${mergedWidth.value}px` : mergedWidth.value;
|
|
619
|
+
if (!mergedAlignCenterBoolean.value && mergedTop.value) style.top = isNumber(mergedTop.value) ? `${mergedTop.value}px` : mergedTop.value;
|
|
506
620
|
if (position.value) style.transform = `translate(${position.value[0]}px, ${position.value[1]}px)`;
|
|
507
621
|
return style;
|
|
508
622
|
}),
|
|
509
623
|
okDisplayText,
|
|
510
624
|
cancelDisplayText,
|
|
625
|
+
mergedMask,
|
|
626
|
+
mergedMaskStyle,
|
|
627
|
+
mergedClosable,
|
|
628
|
+
mergedTitleAlign,
|
|
629
|
+
mergedFooter,
|
|
630
|
+
mergedHideCancel,
|
|
631
|
+
mergedOkButtonProps,
|
|
632
|
+
mergedCancelButtonProps,
|
|
511
633
|
zIndex,
|
|
512
634
|
handleOk,
|
|
513
635
|
handleCancel,
|
|
@@ -646,6 +646,15 @@
|
|
|
646
646
|
"description": "View starts from the right and ends on the left",
|
|
647
647
|
"type": "boolean"
|
|
648
648
|
},
|
|
649
|
+
"sd-config-provider/date-picker": {
|
|
650
|
+
"description": "Default config for DatePicker"
|
|
651
|
+
},
|
|
652
|
+
"sd-config-provider/modal": {
|
|
653
|
+
"description": "Default config for Modal"
|
|
654
|
+
},
|
|
655
|
+
"sd-config-provider/drawer": {
|
|
656
|
+
"description": "Default config for Drawer"
|
|
657
|
+
},
|
|
649
658
|
"sd-config-provider/theme": {
|
|
650
659
|
"description": "Runtime theme configuration object"
|
|
651
660
|
},
|
package/json/vetur-tags.json
CHANGED
package/json/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "@sdata/web-vue",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.13.0",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"types-syntax": "typescript",
|
|
@@ -1734,6 +1734,30 @@
|
|
|
1734
1734
|
"kind": "expression"
|
|
1735
1735
|
}
|
|
1736
1736
|
},
|
|
1737
|
+
{
|
|
1738
|
+
"name": "date-picker",
|
|
1739
|
+
"description": "Default config for DatePicker",
|
|
1740
|
+
"value": {
|
|
1741
|
+
"type": "ConfigProviderDatePicker",
|
|
1742
|
+
"kind": "expression"
|
|
1743
|
+
}
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
"name": "modal",
|
|
1747
|
+
"description": "Default config for Modal",
|
|
1748
|
+
"value": {
|
|
1749
|
+
"type": "ConfigProviderModal",
|
|
1750
|
+
"kind": "expression"
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
"name": "drawer",
|
|
1755
|
+
"description": "Default config for Drawer",
|
|
1756
|
+
"value": {
|
|
1757
|
+
"type": "ConfigProviderDrawer",
|
|
1758
|
+
"kind": "expression"
|
|
1759
|
+
}
|
|
1760
|
+
},
|
|
1737
1761
|
{
|
|
1738
1762
|
"name": "theme",
|
|
1739
1763
|
"description": "Runtime theme configuration object",
|
|
@@ -1917,7 +1941,7 @@
|
|
|
1917
1941
|
"name": "model-value",
|
|
1918
1942
|
"description": "Value",
|
|
1919
1943
|
"value": {
|
|
1920
|
-
"type": "
|
|
1944
|
+
"type": "CalendarValue[]",
|
|
1921
1945
|
"kind": "expression"
|
|
1922
1946
|
}
|
|
1923
1947
|
},
|
|
@@ -1925,7 +1949,7 @@
|
|
|
1925
1949
|
"name": "default-value",
|
|
1926
1950
|
"description": "Default value",
|
|
1927
1951
|
"value": {
|
|
1928
|
-
"type": "
|
|
1952
|
+
"type": "CalendarValue[]",
|
|
1929
1953
|
"kind": "expression"
|
|
1930
1954
|
}
|
|
1931
1955
|
},
|
|
@@ -1933,7 +1957,7 @@
|
|
|
1933
1957
|
"name": "picker-value",
|
|
1934
1958
|
"description": "The date displayed in the default panel",
|
|
1935
1959
|
"value": {
|
|
1936
|
-
"type": "
|
|
1960
|
+
"type": "CalendarValue[]",
|
|
1937
1961
|
"kind": "expression"
|
|
1938
1962
|
}
|
|
1939
1963
|
},
|
|
@@ -1941,7 +1965,7 @@
|
|
|
1941
1965
|
"name": "default-picker-value",
|
|
1942
1966
|
"description": "Date displayed on the panel",
|
|
1943
1967
|
"value": {
|
|
1944
|
-
"type": "
|
|
1968
|
+
"type": "CalendarValue[]",
|
|
1945
1969
|
"kind": "expression"
|
|
1946
1970
|
}
|
|
1947
1971
|
},
|