@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,169 +1,140 @@
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, reactive, computed, watch, provide, onBeforeUnmount } from 'vue'
3
- import { Tooltip as ATooltip } from 'ant-design-vue'
4
- import { get, isArray } from 'lodash-es'
5
- import { useProvideFormItemContext } from 'ant-design-vue/es/form/FormItemContext'
6
- import { useInjectError, useInjectForm } from './hooks'
7
- import { TABLE_FORM_ITEM_ERROR } from './consts'
8
- import genEditTableStyle from './style'
9
-
10
- export default defineComponent({
11
- name: 'JEditTableFormItem',
12
- components: {
13
- ATooltip
14
- },
15
- props: {
16
- name: {
17
- type: [String, Array],
18
- default: undefined
19
- },
20
- required: {
21
- type: Boolean,
22
- default: false
23
- }
24
- },
25
- emits: ['change'],
26
- setup(props, { emit }) {
27
- const prefixCls = computed(() => 'jetlinks-edit-table')
28
- const [wrapSSR, hashId] = genEditTableStyle(prefixCls)
29
-
30
- const context = useInjectForm()
31
- const globalErrorMessage = useInjectError()
32
-
33
- let hideTimer = null
34
-
35
- const eventKey = computed(() => {
36
- const names = isArray(props.name) ? props.name : [props.name]
37
- return names.join('-')
38
- })
39
-
40
- const errorMap = reactive({
41
- message: '',
42
- visible: false
43
- })
44
-
45
- const filedId = computed(() => {
46
- const names = isArray(props.name) ? props.name : [props.name]
47
- const [index, ...extra] = names
48
- return `${index}-${extra.join('.')}`
49
- })
50
-
51
- const filedName = computed(() => {
52
- const names = isArray(props.name) ? props.name : [props.name]
53
- return [...names].pop()
54
- })
55
-
56
- const filedValue = computed(() => {
57
- return get(context.dataSource.value, props.name )
58
- })
59
-
60
- provide(TABLE_FORM_ITEM_ERROR, errorMap)
61
-
62
- const popContainer = (e) => {
63
- return e
64
- }
65
-
66
- const removeTimer = () => {
67
- if (hideTimer) {
68
- window.clearTimeout(hideTimer)
69
- hideTimer = null
70
- }
71
- }
72
-
73
- const showErrorTip = (msg) => {
74
- removeTimer()
75
- errorMap.message = msg
76
- errorMap.visible = true
77
- }
78
-
79
- const hideErrorTip = () => {
80
- errorMap.visible = false
81
- removeTimer()
82
- hideTimer = window.setTimeout(() => {
83
- errorMap.message = ''
84
- }, 300)
85
- }
86
-
87
- const validateRules = () => {
88
- let index = 0
89
- if (isArray(props.name)) {
90
- index = props.name[0]
91
- }
92
- const promise = context.validateItem(
93
- { [filedName.value ]: get(context.dataSource.value, props.name ) },
94
- index
95
- )
96
-
97
- promise.catch((res) => {
98
- const error = _optionalChain([res, 'optionalAccess', _ => _.filter, 'call', _2 => _2((item) => item.field === filedName.value)]) || []
99
- if (error.length === 0) {
100
- hideErrorTip()
101
- context.removeFieldError(eventKey.value)
102
- } else {
103
- removeTimer()
104
- errorMap.message = _optionalChain([error, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.message]) || errorMap.message
105
- errorMap.visible = !!error.length
106
- context.addFieldError(eventKey.value, errorMap.message)
107
- }
108
- return errorMap.message
109
- })
110
-
111
- return promise
112
- }
113
-
114
- const onFieldBlur = () => {
115
- // validateRules()
116
- }
117
-
118
- const onFieldChange = () => {
119
- validateRules()
120
- emit('change')
121
- }
122
-
123
- watch(
124
- () => globalErrorMessage.value,
125
- (val) => {
126
- if (val[eventKey.value]) {
127
- showErrorTip(val[eventKey.value])
128
- } else {
129
- hideErrorTip()
130
- }
131
- },
132
- { immediate: true, deep: true }
133
- )
134
-
135
- useProvideFormItemContext(
136
- {
137
- id: filedId,
138
- onFieldChange,
139
- onFieldBlur
140
- } ,
141
- computed(() => get(context.dataSource.value, props.name ))
142
- )
143
-
144
- onBeforeUnmount(() => {
145
- hideErrorTip()
146
- })
147
-
148
- watch(
149
- () => [filedName.value, props.name],
150
- () => {
151
- context.addField(eventKey.value, {
152
- filedName: filedName.value,
153
- eventKey: eventKey.value,
154
- names: props.name,
155
- validateRules,
156
- showErrorTip
157
- })
158
- },
159
- { immediate: true }
160
- )
161
-
162
- return {
163
- hashId,
164
- eventKey,
165
- errorMap,
166
- popContainer
167
- }
168
- }
169
- })
1
+ import { defineComponent, reactive, computed, watch, provide, onBeforeUnmount } from 'vue';
2
+ import { Tooltip as ATooltip } from 'ant-design-vue';
3
+ import { get, isArray } from 'lodash-es';
4
+ import { useProvideFormItemContext } from 'ant-design-vue/es/form/FormItemContext';
5
+ import { useInjectError, useInjectForm } from './hooks';
6
+ import { TABLE_FORM_ITEM_ERROR } from './consts';
7
+ import genEditTableStyle from './style';
8
+ export default defineComponent({
9
+ name: 'JEditTableFormItem',
10
+ components: {
11
+ ATooltip
12
+ },
13
+ props: {
14
+ name: {
15
+ type: [String, Array],
16
+ default: undefined
17
+ },
18
+ required: {
19
+ type: Boolean,
20
+ default: false
21
+ }
22
+ },
23
+ emits: ['change'],
24
+ setup(props, {
25
+ emit
26
+ }) {
27
+ const prefixCls = computed(() => 'jetlinks-edit-table');
28
+ const [wrapSSR, hashId] = genEditTableStyle(prefixCls);
29
+ const context = useInjectForm();
30
+ const globalErrorMessage = useInjectError();
31
+ let hideTimer = null;
32
+ const eventKey = computed(() => {
33
+ const names = isArray(props.name) ? props.name : [props.name];
34
+ return names.join('-');
35
+ });
36
+ const errorMap = reactive({
37
+ message: '',
38
+ visible: false
39
+ });
40
+ const filedId = computed(() => {
41
+ const names = isArray(props.name) ? props.name : [props.name];
42
+ const [index, ...extra] = names;
43
+ return `${index}-${extra.join('.')}`;
44
+ });
45
+ const filedName = computed(() => {
46
+ const names = isArray(props.name) ? props.name : [props.name];
47
+ return [...names].pop();
48
+ });
49
+ const filedValue = computed(() => {
50
+ return get(context.dataSource.value, props.name);
51
+ });
52
+ provide(TABLE_FORM_ITEM_ERROR, errorMap);
53
+ const popContainer = e => {
54
+ return e;
55
+ };
56
+ const removeTimer = () => {
57
+ if (hideTimer) {
58
+ window.clearTimeout(hideTimer);
59
+ hideTimer = null;
60
+ }
61
+ };
62
+ const showErrorTip = msg => {
63
+ removeTimer();
64
+ errorMap.message = msg;
65
+ errorMap.visible = true;
66
+ };
67
+ const hideErrorTip = () => {
68
+ errorMap.visible = false;
69
+ removeTimer();
70
+ hideTimer = window.setTimeout(() => {
71
+ errorMap.message = '';
72
+ }, 300);
73
+ };
74
+ const validateRules = () => {
75
+ let index = 0;
76
+ if (isArray(props.name)) {
77
+ index = props.name[0];
78
+ }
79
+ const promise = context.validateItem({
80
+ [filedName.value]: get(context.dataSource.value, props.name)
81
+ }, index);
82
+ promise.catch(res => {
83
+ const error = res?.filter(item => item.field === filedName.value) || [];
84
+ if (error.length === 0) {
85
+ hideErrorTip();
86
+ context.removeFieldError(eventKey.value);
87
+ } else {
88
+ removeTimer();
89
+ errorMap.message = error[0]?.message || errorMap.message;
90
+ errorMap.visible = !!error.length;
91
+ context.addFieldError(eventKey.value, errorMap.message);
92
+ }
93
+ return errorMap.message;
94
+ });
95
+ return promise;
96
+ };
97
+ const onFieldBlur = () => {
98
+ // validateRules()
99
+ };
100
+ const onFieldChange = () => {
101
+ validateRules();
102
+ emit('change');
103
+ };
104
+ watch(() => globalErrorMessage.value, val => {
105
+ if (val[eventKey.value]) {
106
+ showErrorTip(val[eventKey.value]);
107
+ } else {
108
+ hideErrorTip();
109
+ }
110
+ }, {
111
+ immediate: true,
112
+ deep: true
113
+ });
114
+ useProvideFormItemContext({
115
+ id: filedId,
116
+ onFieldChange,
117
+ onFieldBlur
118
+ }, computed(() => get(context.dataSource.value, props.name)));
119
+ onBeforeUnmount(() => {
120
+ hideErrorTip();
121
+ });
122
+ watch(() => [filedName.value, props.name], () => {
123
+ context.addField(eventKey.value, {
124
+ filedName: filedName.value,
125
+ eventKey: eventKey.value,
126
+ names: props.name,
127
+ validateRules,
128
+ showErrorTip
129
+ });
130
+ }, {
131
+ immediate: true
132
+ });
133
+ return {
134
+ hashId,
135
+ eventKey,
136
+ errorMap,
137
+ popContainer
138
+ };
139
+ }
140
+ });