ll-plus 2.4.18 → 2.4.20

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.
Files changed (116) hide show
  1. package/es/component.mjs +4 -0
  2. package/es/component.mjs.map +1 -1
  3. package/es/components/breadcrumb-card/index.d.ts +12 -21
  4. package/es/components/breadcrumb-card/src/breadcrumb-card.d.ts +2 -7
  5. package/es/components/breadcrumb-card/src/breadcrumb-card.vue.d.ts +12 -21
  6. package/es/components/drawer/src/components/second-confirmation/index.d.ts +2 -2
  7. package/es/components/drawer/src/components/second-confirmation/src/second-confirmation.vue.d.ts +2 -2
  8. package/es/components/index.d.ts +2 -0
  9. package/es/components/new-drawer/index.d.ts +728 -0
  10. package/es/components/new-drawer/src/drawer.d.ts +59 -0
  11. package/es/components/new-drawer/src/drawer.vue.d.ts +721 -0
  12. package/es/components/new-modal/index.d.ts +2340 -0
  13. package/es/components/new-modal/src/modal.d.ts +58 -0
  14. package/es/components/new-modal/src/modal.vue.d.ts +2333 -0
  15. package/es/components/table/index.d.ts +1 -0
  16. package/es/components/table/src/components/header-search.vue.d.ts +1 -0
  17. package/es/components/table/src/table.vue.d.ts +1 -0
  18. package/es/index.mjs +4 -0
  19. package/es/index.mjs.map +1 -1
  20. package/es/packages/components/breadcrumb-card/src/breadcrumb-card.mjs +6 -5
  21. package/es/packages/components/breadcrumb-card/src/breadcrumb-card.mjs.map +1 -1
  22. package/es/packages/components/breadcrumb-card/src/breadcrumb-card.vue2.mjs +30 -38
  23. package/es/packages/components/breadcrumb-card/src/breadcrumb-card.vue2.mjs.map +1 -1
  24. package/es/packages/components/index.mjs +4 -0
  25. package/es/packages/components/index.mjs.map +1 -1
  26. package/es/packages/components/new-drawer/index.mjs +10 -0
  27. package/es/packages/components/new-drawer/index.mjs.map +1 -0
  28. package/es/packages/components/new-drawer/src/drawer.mjs +99 -0
  29. package/es/packages/components/new-drawer/src/drawer.mjs.map +1 -0
  30. package/es/packages/components/new-drawer/src/drawer.vue.mjs +8 -0
  31. package/es/packages/components/new-drawer/src/drawer.vue.mjs.map +1 -0
  32. package/es/packages/components/new-drawer/src/drawer.vue2.mjs +162 -0
  33. package/es/packages/components/new-drawer/src/drawer.vue2.mjs.map +1 -0
  34. package/es/packages/components/new-modal/index.mjs +10 -0
  35. package/es/packages/components/new-modal/index.mjs.map +1 -0
  36. package/es/packages/components/new-modal/src/modal.mjs +104 -0
  37. package/es/packages/components/new-modal/src/modal.mjs.map +1 -0
  38. package/es/packages/components/new-modal/src/modal.vue.mjs +8 -0
  39. package/es/packages/components/new-modal/src/modal.vue.mjs.map +1 -0
  40. package/es/packages/components/new-modal/src/modal.vue2.mjs +126 -0
  41. package/es/packages/components/new-modal/src/modal.vue2.mjs.map +1 -0
  42. package/es/packages/components/table/src/components/header-search.vue2.mjs +21 -13
  43. package/es/packages/components/table/src/components/header-search.vue2.mjs.map +1 -1
  44. package/es/packages/hooks/use-scroll/index.mjs +72 -3
  45. package/es/packages/hooks/use-scroll/index.mjs.map +1 -1
  46. package/index.full.js +713 -173
  47. package/index.full.min.js +22 -22
  48. package/index.full.min.js.map +1 -1
  49. package/index.full.min.mjs +23 -23
  50. package/index.full.min.mjs.map +1 -1
  51. package/index.full.mjs +710 -177
  52. package/lib/component.js +86 -82
  53. package/lib/component.js.map +1 -1
  54. package/lib/components/breadcrumb-card/index.d.ts +12 -21
  55. package/lib/components/breadcrumb-card/src/breadcrumb-card.d.ts +2 -7
  56. package/lib/components/breadcrumb-card/src/breadcrumb-card.vue.d.ts +12 -21
  57. package/lib/components/drawer/src/components/second-confirmation/index.d.ts +2 -2
  58. package/lib/components/drawer/src/components/second-confirmation/src/second-confirmation.vue.d.ts +2 -2
  59. package/lib/components/index.d.ts +2 -0
  60. package/lib/components/new-drawer/index.d.ts +728 -0
  61. package/lib/components/new-drawer/src/drawer.d.ts +59 -0
  62. package/lib/components/new-drawer/src/drawer.vue.d.ts +721 -0
  63. package/lib/components/new-modal/index.d.ts +2340 -0
  64. package/lib/components/new-modal/src/modal.d.ts +58 -0
  65. package/lib/components/new-modal/src/modal.vue.d.ts +2333 -0
  66. package/lib/components/table/index.d.ts +1 -0
  67. package/lib/components/table/src/components/header-search.vue.d.ts +1 -0
  68. package/lib/components/table/src/table.vue.d.ts +1 -0
  69. package/lib/index.js +97 -86
  70. package/lib/index.js.map +1 -1
  71. package/lib/packages/components/breadcrumb-card/src/breadcrumb-card.js +6 -5
  72. package/lib/packages/components/breadcrumb-card/src/breadcrumb-card.js.map +1 -1
  73. package/lib/packages/components/breadcrumb-card/src/breadcrumb-card.vue2.js +29 -37
  74. package/lib/packages/components/breadcrumb-card/src/breadcrumb-card.vue2.js.map +1 -1
  75. package/lib/packages/components/index.js +93 -82
  76. package/lib/packages/components/index.js.map +1 -1
  77. package/lib/packages/components/new-drawer/index.js +17 -0
  78. package/lib/packages/components/new-drawer/index.js.map +1 -0
  79. package/lib/packages/components/new-drawer/src/drawer.js +102 -0
  80. package/lib/packages/components/new-drawer/src/drawer.js.map +1 -0
  81. package/lib/packages/components/new-drawer/src/drawer.vue.js +12 -0
  82. package/lib/packages/components/new-drawer/src/drawer.vue.js.map +1 -0
  83. package/lib/packages/components/new-drawer/src/drawer.vue2.js +166 -0
  84. package/lib/packages/components/new-drawer/src/drawer.vue2.js.map +1 -0
  85. package/lib/packages/components/new-modal/index.js +18 -0
  86. package/lib/packages/components/new-modal/index.js.map +1 -0
  87. package/lib/packages/components/new-modal/src/modal.js +108 -0
  88. package/lib/packages/components/new-modal/src/modal.js.map +1 -0
  89. package/lib/packages/components/new-modal/src/modal.vue.js +12 -0
  90. package/lib/packages/components/new-modal/src/modal.vue.js.map +1 -0
  91. package/lib/packages/components/new-modal/src/modal.vue2.js +130 -0
  92. package/lib/packages/components/new-modal/src/modal.vue2.js.map +1 -0
  93. package/lib/packages/components/table/src/components/header-search.vue2.js +20 -12
  94. package/lib/packages/components/table/src/components/header-search.vue2.js.map +1 -1
  95. package/lib/packages/hooks/use-scroll/index.js +72 -3
  96. package/lib/packages/hooks/use-scroll/index.js.map +1 -1
  97. package/package.json +1 -1
  98. package/theme-chalk/css/breadcrumb-card.css +1 -1
  99. package/theme-chalk/css/index.css +2 -2
  100. package/theme-chalk/css/new-drawer.css +5 -0
  101. package/theme-chalk/css/new-modal.css +5 -0
  102. package/types/packages/components/breadcrumb-card/index.d.ts +12 -21
  103. package/types/packages/components/breadcrumb-card/src/breadcrumb-card.d.ts +2 -7
  104. package/types/packages/components/breadcrumb-card/src/breadcrumb-card.vue.d.ts +12 -21
  105. package/types/packages/components/drawer/src/components/second-confirmation/index.d.ts +2 -2
  106. package/types/packages/components/drawer/src/components/second-confirmation/src/second-confirmation.vue.d.ts +2 -2
  107. package/types/packages/components/index.d.ts +2 -0
  108. package/types/packages/components/new-drawer/index.d.ts +728 -0
  109. package/types/packages/components/new-drawer/src/drawer.d.ts +59 -0
  110. package/types/packages/components/new-drawer/src/drawer.vue.d.ts +721 -0
  111. package/types/packages/components/new-modal/index.d.ts +2340 -0
  112. package/types/packages/components/new-modal/src/modal.d.ts +58 -0
  113. package/types/packages/components/new-modal/src/modal.vue.d.ts +2333 -0
  114. package/types/packages/components/table/index.d.ts +1 -0
  115. package/types/packages/components/table/src/components/header-search.vue.d.ts +1 -0
  116. package/types/packages/components/table/src/table.vue.d.ts +1 -0
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ require('../../../utils/index.js');
4
+ var runtime = require('../../../utils/props/runtime.js');
5
+
6
+ "use strict";
7
+ const modalType = ["confirm", "operate"];
8
+ const newModalProps = runtime.buildProps({
9
+ /**
10
+ * @description 弹窗是否可见
11
+ */
12
+ open: {
13
+ type: Boolean,
14
+ default: false
15
+ },
16
+ /**
17
+ * @description 标题
18
+ */
19
+ title: {
20
+ type: String,
21
+ default: "\u63D0\u793A"
22
+ },
23
+ /**
24
+ * @description 确认/知道了按钮loading
25
+ */
26
+ confirmLoading: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ /**
31
+ * @description 取消按钮的配置信息
32
+ */
33
+ cancelButtonProps: {
34
+ type: runtime.definePropType(Object)
35
+ },
36
+ /**
37
+ * @description 确认按钮的配置信息
38
+ */
39
+ okButtonProps: {
40
+ type: runtime.definePropType(Object)
41
+ },
42
+ /**
43
+ * @description 弹窗类型 确认/操作框
44
+ */
45
+ type: {
46
+ type: String,
47
+ values: modalType,
48
+ default: "operate"
49
+ },
50
+ /**
51
+ * @description 弹窗外层容器的类名
52
+ */
53
+ wrapClassName: {
54
+ type: String,
55
+ default: ""
56
+ },
57
+ /**
58
+ * @description 容器内容的顶部的阴影 设置为false标记可能是外部其他元素滚动
59
+ */
60
+ isShowTopShadow: {
61
+ type: Boolean,
62
+ default: true
63
+ },
64
+ /**
65
+ * @description 容器内容底部的阴影
66
+ */
67
+ isShowFooterShadow: {
68
+ type: Boolean,
69
+ default: true
70
+ },
71
+ /**
72
+ * @description 确认按钮文字
73
+ */
74
+ confirmText: {
75
+ type: String,
76
+ default: ""
77
+ },
78
+ /**
79
+ * @description 取消按钮文字
80
+ */
81
+ cancelText: {
82
+ type: String,
83
+ default: "\u53D6\u6D88"
84
+ },
85
+ /**
86
+ * @description 显示底部
87
+ */
88
+ showFooter: {
89
+ type: Boolean,
90
+ default: true
91
+ }
92
+ });
93
+ const newModalEmits = {
94
+ /**
95
+ * @description 点击取消时触发
96
+ */
97
+ cancel: () => true,
98
+ /**
99
+ * @description 点击确认时触发
100
+ */
101
+ ok: () => true,
102
+ "update:open": () => true
103
+ };
104
+
105
+ exports.modalType = modalType;
106
+ exports.newModalEmits = newModalEmits;
107
+ exports.newModalProps = newModalProps;
108
+ //# sourceMappingURL=modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.js","sources":["../../../../../../packages/components/new-modal/src/modal.ts"],"sourcesContent":["import { buildProps, definePropType } from '@ll-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type Modal from './modal.vue'\nimport type { ButtonProps } from '@ll-plus/components'\n\n// modal的类型 确认框和操作框\nexport const modalType = ['confirm', 'operate'] as const\n\nexport const newModalProps = buildProps({\n /**\n * @description 弹窗是否可见\n */\n open: {\n type: Boolean,\n default: false\n },\n /**\n * @description 标题\n */\n title: {\n type: String,\n default: '提示'\n },\n /**\n * @description 确认/知道了按钮loading\n */\n confirmLoading: {\n type: Boolean,\n default: false\n },\n /**\n * @description 取消按钮的配置信息\n */\n cancelButtonProps: {\n type: definePropType<ButtonProps>(Object)\n },\n /**\n * @description 确认按钮的配置信息\n */\n okButtonProps: {\n type: definePropType<ButtonProps>(Object)\n },\n /**\n * @description 弹窗类型 确认/操作框\n */\n type: {\n type: String,\n values: modalType,\n default: 'operate'\n },\n /**\n * @description 弹窗外层容器的类名\n */\n wrapClassName: {\n type: String,\n default: ''\n },\n /**\n * @description 容器内容的顶部的阴影 设置为false标记可能是外部其他元素滚动\n */\n isShowTopShadow: {\n type: Boolean,\n default: true\n },\n /**\n * @description 容器内容底部的阴影\n */\n isShowFooterShadow: {\n type: Boolean,\n default: true\n },\n /**\n * @description 确认按钮文字\n */\n confirmText: {\n type: String,\n default: ''\n },\n /**\n * @description 取消按钮文字\n */\n cancelText: {\n type: String,\n default: '取消'\n },\n /**\n * @description 显示底部\n */\n showFooter: {\n type: Boolean,\n default: true\n }\n} as const)\n\nexport const newModalEmits = {\n /**\n * @description 点击取消时触发\n */\n cancel: () => true,\n /**\n * @description 点击确认时触发\n */\n ok: () => true,\n 'update:open': () => true\n} as const\n\n// props\nexport type NewModalProps = ExtractPropTypes<typeof newModalProps>\n\n// emits\nexport type NewModalEmits = typeof newModalEmits\nexport type ModalType = NewModalProps['type']\n\n// instance\nexport type NewModalInstance = InstanceType<typeof Modal>\n"],"names":["buildProps","definePropType"],"mappings":";;;;;;AAOa,MAAA,SAAA,GAAY,CAAC,SAAA,EAAW,SAAS,EAAA;AAEvC,MAAM,gBAAgBA,kBAAW,CAAA;AAAA;AAAA;AAAA;AAAA,EAItC,IAAM,EAAA;AAAA,IACJ,IAA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,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AACF,CAAU,EAAA;AAEH,MAAM,aAAgB,GAAA;AAAA;AAAA;AAAA;AAAA,EAI3B,QAAQ,MAAM,IAAA;AAAA;AAAA;AAAA;AAAA,EAId,IAAI,MAAM,IAAA;AAAA,EACV,eAAe,MAAM,IAAA;AACvB;;;;;;"}
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var modal_vue_vue_type_script_setup_true_lang = require('./modal.vue2.js');
6
+ var _pluginVue_exportHelper = require('../../../../_virtual/_plugin-vue_export-helper.js');
7
+
8
+ "use strict";
9
+ var Modal = /* @__PURE__ */ _pluginVue_exportHelper.default(modal_vue_vue_type_script_setup_true_lang.default, [["__file", "modal.vue"]]);
10
+
11
+ exports.default = Modal;
12
+ //# sourceMappingURL=modal.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var antDesignVue = require('ant-design-vue');
7
+ require('../../index.js');
8
+ require('../../../utils/index.js');
9
+ var lodashEs = require('lodash-es');
10
+ var modal = require('./modal.js');
11
+ require('../../../hooks/index.js');
12
+ var index = require('../../../hooks/use-scroll/index.js');
13
+ var createNamespace = require('../../../utils/create-namespace.js');
14
+ var index$1 = require('../../button/index.js');
15
+
16
+ "use strict";
17
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
18
+ ...{ name: "LlNewModal" },
19
+ __name: "modal",
20
+ props: modal.newModalProps,
21
+ emits: modal.newModalEmits,
22
+ setup(__props, { emit: __emit }) {
23
+ const props = __props;
24
+ const emits = __emit;
25
+ const attrs = vue.useAttrs();
26
+ const { scrollPosition, isHasScrollBar, scrollRef } = index.useScroll();
27
+ const modal$1 = vue.ref();
28
+ const getBindValue = vue.computed(() => {
29
+ const result = {
30
+ ...lodashEs.omit({ ...attrs }, [...Object.keys(modal.newModalProps), "wrapClassName"])
31
+ };
32
+ if (!props.showFooter)
33
+ result.footer = null;
34
+ return result;
35
+ });
36
+ const isShowContentTopBox = vue.computed(() => {
37
+ return props.isShowTopShadow && scrollPosition.value && isHasScrollBar.value && scrollPosition.value !== "top";
38
+ });
39
+ const isShowContentBottomBox = vue.computed(() => {
40
+ if (props.isShowTopShadow) {
41
+ return isHasScrollBar.value && scrollPosition.value !== "bottom";
42
+ } else {
43
+ return props.isShowFooterShadow;
44
+ }
45
+ });
46
+ const bem = createNamespace.createNamespace("new-modal");
47
+ const handleCancel = () => {
48
+ emits("cancel");
49
+ emits("update:open");
50
+ };
51
+ const handleOk = () => {
52
+ emits("ok");
53
+ };
54
+ return (_ctx, _cache) => {
55
+ return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Modal), vue.mergeProps(getBindValue.value, {
56
+ ref_key: "modal",
57
+ ref: modal$1,
58
+ open: _ctx.open,
59
+ title: _ctx.title,
60
+ "wrap-class-name": `${vue.unref(bem).b()} ${_ctx.wrapClassName}`,
61
+ class: [vue.unref(bem).is(_ctx.type === "confirm" ? "confirm-modal" : "")],
62
+ onCancel: handleCancel,
63
+ onOk: handleOk
64
+ }), vue.createSlots({
65
+ default: vue.withCtx(() => [
66
+ vue.createElementVNode(
67
+ "div",
68
+ {
69
+ ref_key: "scrollRef",
70
+ ref: scrollRef,
71
+ class: vue.normalizeClass([vue.unref(bem).e("container")])
72
+ },
73
+ [
74
+ vue.createCommentVNode(" \u5185\u5BB9\u533A\u57DF\u9876\u90E8\u7684\u76D2\u5B50\u7528\u4E8E\u6EDA\u52A8\u906E\u76D6/\u9634\u5F71 \u53EA\u6709\u6EDA\u52A8\u72B6\u6001\u4E0B\u624D\u6709\uFF0C\u6EDA\u52A8\u5230\u9876\u90E8\u9700\u8981 "),
75
+ vue.withDirectives(vue.createElementVNode(
76
+ "div",
77
+ {
78
+ class: vue.normalizeClass(vue.unref(bem).e("content-top-shadow"))
79
+ },
80
+ null,
81
+ 2
82
+ /* CLASS */
83
+ ), [
84
+ [vue.vShow, isShowContentTopBox.value]
85
+ ]),
86
+ vue.renderSlot(_ctx.$slots, "default")
87
+ ],
88
+ 2
89
+ /* CLASS */
90
+ )
91
+ ]),
92
+ _: 2
93
+ /* DYNAMIC */
94
+ }, [
95
+ _ctx.showFooter ? {
96
+ name: "footer",
97
+ fn: vue.withCtx(() => [
98
+ vue.createElementVNode(
99
+ "div",
100
+ {
101
+ class: vue.normalizeClass(`${vue.unref(bem).e("footer")} ${isShowContentBottomBox.value ? vue.unref(bem).e("footer-shadow") : ""}`)
102
+ },
103
+ [
104
+ vue.renderSlot(_ctx.$slots, "footer", {}, () => [
105
+ _ctx.type !== "confirm" ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.LlButton), vue.mergeProps({
106
+ key: 0,
107
+ label: _ctx.cancelText,
108
+ size: "middle"
109
+ }, _ctx.cancelButtonProps, { onClick: handleCancel }), null, 16, ["label"])) : vue.createCommentVNode("v-if", true),
110
+ vue.createVNode(vue.unref(index$1.LlButton), vue.mergeProps({
111
+ type: "primary",
112
+ loading: props.confirmLoading,
113
+ size: "middle",
114
+ label: props.confirmText ? props.confirmText : props.type === "confirm" ? "\u77E5\u9053\u4E86" : "\u786E\u8BA4"
115
+ }, _ctx.okButtonProps, { onClick: handleOk }), null, 16, ["loading", "label"])
116
+ ])
117
+ ],
118
+ 2
119
+ /* CLASS */
120
+ )
121
+ ]),
122
+ key: "0"
123
+ } : void 0
124
+ ]), 1040, ["open", "title", "wrap-class-name", "class"]);
125
+ };
126
+ }
127
+ });
128
+
129
+ exports.default = _sfc_main;
130
+ //# sourceMappingURL=modal.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.vue2.js","sources":["../../../../../../packages/components/new-modal/src/modal.vue"],"sourcesContent":["<template>\n <Modal\n v-bind=\"getBindValue\"\n ref=\"modal\"\n :open=\"open\"\n :title=\"title\"\n :wrap-class-name=\"`${bem.b()} ${wrapClassName}`\"\n :class=\"[bem.is(type === 'confirm' ? 'confirm-modal' : '')]\"\n @cancel=\"handleCancel\"\n @ok=\"handleOk\"\n >\n <!-- 内容区域 -->\n <div ref=\"scrollRef\" :class=\"[bem.e('container')]\">\n <!-- 内容区域顶部的盒子用于滚动遮盖/阴影 只有滚动状态下才有,滚动到顶部需要 -->\n <div\n v-show=\"isShowContentTopBox\"\n :class=\"bem.e('content-top-shadow')\"\n ></div>\n <slot />\n </div>\n <!-- 底部区域 -->\n <template v-if=\"showFooter\" #footer>\n <div\n :class=\"`${bem.e('footer')} ${\n isShowContentBottomBox ? bem.e('footer-shadow') : ''\n }`\"\n >\n <slot name=\"footer\">\n <ll-button\n v-if=\"type !== 'confirm'\"\n :label=\"cancelText\"\n size=\"middle\"\n v-bind=\"cancelButtonProps\"\n @click=\"handleCancel\"\n >\n </ll-button>\n <ll-button\n type=\"primary\"\n :loading=\"props.confirmLoading\"\n size=\"middle\"\n :label=\"\n props.confirmText\n ? props.confirmText\n : props.type === 'confirm'\n ? '知道了'\n : '确认'\n \"\n v-bind=\"okButtonProps\"\n @click=\"handleOk\"\n />\n </slot>\n </div>\n </template>\n </Modal>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useAttrs, ref, computed } from 'vue'\n\nimport { Modal } from 'ant-design-vue'\nimport { LlButton } from '@ll-plus/components'\n\nimport { createNamespace } from '@ll-plus/utils'\nimport { omit } from 'lodash-es'\nimport { newModalProps, newModalEmits } from './modal'\nimport { useScroll } from '@ll-plus/hooks'\n\nimport type { ModalProps } from 'ant-design-vue'\n\ndefineOptions({ name: 'LlNewModal' })\n\n// 1.props/emits\nconst props = defineProps(newModalProps)\nconst emits = defineEmits(newModalEmits)\n\n// 2.hooks\nconst attrs = useAttrs()\nconst { scrollPosition, isHasScrollBar, scrollRef } = useScroll()\n\n// 3.ref/computed/const\nconst modal = ref<HTMLElement>()\nconst getBindValue = computed(() => {\n const result: ModalProps = {\n ...omit({ ...attrs }, [...Object.keys(newModalProps), 'wrapClassName'])\n }\n if (!props.showFooter) result.footer = null\n return result\n})\n// 是否现实内容区域顶部的阴影div\nconst isShowContentTopBox = computed(() => {\n return (\n props.isShowTopShadow &&\n scrollPosition.value &&\n isHasScrollBar.value &&\n scrollPosition.value !== 'top'\n )\n})\n// 是否现实内容区域底部的阴影div\nconst isShowContentBottomBox = computed(() => {\n // 如果顶部的阴影为true则说明是内部的容器在滚动产品的阴影 则由容器的滚动情况来决定阴影\n if (props.isShowTopShadow) {\n return isHasScrollBar.value && scrollPosition.value !== 'bottom'\n } else {\n // 如果顶部的阴影为false,则说明不是内部容器滚动,则底部的阴影由 外部的isShowFooterShadow来决定\n return props.isShowFooterShadow\n }\n})\nconst bem = createNamespace('new-modal')\n\n// 3.methods\nconst handleCancel = () => {\n emits('cancel')\n emits('update:open')\n}\nconst handleOk = () => {\n emits('ok')\n}\n</script>\n"],"names":["useAttrs","useScroll","modal","ref","computed","omit","newModalProps","createNamespace"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwEA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAGd,IAAA,MAAM,QAAQA,YAAS,EAAA,CAAA;AACvB,IAAA,MAAM,EAAE,cAAA,EAAgB,cAAgB,EAAA,SAAA,KAAcC,eAAU,EAAA,CAAA;AAGhE,IAAA,MAAMC,UAAQC,OAAiB,EAAA,CAAA;AAC/B,IAAM,MAAA,YAAA,GAAeC,aAAS,MAAM;AAClC,MAAA,MAAM,MAAqB,GAAA;AAAA,QACzB,GAAGC,aAAA,CAAK,EAAE,GAAG,KAAM,EAAA,EAAG,CAAC,GAAG,MAAO,CAAA,IAAA,CAAKC,mBAAa,CAAA,EAAG,eAAe,CAAC,CAAA;AAAA,OACxE,CAAA;AACA,MAAA,IAAI,CAAC,KAAM,CAAA,UAAA;AAAY,QAAA,MAAA,CAAO,MAAS,GAAA,IAAA,CAAA;AACvC,MAAO,OAAA,MAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAM,MAAA,mBAAA,GAAsBF,aAAS,MAAM;AACzC,MAAA,OACE,MAAM,eACN,IAAA,cAAA,CAAe,SACf,cAAe,CAAA,KAAA,IACf,eAAe,KAAU,KAAA,KAAA,CAAA;AAAA,KAE5B,CAAA,CAAA;AAED,IAAM,MAAA,sBAAA,GAAyBA,aAAS,MAAM;AAE5C,MAAA,IAAI,MAAM,eAAiB,EAAA;AACzB,QAAO,OAAA,cAAA,CAAe,KAAS,IAAA,cAAA,CAAe,KAAU,KAAA,QAAA,CAAA;AAAA,OACnD,MAAA;AAEL,QAAA,OAAO,KAAM,CAAA,kBAAA,CAAA;AAAA,OACf;AAAA,KACD,CAAA,CAAA;AACD,IAAM,MAAA,GAAA,GAAMG,gCAAgB,WAAW,CAAA,CAAA;AAGvC,IAAA,MAAM,eAAe,MAAM;AACzB,MAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AACd,MAAA,KAAA,CAAM,aAAa,CAAA,CAAA;AAAA,KACrB,CAAA;AACA,IAAA,MAAM,WAAW,MAAM;AACrB,MAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AAAA,KACZ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -22,6 +22,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
22
22
  const props = __props;
23
23
  const headerSearchRef = vue.ref();
24
24
  const contentType = vue.inject("contentType");
25
+ let observer;
25
26
  const emits = __emit;
26
27
  const bem = createNamespace.createNamespace("table");
27
28
  const handleMenuSwitchChange = (event) => {
@@ -34,19 +35,21 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
34
35
  headerSearchRef,
35
36
  () => {
36
37
  if (headerSearchRef.value) {
37
- const observer = new MutationObserver(function(mutations) {
38
- mutations.forEach(function() {
39
- const newHeight = headerSearchRef.value.getBoundingClientRect().height;
40
- emits("changeHeaderSearch", newHeight);
38
+ if (!observer) {
39
+ observer = new MutationObserver(function(mutations) {
40
+ mutations.forEach(function() {
41
+ const newHeight = headerSearchRef.value.getBoundingClientRect().height;
42
+ emits("changeHeaderSearch", newHeight);
43
+ });
41
44
  });
42
- });
43
- const config = {
44
- childList: true,
45
- // 观察直接子节点
46
- subtree: true
47
- // 及其更低的后代节点
48
- };
49
- observer.observe(headerSearchRef.value, config);
45
+ const config = {
46
+ childList: true,
47
+ // 观察直接子节点
48
+ subtree: true
49
+ // 及其更低的后代节点
50
+ };
51
+ observer?.observe(headerSearchRef.value, config);
52
+ }
50
53
  }
51
54
  },
52
55
  {
@@ -54,6 +57,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
54
57
  deep: true
55
58
  }
56
59
  );
60
+ vue.onUnmounted(() => {
61
+ if (observer) {
62
+ observer.disconnect();
63
+ }
64
+ });
57
65
  return (_ctx, _cache) => {
58
66
  const _component_a_radio_button = vue.resolveComponent("a-radio-button");
59
67
  const _component_a_radio_group = vue.resolveComponent("a-radio-group");
@@ -1 +1 @@
1
- {"version":3,"file":"header-search.vue2.js","sources":["../../../../../../../packages/components/table/src/components/header-search.vue"],"sourcesContent":["<template>\n <div ref=\"headerSearchRef\" :class=\"`${bem.e('header-wrapper')}`\">\n <div :class=\"bem.e('header')\">\n <slot name=\"header\">\n <!-- 左边的插槽 -->\n <div :class=\"bem.e('header-left')\">\n <slot name=\"headerLeft\"> </slot>\n </div>\n <!-- 内容中间插槽 -->\n <div :class=\"bem.e('header-middle')\">\n <slot name=\"headerMiddle\"></slot>\n </div>\n <div :class=\"bem.e('header-right')\">\n <slot name=\"headerRight\"></slot>\n <!-- 切换table和list菜单 -->\n <a-radio-group\n v-if=\"props.menuSwitchOptions?.show\"\n v-model:value=\"contentType\"\n :class=\"`m-l20 ${bem.e('header-menu-radio-group')}`\"\n @change=\"handleMenuSwitchChange\"\n >\n <a-radio-button\n v-for=\"menuItem in menuSwitchRadioList\"\n :key=\"menuItem.value\"\n :class=\"`${bem.e('header-menu-icon')}`\"\n :value=\"menuItem.value\"\n >\n <ll-icon :icon-name=\"menuItem.icon\" :size=\"18\" />\n </a-radio-button>\n </a-radio-group>\n </div>\n </slot>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { ref, inject, watch } from 'vue'\n\nimport {\n menuSwitchRadioList,\n tableHeaderSearchEmits,\n ImenuSwitchType\n} from '../config'\nimport { createNamespace } from '@ll-plus/utils'\nimport { tableHeaderSearchProps } from '../config'\n\nimport { LlIcon } from '@ll-plus/components'\n\nimport type { RadioChangeEvent } from 'ant-design-vue'\n\n// 1.defineOptions\ndefineOptions({\n name: 'TableHeaderSearch'\n})\n\n// 2.props\nconst props = defineProps(tableHeaderSearchProps)\n\nconst headerSearchRef = ref() // headerSearch的ref\n// 获取menuswitch\nconst contentType = inject('contentType')\n\n// 3.emits\nconst emits = defineEmits(tableHeaderSearchEmits)\n// 4.const\nconst bem = createNamespace('table')\n\n// 5.methods\n// 切换菜单table\nconst handleMenuSwitchChange = (event: RadioChangeEvent) => {\n const target = event.target\n const value = target.value as ImenuSwitchType\n props.menuSwitchOptions.onChange && props.menuSwitchOptions.onChange(value)\n emits('change', value)\n}\n// 6.watch\nwatch(\n headerSearchRef,\n () => {\n if (headerSearchRef.value) {\n // 创建一个新的MutationObserver对象\n const observer = new MutationObserver(function (mutations) {\n mutations.forEach(function () {\n // 检查容器的高度变化\n const newHeight = headerSearchRef.value.getBoundingClientRect().height\n emits('changeHeaderSearch', newHeight)\n })\n })\n\n // 配置MutationObserver,监听子节点的变化\n const config = {\n childList: true, // 观察直接子节点\n subtree: true // 及其更低的后代节点\n }\n\n // 开始监听容器的变化\n observer.observe(headerSearchRef.value, config)\n }\n },\n {\n immediate: true,\n deep: true\n }\n)\n</script>\n"],"names":["ref","inject","createNamespace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SAAW,EAAA,IAAA;AAAA,QACX,IAAM,EAAA,IAAA;AAAA,OACR;AAAA,KACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"header-search.vue2.js","sources":["../../../../../../../packages/components/table/src/components/header-search.vue"],"sourcesContent":["<template>\n <div ref=\"headerSearchRef\" :class=\"`${bem.e('header-wrapper')}`\">\n <div :class=\"bem.e('header')\">\n <slot name=\"header\">\n <!-- 左边的插槽 -->\n <div :class=\"bem.e('header-left')\">\n <slot name=\"headerLeft\"> </slot>\n </div>\n <!-- 内容中间插槽 -->\n <div :class=\"bem.e('header-middle')\">\n <slot name=\"headerMiddle\"></slot>\n </div>\n <div :class=\"bem.e('header-right')\">\n <slot name=\"headerRight\"></slot>\n <!-- 切换table和list菜单 -->\n <a-radio-group\n v-if=\"props.menuSwitchOptions?.show\"\n v-model:value=\"contentType\"\n :class=\"`m-l20 ${bem.e('header-menu-radio-group')}`\"\n @change=\"handleMenuSwitchChange\"\n >\n <a-radio-button\n v-for=\"menuItem in menuSwitchRadioList\"\n :key=\"menuItem.value\"\n :class=\"`${bem.e('header-menu-icon')}`\"\n :value=\"menuItem.value\"\n >\n <ll-icon :icon-name=\"menuItem.icon\" :size=\"18\" />\n </a-radio-button>\n </a-radio-group>\n </div>\n </slot>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { ref, inject, watch, onUnmounted } from 'vue'\n\nimport {\n menuSwitchRadioList,\n tableHeaderSearchEmits,\n ImenuSwitchType\n} from '../config'\nimport { createNamespace } from '@ll-plus/utils'\nimport { tableHeaderSearchProps } from '../config'\n\nimport { LlIcon } from '@ll-plus/components'\n\nimport type { RadioChangeEvent } from 'ant-design-vue'\n\n// 1.defineOptions\ndefineOptions({\n name: 'TableHeaderSearch'\n})\n\n// 2.props\nconst props = defineProps(tableHeaderSearchProps)\n\nconst headerSearchRef = ref() // headerSearch的ref\n// 获取menuswitch\nconst contentType = inject('contentType')\nlet observer: MutationObserver // 监听dom内容发生变化\n\n// 3.emits\nconst emits = defineEmits(tableHeaderSearchEmits)\n// 4.const\nconst bem = createNamespace('table')\n\n// 5.methods\n// 切换菜单table\nconst handleMenuSwitchChange = (event: RadioChangeEvent) => {\n const target = event.target\n const value = target.value as ImenuSwitchType\n props.menuSwitchOptions.onChange && props.menuSwitchOptions.onChange(value)\n emits('change', value)\n}\n// 6.watch\nwatch(\n headerSearchRef,\n () => {\n if (headerSearchRef.value) {\n // 创建一个新的MutationObserver对象\n if (!observer) {\n observer = new MutationObserver(function (mutations) {\n mutations.forEach(function () {\n // 检查容器的高度变化\n const newHeight =\n headerSearchRef.value.getBoundingClientRect().height\n emits('changeHeaderSearch', newHeight)\n })\n })\n\n // 配置MutationObserver,监听子节点的变化\n const config = {\n childList: true, // 观察直接子节点\n subtree: true // 及其更低的后代节点\n }\n\n // 开始监听容器的变化\n observer?.observe(headerSearchRef.value, config)\n }\n }\n },\n {\n immediate: true,\n deep: true\n }\n)\n\n// 组件卸载停止监听\nonUnmounted(() => {\n if (observer) {\n observer.disconnect()\n }\n})\n</script>\n"],"names":["ref","inject","createNamespace","watch","onUnmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwDA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAEd,IAAA,MAAM,kBAAkBA,OAAI,EAAA,CAAA;AAE5B,IAAM,MAAA,WAAA,GAAcC,WAAO,aAAa,CAAA,CAAA;AACxC,IAAI,IAAA,QAAA,CAAA;AAGJ,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,GAAA,GAAMC,gCAAgB,OAAO,CAAA,CAAA;AAInC,IAAM,MAAA,sBAAA,GAAyB,CAAC,KAA4B,KAAA;AAC1D,MAAA,MAAM,SAAS,KAAM,CAAA,MAAA,CAAA;AACrB,MAAA,MAAM,QA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() {
7
7
  const scrollRef = vue.ref();
8
8
  const scrollPosition = vue.ref();
9
9
  const isHasScrollBar = vue.ref(false);
10
+ let observer;
11
+ let timer;
10
12
  const handleScroll = (event) => {
11
13
  const target = event.target;
14
+ getSrcollPosition(target);
15
+ };
16
+ const getSrcollPosition = (target) => {
17
+ if (target.scrollHeight > target.offsetHeight) {
18
+ isHasScrollBar.value = true;
19
+ } else {
20
+ isHasScrollBar.value = false;
21
+ }
12
22
  if (!!target.scrollTop) {
13
23
  if (target.scrollTop + target.offsetHeight >= target.scrollHeight - 1) {
14
24
  scrollPosition.value = "bottom";
@@ -23,9 +33,11 @@ function useScroll() {
23
33
  scrollRef,
24
34
  () => {
25
35
  if (scrollRef.value) {
26
- if (scrollRef.value.scrollHeight > scrollRef.value.offsetHeight) {
27
- isHasScrollBar.value = true;
28
- }
36
+ timer = setTimeout(() => {
37
+ if (scrollRef.value.scrollHeight > scrollRef.value.offsetHeight) {
38
+ isHasScrollBar.value = true;
39
+ }
40
+ }, 10);
29
41
  scrollRef.value.addEventListener("scroll", handleScroll);
30
42
  }
31
43
  },
@@ -34,11 +46,68 @@ function useScroll() {
34
46
  deep: true
35
47
  }
36
48
  );
49
+ const handleWindowResize = () => {
50
+ getSrcollPosition(scrollRef.value);
51
+ };
52
+ vue.watch(
53
+ scrollRef,
54
+ () => {
55
+ if (scrollRef.value) {
56
+ window.addEventListener("resize", handleWindowResize);
57
+ }
58
+ },
59
+ {
60
+ immediate: true,
61
+ deep: true
62
+ }
63
+ );
64
+ vue.watch(
65
+ scrollRef,
66
+ () => {
67
+ if (scrollRef.value) {
68
+ if (!observer) {
69
+ observer = new MutationObserver(function(mutations) {
70
+ mutations.forEach(function() {
71
+ if (scrollRef.value.scrollHeight > scrollRef.value.offsetHeight) {
72
+ isHasScrollBar.value = true;
73
+ }
74
+ scrollRef.value.addEventListener("scroll", handleScroll);
75
+ });
76
+ });
77
+ const config = {
78
+ childList: true,
79
+ // 观察直接子节点
80
+ subtree: true
81
+ // 及其更低的后代节点
82
+ };
83
+ observer.observe(scrollRef.value, config);
84
+ }
85
+ }
86
+ },
87
+ {
88
+ immediate: true,
89
+ deep: true
90
+ }
91
+ );
37
92
  vue.onUnmounted(() => {
38
93
  if (scrollRef.value) {
39
94
  scrollRef.value?.removeEventListener("scroll", handleScroll);
40
95
  }
41
96
  });
97
+ vue.onUnmounted(() => {
98
+ window.removeEventListener("resize", handleWindowResize);
99
+ });
100
+ vue.onUnmounted(() => {
101
+ if (observer) {
102
+ observer.disconnect();
103
+ }
104
+ });
105
+ vue.onUnmounted(() => {
106
+ if (timer) {
107
+ clearTimeout(timer);
108
+ timer = null;
109
+ }
110
+ });
42
111
  return { scrollRef, isHasScrollBar, scrollPosition };
43
112
  }
44
113
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-scroll/index.ts"],"sourcesContent":["/**\n * @description: 用于监听滚动行为\n * @return {HTMLElement} elementRef 要滚动监听的dom\n * @return {scrollPosition} IScrollPosition 监听的位置\n */\nimport { onUnmounted, ref, watch } from 'vue'\n\ntype IScrollPosition = 'top' | 'scrolling' | 'bottom' // 滚动到最顶部、滚动中、滚动到最底部\nexport function useScroll() {\n const scrollRef = ref<HTMLElement>() // 监听滚动的dom\n const scrollPosition = ref<IScrollPosition>() // 滚动到的位置\n const isHasScrollBar = ref(false) // 是否有滚动条\n\n // 滚动\n const handleScroll = (event: Event) => {\n const target = event.target as HTMLElement\n if (!!target.scrollTop) {\n // 有0.5px的误差 故-1\n if (target.scrollTop + target.offsetHeight >= target.scrollHeight - 1) {\n // 在最底部\n scrollPosition.value = 'bottom'\n } else {\n // 滚动中\n scrollPosition.value = 'scrolling'\n }\n } else {\n // 在最顶部\n scrollPosition.value = 'top'\n }\n }\n\n // 监听dom的滚动事件\n watch(\n scrollRef,\n () => {\n if (scrollRef.value) {\n if (scrollRef.value.scrollHeight > scrollRef.value.offsetHeight) {\n isHasScrollBar.value = true\n }\n scrollRef.value.addEventListener('scroll', handleScroll)\n }\n },\n {\n immediate: true,\n deep: true\n }\n )\n\n // 卸载滚动事件\n onUnmounted(() => {\n if (scrollRef.value) {\n scrollRef.value?.removeEventListener('scroll', handleScroll)\n }\n })\n\n return { scrollRef, isHasScrollBar, scrollPosition }\n}\n"],"names":["ref","watch","onUnmounted"],"mappings":";;;;;AAQO,SAAS,SAAY,GAAA;AAC1B,EAAA,MAAM,YAAYA,OAAiB,EAAA,CAAA;AACnC,EAAA,MAAM,iBAAiBA,OAAqB,EAAA,CAAA;AAC5C,EAAM,MAAA,cAAA,GAAiBA,QAAI,KAAK,CAAA,CAAA;AAGhC,EAAM,MAAA,YAAA,GAAe,CAAC,KAAiB,KAAA;AACrC,IAAA,MAAM,SAAS,KAAM,CAAA,MAAA,CAAA;AACrB,IAAI,IAAA,CAAC,CAAC,MAAA,CAAO,SAAW,EAAA;AAEtB,MAAA,IAAI,OAAO,SAAY,GAAA,MAAA,CAAO,YAAgB,IAAA,MAAA,CAAO,eAAe,CAAG,EAAA;AAErE,QAAA,cAAA,CAAe,KAAQ,GAAA,QAAA,CAAA;AAAA,OAClB,MAAA;AAEL,QAAA,cAAA,CAAe,KAAQ,GAAA,WAAA,CAAA;AAAA,OACzB;AAAA,KACK,MAAA;AAEL,MAAA,cAAA,CAAe,KAAQ,GAAA,KAAA,CAAA;AAAA,KACzB;AAAA,GACF,CAAA;AAGA,EAAAC,SAAA;AAAA,IACE,SAAA;AAAA,IACA,MAAM;AACJ,MAAA,IAAI,UAAU,KAAO,EAAA;AACnB,QAAA,IAAI,SAAU,CAAA,KAAA,CAAM,YAAe,GAAA,SAAA,CAAU,MAAM,YAAc,EAAA;AAC/D,UAAA,cAAA,CAAe,KAAQ,GAAA,IAAA,CAAA;AAAA,SACzB;AACA,QAAU,SAAA,CAAA,KAAA,CAAM,gBAAiB,CAAA,QAAA,EAAU,YAAY,CAAA,CAAA;AAAA,OACzD;AAAA,KACF;AAAA,IACA;AAAA,MACE,SAAW,EAAA,IAAA;AAAA,MACX,IAAM,EAAA,IAAA;AAAA,KACR;AAAA,GACF,CAAA;AAGA,EAAAC,eAAA,CAAY,MAAM;AAChB,IAAA,IAAI,UAAU,KAAO,EAAA;AACnB,MAAU,SAAA,CAAA,KAAA,EAAO,mBAAoB,CAAA,QAAA,EAAU,YAAY,CAAA,CAAA;AAAA,KAC7D;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA,EAAE,SAAW,EAAA,cAAA,EAAgB,cAAe,EAAA,CAAA;AACrD;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../packages/hooks/use-scroll/index.ts"],"sourcesContent":["/**\n * @description: 用于监听滚动行为/window的resize监听/滚动区域内的dom动态增删dom来添加阴影\n * @return {HTMLElement} elementRef 要滚动监听的dom\n * @return {scrollPosition} IScrollPosition 监听的位置\n */\nimport { onUnmounted, ref, watch } from 'vue'\n\ntype IScrollPosition = 'top' | 'scrolling' | 'bottom' // 滚动到最顶部、滚动中、滚动到最底部\nexport function useScroll() {\n const scrollRef = ref<HTMLElement>() // 监听滚动的dom\n const scrollPosition = ref<IScrollPosition>() // 滚动到的位置\n const isHasScrollBar = ref(false) // 是否有滚动条\n let observer: MutationObserver // 监听dom内容发生变化\n let timer\n\n // 滚动事件\n const handleScroll = (event: Event) => {\n const target = event.target as HTMLElement\n getSrcollPosition(target)\n }\n // 判断滚动位置\n const getSrcollPosition = (target: HTMLElement) => {\n // 判断是否有滚动体条\n if (target.scrollHeight > target.offsetHeight) {\n isHasScrollBar.value = true\n } else {\n isHasScrollBar.value = false\n }\n if (!!target.scrollTop) {\n // 有0.5px的误差 故-1\n if (target.scrollTop + target.offsetHeight >= target.scrollHeight - 1) {\n // 在最底部\n scrollPosition.value = 'bottom'\n } else {\n // 滚动中\n scrollPosition.value = 'scrolling'\n }\n } else {\n // 在最顶部\n scrollPosition.value = 'top'\n }\n }\n\n // dom挂载完成的监听滚动事件\n watch(\n scrollRef,\n () => {\n if (scrollRef.value) {\n // 防止子元素没有加载出来没有高度\n timer = setTimeout(() => {\n if (scrollRef.value!.scrollHeight > scrollRef.value!.offsetHeight) {\n isHasScrollBar.value = true\n }\n }, 10)\n scrollRef.value.addEventListener('scroll', handleScroll)\n }\n },\n {\n immediate: true,\n deep: true\n }\n )\n\n // 监听window的resize事件\n const handleWindowResize = () => {\n getSrcollPosition(scrollRef.value!)\n }\n // 监听window的resize\n watch(\n scrollRef,\n () => {\n if (scrollRef.value) {\n window.addEventListener('resize', handleWindowResize)\n }\n },\n {\n immediate: true,\n deep: true\n }\n )\n\n // 监视对 DOM 树所做更改的能力(对dom增删改等)\n watch(\n scrollRef,\n () => {\n if (scrollRef.value) {\n if (!observer) {\n observer = new MutationObserver(function (mutations) {\n mutations.forEach(function () {\n // 检查容器的高度变化\n if (\n scrollRef.value!.scrollHeight > scrollRef.value!.offsetHeight\n ) {\n isHasScrollBar.value = true\n }\n scrollRef.value!.addEventListener('scroll', handleScroll)\n })\n })\n // 配置MutationObserver,监听子节点的变化\n const config = {\n childList: true, // 观察直接子节点\n subtree: true // 及其更低的后代节点\n }\n // 开始监听容器的变化\n observer.observe(scrollRef.value!, config)\n }\n }\n },\n {\n immediate: true,\n deep: true\n }\n )\n\n // 卸载滚动事件\n onUnmounted(() => {\n if (scrollRef.value) {\n scrollRef.value?.removeEventListener('scroll', handleScroll)\n }\n })\n // 卸载停止resize\n onUnmounted(() => {\n window.removeEventListener('resize', handleWindowResize)\n })\n // 组件卸载停止监听\n onUnmounted(() => {\n if (observer) {\n observer.disconnect()\n }\n })\n\n // 清空定时器\n onUnmounted(() => {\n if (timer) {\n clearTimeout(timer)\n timer = null\n }\n })\n\n return { scrollRef, isHasScrollBar, scrollPosition }\n}\n"],"names":["ref","watch","onUnmounted"],"mappings":";;;;;AAQO,SAAS,SAAY,GAAA;AAC1B,EAAA,MAAM,YAAYA,OAAiB,EAAA,CAAA;AACnC,EAAA,MAAM,iBAAiBA,OAAqB,EAAA,CAAA;AAC5C,EAAM,MAAA,cAAA,GAAiB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KACF;AAAA,IACA;AAAA,MACE,SAAW,EAAA,IAAA;AAAA,MACX,IAAM,EAAA,IAAA;AAAA,KACR;AAAA,GACF,CAAA;AAGA,EAAAC,eAAA,CAAY,MAAM;AAChB,IAAA,IAAI,UAAU,KAAO,EAAA;AACnB,MAAU,SAAA,CAAA,KAAA,EAAO,mBAAoB,CAAA,QAAA,EAAU,YAAY,CAAA,CAAA;AAAA,KAC7D;AAAA,GACD,CAAA,CAAA;AAED,EAAAA,eAAA,CAAY,MAAM;AAChB,IAAO,MAAA,CAAA,mBAAA,CAAoB,UAAU,kBAAkB,CAAA,CAAA;AAAA,GACxD,CAAA,CAAA;AAED,EAAAA,eAAA,CAAY,MAAM;AAChB,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,QAAA,CAAS,UAAW,EAAA,CAAA;AAAA,KACtB;AAAA,GACD,CAAA,CAAA;AAGD,EAAAA,eAAA,CAAY,MAAM;AAChB,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,YAAA,CAAa,KAAK,CAAA,CAAA;AAClB,MAAQ,KAAA,GAAA,IAAA,CAAA;AAAA,KACV;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA,EAAE,SAAW,EAAA,cAAA,EAAgB,cAAe,EAAA,CAAA;AACrD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ll-plus",
3
- "version": "2.4.18",
3
+ "version": "2.4.20",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.mjs",
@@ -1 +1 @@
1
- .ll-breadcrumb-card{position:absolute;inset:0;z-index:100;overflow:auto;background:var(--color-bg-container);border-radius:6px}.ll-breadcrumb-card .ant-spin-nested-loading{height:100%}.ll-breadcrumb-card .ant-spin-nested-loading .ant-spin-container{height:100%}.ll-breadcrumb-card .ant-breadcrumb-separator{display:none}.ll-breadcrumb-card__container{position:relative;display:flex;flex-direction:column;height:100%}.ll-breadcrumb-card__header{display:flex;justify-content:space-between;align-items:center;height:56px;padding:0 20px;border-bottom:1px solid var(--color-border-secondary)}.ll-breadcrumb-card__header .ant-breadcrumb-link{display:flex;align-items:center}.ll-breadcrumb-card__back li{display:flex;align-items:center}.ll-breadcrumb-card__back-icon{margin-right:10px;font-size:16px;cursor:pointer}.ll-breadcrumb-card__title{font-size:16px;font-weight:500}.ll-breadcrumb-card__content{overflow:hidden;display:flex;flex-direction:column;flex:1;margin-top:24px;padding:0 60px 0}.ll-breadcrumb-card__content-container{flex:1;overflow:auto}.ll-breadcrumb-card__content-top-shadow{box-shadow:var(--pop-up-top-box-shadow);height:1px;width:100%;position:sticky;z-index:99;top:0}.ll-breadcrumb-card__content-bottom-shadow{box-shadow:var(--pop-up-bottom-box-shadow);height:1px;width:100%;position:sticky;z-index:99;top:0}.ll-breadcrumb-card__footer{width:100%;height:66px;position:relative;display:flex;justify-content:center;align-items:center}
1
+ .ll-breadcrumb-card{position:absolute;inset:0;z-index:100;overflow:auto;background:var(--color-bg-container);border-radius:6px}.ll-breadcrumb-card .ant-spin-nested-loading{height:100%}.ll-breadcrumb-card .ant-spin-nested-loading .ant-spin-container{height:100%}.ll-breadcrumb-card .ant-breadcrumb-separator{display:none}.ll-breadcrumb-card__container{position:relative;display:flex;flex-direction:column;height:100%}.ll-breadcrumb-card__header{display:flex;justify-content:space-between;align-items:center;height:56px;padding:0 20px;border-bottom:1px solid var(--color-border-secondary)}.ll-breadcrumb-card__header .ant-breadcrumb-link{display:flex;align-items:center}.ll-breadcrumb-card__back li{display:flex;align-items:center}.ll-breadcrumb-card__back-icon{margin-right:10px;font-size:16px;cursor:pointer}.ll-breadcrumb-card__title{font-size:16px;font-weight:500}.ll-breadcrumb-card__content{overflow:hidden;display:flex;flex-direction:column;flex:1;margin-top:24px;padding:0 60px 0}.ll-breadcrumb-card__content-container{flex:1;overflow:auto}.ll-breadcrumb-card__content-top-shadow{box-shadow:var(--pop-up-top-box-shadow);height:1px;width:100%;position:sticky;z-index:99;top:0}.ll-breadcrumb-card__footer{width:100%;height:66px;position:relative;display:flex;justify-content:center;align-items:center}.ll-breadcrumb-card__footer-shadow{box-shadow:var(--pop-up-bottom-box-shadow)}