@v-c/overflow 1.0.5 → 1.1.0-rc.1
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/dist/Item.js +2 -0
- package/dist/Overflow.js +8 -4
- package/dist/RawItem.js +2 -0
- package/dist/context.js +3 -1
- package/dist/hooks/channelUpdate.js +2 -0
- package/dist/hooks/useEffectState.js +8 -0
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/Item.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, createVNode, defineComponent, isVNode, mergeProps, onUnmounted } from "vue";
|
|
2
2
|
import ResizeObserver from "@v-c/resize-observer";
|
|
3
3
|
import { classNames } from "@v-c/util";
|
|
4
|
+
//#region src/Item.tsx
|
|
4
5
|
function _isSlot(s) {
|
|
5
6
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
6
7
|
}
|
|
@@ -89,4 +90,5 @@ var Item_default = /* @__PURE__ */ defineComponent({
|
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
});
|
|
93
|
+
//#endregion
|
|
92
94
|
export { Item_default as default };
|
package/dist/Overflow.js
CHANGED
|
@@ -5,6 +5,7 @@ import RawItem_default from "./RawItem.js";
|
|
|
5
5
|
import { computed, createVNode, defineComponent, isVNode, mergeProps, ref, watchEffect } from "vue";
|
|
6
6
|
import ResizeObserver from "@v-c/resize-observer";
|
|
7
7
|
import { classNames } from "@v-c/util";
|
|
8
|
+
//#region src/Overflow.tsx
|
|
8
9
|
function _isSlot(s) {
|
|
9
10
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
10
11
|
}
|
|
@@ -77,6 +78,9 @@ var Overflow = /* @__PURE__ */ defineComponent({
|
|
|
77
78
|
const isResponsive = computed(() => props.maxCount === RESPONSIVE);
|
|
78
79
|
const shouldResponsive = computed(() => data.value.length && isResponsive.value);
|
|
79
80
|
const invalidate = computed(() => props.maxCount === INVALIDATE);
|
|
81
|
+
/**
|
|
82
|
+
* When is `responsive`, we will always render rest node to get the real width of it for calculation
|
|
83
|
+
*/
|
|
80
84
|
const showRest = computed(() => shouldResponsive.value || typeof props.maxCount === "number" && data.value.length > props.maxCount);
|
|
81
85
|
const mergedData = computed(() => {
|
|
82
86
|
let items = data.value;
|
|
@@ -179,8 +183,8 @@ var Overflow = /* @__PURE__ */ defineComponent({
|
|
|
179
183
|
let suffixStyle = {};
|
|
180
184
|
if (suffixFixedStart.value !== null && shouldResponsive.value) suffixStyle = {
|
|
181
185
|
position: "absolute",
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
top: 0,
|
|
187
|
+
insetInlineStart: `${suffixFixedStart.value}px`
|
|
184
188
|
};
|
|
185
189
|
const itemSharedProps = {
|
|
186
190
|
prefixCls: itemPrefixCls.value,
|
|
@@ -267,5 +271,5 @@ var Overflow = /* @__PURE__ */ defineComponent({
|
|
|
267
271
|
Overflow.Item = RawItem_default;
|
|
268
272
|
Overflow.RESPONSIVE = RESPONSIVE;
|
|
269
273
|
Overflow.INVALIDATE = INVALIDATE;
|
|
270
|
-
|
|
271
|
-
export {
|
|
274
|
+
//#endregion
|
|
275
|
+
export { Overflow as default };
|
package/dist/RawItem.js
CHANGED
|
@@ -2,6 +2,7 @@ import { OverflowContextProvider, useInjectOverflowContext } from "./context.js"
|
|
|
2
2
|
import Item_default from "./Item.js";
|
|
3
3
|
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
4
4
|
import { classNames } from "@v-c/util";
|
|
5
|
+
//#region src/RawItem.tsx
|
|
5
6
|
var RawItem_default = /* @__PURE__ */ defineComponent({
|
|
6
7
|
name: "OverflowRawItem",
|
|
7
8
|
inheritAttrs: false,
|
|
@@ -26,4 +27,5 @@ var RawItem_default = /* @__PURE__ */ defineComponent({
|
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
});
|
|
30
|
+
//#endregion
|
|
29
31
|
export { RawItem_default as default };
|
package/dist/context.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, defineComponent, inject, provide } from "vue";
|
|
2
|
+
//#region src/context.tsx
|
|
2
3
|
var OverflowContextKey = Symbol("OverflowContext");
|
|
3
|
-
|
|
4
|
+
var OverflowContextProvider = /* @__PURE__ */ defineComponent({
|
|
4
5
|
name: "OverflowContextProvider",
|
|
5
6
|
inheritAttrs: false,
|
|
6
7
|
props: { value: { type: Object } },
|
|
@@ -12,4 +13,5 @@ const OverflowContextProvider = /* @__PURE__ */ defineComponent({
|
|
|
12
13
|
function useInjectOverflowContext() {
|
|
13
14
|
return inject(OverflowContextKey, null);
|
|
14
15
|
}
|
|
16
|
+
//#endregion
|
|
15
17
|
export { OverflowContextProvider, useInjectOverflowContext };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import raf from "@v-c/util/dist/raf";
|
|
2
|
+
//#region src/hooks/channelUpdate.ts
|
|
2
3
|
function channelUpdate(callback) {
|
|
3
4
|
if (typeof MessageChannel === "undefined") raf(callback);
|
|
4
5
|
else {
|
|
@@ -7,4 +8,5 @@ function channelUpdate(callback) {
|
|
|
7
8
|
channel.port2.postMessage(void 0);
|
|
8
9
|
}
|
|
9
10
|
}
|
|
11
|
+
//#endregion
|
|
10
12
|
export { channelUpdate as default };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import channelUpdate from "./channelUpdate.js";
|
|
2
2
|
import { ref } from "vue";
|
|
3
3
|
import useEvent from "@v-c/util/dist/hooks/useEvent";
|
|
4
|
+
//#region src/hooks/useEffectState.ts
|
|
5
|
+
/**
|
|
6
|
+
* Batcher for record any useEffectState need update.
|
|
7
|
+
*/
|
|
4
8
|
function useBatcher() {
|
|
5
9
|
const updateFuncRef = ref(null);
|
|
6
10
|
const notifyEffectUpdate = (callback) => {
|
|
@@ -17,6 +21,9 @@ function useBatcher() {
|
|
|
17
21
|
};
|
|
18
22
|
return notifyEffectUpdate;
|
|
19
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Trigger state update by ref to save perf.
|
|
26
|
+
*/
|
|
20
27
|
function useEffectState(notifyEffectUpdate, defaultValue) {
|
|
21
28
|
const stateValue = ref(defaultValue);
|
|
22
29
|
return [stateValue, useEvent((nextValue) => {
|
|
@@ -26,4 +33,5 @@ function useEffectState(notifyEffectUpdate, defaultValue) {
|
|
|
26
33
|
});
|
|
27
34
|
})];
|
|
28
35
|
}
|
|
36
|
+
//#endregion
|
|
29
37
|
export { useEffectState as default, useBatcher };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { OverflowContextProvider } from "./context.js";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import Overflow from "./Overflow.js";
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
var src_default = Overflow;
|
|
5
|
+
//#endregion
|
|
4
6
|
export { OverflowContextProvider, src_default as default };
|