@meethive/components 0.0.2 → 0.0.4

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 +38 -31
  22. package/es/Markdown/Markdown.js +101 -118
  23. package/es/PermissionButton/PermissionButton.js +118 -118
  24. package/es/ProLayout/Basic/BasicLayout.js +301 -418
  25. package/es/ProLayout/Basic/Header.js +91 -111
  26. package/es/ProLayout/PageContainer/index.js +267 -344
  27. package/es/ProLayout/SiderMenu/BaseMenu.js +186 -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 +38 -31
  77. package/lib/Markdown/Markdown.js +101 -118
  78. package/lib/PermissionButton/PermissionButton.js +118 -118
  79. package/lib/ProLayout/Basic/BasicLayout.js +301 -418
  80. package/lib/ProLayout/Basic/Header.js +91 -111
  81. package/lib/ProLayout/PageContainer/index.js +267 -344
  82. package/lib/ProLayout/SiderMenu/BaseMenu.js +186 -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,187 @@
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 } 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
+ let AntdIconFont = createFromIconfontCN({
9
+ scriptUrl: ''
10
+ });
11
+ const LazyIcon = props => {
12
+ const {
13
+ icon,
14
+ iconUrl,
15
+ prefixCls = defaultPrefixCls
16
+ } = props;
17
+ if (!icon) return null;
18
+ if (isVNode(icon)) {
19
+ return icon;
20
+ }
21
+ if (typeof icon === 'string' && icon !== '') {
22
+ if (regular.isUrl(icon) || regular.isImg(icon)) {
23
+ return <img src={icon} alt="icon" class={`${prefixCls}-sider-menu-icon`} />;
24
+ }
25
+ return iconUrl ? <AntdIconFont type={icon} /> : <IconFont type={icon} />;
26
+ }
27
+ return null;
28
+ };
29
+ export const baseMenuProps = {
30
+ ...defaultSettingProps,
31
+ prefixCls: {
32
+ type: String,
33
+ default: defaultPrefixCls
34
+ },
35
+ locale: {
36
+ type: [Function, Boolean],
37
+ default: t => t
38
+ },
39
+ menuData: {
40
+ type: Array,
41
+ default: () => []
42
+ },
43
+ mode: {
44
+ type: String,
45
+ default: 'inline'
46
+ },
47
+ theme: {
48
+ type: String,
49
+ default: 'dark'
50
+ },
51
+ collapsed: {
52
+ type: Boolean,
53
+ default: () => false
54
+ },
55
+ openKeys: {
56
+ type: Array,
57
+ default: () => undefined
58
+ },
59
+ selectedKeys: {
60
+ type: Array,
61
+ default: () => undefined
62
+ },
63
+ menuProps: {
64
+ type: Object,
65
+ default: () => null
66
+ },
67
+ menuItemRender: {
68
+ type: [Object, Function, Boolean],
69
+ default: () => undefined
70
+ },
71
+ subMenuItemRender: {
72
+ type: [Object, Function, Boolean],
73
+ default: () => undefined
74
+ },
75
+ onClick: [Function, Object]
76
+ };
130
77
 
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
- })
78
+ // MenuUtil class for recursive menu rendering (matching ES source)
79
+ class MenuUtil {
80
+ constructor(_props, ctx) {
81
+ this.props = _props;
82
+ this.ctx = ctx;
83
+ this.RouterLink = resolveComponent('router-link');
84
+ }
85
+ getNavMenuItems = (menusData = []) => {
86
+ return menusData.map(item => this.getSubMenuOrItem(item)).filter(item => item);
87
+ };
88
+ getSubMenuOrItem = item => {
89
+ if (Array.isArray(item.children) && item.children.length > 0 && !item.meta?.hideInMenu && !item.meta?.hideChildrenInMenu) {
90
+ if (this.props.subMenuItemRender) {
91
+ const subMenuItemRender = withCtx(this.props.subMenuItemRender, this.ctx);
92
+ return subMenuItemRender({
93
+ item,
94
+ children: this.getNavMenuItems(item.children)
95
+ });
96
+ }
97
+ const {
98
+ prefixCls,
99
+ locale
100
+ } = this.props;
101
+ const menuTitle = locale && locale(item.meta?.title) || item.meta?.title;
102
+ const defaultTitle = item.meta?.icon ? <span class={`${prefixCls}-menu-item`}>
103
+ <span class={`${prefixCls}-menu-item-title`}>{menuTitle}</span>
104
+ </span> : <span class={`${prefixCls}-menu-item`}>{menuTitle}</span>;
105
+ return <Menu.SubMenu title={defaultTitle} key={item.key || item.path} popupClassName={`${prefixCls}-menu-popup`} icon={<LazyIcon iconUrl={this.props.iconfontUrl} icon={item.meta?.icon} />}>
106
+ {this.getNavMenuItems(item.children)}
107
+ </Menu.SubMenu>;
108
+ }
109
+ const menuItemRender = this.props.menuItemRender && withCtx(this.props.menuItemRender, this.ctx);
110
+ const [title, icon] = this.getMenuItem(item);
111
+ return menuItemRender && menuItemRender({
112
+ item,
113
+ title,
114
+ icon
115
+ }) || <Menu.Item disabled={item.meta?.disabled} danger={item.meta?.danger} key={item.key || item.path}>
116
+ {title}
117
+ </Menu.Item>;
118
+ };
119
+ getMenuItem = item => {
120
+ const meta = {
121
+ ...item.meta
122
+ };
123
+ const target = meta.target || null;
124
+ const hasUrl = regular.isUrl(item.path);
125
+ const CustomTag = target && 'a' || this.RouterLink;
126
+ const routerProps = {
127
+ to: {
128
+ name: item.name,
129
+ ...item.meta
130
+ }
131
+ };
132
+ const attrs = hasUrl || target ? {
133
+ ...item.meta,
134
+ href: item.path,
135
+ target: target
136
+ } : {};
137
+ const {
138
+ prefixCls,
139
+ locale
140
+ } = this.props;
141
+ const icon = item.meta?.icon && <LazyIcon iconUrl={this.props.iconfontUrl} icon={item.meta?.icon} /> || undefined;
142
+ const menuTitle = locale && locale(item.meta?.title) || item.meta?.title;
143
+ const defaultTitle = item.meta?.icon ? <CustomTag {...attrs} {...routerProps} class={`${prefixCls}-menu-item`}>
144
+ {icon}
145
+ <span class={`${prefixCls}-menu-item-title`}>{menuTitle}</span>
146
+ </CustomTag> : <CustomTag {...attrs} {...routerProps} class={`${prefixCls}-menu-item`}>
147
+ <span>{menuTitle}</span>
148
+ </CustomTag>;
149
+ return [defaultTitle, icon];
150
+ };
151
+ }
152
+ export default defineComponent({
153
+ name: 'BaseMenu',
154
+ props: baseMenuProps,
155
+ emits: ['update:openKeys', 'update:selectedKeys', 'click'],
156
+ setup(props, {
157
+ emit
158
+ }) {
159
+ const ctx = getCurrentInstance();
160
+ const menuUtil = new MenuUtil(props, ctx);
161
+ watchEffect(() => {
162
+ if (props.iconfontUrl) {
163
+ AntdIconFont = createFromIconfontCN({
164
+ scriptUrl: props.iconfontUrl
165
+ });
166
+ }
167
+ });
168
+ const handleOpenChange = openKeys => {
169
+ emit('update:openKeys', openKeys);
170
+ };
171
+ const handleSelect = args => {
172
+ // ignore https? link handle selectkeys
173
+ if (regular.isUrl(args.key)) {
174
+ return;
175
+ }
176
+ emit('update:selectedKeys', args.selectedKeys);
177
+ };
178
+ const handleClick = args => {
179
+ emit('click', args);
180
+ };
181
+ return () => {
182
+ return <Menu key="Menu" inlineIndent={16} mode={props.mode} theme={props.theme} openKeys={props.openKeys === false ? [] : props.openKeys} selectedKeys={props.selectedKeys || []} onOpenChange={handleOpenChange} onSelect={handleSelect} onClick={handleClick} {...props.menuProps}>
183
+ {menuUtil.getNavMenuItems(props.menuData)}
184
+ </Menu>;
185
+ };
186
+ }
187
+ });
@@ -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
+ });