@opentiny/vue-renderless 3.16.0 → 3.16.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/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/package.json +1 -1
- package/tabs/index.js +37 -13
- package/types/action-menu.type.d.ts +12 -4
package/common/index.js
CHANGED
package/common/runtime.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"homepage": "https://opentiny.design/tiny-vue",
|
|
6
6
|
"keywords": [
|
package/tabs/index.js
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const getOrderedPanes = (parent, panes) => {
|
|
3
|
+
const slotDefault = parent.$slots.default;
|
|
4
|
+
let orders;
|
|
5
|
+
if (typeof slotDefault === "function") {
|
|
6
|
+
orders = [];
|
|
7
|
+
const tabVnodes = slotDefault();
|
|
8
|
+
const handler = ({ type, componentOptions, props }) => {
|
|
9
|
+
let componentName = type && type.componentName;
|
|
10
|
+
if (!componentName)
|
|
11
|
+
componentName = componentOptions && componentOptions.Ctor.extendOptions.componentName;
|
|
12
|
+
if (componentName === "TabItem") {
|
|
13
|
+
const paneName = props && props.name || componentOptions && componentOptions.propsData.name;
|
|
14
|
+
orders.push(paneName);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
tabVnodes.forEach(({ type, componentOptions, props, children }) => {
|
|
18
|
+
if (type && (type.toString() === "Symbol(Fragment)" || // vue@3.3之前的开发模式
|
|
19
|
+
type.toString() === "Symbol(v-fgt)" || // vue@3.3.1 的变更
|
|
20
|
+
type.toString() === "Symbol()")) {
|
|
21
|
+
Array.isArray(children) && children.forEach(({ type: type2, componentOptions: componentOptions2, props: props2 }) => handler({ type: type2, componentOptions: componentOptions2, props: props2 }));
|
|
22
|
+
} else {
|
|
23
|
+
handler({ type, componentOptions, props });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (orders.length > 0) {
|
|
28
|
+
let tmpPanes = [];
|
|
29
|
+
orders.forEach((paneName) => {
|
|
30
|
+
let pane = panes.find((pane2) => pane2.name === paneName);
|
|
31
|
+
if (pane)
|
|
32
|
+
tmpPanes.push(pane);
|
|
33
|
+
});
|
|
34
|
+
panes = tmpPanes;
|
|
35
|
+
}
|
|
36
|
+
return panes;
|
|
37
|
+
};
|
|
2
38
|
const calcPaneInstances = ({
|
|
3
39
|
constants,
|
|
4
40
|
parent,
|
|
@@ -28,19 +64,7 @@ const calcPaneInstances = ({
|
|
|
28
64
|
index > -1 ? currentPanes[index] = vm : currentPanes.push(vm);
|
|
29
65
|
}
|
|
30
66
|
});
|
|
31
|
-
const
|
|
32
|
-
const paneStates = state.panes.map((pane) => pane.state);
|
|
33
|
-
let newPanes = [];
|
|
34
|
-
for (let i = 0; i < paneStates.length; i++) {
|
|
35
|
-
const paneState = paneStates[i];
|
|
36
|
-
const index = currentPaneStates.indexOf(paneState);
|
|
37
|
-
if (index > -1) {
|
|
38
|
-
newPanes.push(state.panes[i]);
|
|
39
|
-
currentPanes.splice(index, 1);
|
|
40
|
-
currentPaneStates.splice(index, 1);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
newPanes = newPanes.concat(currentPanes);
|
|
67
|
+
const newPanes = getOrderedPanes(parent, currentPanes);
|
|
44
68
|
const panesChanged = !(newPanes.length === state.panes.length && newPanes.every((pane, index) => pane.state === state.panes[index].state));
|
|
45
69
|
if (isForceUpdate || panesChanged) {
|
|
46
70
|
state.panes = newPanes;
|
|
@@ -87,14 +87,22 @@ declare const visibleChange: (emit: IActionMenuRenderlessParams['emit']) => (sta
|
|
|
87
87
|
*
|
|
88
88
|
*/
|
|
89
89
|
|
|
90
|
+
interface IActonMenuOptionsItem {
|
|
91
|
+
label?: string;
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
divided?: boolean;
|
|
94
|
+
children?: IActonMenuOptionsItem[];
|
|
95
|
+
icon?: any;
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
}
|
|
90
98
|
interface IActionMenuState {
|
|
91
|
-
visibleOptions:
|
|
92
|
-
moreOptions:
|
|
99
|
+
visibleOptions: IActonMenuOptionsItem[];
|
|
100
|
+
moreOptions: IActonMenuOptionsItem[];
|
|
93
101
|
isCardMode: boolean;
|
|
94
102
|
spacing: string | number;
|
|
95
103
|
maxShowNum: number;
|
|
96
104
|
moreText: string;
|
|
97
|
-
suffixIcon: string |
|
|
105
|
+
suffixIcon: string | object;
|
|
98
106
|
}
|
|
99
107
|
type IActionMenuProps = ExtractPropTypes<typeof actionMenuProps>;
|
|
100
108
|
type IActionMenuRenderlessParams = ISharedRenderlessFunctionParams<null> & {
|
|
@@ -118,4 +126,4 @@ interface IActionMenuApi {
|
|
|
118
126
|
}
|
|
119
127
|
type IActionMenuRenderlessParamUtils = ISharedRenderlessParamUtils<null>;
|
|
120
128
|
|
|
121
|
-
export { IActionMenuApi, IActionMenuItemData, IActionMenuProps, IActionMenuRenderlessParamUtils, IActionMenuRenderlessParams, IActionMenuState };
|
|
129
|
+
export { IActionMenuApi, IActionMenuItemData, IActionMenuProps, IActionMenuRenderlessParamUtils, IActionMenuRenderlessParams, IActionMenuState, IActonMenuOptionsItem };
|