@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,86 +1,78 @@
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, computed, onMounted, nextTick } from 'vue'
3
- import { Menu } from 'ant-design-vue'
4
- import AIcon from '../../../Icon'
5
- import { useLocaleReceiver } from '../../../LocaleReciver'
6
- import useEditTableStyle from '../../style'
7
-
8
- const MenuItem = Menu.Item
9
-
10
- export default defineComponent({
11
- name: 'JEditTableContextMenu',
12
- components: {
13
- Menu,
14
- MenuItem,
15
- AIcon
16
- },
17
- props: {
18
- data: {
19
- type: Object,
20
- default: () => ({})
21
- },
22
- onClose: {
23
- type: Function,
24
- default: () => {}
25
- },
26
- onClick: {
27
- type: Function,
28
- default: () => {}
29
- },
30
- onCopy: {
31
- type: Function,
32
- default: () => {}
33
- },
34
- paste: {
35
- type: Object,
36
- default: () => ({})
37
- }
38
- },
39
- setup(props) {
40
- const contextMenu = ref(null)
41
- const prefixCls = computed(() => 'jetlinks-edit-table')
42
- const [wrapSSR, hashId] = useEditTableStyle(prefixCls)
43
- const [contextLocale] = useLocaleReceiver('EditTable')
44
-
45
- const showDetail = computed(() => {
46
- return !props.data.id
47
- })
48
-
49
- const showPaste = computed(() => {
50
- return !props.paste
51
- })
52
-
53
- const showDelete = computed(() => {
54
- return _optionalChain([props, 'access', _ => _.data, 'optionalAccess', _2 => _2.expands, 'optionalAccess', _3 => _3.isProduct])
55
- })
56
-
57
- const clickFunc = ({ key }) => {
58
- if (key === 'copy') {
59
- props.onCopy(props.data)
60
- }
61
- props.onClick(key)
62
- }
63
-
64
- const close = () => {
65
- setTimeout(() => {
66
- props.onClose()
67
- }, 300)
68
- }
69
-
70
- onMounted(async () => {
71
- await nextTick()
72
- contextMenu.value.focus()
73
- })
74
-
75
- return {
76
- contextMenu,
77
- hashId,
78
- contextLocale,
79
- showDetail,
80
- showPaste,
81
- showDelete,
82
- clickFunc,
83
- close
84
- }
85
- }
86
- })
1
+ import { defineComponent, ref, computed, onMounted, nextTick } from 'vue';
2
+ import { Menu } from 'ant-design-vue';
3
+ import AIcon from '../../../Icon';
4
+ import { useLocaleReceiver } from '../../../LocaleReciver';
5
+ import useEditTableStyle from '../../style';
6
+ const MenuItem = Menu.Item;
7
+ export default defineComponent({
8
+ name: 'JEditTableContextMenu',
9
+ components: {
10
+ Menu,
11
+ MenuItem,
12
+ AIcon
13
+ },
14
+ props: {
15
+ data: {
16
+ type: Object,
17
+ default: () => ({})
18
+ },
19
+ onClose: {
20
+ type: Function,
21
+ default: () => {}
22
+ },
23
+ onClick: {
24
+ type: Function,
25
+ default: () => {}
26
+ },
27
+ onCopy: {
28
+ type: Function,
29
+ default: () => {}
30
+ },
31
+ paste: {
32
+ type: Object,
33
+ default: () => ({})
34
+ }
35
+ },
36
+ setup(props) {
37
+ const contextMenu = ref(null);
38
+ const prefixCls = computed(() => 'jetlinks-edit-table');
39
+ const [wrapSSR, hashId] = useEditTableStyle(prefixCls);
40
+ const [contextLocale] = useLocaleReceiver('EditTable');
41
+ const showDetail = computed(() => {
42
+ return !props.data.id;
43
+ });
44
+ const showPaste = computed(() => {
45
+ return !props.paste;
46
+ });
47
+ const showDelete = computed(() => {
48
+ return props.data?.expands?.isProduct;
49
+ });
50
+ const clickFunc = ({
51
+ key
52
+ }) => {
53
+ if (key === 'copy') {
54
+ props.onCopy(props.data);
55
+ }
56
+ props.onClick(key);
57
+ };
58
+ const close = () => {
59
+ setTimeout(() => {
60
+ props.onClose();
61
+ }, 300);
62
+ };
63
+ onMounted(async () => {
64
+ await nextTick();
65
+ contextMenu.value.focus();
66
+ });
67
+ return {
68
+ contextMenu,
69
+ hashId,
70
+ contextLocale,
71
+ showDetail,
72
+ showPaste,
73
+ showDelete,
74
+ clickFunc,
75
+ close
76
+ };
77
+ }
78
+ });
@@ -1,163 +1,151 @@
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, computed } from 'vue'
3
- import { Space as ASpace, Input as AInput, Button as AButton } from 'ant-design-vue'
4
- import EditTable from '../../EditTable.js'
5
- import DragModal from '../../../DragModal/DragModal.js'
6
- import Ellipsis from '../../../Ellipsis/Ellipsis.js'
7
- import { useTableDataSource, useTableOpenGroup, useTableTool, useGroupOptions } from '../../context'
8
- import { useLocaleReceiver } from '../../../LocaleReciver'
9
- import { isNumber, isArray, isObject, isBoolean } from 'lodash-es'
10
-
11
- export default defineComponent({
12
- name: 'JEditTableSearch',
13
- components: {
14
- ASpace,
15
- AInput,
16
- AButton,
17
- EditTable,
18
- DragModal,
19
- Ellipsis
20
- },
21
- props: {
22
- searchKey: {
23
- type: String,
24
- default: 'id'
25
- },
26
- columns: {
27
- type: Array,
28
- default: undefined
29
- }
30
- },
31
- emits: ['close'],
32
- setup(props, { emit }) {
33
- const [contextLocale] = useLocaleReceiver('EditTable')
34
- const dataSource = useTableDataSource()
35
- const openGroup = useTableOpenGroup()
36
- const tableTool = useTableTool()
37
- const groupOptions = useGroupOptions()
38
-
39
- const searchValue = ref()
40
- const filterArray = ref([])
41
- const visible = ref(false)
42
- const searchIndex = ref(-1)
43
- const modalHeight = ref(100)
44
- const tableHeight = ref(230)
45
- const selectedRowKeys = ref([])
46
- const tableRef = ref()
47
-
48
- const myColumns = computed(() => {
49
- if (props.columns) {
50
- return (props.columns ).map((item) => ({
51
- title: item.title,
52
- dataIndex: item.dataIndex
53
- }))
54
- }
55
- return [
56
- { title: contextLocale.value.columns.sign, dataIndex: 'id' },
57
- { title: contextLocale.value.columns.name, dataIndex: 'name' }
58
- ]
59
- })
60
-
61
- const selectedTableRow = (record) => {
62
- tableTool.scrollTo({
63
- ...record,
64
- __serial: record.__oldSerial - 1
65
- })
66
- tableTool.selected([record.id])
67
- }
68
-
69
- const handleFilterArray = () => {
70
- const cloneDataSource = JSON.parse(JSON.stringify(dataSource.value || '[]')).map(
71
- (item) => Object.assign(item, { __oldSerial: item.__serial })
72
- )
73
- const _filterArray = cloneDataSource.filter((item) => {
74
- let targetValue = item[props.searchKey]
75
- if (targetValue) {
76
- if (isNumber(targetValue) || isBoolean(targetValue)) {
77
- targetValue = String(targetValue)
78
- } else if (isArray(targetValue) || isObject(targetValue)) {
79
- targetValue = JSON.stringify(targetValue)
80
- }
81
- return targetValue.includes(searchValue.value)
82
- }
83
- return false
84
- })
85
-
86
- if (openGroup) {
87
- const handleGroup = []
88
- groupOptions.value.forEach((group) => {
89
- handleGroup.push(
90
- ..._filterArray.filter((item) => item.expands.groupId === group.value)
91
- )
92
- })
93
- return handleGroup
94
- }
95
- return _filterArray
96
- }
97
-
98
- const search = (key) => {
99
- filterArray.value = handleFilterArray()
100
- if (key === 'all') {
101
- visible.value = true
102
- modalHeight.value = 400
103
- searchIndex.value = 0
104
- } else if (key === 'next') {
105
- searchIndex.value += 1
106
- } else {
107
- searchIndex.value -= 1
108
- }
109
-
110
- if (searchIndex.value < 0) {
111
- searchIndex.value = filterArray.value.length - 1
112
- } else if (searchIndex.value > filterArray.value.length - 1) {
113
- searchIndex.value = 0
114
- }
115
-
116
- const searchItem = filterArray.value[searchIndex.value]
117
- if (key !== 'all' && visible.value) {
118
- _optionalChain([tableRef, 'access', _ => _.value, 'optionalAccess', _2 => _2.scrollToByIndex, 'call', _3 => _3(searchIndex.value - 1)])
119
- }
120
-
121
- if (filterArray.value.length >= 1) {
122
- selectedRowKeys.value = [searchItem.id]
123
- selectedTableRow(searchItem)
124
- } else {
125
- selectedRowKeys.value = []
126
- tableTool.selected([])
127
- }
128
- }
129
-
130
- const heightChange = (h) => {
131
- if (h > 340) {
132
- tableHeight.value = h - 160
133
- }
134
- }
135
-
136
- const onClose = () => {
137
- emit('close')
138
- }
139
-
140
- const onSelect = (record) => {
141
- searchIndex.value = filterArray.value.findIndex((item) => item.id === record.id)
142
- selectedRowKeys.value = [record.id]
143
- selectedTableRow(record)
144
- }
145
-
146
- return {
147
- contextLocale,
148
- openGroup,
149
- searchValue,
150
- filterArray,
151
- visible,
152
- modalHeight,
153
- tableHeight,
154
- selectedRowKeys,
155
- tableRef,
156
- myColumns,
157
- search,
158
- heightChange,
159
- onClose,
160
- onSelect
161
- }
162
- }
163
- })
1
+ import { defineComponent, ref, computed } from 'vue';
2
+ import { Space as ASpace, Input as AInput, Button as AButton } from 'ant-design-vue';
3
+ import EditTable from '../../EditTable.js';
4
+ import DragModal from '../../../DragModal/DragModal.js';
5
+ import Ellipsis from '../../../Ellipsis/Ellipsis.js';
6
+ import { useTableDataSource, useTableOpenGroup, useTableTool, useGroupOptions } from '../../context';
7
+ import { useLocaleReceiver } from '../../../LocaleReciver';
8
+ import { isNumber, isArray, isObject, isBoolean } from 'lodash-es';
9
+ export default defineComponent({
10
+ name: 'JEditTableSearch',
11
+ components: {
12
+ ASpace,
13
+ AInput,
14
+ AButton,
15
+ EditTable,
16
+ DragModal,
17
+ Ellipsis
18
+ },
19
+ props: {
20
+ searchKey: {
21
+ type: String,
22
+ default: 'id'
23
+ },
24
+ columns: {
25
+ type: Array,
26
+ default: undefined
27
+ }
28
+ },
29
+ emits: ['close'],
30
+ setup(props, {
31
+ emit
32
+ }) {
33
+ const [contextLocale] = useLocaleReceiver('EditTable');
34
+ const dataSource = useTableDataSource();
35
+ const openGroup = useTableOpenGroup();
36
+ const tableTool = useTableTool();
37
+ const groupOptions = useGroupOptions();
38
+ const searchValue = ref();
39
+ const filterArray = ref([]);
40
+ const visible = ref(false);
41
+ const searchIndex = ref(-1);
42
+ const modalHeight = ref(100);
43
+ const tableHeight = ref(230);
44
+ const selectedRowKeys = ref([]);
45
+ const tableRef = ref();
46
+ const myColumns = computed(() => {
47
+ if (props.columns) {
48
+ return props.columns.map(item => ({
49
+ title: item.title,
50
+ dataIndex: item.dataIndex
51
+ }));
52
+ }
53
+ return [{
54
+ title: contextLocale.value.columns.sign,
55
+ dataIndex: 'id'
56
+ }, {
57
+ title: contextLocale.value.columns.name,
58
+ dataIndex: 'name'
59
+ }];
60
+ });
61
+ const selectedTableRow = record => {
62
+ tableTool.scrollTo({
63
+ ...record,
64
+ __serial: record.__oldSerial - 1
65
+ });
66
+ tableTool.selected([record.id]);
67
+ };
68
+ const handleFilterArray = () => {
69
+ const cloneDataSource = JSON.parse(JSON.stringify(dataSource.value || '[]')).map(item => Object.assign(item, {
70
+ __oldSerial: item.__serial
71
+ }));
72
+ const _filterArray = cloneDataSource.filter(item => {
73
+ let targetValue = item[props.searchKey];
74
+ if (targetValue) {
75
+ if (isNumber(targetValue) || isBoolean(targetValue)) {
76
+ targetValue = String(targetValue);
77
+ } else if (isArray(targetValue) || isObject(targetValue)) {
78
+ targetValue = JSON.stringify(targetValue);
79
+ }
80
+ return targetValue.includes(searchValue.value);
81
+ }
82
+ return false;
83
+ });
84
+ if (openGroup) {
85
+ const handleGroup = [];
86
+ groupOptions.value.forEach(group => {
87
+ handleGroup.push(..._filterArray.filter(item => item.expands.groupId === group.value));
88
+ });
89
+ return handleGroup;
90
+ }
91
+ return _filterArray;
92
+ };
93
+ const search = key => {
94
+ filterArray.value = handleFilterArray();
95
+ if (key === 'all') {
96
+ visible.value = true;
97
+ modalHeight.value = 400;
98
+ searchIndex.value = 0;
99
+ } else if (key === 'next') {
100
+ searchIndex.value += 1;
101
+ } else {
102
+ searchIndex.value -= 1;
103
+ }
104
+ if (searchIndex.value < 0) {
105
+ searchIndex.value = filterArray.value.length - 1;
106
+ } else if (searchIndex.value > filterArray.value.length - 1) {
107
+ searchIndex.value = 0;
108
+ }
109
+ const searchItem = filterArray.value[searchIndex.value];
110
+ if (key !== 'all' && visible.value) {
111
+ tableRef.value?.scrollToByIndex(searchIndex.value - 1);
112
+ }
113
+ if (filterArray.value.length >= 1) {
114
+ selectedRowKeys.value = [searchItem.id];
115
+ selectedTableRow(searchItem);
116
+ } else {
117
+ selectedRowKeys.value = [];
118
+ tableTool.selected([]);
119
+ }
120
+ };
121
+ const heightChange = h => {
122
+ if (h > 340) {
123
+ tableHeight.value = h - 160;
124
+ }
125
+ };
126
+ const onClose = () => {
127
+ emit('close');
128
+ };
129
+ const onSelect = record => {
130
+ searchIndex.value = filterArray.value.findIndex(item => item.id === record.id);
131
+ selectedRowKeys.value = [record.id];
132
+ selectedTableRow(record);
133
+ };
134
+ return {
135
+ contextLocale,
136
+ openGroup,
137
+ searchValue,
138
+ filterArray,
139
+ visible,
140
+ modalHeight,
141
+ tableHeight,
142
+ selectedRowKeys,
143
+ tableRef,
144
+ myColumns,
145
+ search,
146
+ heightChange,
147
+ onClose,
148
+ onSelect
149
+ };
150
+ }
151
+ });