@meethive/components 0.0.1
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.
- package/es/AutoComplete/AutoComplete.js +84 -0
- package/es/AutoComplete/index.js +7 -0
- package/es/BadgeStatus/Badge.js +51 -0
- package/es/BadgeStatus/color.js +14 -0
- package/es/BadgeStatus/index.js +8 -0
- package/es/CardSelect/CardSelect.js +141 -0
- package/es/CardSelect/index.js +7 -0
- package/es/CardSelect/style/index.js +29 -0
- package/es/CheckButton/CheckButton.js +122 -0
- package/es/CheckButton/index.js +7 -0
- package/es/CheckButton/style/index.js +44 -0
- package/es/ConfigProvider/ConfigProvider.js +73 -0
- package/es/ConfigProvider/context.js +26 -0
- package/es/ConfigProvider/index.js +9 -0
- package/es/DragModal/DragModal.js +212 -0
- package/es/DragModal/index.js +7 -0
- package/es/DragModal/style/index.js +86 -0
- package/es/EditTable/Body.js +189 -0
- package/es/EditTable/CellRender.js +12 -0
- package/es/EditTable/EditTable.js +434 -0
- package/es/EditTable/FormItem.js +169 -0
- package/es/EditTable/Group.js +204 -0
- package/es/EditTable/Header.js +63 -0
- package/es/EditTable/HeaderRender.js +12 -0
- package/es/EditTable/components/ContextMenu/Menu.js +86 -0
- package/es/EditTable/components/ContextMenu/index.js +96 -0
- package/es/EditTable/components/Search/Search.js +163 -0
- package/es/EditTable/components/Search/Sort.js +119 -0
- package/es/EditTable/components/Search/index.js +2 -0
- package/es/EditTable/consts.js +13 -0
- package/es/EditTable/context.js +88 -0
- package/es/EditTable/hooks/index.js +19 -0
- package/es/EditTable/hooks/useGroup.js +48 -0
- package/es/EditTable/hooks/useResizeObserver.js +27 -0
- package/es/EditTable/hooks/useValidate.js +112 -0
- package/es/EditTable/index.js +25 -0
- package/es/EditTable/props.js +60 -0
- package/es/EditTable/style/body.js +63 -0
- package/es/EditTable/style/form.js +33 -0
- package/es/EditTable/style/group.js +33 -0
- package/es/EditTable/style/header.js +72 -0
- package/es/EditTable/style/index.js +52 -0
- package/es/EditTable/style/menu.js +27 -0
- package/es/EditTable/style/table.js +46 -0
- package/es/EditTable/utils.js +110 -0
- package/es/Ellipsis/Ellipsis.js +148 -0
- package/es/Ellipsis/index.js +7 -0
- package/es/Ellipsis/style/index.js +26 -0
- package/es/Empty/Empty.js +63 -0
- package/es/Empty/image.js +3 -0
- package/es/Empty/index.js +7 -0
- package/es/FullPage/FullPage.js +19 -0
- package/es/FullPage/index.js +7 -0
- package/es/Icon/Icon.js +49 -0
- package/es/Icon/index.js +7 -0
- package/es/LocaleProvider/LocaleProvider.js +31 -0
- package/es/LocaleProvider/index.js +7 -0
- package/es/LocaleReciver/index.js +24 -0
- package/es/Markdown/Markdown.js +118 -0
- package/es/Markdown/index.js +7 -0
- package/es/PermissionButton/PermissionButton.js +118 -0
- package/es/PermissionButton/confirm.js +94 -0
- package/es/PermissionButton/index.js +9 -0
- package/es/PermissionButton/shared.js +1 -0
- package/es/ProLayout/Basic/BasicLayout.js +422 -0
- package/es/ProLayout/Basic/BasicLayoutStyle.js +51 -0
- package/es/ProLayout/Basic/Header.js +111 -0
- package/es/ProLayout/Basic/HeaderStyle.js +10 -0
- package/es/ProLayout/PageContainer/index.js +354 -0
- package/es/ProLayout/PageContainer/style.js +85 -0
- package/es/ProLayout/RouteContext.js +28 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +241 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +274 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/style.js +204 -0
- package/es/ProLayout/TopHeader/index.js +170 -0
- package/es/ProLayout/TopHeader/style.js +154 -0
- package/es/ProLayout/defaultSettings.js +113 -0
- package/es/ProLayout/index.js +10 -0
- package/es/ProLayout/style/index.js +14 -0
- package/es/ProLayout/util.js +58 -0
- package/es/ProTable/Alert.js +40 -0
- package/es/ProTable/Content.js +97 -0
- package/es/ProTable/Header.js +33 -0
- package/es/ProTable/Pagination.js +55 -0
- package/es/ProTable/ProTable.js +279 -0
- package/es/ProTable/hooks/index.js +2 -0
- package/es/ProTable/hooks/useTableInject.js +6 -0
- package/es/ProTable/hooks/useTableSelection.js +115 -0
- package/es/ProTable/index.js +8 -0
- package/es/ProTable/setting.js +138 -0
- package/es/ProTable/style/index.js +113 -0
- package/es/RadioButton/RadioButton.js +53 -0
- package/es/RadioButton/index.js +8 -0
- package/es/RadioButton/style/index.js +25 -0
- package/es/Scrollbar/Bar.js +76 -0
- package/es/Scrollbar/Scrollbar.js +161 -0
- package/es/Scrollbar/Thumb.js +150 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +7 -0
- package/es/Scrollbar/scrollbarProps.js +100 -0
- package/es/Scrollbar/style/index.js +85 -0
- package/es/Scrollbar/thumbProps.js +10 -0
- package/es/Scrollbar/util.js +39 -0
- package/es/Search/Item.js +239 -0
- package/es/Search/Search.js +90 -0
- package/es/Search/hooks/index.js +117 -0
- package/es/Search/hooks/useRouteQuery.js +86 -0
- package/es/Search/hooks/useSearchItems.js +50 -0
- package/es/Search/hooks/useTermOptions.js +29 -0
- package/es/Search/index.js +10 -0
- package/es/Search/setting.js +245 -0
- package/es/Search/style/index.js +5 -0
- package/es/Search/style/item.js +40 -0
- package/es/Search/style/search.js +177 -0
- package/es/Search/util.js +270 -0
- package/es/Skeleton/Skeleton.js +27 -0
- package/es/Skeleton/components/DashBoardCard.js +27 -0
- package/es/Skeleton/components/DashBoardChart.js +27 -0
- package/es/Skeleton/components/Detail.js +27 -0
- package/es/Skeleton/components/Drawer.js +27 -0
- package/es/Skeleton/components/Item.js +54 -0
- package/es/Skeleton/components/List.js +27 -0
- package/es/Skeleton/components/ListCard.js +28 -0
- package/es/Skeleton/components/ListCardItem.js +20 -0
- package/es/Skeleton/components/ListTable.js +27 -0
- package/es/Skeleton/components/Page.js +26 -0
- package/es/Skeleton/components/Search.js +16 -0
- package/es/Skeleton/components/Tree.js +27 -0
- package/es/Skeleton/index.js +28 -0
- package/es/Skeleton/style/index.js +195 -0
- package/es/TimeFormat/TimeFormat.js +36 -0
- package/es/TimeFormat/index.js +7 -0
- package/es/Title/Title.js +26 -0
- package/es/Title/index.js +7 -0
- package/es/Title/style/index.js +34 -0
- package/es/ValueItem/ValueItem.js +113 -0
- package/es/ValueItem/index.js +7 -0
- package/es/ValueItem/util.js +17 -0
- package/es/VirtualTable/VirtualTable.js +271 -0
- package/es/VirtualTable/data.js +60 -0
- package/es/VirtualTable/index.js +7 -0
- package/es/VirtualTable/style/index.js +34 -0
- package/es/components.js +21 -0
- package/es/index.js +17 -0
- package/es/locale/en-US.js +120 -0
- package/es/locale/zh-CN.js +120 -0
- package/es/style/styleRegister.js +19 -0
- package/es/style/variable.js +4 -0
- package/es/style.js +1 -0
- package/es/utils/constants.js +10 -0
- package/lib/AutoComplete/AutoComplete.js +84 -0
- package/lib/AutoComplete/index.js +7 -0
- package/lib/BadgeStatus/Badge.js +51 -0
- package/lib/BadgeStatus/color.js +14 -0
- package/lib/BadgeStatus/index.js +8 -0
- package/lib/CardSelect/CardSelect.js +141 -0
- package/lib/CardSelect/index.js +7 -0
- package/lib/CardSelect/style/index.js +29 -0
- package/lib/CheckButton/CheckButton.js +122 -0
- package/lib/CheckButton/index.js +7 -0
- package/lib/CheckButton/style/index.js +44 -0
- package/lib/ConfigProvider/ConfigProvider.js +73 -0
- package/lib/ConfigProvider/context.js +26 -0
- package/lib/ConfigProvider/index.js +9 -0
- package/lib/DragModal/DragModal.js +212 -0
- package/lib/DragModal/index.js +7 -0
- package/lib/DragModal/style/index.js +86 -0
- package/lib/EditTable/Body.js +189 -0
- package/lib/EditTable/CellRender.js +12 -0
- package/lib/EditTable/EditTable.js +434 -0
- package/lib/EditTable/FormItem.js +169 -0
- package/lib/EditTable/Group.js +204 -0
- package/lib/EditTable/Header.js +63 -0
- package/lib/EditTable/HeaderRender.js +12 -0
- package/lib/EditTable/components/ContextMenu/Menu.js +86 -0
- package/lib/EditTable/components/ContextMenu/index.js +96 -0
- package/lib/EditTable/components/Search/Search.js +163 -0
- package/lib/EditTable/components/Search/Sort.js +119 -0
- package/lib/EditTable/components/Search/index.js +2 -0
- package/lib/EditTable/consts.js +13 -0
- package/lib/EditTable/context.js +88 -0
- package/lib/EditTable/hooks/index.js +19 -0
- package/lib/EditTable/hooks/useGroup.js +48 -0
- package/lib/EditTable/hooks/useResizeObserver.js +27 -0
- package/lib/EditTable/hooks/useValidate.js +112 -0
- package/lib/EditTable/index.js +25 -0
- package/lib/EditTable/props.js +60 -0
- package/lib/EditTable/style/body.js +63 -0
- package/lib/EditTable/style/form.js +33 -0
- package/lib/EditTable/style/group.js +33 -0
- package/lib/EditTable/style/header.js +72 -0
- package/lib/EditTable/style/index.js +52 -0
- package/lib/EditTable/style/menu.js +27 -0
- package/lib/EditTable/style/table.js +46 -0
- package/lib/EditTable/utils.js +110 -0
- package/lib/Ellipsis/Ellipsis.js +148 -0
- package/lib/Ellipsis/index.js +7 -0
- package/lib/Ellipsis/style/index.js +26 -0
- package/lib/Empty/Empty.js +63 -0
- package/lib/Empty/image.js +3 -0
- package/lib/Empty/index.js +7 -0
- package/lib/FullPage/FullPage.js +19 -0
- package/lib/FullPage/index.js +7 -0
- package/lib/Icon/Icon.js +49 -0
- package/lib/Icon/index.js +7 -0
- package/lib/LocaleProvider/LocaleProvider.js +31 -0
- package/lib/LocaleProvider/index.js +7 -0
- package/lib/LocaleReciver/index.js +24 -0
- package/lib/Markdown/Markdown.js +118 -0
- package/lib/Markdown/index.js +7 -0
- package/lib/PermissionButton/PermissionButton.js +118 -0
- package/lib/PermissionButton/confirm.js +94 -0
- package/lib/PermissionButton/index.js +9 -0
- package/lib/PermissionButton/shared.js +1 -0
- package/lib/ProLayout/Basic/BasicLayout.js +422 -0
- package/lib/ProLayout/Basic/BasicLayoutStyle.js +51 -0
- package/lib/ProLayout/Basic/Header.js +111 -0
- package/lib/ProLayout/Basic/HeaderStyle.js +10 -0
- package/lib/ProLayout/PageContainer/index.js +354 -0
- package/lib/ProLayout/PageContainer/style.js +85 -0
- package/lib/ProLayout/RouteContext.js +28 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +241 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +274 -0
- package/lib/ProLayout/SiderMenu/index.js +2 -0
- package/lib/ProLayout/SiderMenu/style.js +204 -0
- package/lib/ProLayout/TopHeader/index.js +170 -0
- package/lib/ProLayout/TopHeader/style.js +154 -0
- package/lib/ProLayout/defaultSettings.js +113 -0
- package/lib/ProLayout/index.js +10 -0
- package/lib/ProLayout/style/index.js +14 -0
- package/lib/ProLayout/util.js +58 -0
- package/lib/ProTable/Alert.js +40 -0
- package/lib/ProTable/Content.js +97 -0
- package/lib/ProTable/Header.js +33 -0
- package/lib/ProTable/Pagination.js +55 -0
- package/lib/ProTable/ProTable.js +279 -0
- package/lib/ProTable/hooks/index.js +2 -0
- package/lib/ProTable/hooks/useTableInject.js +6 -0
- package/lib/ProTable/hooks/useTableSelection.js +115 -0
- package/lib/ProTable/index.js +8 -0
- package/lib/ProTable/setting.js +138 -0
- package/lib/ProTable/style/index.js +113 -0
- package/lib/RadioButton/RadioButton.js +53 -0
- package/lib/RadioButton/index.js +8 -0
- package/lib/RadioButton/style/index.js +25 -0
- package/lib/Scrollbar/Bar.js +76 -0
- package/lib/Scrollbar/Scrollbar.js +161 -0
- package/lib/Scrollbar/Thumb.js +150 -0
- package/lib/Scrollbar/constants.js +1 -0
- package/lib/Scrollbar/index.js +7 -0
- package/lib/Scrollbar/scrollbarProps.js +100 -0
- package/lib/Scrollbar/style/index.js +85 -0
- package/lib/Scrollbar/thumbProps.js +10 -0
- package/lib/Scrollbar/util.js +39 -0
- package/lib/Search/Item.js +239 -0
- package/lib/Search/Search.js +90 -0
- package/lib/Search/hooks/index.js +117 -0
- package/lib/Search/hooks/useRouteQuery.js +86 -0
- package/lib/Search/hooks/useSearchItems.js +50 -0
- package/lib/Search/hooks/useTermOptions.js +29 -0
- package/lib/Search/index.js +10 -0
- package/lib/Search/setting.js +245 -0
- package/lib/Search/style/index.js +5 -0
- package/lib/Search/style/item.js +40 -0
- package/lib/Search/style/search.js +177 -0
- package/lib/Search/util.js +270 -0
- package/lib/Skeleton/Skeleton.js +27 -0
- package/lib/Skeleton/components/DashBoardCard.js +27 -0
- package/lib/Skeleton/components/DashBoardChart.js +27 -0
- package/lib/Skeleton/components/Detail.js +27 -0
- package/lib/Skeleton/components/Drawer.js +27 -0
- package/lib/Skeleton/components/Item.js +54 -0
- package/lib/Skeleton/components/List.js +27 -0
- package/lib/Skeleton/components/ListCard.js +28 -0
- package/lib/Skeleton/components/ListCardItem.js +20 -0
- package/lib/Skeleton/components/ListTable.js +27 -0
- package/lib/Skeleton/components/Page.js +26 -0
- package/lib/Skeleton/components/Search.js +16 -0
- package/lib/Skeleton/components/Tree.js +27 -0
- package/lib/Skeleton/index.js +28 -0
- package/lib/Skeleton/style/index.js +195 -0
- package/lib/TimeFormat/TimeFormat.js +36 -0
- package/lib/TimeFormat/index.js +7 -0
- package/lib/Title/Title.js +26 -0
- package/lib/Title/index.js +7 -0
- package/lib/Title/style/index.js +34 -0
- package/lib/ValueItem/ValueItem.js +113 -0
- package/lib/ValueItem/index.js +7 -0
- package/lib/ValueItem/util.js +17 -0
- package/lib/VirtualTable/VirtualTable.js +271 -0
- package/lib/VirtualTable/data.js +60 -0
- package/lib/VirtualTable/index.js +7 -0
- package/lib/VirtualTable/style/index.js +34 -0
- package/lib/components.js +21 -0
- package/lib/index.js +17 -0
- package/lib/locale/en-US.js +120 -0
- package/lib/locale/zh-CN.js +120 -0
- package/lib/style/styleRegister.js +19 -0
- package/lib/style/variable.js +4 -0
- package/lib/style.js +1 -0
- package/lib/utils/constants.js +10 -0
- package/package.json +164 -0
|
@@ -0,0 +1,270 @@
|
|
|
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; }import { cloneDeep, isArray, isFunction, isString, omit } from 'lodash-es'
|
|
2
|
+
import { termType } from './setting'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 处理like,nlike特殊值
|
|
6
|
+
* @param v
|
|
7
|
+
*/
|
|
8
|
+
export const handleLikeValue = (v) => {
|
|
9
|
+
if (isString(v)) {
|
|
10
|
+
return v.split('').reduce((pre, next) => {
|
|
11
|
+
let _next = next
|
|
12
|
+
if (next === '\\') {
|
|
13
|
+
_next = '\\\\'
|
|
14
|
+
} else if (next === '%') {
|
|
15
|
+
_next = '\\%'
|
|
16
|
+
}
|
|
17
|
+
return pre + _next
|
|
18
|
+
}, '')
|
|
19
|
+
}
|
|
20
|
+
return v
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const handleItemValue = (item, columnOptionMap) => {
|
|
24
|
+
const _item = columnOptionMap[item.column].search
|
|
25
|
+
if (_item === null || _item === '' || _item === undefined) return item
|
|
26
|
+
|
|
27
|
+
if (_item.rename) {
|
|
28
|
+
item.column = _item.rename
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (_item.handleValue && isFunction(_item.handleValue)) {
|
|
32
|
+
item.value = _item.handleValue(item.value, item)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (['like', 'nlike'].includes(item.termType) && !!item.value) {
|
|
36
|
+
item.value = `%${handleLikeValue(item.value)}%`
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (_item.handleTerms && isFunction(_item.handleTerms)) {
|
|
40
|
+
return _item.handleTerms(item)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return item
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const isEmpty = (v) => {
|
|
47
|
+
return v === undefined || v === null || v === '' || (isArray(v) && v.length === 0)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const isFilterItem = (item) => {
|
|
51
|
+
return !isEmpty(item.value) && item.column !== undefined
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 处理为外部使用
|
|
56
|
+
* @terms {Array} 表单数据
|
|
57
|
+
* @columnOptionMap {Map} column的Map对象
|
|
58
|
+
*/
|
|
59
|
+
export const termsParamsFormat = (
|
|
60
|
+
terms,
|
|
61
|
+
columnOptionMap,
|
|
62
|
+
type = 'adv',
|
|
63
|
+
dataFormat = 'terms'
|
|
64
|
+
) => {
|
|
65
|
+
// 过滤掉terms中value无效的item
|
|
66
|
+
const cloneParams = cloneDeep(terms.terms)
|
|
67
|
+
const handleParamsValue = cloneParams.map((item) => {
|
|
68
|
+
return omit(handleItemValue(item, columnOptionMap), ['_span'])
|
|
69
|
+
})
|
|
70
|
+
const filterParams = handleParamsValue.filter(isFilterItem)
|
|
71
|
+
|
|
72
|
+
if (dataFormat === 'terms') {
|
|
73
|
+
// terms格式
|
|
74
|
+
// 过滤,并处理值
|
|
75
|
+
if (type === 'adv') {
|
|
76
|
+
if (cloneParams.length > 1) {
|
|
77
|
+
// 拓展开
|
|
78
|
+
const array_A = handleParamsValue.slice(0, 3).filter(isFilterItem)
|
|
79
|
+
const array_B = handleParamsValue.slice(3, 6).filter(isFilterItem)
|
|
80
|
+
const _terms = []
|
|
81
|
+
|
|
82
|
+
if (array_A.length > 0) {
|
|
83
|
+
_terms.push({
|
|
84
|
+
terms: array_A
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (array_B.length > 0) {
|
|
89
|
+
_terms.push({
|
|
90
|
+
terms: array_B,
|
|
91
|
+
type: handleParamsValue[3].type
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
terms: _terms
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
terms: [
|
|
102
|
+
{
|
|
103
|
+
terms: filterParams
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return filterParams
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// dataFormat === 'object'
|
|
113
|
+
return filterParams.reduce((pre, item) => {
|
|
114
|
+
pre[item.column] = item
|
|
115
|
+
return pre
|
|
116
|
+
}, {})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* TreeSelect过滤
|
|
121
|
+
* @param value 过滤值
|
|
122
|
+
* @param treeNode
|
|
123
|
+
* @param key
|
|
124
|
+
*/
|
|
125
|
+
export const filterTreeSelectNode = (value, treeNode, key = 'name') => {
|
|
126
|
+
return _optionalChain([treeNode, 'access', _ => _[key], 'optionalAccess', _2 => _2.includes, 'call', _3 => _3(value)])
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Select过滤
|
|
131
|
+
* @param value 过滤值
|
|
132
|
+
* @param option
|
|
133
|
+
* @param key
|
|
134
|
+
*/
|
|
135
|
+
export const filterSelectNode = (value, option, key = 'label') => {
|
|
136
|
+
return _optionalChain([option, 'access', _4 => _4[key], 'optionalAccess', _5 => _5.includes, 'call', _6 => _6(value)])
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export const hasExpand = (terms) => {
|
|
140
|
+
let itemCount = 0
|
|
141
|
+
terms.forEach((a) => {
|
|
142
|
+
a.terms.forEach((b) => {
|
|
143
|
+
if (b) {
|
|
144
|
+
itemCount += 1
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
return itemCount >= 2
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function shouldExpand(a, b) {
|
|
152
|
+
const isAFirstHasValue = a[0] !== null && a[0] !== undefined
|
|
153
|
+
const isARestNull = a.slice(1).every((item) => item === null || item === undefined)
|
|
154
|
+
const isBAllNull = b.every((item) => item === null || item === undefined)
|
|
155
|
+
return !(isAFirstHasValue && isARestNull && isBAllNull)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const compatibleOldTerms = (q, columnsMap, defaultCacheValues) => {
|
|
159
|
+
try {
|
|
160
|
+
const terms = JSON.parse(q || '{}')
|
|
161
|
+
|
|
162
|
+
if (terms.terms.length === 2) {
|
|
163
|
+
const expand = shouldExpand(terms.terms[0].terms, terms.terms[1].terms)
|
|
164
|
+
let _terms = []
|
|
165
|
+
|
|
166
|
+
if (!expand) {
|
|
167
|
+
_terms = [terms.terms[0].terms[0]]
|
|
168
|
+
} else {
|
|
169
|
+
_terms = [...terms.terms[0].terms, ...terms.terms[1].terms]
|
|
170
|
+
// 重新
|
|
171
|
+
const arr = Object.values(columnsMap)
|
|
172
|
+
for (let i = 0; i < _terms.length; i++) {
|
|
173
|
+
if (_terms[i] === null) {
|
|
174
|
+
const indexIn = i % arr.length
|
|
175
|
+
const obj = getItemDefaultValue(arr[indexIn], defaultCacheValues)
|
|
176
|
+
if (i === 3) {
|
|
177
|
+
obj.type = terms.terms[1].type
|
|
178
|
+
}
|
|
179
|
+
_terms[i] = obj
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
terms: _terms,
|
|
186
|
+
expand
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
const hasTermsKey = Reflect.has(terms.terms[0], 'terms') // 兼容历史数据
|
|
190
|
+
return {
|
|
191
|
+
terms: hasTermsKey ? terms.terms[0].terms : terms.terms,
|
|
192
|
+
expand: terms.terms.length > 1
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
} catch (e) {
|
|
196
|
+
console.warn('[Pro Search Error] > ', e)
|
|
197
|
+
return {
|
|
198
|
+
terms: [],
|
|
199
|
+
expand: false
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export const getTermTypeFn = (type) => {
|
|
205
|
+
switch (type) {
|
|
206
|
+
case 'select':
|
|
207
|
+
case 'treeSelect':
|
|
208
|
+
case 'number':
|
|
209
|
+
return 'eq'
|
|
210
|
+
case 'date':
|
|
211
|
+
case 'time':
|
|
212
|
+
return 'gt'
|
|
213
|
+
case 'timeRange':
|
|
214
|
+
case 'rangePicker':
|
|
215
|
+
return 'btw'
|
|
216
|
+
default:
|
|
217
|
+
return 'like'
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export const getTermTypes = (types, locale) => {
|
|
222
|
+
const termTypes = termType(locale)
|
|
223
|
+
return types.map((code) => {
|
|
224
|
+
return termTypes.find((item) => item.value === code)
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export const getTermOptions = (type, locale) => {
|
|
229
|
+
let keys = []
|
|
230
|
+
|
|
231
|
+
switch (type) {
|
|
232
|
+
case 'select':
|
|
233
|
+
case 'treeSelect':
|
|
234
|
+
keys = ['not', 'eq', 'in', 'nin']
|
|
235
|
+
break
|
|
236
|
+
case 'time':
|
|
237
|
+
case 'date':
|
|
238
|
+
keys = ['gt', 'lt', 'gte', 'lte']
|
|
239
|
+
break
|
|
240
|
+
case 'timeRange':
|
|
241
|
+
case 'rangePicker':
|
|
242
|
+
keys = ['btw', 'nbtw']
|
|
243
|
+
break
|
|
244
|
+
case 'number':
|
|
245
|
+
keys = ['eq', 'not', 'gt', 'lt', 'gte', 'lte']
|
|
246
|
+
break
|
|
247
|
+
default:
|
|
248
|
+
keys = ['like', 'nlike', 'eq', 'not']
|
|
249
|
+
break
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return keys.length ? getTermTypes(keys, locale) : termType(locale)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* 获取单项默认值,仅初始化使用
|
|
257
|
+
* @param record
|
|
258
|
+
* @param defaultCacheValues
|
|
259
|
+
*/
|
|
260
|
+
export const getItemDefaultValue = (record, defaultCacheValues) => {
|
|
261
|
+
const defaultValue = { ...defaultCacheValues[record.dataIndex] }
|
|
262
|
+
|
|
263
|
+
return {
|
|
264
|
+
column: record.dataIndex,
|
|
265
|
+
termType: defaultValue.defaultTermType || getTermTypeFn(record.search.type),
|
|
266
|
+
value: defaultValue.defaultValue,
|
|
267
|
+
type: 'or',
|
|
268
|
+
_span: record.search.span
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './components/Item.js'
|
|
4
|
+
import useSkeletonStyle from './style'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeleton',
|
|
8
|
+
components: { Item },
|
|
9
|
+
props: {
|
|
10
|
+
active: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
21
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
hashId
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
import useSkeletonStyle from '../style'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeletonDashboardCard',
|
|
8
|
+
components: { Item },
|
|
9
|
+
props: {
|
|
10
|
+
active: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
21
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
hashId
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
import useSkeletonStyle from '../style'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeletonDashboardChart',
|
|
8
|
+
components: { Item },
|
|
9
|
+
props: {
|
|
10
|
+
active: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
21
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
hashId
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
import useSkeletonStyle from '../style'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeletonDetail',
|
|
8
|
+
components: { Item },
|
|
9
|
+
props: {
|
|
10
|
+
active: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
21
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
hashId
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
import useSkeletonStyle from '../style'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeletonDrawer',
|
|
8
|
+
components: { Item },
|
|
9
|
+
props: {
|
|
10
|
+
active: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
21
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
hashId
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import useSkeletonStyle from '../style'
|
|
4
|
+
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
props: {
|
|
7
|
+
active: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: true
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
type: [String, Number],
|
|
13
|
+
default: 'default'
|
|
14
|
+
},
|
|
15
|
+
width: {
|
|
16
|
+
type: [String, Number],
|
|
17
|
+
default: '100%'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
22
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
23
|
+
|
|
24
|
+
const _className = computed(() => {
|
|
25
|
+
const { active, size } = props
|
|
26
|
+
return {
|
|
27
|
+
'j-skeleton-item': true,
|
|
28
|
+
'j-skeleton-item-active': active,
|
|
29
|
+
'j-skeleton-item-lg': size === 'large',
|
|
30
|
+
'j-skeleton-item-sm': size === 'small',
|
|
31
|
+
[hashId.value]: true
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const sizeStyle = computed(() => {
|
|
36
|
+
const { size, width } = props
|
|
37
|
+
if (typeof size === 'number') {
|
|
38
|
+
return {
|
|
39
|
+
height: `${size}px`,
|
|
40
|
+
width: `${width}px`
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
return {
|
|
44
|
+
width: typeof size === 'number' ? `${width}px` : width
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
_className,
|
|
51
|
+
sizeStyle
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
import ListCard from './ListCard.js'
|
|
4
|
+
import ListTable from './ListTable.js'
|
|
5
|
+
import Search from './Search.js'
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'JSkeletonList',
|
|
9
|
+
components: { ListCard, ListTable, Search },
|
|
10
|
+
props: {
|
|
11
|
+
active: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: true
|
|
14
|
+
},
|
|
15
|
+
loading: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true
|
|
18
|
+
},
|
|
19
|
+
mode: {
|
|
20
|
+
type: [String, undefined] ,
|
|
21
|
+
default: 'TABLE'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(props) {
|
|
25
|
+
return {}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
import ListCardItem from './ListCardItem.js'
|
|
5
|
+
import useSkeletonStyle from '../style'
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'JSkeletonListCard',
|
|
9
|
+
components: { Item, ListCardItem },
|
|
10
|
+
props: {
|
|
11
|
+
active: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: true
|
|
14
|
+
},
|
|
15
|
+
loading: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
22
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
hashId
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
components: { Item },
|
|
7
|
+
props: {
|
|
8
|
+
active: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: true
|
|
11
|
+
},
|
|
12
|
+
loading: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: true
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
setup(props) {
|
|
18
|
+
return {}
|
|
19
|
+
}
|
|
20
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
import useSkeletonStyle from '../style'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeletonListTable',
|
|
8
|
+
components: { Item },
|
|
9
|
+
props: {
|
|
10
|
+
active: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
21
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
hashId
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
import List from './List.js'
|
|
4
|
+
import Detail from './Detail.js'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeletonPage',
|
|
8
|
+
components: { List, Detail },
|
|
9
|
+
props: {
|
|
10
|
+
type: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: 'list' // detail
|
|
13
|
+
},
|
|
14
|
+
active: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
},
|
|
18
|
+
loading: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(props) {
|
|
24
|
+
return {}
|
|
25
|
+
}
|
|
26
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, computed } from 'vue'
|
|
3
|
+
import Item from './Item.js'
|
|
4
|
+
import useSkeletonStyle from '../style'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'JSkeletonTree',
|
|
8
|
+
components: { Item },
|
|
9
|
+
props: {
|
|
10
|
+
active: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const prefixCls = computed(() => 'j-skeleton')
|
|
21
|
+
const [wrapSSR, hashId] = useSkeletonStyle(prefixCls)
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
hashId
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import JSkeletonListTable from './components/ListTable.js'
|
|
2
|
+
import JSkeletonListCard from './components/ListCard.js'
|
|
3
|
+
import JSkeletonTree from './components/Tree.js'
|
|
4
|
+
import JSkeletonDetail from './components/Detail.js'
|
|
5
|
+
import JSkeletonDrawer from './components/Drawer.js'
|
|
6
|
+
import JSkeletonDashboardCard from './components/DashBoardCard.js'
|
|
7
|
+
import JSkeletonDashboardChart from './components/DashBoardChart.js'
|
|
8
|
+
import JSkeletonList from './components/List.js'
|
|
9
|
+
import JSkeletonPage from './components/Page.js'
|
|
10
|
+
import Skeleton from './Skeleton.js'
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
JSkeletonDashboardCard,
|
|
14
|
+
JSkeletonDashboardChart,
|
|
15
|
+
JSkeletonListTable,
|
|
16
|
+
JSkeletonListCard,
|
|
17
|
+
JSkeletonPage,
|
|
18
|
+
JSkeletonTree,
|
|
19
|
+
JSkeletonDetail,
|
|
20
|
+
JSkeletonDrawer,
|
|
21
|
+
JSkeletonList
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Skeleton.install = function (app) {
|
|
25
|
+
app.component(Skeleton.name , Skeleton)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Skeleton
|