@jetlinks-web/components 3.3.9 → 3.3.11
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/ProTable/Header.js +85 -37
- package/es/ProTable/style/index.js +1 -1
- package/lib/ProTable/Header.js +85 -37
- package/lib/ProTable/style/index.js +1 -1
- package/package.json +3 -3
package/es/ProTable/Header.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
|
|
2
|
+
const op = ops[i];
|
|
3
|
+
const fn = ops[i + 1];
|
|
4
|
+
i += 2;
|
|
5
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
9
|
+
lastAccessLHS = value;
|
|
10
|
+
value = fn(value);
|
|
11
|
+
}
|
|
12
|
+
else if (op === 'call' || op === 'optionalCall') {
|
|
13
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
14
|
+
lastAccessLHS = undefined;
|
|
15
|
+
}
|
|
16
|
+
} return value; }
|
|
1
17
|
/* Analyzed bindings: {
|
|
2
18
|
"initMode": "props",
|
|
19
|
+
"Comment": "setup-const",
|
|
20
|
+
"Fragment": "setup-const",
|
|
21
|
+
"Text": "setup-const",
|
|
3
22
|
"computed": "setup-const",
|
|
23
|
+
"useSlots": "setup-const",
|
|
4
24
|
"RadioGroup": "setup-maybe-ref",
|
|
5
25
|
"RadioButton": "setup-maybe-ref",
|
|
6
26
|
"AIcon": "setup-maybe-ref",
|
|
@@ -8,9 +28,13 @@
|
|
|
8
28
|
"useProTableStyle": "setup-maybe-ref",
|
|
9
29
|
"props": "setup-reactive-const",
|
|
10
30
|
"emits": "setup-const",
|
|
31
|
+
"slots": "setup-maybe-ref",
|
|
11
32
|
"prefixCls": "setup-ref",
|
|
12
33
|
"wrapSSR": "setup-maybe-ref",
|
|
13
|
-
"hashId": "setup-maybe-ref"
|
|
34
|
+
"hashId": "setup-maybe-ref",
|
|
35
|
+
"isValidSlotNode": "setup-const",
|
|
36
|
+
"hasSlotContent": "setup-const",
|
|
37
|
+
"showHeader": "setup-ref"
|
|
14
38
|
} */
|
|
15
39
|
import { defineComponent as _defineComponent } from 'vue';
|
|
16
40
|
import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass } from "vue";
|
|
@@ -20,7 +44,7 @@ const _hoisted_3 = {
|
|
|
20
44
|
key: 0,
|
|
21
45
|
class: "table-body-header-right-button"
|
|
22
46
|
};
|
|
23
|
-
import { computed } from 'vue';
|
|
47
|
+
import { Comment, Fragment, Text, computed, useSlots, } from 'vue';
|
|
24
48
|
import { RadioGroup, RadioButton } from 'ant-design-vue';
|
|
25
49
|
import AIcon from '../Icon';
|
|
26
50
|
import { _headerProps } from './setting';
|
|
@@ -32,7 +56,7 @@ const __sfc_main__ = _defineComponent({
|
|
|
32
56
|
props: {
|
|
33
57
|
..._headerProps,
|
|
34
58
|
initMode: {
|
|
35
|
-
type: [String, undefined],
|
|
59
|
+
type: [String, Boolean, undefined],
|
|
36
60
|
default: undefined
|
|
37
61
|
}
|
|
38
62
|
},
|
|
@@ -40,43 +64,67 @@ const __sfc_main__ = _defineComponent({
|
|
|
40
64
|
setup(__props, { emit: __emit }) {
|
|
41
65
|
const props = __props;
|
|
42
66
|
const emits = __emit;
|
|
67
|
+
const slots = useSlots();
|
|
43
68
|
const prefixCls = computed(() => 'pro-table');
|
|
44
69
|
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
70
|
+
const isValidSlotNode = (node) => {
|
|
71
|
+
if (node.type === Comment) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (node.type === Text) {
|
|
75
|
+
return String(node.children || '').trim().length > 0;
|
|
76
|
+
}
|
|
77
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
78
|
+
return node.children.some((child) => isValidSlotNode(child));
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
const hasSlotContent = (name) => {
|
|
83
|
+
const slot = slots[name];
|
|
84
|
+
return _optionalChain([slot, 'optionalCall', _2 => _2(), 'access', _3 => _3.some, 'call', _4 => _4(isValidSlotNode)]) || false;
|
|
85
|
+
};
|
|
86
|
+
const showHeader = computed(() => {
|
|
87
|
+
const shouldHideEmptyHeader = !props.initMode;
|
|
88
|
+
return shouldHideEmptyHeader || hasSlotContent('headerLeftRender') || hasSlotContent('headerRightRender');
|
|
89
|
+
});
|
|
45
90
|
return (_ctx, _cache) => {
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
return (showHeader.value)
|
|
92
|
+
? (_openBlock(), _createElementBlock("div", {
|
|
93
|
+
key: 0,
|
|
94
|
+
class: _normalizeClass(['jtable-body-header', _unref(hashId)])
|
|
95
|
+
}, [
|
|
96
|
+
_createElementVNode("div", _hoisted_1, [
|
|
97
|
+
_renderSlot(_ctx.$slots, "headerLeftRender")
|
|
98
|
+
]),
|
|
99
|
+
_createElementVNode("div", _hoisted_2, [
|
|
100
|
+
_renderSlot(_ctx.$slots, "headerRightRender"),
|
|
101
|
+
(!__props.initMode)
|
|
102
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_3, [
|
|
103
|
+
_createVNode(_unref(RadioGroup), {
|
|
104
|
+
value: _ctx.mode,
|
|
105
|
+
onChange: _cache[0] || (_cache[0] = (e) => emits('change', e))
|
|
106
|
+
}, {
|
|
107
|
+
default: _withCtx(() => [
|
|
108
|
+
_createVNode(_unref(RadioButton), { value: "TABLE" }, {
|
|
109
|
+
default: _withCtx(() => [
|
|
110
|
+
_createVNode(_unref(AIcon), { type: "UnorderedListOutlined" })
|
|
111
|
+
]),
|
|
112
|
+
_: 1 /* STABLE */
|
|
113
|
+
}),
|
|
114
|
+
_createVNode(_unref(RadioButton), { value: "CARD" }, {
|
|
115
|
+
default: _withCtx(() => [
|
|
116
|
+
_createVNode(_unref(AIcon), { type: "AppstoreOutlined" })
|
|
117
|
+
]),
|
|
118
|
+
_: 1 /* STABLE */
|
|
119
|
+
})
|
|
120
|
+
]),
|
|
121
|
+
_: 1 /* STABLE */
|
|
122
|
+
}, 8 /* PROPS */, ["value"])
|
|
123
|
+
]))
|
|
124
|
+
: _createCommentVNode("v-if", true)
|
|
125
|
+
])
|
|
126
|
+
], 2 /* CLASS */))
|
|
127
|
+
: _createCommentVNode("v-if", true);
|
|
80
128
|
};
|
|
81
129
|
}
|
|
82
130
|
});
|
package/lib/ProTable/Header.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
|
|
2
|
+
const op = ops[i];
|
|
3
|
+
const fn = ops[i + 1];
|
|
4
|
+
i += 2;
|
|
5
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
9
|
+
lastAccessLHS = value;
|
|
10
|
+
value = fn(value);
|
|
11
|
+
}
|
|
12
|
+
else if (op === 'call' || op === 'optionalCall') {
|
|
13
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
14
|
+
lastAccessLHS = undefined;
|
|
15
|
+
}
|
|
16
|
+
} return value; }
|
|
1
17
|
/* Analyzed bindings: {
|
|
2
18
|
"initMode": "props",
|
|
19
|
+
"Comment": "setup-const",
|
|
20
|
+
"Fragment": "setup-const",
|
|
21
|
+
"Text": "setup-const",
|
|
3
22
|
"computed": "setup-const",
|
|
23
|
+
"useSlots": "setup-const",
|
|
4
24
|
"RadioGroup": "setup-maybe-ref",
|
|
5
25
|
"RadioButton": "setup-maybe-ref",
|
|
6
26
|
"AIcon": "setup-maybe-ref",
|
|
@@ -8,9 +28,13 @@
|
|
|
8
28
|
"useProTableStyle": "setup-maybe-ref",
|
|
9
29
|
"props": "setup-reactive-const",
|
|
10
30
|
"emits": "setup-const",
|
|
31
|
+
"slots": "setup-maybe-ref",
|
|
11
32
|
"prefixCls": "setup-ref",
|
|
12
33
|
"wrapSSR": "setup-maybe-ref",
|
|
13
|
-
"hashId": "setup-maybe-ref"
|
|
34
|
+
"hashId": "setup-maybe-ref",
|
|
35
|
+
"isValidSlotNode": "setup-const",
|
|
36
|
+
"hasSlotContent": "setup-const",
|
|
37
|
+
"showHeader": "setup-ref"
|
|
14
38
|
} */
|
|
15
39
|
import { defineComponent as _defineComponent } from 'vue';
|
|
16
40
|
import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass } from "vue";
|
|
@@ -20,7 +44,7 @@ const _hoisted_3 = {
|
|
|
20
44
|
key: 0,
|
|
21
45
|
class: "table-body-header-right-button"
|
|
22
46
|
};
|
|
23
|
-
import { computed } from 'vue';
|
|
47
|
+
import { Comment, Fragment, Text, computed, useSlots, } from 'vue';
|
|
24
48
|
import { RadioGroup, RadioButton } from 'ant-design-vue';
|
|
25
49
|
import AIcon from '../Icon';
|
|
26
50
|
import { _headerProps } from './setting';
|
|
@@ -32,7 +56,7 @@ const __sfc_main__ = _defineComponent({
|
|
|
32
56
|
props: {
|
|
33
57
|
..._headerProps,
|
|
34
58
|
initMode: {
|
|
35
|
-
type: [String, undefined],
|
|
59
|
+
type: [String, Boolean, undefined],
|
|
36
60
|
default: undefined
|
|
37
61
|
}
|
|
38
62
|
},
|
|
@@ -40,43 +64,67 @@ const __sfc_main__ = _defineComponent({
|
|
|
40
64
|
setup(__props, { emit: __emit }) {
|
|
41
65
|
const props = __props;
|
|
42
66
|
const emits = __emit;
|
|
67
|
+
const slots = useSlots();
|
|
43
68
|
const prefixCls = computed(() => 'pro-table');
|
|
44
69
|
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
70
|
+
const isValidSlotNode = (node) => {
|
|
71
|
+
if (node.type === Comment) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (node.type === Text) {
|
|
75
|
+
return String(node.children || '').trim().length > 0;
|
|
76
|
+
}
|
|
77
|
+
if (node.type === Fragment && Array.isArray(node.children)) {
|
|
78
|
+
return node.children.some((child) => isValidSlotNode(child));
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
const hasSlotContent = (name) => {
|
|
83
|
+
const slot = slots[name];
|
|
84
|
+
return _optionalChain([slot, 'optionalCall', _2 => _2(), 'access', _3 => _3.some, 'call', _4 => _4(isValidSlotNode)]) || false;
|
|
85
|
+
};
|
|
86
|
+
const showHeader = computed(() => {
|
|
87
|
+
const shouldHideEmptyHeader = !props.initMode;
|
|
88
|
+
return shouldHideEmptyHeader || hasSlotContent('headerLeftRender') || hasSlotContent('headerRightRender');
|
|
89
|
+
});
|
|
45
90
|
return (_ctx, _cache) => {
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
return (showHeader.value)
|
|
92
|
+
? (_openBlock(), _createElementBlock("div", {
|
|
93
|
+
key: 0,
|
|
94
|
+
class: _normalizeClass(['jtable-body-header', _unref(hashId)])
|
|
95
|
+
}, [
|
|
96
|
+
_createElementVNode("div", _hoisted_1, [
|
|
97
|
+
_renderSlot(_ctx.$slots, "headerLeftRender")
|
|
98
|
+
]),
|
|
99
|
+
_createElementVNode("div", _hoisted_2, [
|
|
100
|
+
_renderSlot(_ctx.$slots, "headerRightRender"),
|
|
101
|
+
(!__props.initMode)
|
|
102
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_3, [
|
|
103
|
+
_createVNode(_unref(RadioGroup), {
|
|
104
|
+
value: _ctx.mode,
|
|
105
|
+
onChange: _cache[0] || (_cache[0] = (e) => emits('change', e))
|
|
106
|
+
}, {
|
|
107
|
+
default: _withCtx(() => [
|
|
108
|
+
_createVNode(_unref(RadioButton), { value: "TABLE" }, {
|
|
109
|
+
default: _withCtx(() => [
|
|
110
|
+
_createVNode(_unref(AIcon), { type: "UnorderedListOutlined" })
|
|
111
|
+
]),
|
|
112
|
+
_: 1 /* STABLE */
|
|
113
|
+
}),
|
|
114
|
+
_createVNode(_unref(RadioButton), { value: "CARD" }, {
|
|
115
|
+
default: _withCtx(() => [
|
|
116
|
+
_createVNode(_unref(AIcon), { type: "AppstoreOutlined" })
|
|
117
|
+
]),
|
|
118
|
+
_: 1 /* STABLE */
|
|
119
|
+
})
|
|
120
|
+
]),
|
|
121
|
+
_: 1 /* STABLE */
|
|
122
|
+
}, 8 /* PROPS */, ["value"])
|
|
123
|
+
]))
|
|
124
|
+
: _createCommentVNode("v-if", true)
|
|
125
|
+
])
|
|
126
|
+
], 2 /* CLASS */))
|
|
127
|
+
: _createCommentVNode("v-if", true);
|
|
80
128
|
};
|
|
81
129
|
}
|
|
82
130
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetlinks-web/components",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -154,9 +154,9 @@
|
|
|
154
154
|
"webpack-dev-server": "^4.0.0",
|
|
155
155
|
"webpack-merge": "^5.0.0",
|
|
156
156
|
"webpackbar": "^5.0.2",
|
|
157
|
-
"@jetlinks-web/
|
|
157
|
+
"@jetlinks-web/hooks": "^1.1.2",
|
|
158
158
|
"@jetlinks-web/constants": "^1.0.9",
|
|
159
|
-
"@jetlinks-web/
|
|
159
|
+
"@jetlinks-web/utils": "^1.3.6"
|
|
160
160
|
},
|
|
161
161
|
"publishConfig": {
|
|
162
162
|
"registry": "https://registry.npmjs.org/",
|