@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,204 +1,171 @@
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, ref, reactive, computed, watch, onMounted } from 'vue'
3
- import {
4
- Tabs as ATabs,
5
- TabPane as ATabPane,
6
- Dropdown as ADropdown,
7
- Menu as AMenu,
8
- MenuItem as AMenuItem,
9
- Tooltip as ATooltip,
10
- Modal as AModal,
11
- Form as AForm,
12
- FormItem as AFormItem,
13
- Input as AInput,
14
- Button as AButton,
15
- Modal
16
- } from 'ant-design-vue'
17
- import { randomNumber } from '@meethive/utils'
18
- import { isFullScreen } from './utils'
19
- import { useTableGroupError, useTableWrapper } from './context'
20
- import { useLocaleReceiver } from '../LocaleReciver'
21
- import genEditTableStyle from './style'
22
-
23
- export default defineComponent({
24
- name: 'JEditTableGroup',
25
- components: {
26
- ATabs,
27
- ATabPane,
28
- ADropdown,
29
- AMenu,
30
- AMenuItem,
31
- ATooltip,
32
- AModal,
33
- AForm,
34
- AFormItem,
35
- AInput,
36
- AButton
37
- },
38
- props: {
39
- options: {
40
- type: Array ,
41
- default: () => []
42
- },
43
- activeKey: {
44
- type: String,
45
- default: undefined
46
- },
47
- readonly: {
48
- type: Boolean,
49
- default: false
50
- }
51
- },
52
- emits: ['delete', 'edit', 'add', 'change', 'update:activeKey'],
53
- setup(props, { emit }) {
54
- const [contextLocale] = useLocaleReceiver('EditTable')
55
-
56
- const myActiveKey = ref(props.activeKey)
57
- const visible = ref(false)
58
- const type = ref(contextLocale.value.Group.addGroup)
59
- const errorMap = useTableGroupError()
60
- const tableWrapperRef = useTableWrapper()
61
- const addIndex = ref(0)
62
- const formRef = ref()
63
- const formData = reactive({
64
- label: undefined
65
- })
66
-
67
- const prefixCls = computed(() => 'jetlinks-edit-table')
68
- const [wrapSSR, hashId] = genEditTableStyle(prefixCls)
69
-
70
- const onAdd = (targetKey, action) => {
71
- if (action === 'add') {
72
- type.value = 'add'
73
- const groupName = props.options.filter((item) =>
74
- item.label.includes(contextLocale.value.Group.one)
75
- )
76
- let index = addIndex.value + 1
77
- let findStatus = false
78
-
79
- while (!findStatus) {
80
- const status = groupName.some((item) => {
81
- const [_, _index] = item.label.split('_')
82
- if (index === Number(_index)) {
83
- index = Number(_index) + 1
84
- return true
85
- }
86
- return false
87
- })
88
- findStatus = !status
89
- }
90
-
91
- addIndex.value = index
92
- formData.label = contextLocale.value.Group.one + index
93
- onOk()
94
- }
95
- }
96
-
97
- const onEdit = (record) => {
98
- visible.value = true
99
- type.value = 'edit'
100
- formData.label = record.label
101
- }
102
-
103
- const onCancel = () => {
104
- formRef.value.resetFields()
105
- visible.value = false
106
- }
107
-
108
- const onOk = () => {
109
- const data = { ...formData }
110
- if (type.value === 'add') {
111
- data.value = 'group_' + randomNumber()
112
- myActiveKey.value = data.value
113
- emit(type.value, data)
114
- emit('change', data.value, data.label)
115
- emit('update:activeKey', data.value)
116
- visible.value = false
117
- } else {
118
- formRef.value.validate().then(() => {
119
- data.value = myActiveKey.value
120
- emit(type.value, data)
121
- emit('change', data.value, data.label)
122
- visible.value = false
123
- })
124
- }
125
- }
126
-
127
- const change = () => {
128
- const item = props.options.find((item) => item.value === myActiveKey.value)
129
- emit('change', myActiveKey.value, item.label)
130
- emit('update:activeKey', myActiveKey.value)
131
- }
132
-
133
- const menuClick = (e, record) => {
134
- if (props.readonly) return
135
- if (e.key === 'edit') {
136
- onEdit(record)
137
- } else {
138
- Modal.confirm({
139
- title: contextLocale.value.Group.deleteMessage,
140
- onOk: () => {
141
- const index = props.options.findIndex((item) => item.value === record.value)
142
- let label = ''
143
-
144
- if (index !== 0 && index === props.options.length - 1) {
145
- myActiveKey.value = props.options[index - 1].value
146
- label = props.options[index - 1].label
147
- } else if (index === 0 && props.options.length === 1) {
148
- myActiveKey.value = props.options[0].value
149
- label = props.options[0].label
150
- } else {
151
- myActiveKey.value = props.options[index + 1].value
152
- label = props.options[index + 1].label
153
- }
154
-
155
- emit('delete', record.value, index)
156
- emit('change', myActiveKey.value, label)
157
- }
158
- })
159
- }
160
- }
161
-
162
- const popContainer = (e) => {
163
- return tableWrapperRef.value || e
164
- }
165
-
166
- const modalContainer = () => {
167
- if (isFullScreen()) {
168
- return tableWrapperRef.value || document.body
169
- }
170
- return document.body
171
- }
172
-
173
- onMounted(() => {
174
- myActiveKey.value = _optionalChain([props, 'access', _2 => _2.options, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.value])
175
- emit('change', myActiveKey.value, _optionalChain([props, 'access', _5 => _5.options, 'access', _6 => _6[0], 'optionalAccess', _7 => _7.label]))
176
- emit('update:activeKey', myActiveKey.value)
177
- })
178
-
179
- watch(
180
- () => props.activeKey,
181
- (val) => {
182
- myActiveKey.value = val
183
- }
184
- )
185
-
186
- return {
187
- hashId,
188
- contextLocale,
189
- myActiveKey,
190
- visible,
191
- errorMap,
192
- tableWrapperRef,
193
- formRef,
194
- formData,
195
- onAdd,
196
- onCancel,
197
- onOk,
198
- change,
199
- menuClick,
200
- popContainer,
201
- modalContainer
202
- }
203
- }
204
- })
1
+ import { defineComponent, ref, reactive, computed, watch, onMounted } from 'vue';
2
+ import { Tabs as ATabs, TabPane as ATabPane, Dropdown as ADropdown, Menu as AMenu, MenuItem as AMenuItem, Tooltip as ATooltip, Modal as AModal, Form as AForm, FormItem as AFormItem, Input as AInput, Button as AButton, Modal } from 'ant-design-vue';
3
+ import { randomNumber } from '@meethive/utils';
4
+ import { isFullScreen } from './utils';
5
+ import { useTableGroupError, useTableWrapper } from './context';
6
+ import { useLocaleReceiver } from '../LocaleReciver';
7
+ import genEditTableStyle from './style';
8
+ export default defineComponent({
9
+ name: 'JEditTableGroup',
10
+ components: {
11
+ ATabs,
12
+ ATabPane,
13
+ ADropdown,
14
+ AMenu,
15
+ AMenuItem,
16
+ ATooltip,
17
+ AModal,
18
+ AForm,
19
+ AFormItem,
20
+ AInput,
21
+ AButton
22
+ },
23
+ props: {
24
+ options: {
25
+ type: Array,
26
+ default: () => []
27
+ },
28
+ activeKey: {
29
+ type: String,
30
+ default: undefined
31
+ },
32
+ readonly: {
33
+ type: Boolean,
34
+ default: false
35
+ }
36
+ },
37
+ emits: ['delete', 'edit', 'add', 'change', 'update:activeKey'],
38
+ setup(props, {
39
+ emit
40
+ }) {
41
+ const [contextLocale] = useLocaleReceiver('EditTable');
42
+ const myActiveKey = ref(props.activeKey);
43
+ const visible = ref(false);
44
+ const type = ref(contextLocale.value.Group.addGroup);
45
+ const errorMap = useTableGroupError();
46
+ const tableWrapperRef = useTableWrapper();
47
+ const addIndex = ref(0);
48
+ const formRef = ref();
49
+ const formData = reactive({
50
+ label: undefined
51
+ });
52
+ const prefixCls = computed(() => 'jetlinks-edit-table');
53
+ const [wrapSSR, hashId] = genEditTableStyle(prefixCls);
54
+ const onAdd = (targetKey, action) => {
55
+ if (action === 'add') {
56
+ type.value = 'add';
57
+ const groupName = props.options.filter(item => item.label.includes(contextLocale.value.Group.one));
58
+ let index = addIndex.value + 1;
59
+ let findStatus = false;
60
+ while (!findStatus) {
61
+ const status = groupName.some(item => {
62
+ const [_, _index] = item.label.split('_');
63
+ if (index === Number(_index)) {
64
+ index = Number(_index) + 1;
65
+ return true;
66
+ }
67
+ return false;
68
+ });
69
+ findStatus = !status;
70
+ }
71
+ addIndex.value = index;
72
+ formData.label = contextLocale.value.Group.one + index;
73
+ onOk();
74
+ }
75
+ };
76
+ const onEdit = record => {
77
+ visible.value = true;
78
+ type.value = 'edit';
79
+ formData.label = record.label;
80
+ };
81
+ const onCancel = () => {
82
+ formRef.value.resetFields();
83
+ visible.value = false;
84
+ };
85
+ const onOk = () => {
86
+ const data = {
87
+ ...formData
88
+ };
89
+ if (type.value === 'add') {
90
+ data.value = 'group_' + randomNumber();
91
+ myActiveKey.value = data.value;
92
+ emit(type.value, data);
93
+ emit('change', data.value, data.label);
94
+ emit('update:activeKey', data.value);
95
+ visible.value = false;
96
+ } else {
97
+ formRef.value.validate().then(() => {
98
+ data.value = myActiveKey.value;
99
+ emit(type.value, data);
100
+ emit('change', data.value, data.label);
101
+ visible.value = false;
102
+ });
103
+ }
104
+ };
105
+ const change = () => {
106
+ const item = props.options.find(item => item.value === myActiveKey.value);
107
+ emit('change', myActiveKey.value, item.label);
108
+ emit('update:activeKey', myActiveKey.value);
109
+ };
110
+ const menuClick = (e, record) => {
111
+ if (props.readonly) return;
112
+ if (e.key === 'edit') {
113
+ onEdit(record);
114
+ } else {
115
+ Modal.confirm({
116
+ title: contextLocale.value.Group.deleteMessage,
117
+ onOk: () => {
118
+ const index = props.options.findIndex(item => item.value === record.value);
119
+ let label = '';
120
+ if (index !== 0 && index === props.options.length - 1) {
121
+ myActiveKey.value = props.options[index - 1].value;
122
+ label = props.options[index - 1].label;
123
+ } else if (index === 0 && props.options.length === 1) {
124
+ myActiveKey.value = props.options[0].value;
125
+ label = props.options[0].label;
126
+ } else {
127
+ myActiveKey.value = props.options[index + 1].value;
128
+ label = props.options[index + 1].label;
129
+ }
130
+ emit('delete', record.value, index);
131
+ emit('change', myActiveKey.value, label);
132
+ }
133
+ });
134
+ }
135
+ };
136
+ const popContainer = e => {
137
+ return tableWrapperRef.value || e;
138
+ };
139
+ const modalContainer = () => {
140
+ if (isFullScreen()) {
141
+ return tableWrapperRef.value || document.body;
142
+ }
143
+ return document.body;
144
+ };
145
+ onMounted(() => {
146
+ myActiveKey.value = props.options[0]?.value;
147
+ emit('change', myActiveKey.value, props.options[0]?.label);
148
+ emit('update:activeKey', myActiveKey.value);
149
+ });
150
+ watch(() => props.activeKey, val => {
151
+ myActiveKey.value = val;
152
+ });
153
+ return {
154
+ hashId,
155
+ contextLocale,
156
+ myActiveKey,
157
+ visible,
158
+ errorMap,
159
+ tableWrapperRef,
160
+ formRef,
161
+ formData,
162
+ onAdd,
163
+ onCancel,
164
+ onOk,
165
+ change,
166
+ menuClick,
167
+ popContainer,
168
+ modalContainer
169
+ };
170
+ }
171
+ });
@@ -1,63 +1,57 @@
1
-
2
- import { defineComponent, reactive, computed } from 'vue'
3
- import { SearchModal, Sort } from './components/Search'
4
- import { useHScroll, useTableTool } from './hooks'
5
- import HeaderItemRender from './HeaderRender.js'
6
- import useEditTableStyle from './style'
7
- import AIcon from '../Icon'
8
-
9
- export default defineComponent({
10
- name: 'JEditTableHeader',
11
- components: {
12
- SearchModal,
13
- Sort,
14
- HeaderItemRender,
15
- AIcon
16
- },
17
- props: {
18
- columns: {
19
- type: Array,
20
- default: () => []
21
- },
22
- searchColumns: {
23
- type: Array,
24
- default: undefined
25
- },
26
- serial: {
27
- type: Boolean,
28
- default: false
29
- },
30
- style: {
31
- type: Object,
32
- default: undefined
33
- }
34
- },
35
- setup(props) {
36
- const prefixCls = computed(() => 'jetlinks-edit-table')
37
- const [wrapSSR, hashId] = useEditTableStyle(prefixCls)
38
- const tableTool = useTableTool()
39
- const hScroll = useHScroll()
40
-
41
- const searchData = reactive({
42
- visible: false,
43
- key: undefined
44
- })
45
-
46
- const showFilter = (key) => {
47
- searchData.visible = true
48
- searchData.key = key
49
- }
50
-
51
- const sortClick = () => {
52
- searchData.visible = false
53
- }
54
-
55
- return {
56
- hashId,
57
- tableTool,
58
- searchData,
59
- showFilter,
60
- sortClick
61
- }
62
- }
63
- })
1
+ import { defineComponent, reactive, computed } from 'vue';
2
+ import { SearchModal, Sort } from './components/Search';
3
+ import { useHScroll, useTableTool } from './hooks';
4
+ import HeaderItemRender from './HeaderRender.js';
5
+ import useEditTableStyle from './style';
6
+ import AIcon from '../Icon';
7
+ export default defineComponent({
8
+ name: 'JEditTableHeader',
9
+ components: {
10
+ SearchModal,
11
+ Sort,
12
+ HeaderItemRender,
13
+ AIcon
14
+ },
15
+ props: {
16
+ columns: {
17
+ type: Array,
18
+ default: () => []
19
+ },
20
+ searchColumns: {
21
+ type: Array,
22
+ default: undefined
23
+ },
24
+ serial: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ style: {
29
+ type: Object,
30
+ default: undefined
31
+ }
32
+ },
33
+ setup(props) {
34
+ const prefixCls = computed(() => 'jetlinks-edit-table');
35
+ const [wrapSSR, hashId] = useEditTableStyle(prefixCls);
36
+ const tableTool = useTableTool();
37
+ const hScroll = useHScroll();
38
+ const searchData = reactive({
39
+ visible: false,
40
+ key: undefined
41
+ });
42
+ const showFilter = key => {
43
+ searchData.visible = true;
44
+ searchData.key = key;
45
+ };
46
+ const sortClick = () => {
47
+ searchData.visible = false;
48
+ };
49
+ return {
50
+ hashId,
51
+ tableTool,
52
+ searchData,
53
+ showFilter,
54
+ sortClick
55
+ };
56
+ }
57
+ });
@@ -1,12 +1,10 @@
1
-
2
- import { defineComponent } from 'vue'
3
-
4
- export default defineComponent({
5
- name: 'HeaderItemRender',
6
- props: ['renderFn', 'value'],
7
- setup(props) {
8
- return () => {
9
- return props.renderFn(props.value)
10
- }
11
- }
12
- })
1
+ import { defineComponent } from 'vue';
2
+ export default defineComponent({
3
+ name: 'HeaderItemRender',
4
+ props: ['renderFn', 'value'],
5
+ setup(props) {
6
+ return () => {
7
+ return props.renderFn(props.value);
8
+ };
9
+ }
10
+ });