@meethive/components 0.0.3 → 0.0.5

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 (111) hide show
  1. package/es/AutoComplete/AutoComplete.js +71 -80
  2. package/es/BadgeStatus/Badge.js +38 -47
  3. package/es/CardSelect/CardSelect.js +115 -137
  4. package/es/CheckButton/CheckButton.js +102 -118
  5. package/es/ConfigProvider/ConfigProvider.js +44 -68
  6. package/es/DragModal/DragModal.js +191 -212
  7. package/es/EditTable/Body.js +158 -189
  8. package/es/EditTable/CellRender.js +10 -12
  9. package/es/EditTable/EditTable.js +385 -434
  10. package/es/EditTable/FormItem.js +140 -169
  11. package/es/EditTable/Group.js +171 -204
  12. package/es/EditTable/Header.js +57 -63
  13. package/es/EditTable/HeaderRender.js +10 -12
  14. package/es/EditTable/components/ContextMenu/Menu.js +78 -86
  15. package/es/EditTable/components/Search/Search.js +151 -163
  16. package/es/EditTable/components/Search/Sort.js +104 -119
  17. package/es/Ellipsis/Ellipsis.js +144 -148
  18. package/es/Empty/Empty.js +51 -57
  19. package/es/FullPage/FullPage.js +20 -19
  20. package/es/Icon/Icon.js +42 -49
  21. package/es/LocaleProvider/LocaleProvider.js +32 -38
  22. package/es/Markdown/Markdown.js +101 -118
  23. package/es/PermissionButton/PermissionButton.js +118 -118
  24. package/es/ProLayout/Basic/BasicLayout.js +361 -418
  25. package/es/ProLayout/Basic/Header.js +97 -111
  26. package/es/ProLayout/PageContainer/index.js +298 -344
  27. package/es/ProLayout/SiderMenu/BaseMenu.js +233 -240
  28. package/es/ProTable/Alert.js +39 -40
  29. package/es/ProTable/Content.js +84 -97
  30. package/es/ProTable/Header.js +32 -33
  31. package/es/ProTable/Pagination.js +56 -55
  32. package/es/ProTable/ProTable.js +256 -276
  33. package/es/RadioButton/RadioButton.js +48 -53
  34. package/es/Scrollbar/Bar.js +65 -76
  35. package/es/Scrollbar/Scrollbar.js +129 -161
  36. package/es/Scrollbar/Thumb.js +101 -150
  37. package/es/Search/Item.js +208 -236
  38. package/es/Search/Search.js +90 -90
  39. package/es/Skeleton/Skeleton.js +26 -27
  40. package/es/Skeleton/components/DashBoardCard.js +26 -27
  41. package/es/Skeleton/components/DashBoardChart.js +26 -27
  42. package/es/Skeleton/components/Detail.js +26 -27
  43. package/es/Skeleton/components/Drawer.js +26 -27
  44. package/es/Skeleton/components/Item.js +55 -54
  45. package/es/Skeleton/components/List.js +29 -27
  46. package/es/Skeleton/components/ListCard.js +28 -28
  47. package/es/Skeleton/components/ListCardItem.js +20 -20
  48. package/es/Skeleton/components/ListTable.js +26 -27
  49. package/es/Skeleton/components/Page.js +27 -26
  50. package/es/Skeleton/components/Search.js +16 -16
  51. package/es/Skeleton/components/Tree.js +26 -27
  52. package/es/TimeFormat/TimeFormat.js +32 -36
  53. package/es/Title/Title.js +23 -26
  54. package/es/ValueItem/ValueItem.js +100 -113
  55. package/es/VirtualTable/VirtualTable.js +235 -271
  56. package/lib/AutoComplete/AutoComplete.js +71 -80
  57. package/lib/BadgeStatus/Badge.js +38 -47
  58. package/lib/CardSelect/CardSelect.js +115 -137
  59. package/lib/CheckButton/CheckButton.js +102 -118
  60. package/lib/ConfigProvider/ConfigProvider.js +44 -68
  61. package/lib/DragModal/DragModal.js +191 -212
  62. package/lib/EditTable/Body.js +158 -189
  63. package/lib/EditTable/CellRender.js +10 -12
  64. package/lib/EditTable/EditTable.js +385 -434
  65. package/lib/EditTable/FormItem.js +140 -169
  66. package/lib/EditTable/Group.js +171 -204
  67. package/lib/EditTable/Header.js +57 -63
  68. package/lib/EditTable/HeaderRender.js +10 -12
  69. package/lib/EditTable/components/ContextMenu/Menu.js +78 -86
  70. package/lib/EditTable/components/Search/Search.js +151 -163
  71. package/lib/EditTable/components/Search/Sort.js +104 -119
  72. package/lib/Ellipsis/Ellipsis.js +144 -148
  73. package/lib/Empty/Empty.js +51 -57
  74. package/lib/FullPage/FullPage.js +20 -19
  75. package/lib/Icon/Icon.js +42 -49
  76. package/lib/LocaleProvider/LocaleProvider.js +32 -38
  77. package/lib/Markdown/Markdown.js +101 -118
  78. package/lib/PermissionButton/PermissionButton.js +118 -118
  79. package/lib/ProLayout/Basic/BasicLayout.js +361 -418
  80. package/lib/ProLayout/Basic/Header.js +97 -111
  81. package/lib/ProLayout/PageContainer/index.js +298 -344
  82. package/lib/ProLayout/SiderMenu/BaseMenu.js +233 -240
  83. package/lib/ProTable/Alert.js +39 -40
  84. package/lib/ProTable/Content.js +84 -97
  85. package/lib/ProTable/Header.js +32 -33
  86. package/lib/ProTable/Pagination.js +56 -55
  87. package/lib/ProTable/ProTable.js +256 -276
  88. package/lib/RadioButton/RadioButton.js +48 -53
  89. package/lib/Scrollbar/Bar.js +65 -76
  90. package/lib/Scrollbar/Scrollbar.js +129 -161
  91. package/lib/Scrollbar/Thumb.js +101 -150
  92. package/lib/Search/Item.js +208 -236
  93. package/lib/Search/Search.js +90 -90
  94. package/lib/Skeleton/Skeleton.js +26 -27
  95. package/lib/Skeleton/components/DashBoardCard.js +26 -27
  96. package/lib/Skeleton/components/DashBoardChart.js +26 -27
  97. package/lib/Skeleton/components/Detail.js +26 -27
  98. package/lib/Skeleton/components/Drawer.js +26 -27
  99. package/lib/Skeleton/components/Item.js +55 -54
  100. package/lib/Skeleton/components/List.js +29 -27
  101. package/lib/Skeleton/components/ListCard.js +28 -28
  102. package/lib/Skeleton/components/ListCardItem.js +20 -20
  103. package/lib/Skeleton/components/ListTable.js +26 -27
  104. package/lib/Skeleton/components/Page.js +27 -26
  105. package/lib/Skeleton/components/Search.js +16 -16
  106. package/lib/Skeleton/components/Tree.js +26 -27
  107. package/lib/TimeFormat/TimeFormat.js +32 -36
  108. package/lib/Title/Title.js +23 -26
  109. package/lib/ValueItem/ValueItem.js +100 -113
  110. package/lib/VirtualTable/VirtualTable.js +235 -271
  111. package/package.json +1 -1
@@ -1,241 +1,234 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
- import { defineComponent, watchEffect, isVNode, resolveComponent, getCurrentInstance, withCtx, } from 'vue'
3
- import { Menu } from 'ant-design-vue'
4
- import { createFromIconfontCN } from '@ant-design/icons-vue'
5
- import { defaultSettingProps } from '../defaultSettings'
6
- import { defaultPrefixCls } from '../RouteContext'
7
- import IconFont from '../../Icon'
8
- import { regular } from '@meethive/utils'
9
-
10
- let AntdIconFont = createFromIconfontCN({
11
- scriptUrl: ''
12
- })
13
-
14
- const LazyIcon = (props) => {
15
- const { icon, iconUrl, prefixCls = defaultPrefixCls } = props
16
- if (!icon) return null
17
- if (isVNode(icon)) {
18
- return icon
19
- }
20
- if (typeof icon === 'string' && icon !== '') {
21
- if (regular.isUrl(icon) || regular.isImg(icon)) {
22
- return (
23
- React.createElement('img', {
24
- src: icon,
25
- alt: "icon",
26
- class: `${prefixCls}-sider-menu-icon`,}
27
- )
28
- )
29
- }
30
- return iconUrl
31
- ? React.createElement(AntdIconFont, { type: icon,} )
32
- : React.createElement(IconFont, { type: icon,} )
33
- }
34
- return null
35
- }
36
-
37
- export const baseMenuProps = {
38
- ...defaultSettingProps,
39
- prefixCls: {
40
- type: String,
41
- default: defaultPrefixCls
42
- },
43
- locale: {
44
- type: [Function, Boolean],
45
- default: (t) => t
46
- },
47
- menuData: {
48
- type: Array,
49
- default: () => []
50
- },
51
- mode: {
52
- type: String,
53
- default: 'inline'
54
- },
55
- theme: {
56
- type: String,
57
- default: 'dark'
58
- },
59
- collapsed: {
60
- type: Boolean,
61
- default: () => false
62
- },
63
- openKeys: {
64
- type: Array,
65
- default: () => undefined
66
- },
67
- selectedKeys: {
68
- type: Array,
69
- default: () => undefined
70
- },
71
- menuProps: {
72
- type: Object,
73
- default: () => null
74
- },
75
- menuItemRender: {
76
- type: [Object, Function, Boolean],
77
- default: () => undefined
78
- },
79
- subMenuItemRender: {
80
- type: [Object, Function, Boolean],
81
- default: () => undefined
82
- },
83
- onClick: [Function, Object]
84
- }
85
-
86
- // MenuUtil class for recursive menu rendering (matching ES source)
87
- class MenuUtil {
88
-
89
-
90
-
91
-
92
- constructor(_props, ctx) {;MenuUtil.prototype.__init.call(this);MenuUtil.prototype.__init2.call(this);MenuUtil.prototype.__init3.call(this);
93
- this.props = _props
94
- this.ctx = ctx
95
- this.RouterLink = resolveComponent('router-link')
96
- }
97
-
98
- __init() {this.getNavMenuItems = (menusData = []) => {
99
- return menusData.map((item) => this.getSubMenuOrItem(item)).filter((item) => item)
100
- }}
101
-
102
- __init2() {this.getSubMenuOrItem = (item) => {
103
- if (
104
- Array.isArray(item.children) &&
105
- item.children.length > 0 &&
106
- !_optionalChain([item, 'access', _27 => _27.meta, 'optionalAccess', _28 => _28.hideInMenu]) &&
107
- !_optionalChain([item, 'access', _29 => _29.meta, 'optionalAccess', _30 => _30.hideChildrenInMenu])
108
- ) {
109
- if (this.props.subMenuItemRender) {
110
- const subMenuItemRender = withCtx(this.props.subMenuItemRender, this.ctx)
111
- return subMenuItemRender({
112
- item,
113
- children: this.getNavMenuItems(item.children)
114
- })
115
- }
116
- const { prefixCls, locale } = this.props
117
- const menuTitle = locale && locale(_optionalChain([item, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.title])) || _optionalChain([item, 'access', _33 => _33.meta, 'optionalAccess', _34 => _34.title])
118
- const defaultTitle = _optionalChain([item, 'access', _35 => _35.meta, 'optionalAccess', _36 => _36.icon])
119
- ? React.createElement('span', { class: `${prefixCls}-menu-item`,}
120
- , React.createElement('span', { class: `${prefixCls}-menu-item-title`,}, menuTitle)
121
- )
122
- : React.createElement('span', { class: `${prefixCls}-menu-item`,}, menuTitle)
123
-
124
- return (
125
- React.createElement(Menu.SubMenu, {
126
- title: defaultTitle,
127
- key: item.key || item.path,
128
- popupClassName: `${prefixCls}-menu-popup`,
129
- icon: React.createElement(LazyIcon, { iconUrl: this.props.iconfontUrl, icon: _optionalChain([item, 'access', _37 => _37.meta, 'optionalAccess', _38 => _38.icon]),} ),}
1
+ import { defineComponent, watchEffect, isVNode, resolveComponent, getCurrentInstance, withCtx, createVNode as _createVNode, isVNode as _isVNode, mergeProps as _mergeProps } from 'vue';
2
+ import { Menu } from 'ant-design-vue';
3
+ import { createFromIconfontCN } from '@ant-design/icons-vue';
4
+ import { defaultSettingProps } from '../defaultSettings';
5
+ import { defaultPrefixCls } from '../RouteContext';
6
+ import IconFont from '../../Icon';
7
+ import { regular } from '@meethive/utils';
8
+ function _isSlot(s) {
9
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
10
+ }
11
+ let AntdIconFont = createFromIconfontCN({
12
+ scriptUrl: ''
13
+ });
14
+ const LazyIcon = props => {
15
+ const {
16
+ icon,
17
+ iconUrl,
18
+ prefixCls = defaultPrefixCls
19
+ } = props;
20
+ if (!icon) return null;
21
+ if (isVNode(icon)) {
22
+ return icon;
23
+ }
24
+ if (typeof icon === 'string' && icon !== '') {
25
+ if (regular.isUrl(icon) || regular.isImg(icon)) {
26
+ return _createVNode("img", {
27
+ "src": icon,
28
+ "alt": "icon",
29
+ "class": `${prefixCls}-sider-menu-icon`
30
+ }, null);
31
+ }
32
+ return iconUrl ? _createVNode(AntdIconFont, {
33
+ "type": icon
34
+ }, null) : _createVNode(IconFont, {
35
+ "type": icon
36
+ }, null);
37
+ }
38
+ return null;
39
+ };
40
+ export const baseMenuProps = {
41
+ ...defaultSettingProps,
42
+ prefixCls: {
43
+ type: String,
44
+ default: defaultPrefixCls
45
+ },
46
+ locale: {
47
+ type: [Function, Boolean],
48
+ default: t => t
49
+ },
50
+ menuData: {
51
+ type: Array,
52
+ default: () => []
53
+ },
54
+ mode: {
55
+ type: String,
56
+ default: 'inline'
57
+ },
58
+ theme: {
59
+ type: String,
60
+ default: 'dark'
61
+ },
62
+ collapsed: {
63
+ type: Boolean,
64
+ default: () => false
65
+ },
66
+ openKeys: {
67
+ type: Array,
68
+ default: () => undefined
69
+ },
70
+ selectedKeys: {
71
+ type: Array,
72
+ default: () => undefined
73
+ },
74
+ menuProps: {
75
+ type: Object,
76
+ default: () => null
77
+ },
78
+ menuItemRender: {
79
+ type: [Object, Function, Boolean],
80
+ default: () => undefined
81
+ },
82
+ subMenuItemRender: {
83
+ type: [Object, Function, Boolean],
84
+ default: () => undefined
85
+ },
86
+ onClick: [Function, Object]
87
+ };
130
88
 
131
- , this.getNavMenuItems(item.children)
132
- )
133
- )
134
- }
135
-
136
- const menuItemRender = this.props.menuItemRender && withCtx(this.props.menuItemRender, this.ctx)
137
- const [title, icon] = this.getMenuItem(item)
138
-
139
- return (
140
- menuItemRender &&
141
- menuItemRender({
142
- item,
143
- title,
144
- icon
145
- })
146
- ) || (
147
- React.createElement(Menu.Item, {
148
- disabled: _optionalChain([item, 'access', _39 => _39.meta, 'optionalAccess', _40 => _40.disabled]),
149
- danger: _optionalChain([item, 'access', _41 => _41.meta, 'optionalAccess', _42 => _42.danger]),
150
- key: item.key || item.path,}
151
-
152
- , title
153
- )
154
- )
155
- }}
156
-
157
- __init3() {this.getMenuItem = (item) => {
158
- const meta = { ...item.meta }
159
- const target = meta.target || null
160
- const hasUrl = regular.isUrl(item.path)
161
- const CustomTag = (target && 'a') || this.RouterLink
162
- const routerProps = {
163
- to: {
164
- name: item.name,
165
- ...item.meta
166
- }
167
- }
168
- const attrs = hasUrl || target ? {
169
- ...item.meta,
170
- href: item.path,
171
- target: target
172
- } : {}
173
- const { prefixCls, locale } = this.props
174
- const icon = _optionalChain([item, 'access', _43 => _43.meta, 'optionalAccess', _44 => _44.icon]) && (
175
- React.createElement(LazyIcon, { iconUrl: this.props.iconfontUrl, icon: _optionalChain([item, 'access', _45 => _45.meta, 'optionalAccess', _46 => _46.icon]),} )
176
- ) || undefined
177
- const menuTitle = locale && locale(_optionalChain([item, 'access', _47 => _47.meta, 'optionalAccess', _48 => _48.title])) || _optionalChain([item, 'access', _49 => _49.meta, 'optionalAccess', _50 => _50.title])
178
- const defaultTitle = _optionalChain([item, 'access', _51 => _51.meta, 'optionalAccess', _52 => _52.icon])
179
- ? React.createElement(CustomTag, { ...attrs, ...routerProps, class: `${prefixCls}-menu-item`,}
180
- , icon
181
- , React.createElement('span', { class: `${prefixCls}-menu-item-title`,}, menuTitle)
182
- )
183
- : React.createElement(CustomTag, { ...attrs, ...routerProps, class: `${prefixCls}-menu-item`,}
184
- , React.createElement('span', null, menuTitle)
185
- )
186
- return [defaultTitle, icon]
187
- }}
188
- }
189
-
190
- export default defineComponent({
191
- name: 'BaseMenu',
192
- props: baseMenuProps ,
193
- emits: ['update:openKeys', 'update:selectedKeys', 'click'],
194
- setup(props, { emit }) {
195
- const ctx = getCurrentInstance()
196
- const menuUtil = new MenuUtil(props, ctx)
197
-
198
- watchEffect(() => {
199
- if (props.iconfontUrl) {
200
- AntdIconFont = createFromIconfontCN({
201
- scriptUrl: props.iconfontUrl
202
- })
203
- }
204
- })
205
-
206
- const handleOpenChange = (openKeys) => {
207
- emit('update:openKeys', openKeys)
208
- }
209
-
210
- const handleSelect = (args) => {
211
- // ignore https? link handle selectkeys
212
- if (regular.isUrl(args.key)) {
213
- return
214
- }
215
- emit('update:selectedKeys', args.selectedKeys)
216
- }
217
-
218
- const handleClick = (args) => {
219
- emit('click', args)
220
- }
221
-
222
- return () => {
223
- return (
224
- React.createElement(Menu, {
225
- key: "Menu",
226
- inlineIndent: 16,
227
- mode: props.mode,
228
- theme: props.theme,
229
- openKeys: props.openKeys === false ? [] : props.openKeys,
230
- selectedKeys: props.selectedKeys || [],
231
- onOpenChange: handleOpenChange,
232
- onSelect: handleSelect,
233
- onClick: handleClick,
234
- ...props.menuProps,}
235
-
236
- , menuUtil.getNavMenuItems(props.menuData)
237
- )
238
- )
239
- }
240
- }
241
- })
89
+ // MenuUtil class for recursive menu rendering (matching ES source)
90
+ class MenuUtil {
91
+ constructor(_props, ctx) {
92
+ this.props = _props;
93
+ this.ctx = ctx;
94
+ this.RouterLink = resolveComponent('router-link');
95
+ }
96
+ getNavMenuItems = (menusData = []) => {
97
+ return menusData.map(item => this.getSubMenuOrItem(item)).filter(item => item);
98
+ };
99
+ getSubMenuOrItem = item => {
100
+ if (Array.isArray(item.children) && item.children.length > 0 && !item.meta?.hideInMenu && !item.meta?.hideChildrenInMenu) {
101
+ let _slot;
102
+ if (this.props.subMenuItemRender) {
103
+ const subMenuItemRender = withCtx(this.props.subMenuItemRender, this.ctx);
104
+ return subMenuItemRender({
105
+ item,
106
+ children: this.getNavMenuItems(item.children)
107
+ });
108
+ }
109
+ const {
110
+ prefixCls,
111
+ locale
112
+ } = this.props;
113
+ const menuTitle = locale && locale(item.meta?.title) || item.meta?.title;
114
+ const defaultTitle = item.meta?.icon ? _createVNode("span", {
115
+ "class": `${prefixCls}-menu-item`
116
+ }, [_createVNode("span", {
117
+ "class": `${prefixCls}-menu-item-title`
118
+ }, [menuTitle])]) : _createVNode("span", {
119
+ "class": `${prefixCls}-menu-item`
120
+ }, [menuTitle]);
121
+ return _createVNode(Menu.SubMenu, {
122
+ "title": defaultTitle,
123
+ "key": item.key || item.path,
124
+ "popupClassName": `${prefixCls}-menu-popup`,
125
+ "icon": _createVNode(LazyIcon, {
126
+ "iconUrl": this.props.iconfontUrl,
127
+ "icon": item.meta?.icon
128
+ }, null)
129
+ }, _isSlot(_slot = this.getNavMenuItems(item.children)) ? _slot : {
130
+ default: () => [_slot]
131
+ });
132
+ }
133
+ const menuItemRender = this.props.menuItemRender && withCtx(this.props.menuItemRender, this.ctx);
134
+ const [title, icon] = this.getMenuItem(item);
135
+ return menuItemRender && menuItemRender({
136
+ item,
137
+ title,
138
+ icon
139
+ }) || _createVNode(Menu.Item, {
140
+ "disabled": item.meta?.disabled,
141
+ "danger": item.meta?.danger,
142
+ "key": item.key || item.path
143
+ }, _isSlot(title) ? title : {
144
+ default: () => [title]
145
+ });
146
+ };
147
+ getMenuItem = item => {
148
+ const meta = {
149
+ ...item.meta
150
+ };
151
+ const target = meta.target || null;
152
+ const hasUrl = regular.isUrl(item.path);
153
+ const CustomTag = target && 'a' || this.RouterLink;
154
+ const routerProps = {
155
+ to: {
156
+ name: item.name,
157
+ ...item.meta
158
+ }
159
+ };
160
+ const attrs = hasUrl || target ? {
161
+ ...item.meta,
162
+ href: item.path,
163
+ target: target
164
+ } : {};
165
+ const {
166
+ prefixCls,
167
+ locale
168
+ } = this.props;
169
+ const icon = item.meta?.icon && _createVNode(LazyIcon, {
170
+ "iconUrl": this.props.iconfontUrl,
171
+ "icon": item.meta?.icon
172
+ }, null) || undefined;
173
+ const menuTitle = locale && locale(item.meta?.title) || item.meta?.title;
174
+ const defaultTitle = item.meta?.icon ? _createVNode(CustomTag, _mergeProps(attrs, routerProps, {
175
+ "class": `${prefixCls}-menu-item`
176
+ }), {
177
+ default: () => [icon, _createVNode("span", {
178
+ "class": `${prefixCls}-menu-item-title`
179
+ }, [menuTitle])]
180
+ }) : _createVNode(CustomTag, _mergeProps(attrs, routerProps, {
181
+ "class": `${prefixCls}-menu-item`
182
+ }), {
183
+ default: () => [_createVNode("span", null, [menuTitle])]
184
+ });
185
+ return [defaultTitle, icon];
186
+ };
187
+ }
188
+ export default defineComponent({
189
+ name: 'BaseMenu',
190
+ props: baseMenuProps,
191
+ emits: ['update:openKeys', 'update:selectedKeys', 'click'],
192
+ setup(props, {
193
+ emit
194
+ }) {
195
+ const ctx = getCurrentInstance();
196
+ const menuUtil = new MenuUtil(props, ctx);
197
+ watchEffect(() => {
198
+ if (props.iconfontUrl) {
199
+ AntdIconFont = createFromIconfontCN({
200
+ scriptUrl: props.iconfontUrl
201
+ });
202
+ }
203
+ });
204
+ const handleOpenChange = openKeys => {
205
+ emit('update:openKeys', openKeys);
206
+ };
207
+ const handleSelect = args => {
208
+ // ignore https? link handle selectkeys
209
+ if (regular.isUrl(args.key)) {
210
+ return;
211
+ }
212
+ emit('update:selectedKeys', args.selectedKeys);
213
+ };
214
+ const handleClick = args => {
215
+ emit('click', args);
216
+ };
217
+ return () => {
218
+ let _slot2;
219
+ return _createVNode(Menu, _mergeProps({
220
+ "key": "Menu",
221
+ "inlineIndent": 16,
222
+ "mode": props.mode,
223
+ "theme": props.theme,
224
+ "openKeys": props.openKeys === false ? [] : props.openKeys,
225
+ "selectedKeys": props.selectedKeys || [],
226
+ "onOpenChange": handleOpenChange,
227
+ "onSelect": handleSelect,
228
+ "onClick": handleClick
229
+ }, props.menuProps), _isSlot(_slot2 = menuUtil.getNavMenuItems(props.menuData)) ? _slot2 : {
230
+ default: () => [_slot2]
231
+ });
232
+ };
233
+ }
234
+ });
@@ -1,40 +1,39 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
- import { defineComponent, computed } from 'vue'
3
- import { Alert, Button } from 'ant-design-vue'
4
- import { _alertProps } from './setting'
5
- import { useLocaleReceiver } from '../LocaleReciver'
6
- import useProTableStyle from './style'
7
-
8
- export default defineComponent({
9
- name: 'Alert',
10
- components: {
11
- Alert,
12
- Button
13
- },
14
- props: { ..._alertProps } ,
15
- emits: ['close'],
16
- setup(props, { emit }) {
17
- const [contextLocale] = useLocaleReceiver('ProTable')
18
- const prefixCls = computed(() => 'pro-table')
19
- const [wrapSSR, hashId] = useProTableStyle(prefixCls)
20
-
21
- const _message = computed(() => {
22
- let locale = _optionalChain([contextLocale, 'access', _ => _.value, 'optionalAccess', _2 => _2.alert, 'optionalAccess', _3 => _3.selectItem]) || ''
23
- ;[_optionalChain([props, 'access', _4 => _4.rowSelection, 'optionalAccess', _5 => _5.selectedRowKeys, 'optionalAccess', _6 => _6.length]) || 0].forEach((item, index) => {
24
- locale = locale.replace(`{${index}}`, item)
25
- })
26
- return locale
27
- })
28
-
29
- const onClose = () => {
30
- emit('close')
31
- }
32
-
33
- return {
34
- hashId,
35
- contextLocale,
36
- _message,
37
- onClose
38
- }
39
- }
40
- })
1
+ import { defineComponent, computed } from 'vue';
2
+ import { Alert, Button } from 'ant-design-vue';
3
+ import { _alertProps } from './setting';
4
+ import { useLocaleReceiver } from '../LocaleReciver';
5
+ import useProTableStyle from './style';
6
+ export default defineComponent({
7
+ name: 'Alert',
8
+ components: {
9
+ Alert,
10
+ Button
11
+ },
12
+ props: {
13
+ ..._alertProps
14
+ },
15
+ emits: ['close'],
16
+ setup(props, {
17
+ emit
18
+ }) {
19
+ const [contextLocale] = useLocaleReceiver('ProTable');
20
+ const prefixCls = computed(() => 'pro-table');
21
+ const [wrapSSR, hashId] = useProTableStyle(prefixCls);
22
+ const _message = computed(() => {
23
+ let locale = contextLocale.value?.alert?.selectItem || '';
24
+ [props.rowSelection?.selectedRowKeys?.length || 0].forEach((item, index) => {
25
+ locale = locale.replace(`{${index}}`, item);
26
+ });
27
+ return locale;
28
+ });
29
+ const onClose = () => {
30
+ emit('close');
31
+ };
32
+ return {
33
+ hashId,
34
+ contextLocale,
35
+ _message,
36
+ onClose
37
+ };
38
+ }
39
+ });