@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,39 @@
|
|
|
1
|
+
export const GAP = 4 // top 2 + bottom 2 of bar instance
|
|
2
|
+
|
|
3
|
+
export const BAR_MAP = {
|
|
4
|
+
vertical: {
|
|
5
|
+
offset: 'offsetHeight',
|
|
6
|
+
scroll: 'scrollTop',
|
|
7
|
+
scrollSize: 'scrollHeight',
|
|
8
|
+
size: 'height',
|
|
9
|
+
key: 'vertical',
|
|
10
|
+
axis: 'Y',
|
|
11
|
+
client: 'clientY',
|
|
12
|
+
direction: 'top'
|
|
13
|
+
},
|
|
14
|
+
horizontal: {
|
|
15
|
+
offset: 'offsetWidth',
|
|
16
|
+
scroll: 'scrollLeft',
|
|
17
|
+
scrollSize: 'scrollWidth',
|
|
18
|
+
size: 'width',
|
|
19
|
+
key: 'horizontal',
|
|
20
|
+
axis: 'X',
|
|
21
|
+
client: 'clientX',
|
|
22
|
+
direction: 'left'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const renderThumbStyle = ({
|
|
27
|
+
move,
|
|
28
|
+
size,
|
|
29
|
+
bar
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
) => {
|
|
35
|
+
return {
|
|
36
|
+
[bar.size]: size,
|
|
37
|
+
transform: `translate${bar.axis}(${move}%)`
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
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, ref, reactive, watch, isRef } from 'vue'
|
|
3
|
+
import { Select } from 'ant-design-vue'
|
|
4
|
+
import { componentProps, componentType, typeOptions } from './setting'
|
|
5
|
+
import { getTermOptions, getItemDefaultValue } from './util'
|
|
6
|
+
import { useLocaleReceiver } from '../LocaleReciver'
|
|
7
|
+
import { useColumnsMap, useDefaultValue, useOptionMap } from './hooks'
|
|
8
|
+
import { isArray, isFunction } from 'lodash-es'
|
|
9
|
+
import useSearchStyle from './style'
|
|
10
|
+
|
|
11
|
+
export default defineComponent({
|
|
12
|
+
name: 'JSearchItem',
|
|
13
|
+
components: { Select },
|
|
14
|
+
props: {
|
|
15
|
+
column: {
|
|
16
|
+
type: String
|
|
17
|
+
},
|
|
18
|
+
value: {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
21
|
+
termType: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: 'like'
|
|
24
|
+
},
|
|
25
|
+
type: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'or'
|
|
28
|
+
},
|
|
29
|
+
expand: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
onlyValue: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
},
|
|
37
|
+
labelWidth: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: 40
|
|
40
|
+
},
|
|
41
|
+
index: {
|
|
42
|
+
type: Number,
|
|
43
|
+
default: 1
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
emits: ['update:value', 'update:termType', 'update:type', 'update:column'],
|
|
47
|
+
setup(props, { emit }) {
|
|
48
|
+
const termsModel = reactive({
|
|
49
|
+
type: props.type || 'or',
|
|
50
|
+
value: props.value || '',
|
|
51
|
+
termType: props.termType || 'like',
|
|
52
|
+
column: props.column || undefined
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const [contextLocale] = useLocaleReceiver('Search')
|
|
56
|
+
const optionsMap = useOptionMap()
|
|
57
|
+
const columnsMap = useColumnsMap()
|
|
58
|
+
const columnsValues = useDefaultValue()
|
|
59
|
+
|
|
60
|
+
const targetComponents = ref({})
|
|
61
|
+
const valueOptions = ref()
|
|
62
|
+
|
|
63
|
+
const btwKeys = computed(() => {
|
|
64
|
+
const record = findItemByColumn()
|
|
65
|
+
if (record.search.isBtw && Array.isArray(record.search.isBtw)) {
|
|
66
|
+
return [...record.search.isBtw, 'in', 'nin']
|
|
67
|
+
}
|
|
68
|
+
return ['in', 'nin']
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const prefixCls = computed(() => 'JSearch')
|
|
72
|
+
const [wrapSSR, hashId] = useSearchStyle(prefixCls)
|
|
73
|
+
|
|
74
|
+
const termTypeOptions = computed(() => {
|
|
75
|
+
const columnTarget = findItemByColumn()
|
|
76
|
+
const columnSearch = _optionalChain([columnTarget, 'optionalAccess', _ => _.search])
|
|
77
|
+
let _termsOptions = getTermOptions(targetComponents.value.type, contextLocale.value)
|
|
78
|
+
|
|
79
|
+
if (_optionalChain([columnSearch, 'optionalAccess', _2 => _2.termOptions])) {
|
|
80
|
+
_termsOptions = columnSearch.termOptions
|
|
81
|
+
} else if (_optionalChain([columnSearch, 'optionalAccess', _3 => _3.termFilter, 'optionalAccess', _4 => _4.length])) {
|
|
82
|
+
_termsOptions = _termsOptions.filter(
|
|
83
|
+
(item) => !_optionalChain([columnSearch, 'access', _5 => _5.termFilter, 'optionalAccess', _6 => _6.includes, 'call', _7 => _7(item.value)])
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return _termsOptions
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const columnOptions = computed(() => {
|
|
91
|
+
return Object.values(columnsMap.value)
|
|
92
|
+
.sort((a, b) => a._sort_index - b._sort_index)
|
|
93
|
+
.map((item) => ({ label: item.title, value: item.dataIndex }))
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const findItemByColumn = () => {
|
|
97
|
+
return columnsMap.value[termsModel.column ]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const findOptionsByColumn = () => {
|
|
101
|
+
return optionsMap.value[termsModel.column ]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 处理options
|
|
106
|
+
* @param _options
|
|
107
|
+
*/
|
|
108
|
+
const handleColumnsOptions = async (_options) => {
|
|
109
|
+
if (isFunction(_options)) {
|
|
110
|
+
valueOptions.value = await _options()
|
|
111
|
+
optionsMap.value[props.column ] = [...valueOptions.value]
|
|
112
|
+
} else if (isArray(_options)) {
|
|
113
|
+
valueOptions.value = _options
|
|
114
|
+
} else if (isRef(_options) || (typeof _options === 'object' && 'value' in _options)) {
|
|
115
|
+
valueOptions.value = _options.value
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const onTypeChange = () => {
|
|
120
|
+
emit('update:type', termsModel.type)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const onColumnChange = () => {
|
|
124
|
+
const record = findItemByColumn()
|
|
125
|
+
const defaultValue = getItemDefaultValue(record, columnsValues.value)
|
|
126
|
+
|
|
127
|
+
// 处理默认选项
|
|
128
|
+
termsModel.termType = defaultValue.termType
|
|
129
|
+
// 处理默认值
|
|
130
|
+
termsModel.value = defaultValue.value
|
|
131
|
+
|
|
132
|
+
emit('update:column', termsModel.column)
|
|
133
|
+
onTermTypeChange()
|
|
134
|
+
onValueChange()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const onTermTypeChange = () => {
|
|
138
|
+
const isBtw = btwKeys.value.includes(termsModel.termType)
|
|
139
|
+
|
|
140
|
+
if (!isBtw && termsModel.value && Array.isArray(termsModel.value)) {
|
|
141
|
+
termsModel.value = termsModel.value[0]
|
|
142
|
+
onValueChange()
|
|
143
|
+
} else if (isBtw && termsModel.value && !Array.isArray(termsModel.value)) {
|
|
144
|
+
termsModel.value = [termsModel.value]
|
|
145
|
+
onValueChange()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
emit('update:termType', termsModel.termType)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const onValueChange = () => {
|
|
152
|
+
emit('update:value', termsModel.value)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const handleTermsModelValue = (isBtw) => {
|
|
156
|
+
if (isBtw) {
|
|
157
|
+
if (termsModel.value && !Array.isArray(termsModel.value)) {
|
|
158
|
+
termsModel.value = [termsModel.value]
|
|
159
|
+
} else if (!termsModel.value) {
|
|
160
|
+
termsModel.value = []
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
if (termsModel.value && Array.isArray(termsModel.value)) {
|
|
164
|
+
termsModel.value = termsModel.value[0]
|
|
165
|
+
} else if (!termsModel.value) {
|
|
166
|
+
termsModel.value = undefined
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
watch(
|
|
172
|
+
() => [targetComponents.value.name, termsModel.termType],
|
|
173
|
+
() => {
|
|
174
|
+
const isBtw = btwKeys.value.includes(termsModel.termType)
|
|
175
|
+
|
|
176
|
+
if (targetComponents.value.type === componentType.treeSelect) {
|
|
177
|
+
targetComponents.value.props = {
|
|
178
|
+
...targetComponents.value.props,
|
|
179
|
+
multiple: isBtw
|
|
180
|
+
}
|
|
181
|
+
handleTermsModelValue(isBtw)
|
|
182
|
+
} else if (targetComponents.value.type === componentType.select) {
|
|
183
|
+
targetComponents.value.props = {
|
|
184
|
+
...targetComponents.value.props,
|
|
185
|
+
mode: isBtw ? 'multiple' : 'combobox'
|
|
186
|
+
}
|
|
187
|
+
handleTermsModelValue(isBtw)
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{ immediate: true, deep: true }
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
watch(
|
|
194
|
+
() => [termsModel.column, columnsMap.value],
|
|
195
|
+
async () => {
|
|
196
|
+
// 根据column从map中获取record,再解析search属性
|
|
197
|
+
const record = findItemByColumn()
|
|
198
|
+
if (!record) return
|
|
199
|
+
|
|
200
|
+
const options = findOptionsByColumn()
|
|
201
|
+
targetComponents.value = componentProps(record.search)
|
|
202
|
+
targetComponents.value.label = record.title
|
|
203
|
+
|
|
204
|
+
// 处理options
|
|
205
|
+
if (options) {
|
|
206
|
+
valueOptions.value = options
|
|
207
|
+
} else {
|
|
208
|
+
await handleColumnsOptions(record.search.options)
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{ immediate: true, deep: true }
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
watch(
|
|
215
|
+
() => [props.value, props.termType, props.column, props.type],
|
|
216
|
+
() => {
|
|
217
|
+
termsModel.value = props.value
|
|
218
|
+
termsModel.termType = props.termType
|
|
219
|
+
termsModel.column = props.column
|
|
220
|
+
termsModel.type = props.type
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
termsModel,
|
|
226
|
+
contextLocale,
|
|
227
|
+
targetComponents,
|
|
228
|
+
valueOptions,
|
|
229
|
+
hashId,
|
|
230
|
+
termTypeOptions,
|
|
231
|
+
columnOptions,
|
|
232
|
+
typeOptions,
|
|
233
|
+
onTypeChange,
|
|
234
|
+
onColumnChange,
|
|
235
|
+
onTermTypeChange,
|
|
236
|
+
onValueChange
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
})
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineComponent, reactive, ref, computed, inject, useAttrs } from 'vue'
|
|
3
|
+
import { searchProps } from './setting'
|
|
4
|
+
import { useLocaleReceiver } from '../LocaleReciver'
|
|
5
|
+
import { Button, Col, Form, FormItemRest, Row } from 'ant-design-vue'
|
|
6
|
+
import { SearchConfig } from '../utils/constants'
|
|
7
|
+
import Item from './Item.js'
|
|
8
|
+
import { useHandleColumns, useOptionMapContent } from './hooks'
|
|
9
|
+
import { termsParamsFormat } from './util'
|
|
10
|
+
import useSearchStyle from './style'
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
name: 'JSearch',
|
|
14
|
+
components: {
|
|
15
|
+
Button,
|
|
16
|
+
Col,
|
|
17
|
+
Form,
|
|
18
|
+
FormItemRest,
|
|
19
|
+
Row,
|
|
20
|
+
Item
|
|
21
|
+
},
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
props: {
|
|
24
|
+
...searchProps()
|
|
25
|
+
} ,
|
|
26
|
+
emits: ['search'],
|
|
27
|
+
setup(props, { emit, expose }) {
|
|
28
|
+
const [contextLocale] = useLocaleReceiver('Search')
|
|
29
|
+
const attrs = useAttrs()
|
|
30
|
+
|
|
31
|
+
const columnsOptionMap = ref({}) // 存储每个columnItem的option
|
|
32
|
+
const terms = reactive({ terms: [] }) // 当前查询条件
|
|
33
|
+
|
|
34
|
+
const context = inject(SearchConfig, { align: props.align })
|
|
35
|
+
|
|
36
|
+
const { initValues, columnsMap } = useHandleColumns(props, terms)
|
|
37
|
+
|
|
38
|
+
const prefixCls = computed(() => 'JSearch')
|
|
39
|
+
const [wrapSSR, hashId] = useSearchStyle(prefixCls)
|
|
40
|
+
|
|
41
|
+
useOptionMapContent(columnsOptionMap)
|
|
42
|
+
|
|
43
|
+
const footerStyles = computed(() => {
|
|
44
|
+
const align = context.align || props.align
|
|
45
|
+
if (align === 'value') {
|
|
46
|
+
return { paddingLeft: `${props.labelWidth + 8}px` }
|
|
47
|
+
}
|
|
48
|
+
return {}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const searchSubmit = () => {
|
|
52
|
+
emit('search', termsParamsFormat(terms, columnsMap.value, 'low', props.type))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const reset = () => {
|
|
56
|
+
initValues()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const handleDefaultValues = (value) => {
|
|
60
|
+
const isObject = Object.prototype.toString.call(value) === '[object Object]'
|
|
61
|
+
let _params = isObject
|
|
62
|
+
? Object.keys(value).map((key) => ({ column: key, value: value[key], termType: 'eq' }))
|
|
63
|
+
: [...value]
|
|
64
|
+
|
|
65
|
+
terms.terms.forEach((item) => {
|
|
66
|
+
const paramsItem = _params.find((paramsItem) => paramsItem.column === item.column)
|
|
67
|
+
if (paramsItem) {
|
|
68
|
+
item.value = paramsItem.value
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
emit('search', termsParamsFormat(terms, columnsMap.value))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
expose({
|
|
76
|
+
setValues: handleDefaultValues,
|
|
77
|
+
reset
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
contextLocale,
|
|
82
|
+
attrs,
|
|
83
|
+
terms,
|
|
84
|
+
hashId,
|
|
85
|
+
footerStyles,
|
|
86
|
+
searchSubmit,
|
|
87
|
+
reset
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
|
@@ -0,0 +1,117 @@
|
|
|
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 { provide, inject, watchEffect, ref, } from 'vue'
|
|
2
|
+
import { getItemDefaultValue } from '../util'
|
|
3
|
+
|
|
4
|
+
export * from './useSearchItems'
|
|
5
|
+
export * from './useRouteQuery'
|
|
6
|
+
export * from './useTermOptions'
|
|
7
|
+
|
|
8
|
+
const optionMapKey = Symbol('optionMapKey')
|
|
9
|
+
const columnsMapKey = Symbol('columnMapKey')
|
|
10
|
+
const columnsValues = Symbol('columnsValues')
|
|
11
|
+
|
|
12
|
+
export const useOptionMapContent = (optionsMap) => {
|
|
13
|
+
provide(optionMapKey, optionsMap)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const useOptionMap = () => {
|
|
17
|
+
return inject(optionMapKey)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const useColumnsMapContent = (columnsMap) => {
|
|
21
|
+
provide(columnsMapKey, columnsMap)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const useColumnsMap = () => {
|
|
25
|
+
return inject(columnsMapKey)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const useDefaultValue = () => {
|
|
29
|
+
return inject(columnsValues)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const useHandleColumns = (props, terms, options) => {
|
|
33
|
+
const columnsMap = ref({}) // 存储每个column
|
|
34
|
+
const defaultCacheValues = ref({})
|
|
35
|
+
|
|
36
|
+
useColumnsMapContent(columnsMap)
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 处理search.first为true的排序
|
|
40
|
+
* @param arr
|
|
41
|
+
*/
|
|
42
|
+
const moveFirstElementsToFront = (arr) => {
|
|
43
|
+
// 提取所有 first: true 的元素
|
|
44
|
+
const firstElements = arr.filter((item) => item.search.first === true)
|
|
45
|
+
// 提取剩余的元素
|
|
46
|
+
const otherElements = arr.filter((item) => item.search.first !== true)
|
|
47
|
+
// 合并并返回
|
|
48
|
+
return [...firstElements, ...otherElements]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 处理默认值
|
|
53
|
+
* @param arr
|
|
54
|
+
*/
|
|
55
|
+
const handleDefaultValue = (arr) => {
|
|
56
|
+
for (const item of arr) {
|
|
57
|
+
const search = item.search
|
|
58
|
+
const _data = {
|
|
59
|
+
defaultValue: undefined,
|
|
60
|
+
defaultTermType: undefined
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
_data.defaultValue = search.defaultValue
|
|
64
|
+
_data.defaultTermType = search.defaultTermType
|
|
65
|
+
defaultCacheValues.value[item.dataIndex] = _data
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
provide(columnsValues, defaultCacheValues)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const initValues = () => {
|
|
72
|
+
const arr = Object.values(columnsMap.value)
|
|
73
|
+
if (!arr.length) return
|
|
74
|
+
|
|
75
|
+
if (_optionalChain([options, 'optionalAccess', _ => _.mode]) === 'advanced') {
|
|
76
|
+
// 设置第一位
|
|
77
|
+
terms.terms = [getItemDefaultValue(arr[0], defaultCacheValues.value)]
|
|
78
|
+
} else {
|
|
79
|
+
terms.terms = arr.map((item) => {
|
|
80
|
+
return getItemDefaultValue(item, defaultCacheValues.value)
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const handleColumns = (columns) => {
|
|
86
|
+
const columnsSearch = columns.filter((item) => {
|
|
87
|
+
return item.hasOwnProperty('search') && Object.keys(item.search).length
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// 排序
|
|
91
|
+
const columnsSort = moveFirstElementsToFront(columnsSearch)
|
|
92
|
+
|
|
93
|
+
columnsSort.forEach((item, index) => {
|
|
94
|
+
columnsMap.value[item.dataIndex] = {
|
|
95
|
+
...item,
|
|
96
|
+
_sort_index: index
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
handleDefaultValue(columnsSort)
|
|
101
|
+
|
|
102
|
+
if (terms.terms.length === 0) {
|
|
103
|
+
// 高级模式处理数据
|
|
104
|
+
initValues()
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
watchEffect(() => {
|
|
109
|
+
handleColumns(props.columns)
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
initValues,
|
|
114
|
+
columnsMap,
|
|
115
|
+
defaultCacheValues
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { customRef, nextTick, watch } from 'vue'
|
|
2
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
3
|
+
|
|
4
|
+
const _queue = new WeakMap()
|
|
5
|
+
|
|
6
|
+
export const useRouteQuery = (name) => {
|
|
7
|
+
const router = useRouter()
|
|
8
|
+
const route = useRoute()
|
|
9
|
+
|
|
10
|
+
const transformGet = (value) => {
|
|
11
|
+
return value
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const transformSet = (value) => {
|
|
15
|
+
return value
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 在storybook环境中,router可能为undefined或null,需要进行类型检查
|
|
19
|
+
if (!router || !route) {
|
|
20
|
+
// 返回一个模拟的ref,避免在storybook中报错
|
|
21
|
+
return customRef((track, trigger) => {
|
|
22
|
+
let value = undefined
|
|
23
|
+
return {
|
|
24
|
+
get() {
|
|
25
|
+
track()
|
|
26
|
+
return transformGet(value)
|
|
27
|
+
},
|
|
28
|
+
set(v) {
|
|
29
|
+
value = transformSet(v)
|
|
30
|
+
trigger()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!_queue.has(router)) _queue.set(router, new Map())
|
|
37
|
+
const _queriesQueue = _queue.get(router)
|
|
38
|
+
|
|
39
|
+
let query = route.query[name]
|
|
40
|
+
let _trigger
|
|
41
|
+
|
|
42
|
+
const proxy = customRef((track, trigger) => {
|
|
43
|
+
_trigger = trigger
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
get() {
|
|
47
|
+
track()
|
|
48
|
+
return transformGet(query !== undefined ? query : undefined)
|
|
49
|
+
},
|
|
50
|
+
set(v) {
|
|
51
|
+
v = transformSet(v)
|
|
52
|
+
if (query === v) return
|
|
53
|
+
query = v === undefined ? undefined : v
|
|
54
|
+
_queriesQueue.set(name, v === undefined ? undefined : v)
|
|
55
|
+
trigger()
|
|
56
|
+
|
|
57
|
+
nextTick(() => {
|
|
58
|
+
if (_queriesQueue.size === 0) return
|
|
59
|
+
const newQueries = Object.fromEntries(_queriesQueue.entries())
|
|
60
|
+
_queriesQueue.clear()
|
|
61
|
+
|
|
62
|
+
const { params, query, hash } = route
|
|
63
|
+
router.replace({
|
|
64
|
+
params,
|
|
65
|
+
query: { ...query, ...newQueries },
|
|
66
|
+
hash
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
watch(
|
|
74
|
+
() => route.query[name],
|
|
75
|
+
(v) => {
|
|
76
|
+
if (query === transformGet(v)) return
|
|
77
|
+
query = v
|
|
78
|
+
_trigger()
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
flush: 'sync'
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
return proxy
|
|
86
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 { ref } from 'vue'
|
|
2
|
+
import { sortBy } from 'lodash-es'
|
|
3
|
+
|
|
4
|
+
const hasDefaultValue = (item) => {
|
|
5
|
+
return item.defaultValue !== undefined || item.defaultTermType || item.defaultOnceValue
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const useSearchItems = (columns, options) => {
|
|
9
|
+
const items = ref([])
|
|
10
|
+
const optionsMap = ref(new Map())
|
|
11
|
+
|
|
12
|
+
const handleColumns = () => {
|
|
13
|
+
const _items = []
|
|
14
|
+
const values = []
|
|
15
|
+
|
|
16
|
+
columns.forEach((item, index) => {
|
|
17
|
+
const search = item.search
|
|
18
|
+
|
|
19
|
+
if (search && Object.keys(search).length) {
|
|
20
|
+
optionsMap.value.set(item.dataIndex, search)
|
|
21
|
+
|
|
22
|
+
if (hasDefaultValue(search)) {
|
|
23
|
+
const _value = search.defaultValue || search.defaultOnceValue
|
|
24
|
+
values.push({
|
|
25
|
+
type: 'and',
|
|
26
|
+
value: _value,
|
|
27
|
+
termType: search.defaultTermType || 'like',
|
|
28
|
+
column: item.dataIndex
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_items.push({
|
|
33
|
+
...item.search,
|
|
34
|
+
sortIndex: item.search.first ? 0 : index + 1,
|
|
35
|
+
column: item.dataIndex
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
items.value = sortBy(_items, 'sortIndex')
|
|
41
|
+
_optionalChain([options, 'optionalAccess', _ => _.getDefaultValue, 'call', _2 => _2(values)])
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
handleColumns()
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
searchItems: items,
|
|
48
|
+
searchOptionsMap: optionsMap
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { ref } from 'vue'
|
|
2
|
+
import { TermTypeMap } from '../setting'
|
|
3
|
+
import { useLocaleReceiver } from '../../LocaleReciver'
|
|
4
|
+
|
|
5
|
+
export const useTermOptions = (options) => {
|
|
6
|
+
const [contextLocale] = useLocaleReceiver('Search')
|
|
7
|
+
|
|
8
|
+
const termTypeMap = TermTypeMap(contextLocale.value)
|
|
9
|
+
const termsOptionsCache = Object.values(termTypeMap)
|
|
10
|
+
const termOptions = ref()
|
|
11
|
+
|
|
12
|
+
const termsKey = Object.keys(termTypeMap).reduce((previousValue, currentValue) => {
|
|
13
|
+
previousValue[currentValue] = (termTypeMap )[currentValue].value
|
|
14
|
+
return previousValue
|
|
15
|
+
}, {})
|
|
16
|
+
|
|
17
|
+
if (_optionalChain([options, 'optionalAccess', _ => _.omit])) {
|
|
18
|
+
termOptions.value = termsOptionsCache.filter((item) => !options.omit.includes(item.value))
|
|
19
|
+
} else if (_optionalChain([options, 'optionalAccess', _2 => _2.pick])) {
|
|
20
|
+
termOptions.value = termsOptionsCache.filter((item) => options.pick.includes(item.value))
|
|
21
|
+
} else {
|
|
22
|
+
termOptions.value = [...termsOptionsCache]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
termOptions,
|
|
27
|
+
termsKey
|
|
28
|
+
}
|
|
29
|
+
}
|