@jetlinks-web/components 2.0.2 → 2.0.3
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/AMap/Map.js +124 -0
- package/es/AMap/index.js +2 -0
- package/es/AMap/util.js +56 -0
- package/es/BadgeStatus/Badge.js +54 -0
- package/es/BadgeStatus/color.js +21 -0
- package/es/BadgeStatus/index.js +3 -0
- package/es/CardSelect/CardSelect.js +123 -0
- package/es/CardSelect/index.js +2 -0
- package/es/CheckButton/CheckButton.js +121 -0
- package/es/CheckButton/index.js +2 -0
- package/es/ConfigProvider/context.js +12 -0
- package/es/ConfigProvider/index.js +31 -0
- package/es/Echarts/Echarts.js +47 -0
- package/es/Echarts/index.js +2 -0
- package/es/Ellipsis/Ellipsis.js +189 -0
- package/es/Ellipsis/index.js +2 -0
- package/es/Empty/Empty.js +56 -0
- package/es/Empty/image.js +2 -0
- package/es/Empty/index.js +2 -0
- package/es/FullPage/FullPage.js +31 -0
- package/es/FullPage/index.js +2 -0
- package/es/Icon/icon.js +42 -0
- package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
- package/es/MonacoEditor/Monaco.js +238 -0
- package/es/MonacoEditor/index.js +2 -0
- package/es/PermissionButton/index.js +117 -0
- package/es/ProLayout/Basic/BasicLayout.js +259 -0
- package/es/ProLayout/Basic/Header.js +97 -0
- package/es/ProLayout/PageContainer/index.js +324 -0
- package/es/ProLayout/PageContainer/typings.js +1 -0
- package/es/ProLayout/RouteContext.js +22 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +285 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +278 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/typings.js +1 -0
- package/es/ProLayout/TopHeader/index.js +163 -0
- package/es/ProLayout/defaultSettings.js +66 -0
- package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
- package/{src → es}/ProLayout/style/default.less +4 -4
- package/es/ProLayout/style/index.js +1 -0
- package/es/ProLayout/typings.js +1 -0
- package/es/ProLayout/util.js +61 -0
- package/es/ProTable/index.js +411 -0
- package/es/ProTable/proTableTypes.js +11 -0
- package/es/ProTable/style/index.css +65 -0
- package/es/ProTable/style/index.js +1 -0
- package/es/Scrollbar/Bar.js +114 -0
- package/es/Scrollbar/Scrollbar.js +212 -0
- package/es/Scrollbar/Thumb.js +189 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +2 -0
- package/es/Scrollbar/scrollbarProps.js +100 -0
- package/es/Scrollbar/thumbProps.js +10 -0
- package/es/Scrollbar/util.js +30 -0
- package/es/Search/Advanced/History.js +183 -0
- package/es/Search/Advanced/SaveHistory.js +153 -0
- package/es/Search/Advanced/index.js +520 -0
- package/es/Search/Item.js +497 -0
- package/es/Search/Search.js +249 -0
- package/es/Search/hooks/index.js +1 -0
- package/es/Search/hooks/useSearchItems.js +40 -0
- package/es/Search/index.js +4 -0
- package/es/Search/setting.js +91 -0
- package/es/Search/style/Item.less +33 -0
- package/es/Search/style/Search.less +179 -0
- package/es/Search/style/index.js +2 -0
- package/es/Search/typing.js +1 -0
- package/es/Search/util.js +234 -0
- package/es/ValueItem/ValueItem.js +233 -0
- package/es/ValueItem/index.js +2 -0
- package/es/ValueItem/util.js +16 -0
- package/es/index.js +24 -0
- package/es/style/index.js +3 -0
- package/es/style/variable.css +0 -0
- package/{src → es}/style/variable.less +0 -2
- package/es/style.js +3 -0
- package/lib/AMap/Map.js +124 -0
- package/lib/AMap/index.js +9 -0
- package/lib/AMap/util.js +62 -0
- package/lib/BadgeStatus/Badge.js +54 -0
- package/lib/BadgeStatus/color.js +27 -0
- package/lib/BadgeStatus/index.js +22 -0
- package/lib/CardSelect/CardSelect.js +123 -0
- package/lib/CardSelect/index.js +9 -0
- package/lib/CheckButton/CheckButton.js +121 -0
- package/lib/CheckButton/index.js +9 -0
- package/lib/ConfigProvider/context.js +19 -0
- package/lib/ConfigProvider/index.js +37 -0
- package/lib/Echarts/Echarts.js +47 -0
- package/lib/Echarts/index.js +9 -0
- package/lib/Ellipsis/Ellipsis.js +189 -0
- package/lib/Ellipsis/index.js +9 -0
- package/lib/Empty/Empty.js +56 -0
- package/lib/Empty/image.js +8 -0
- package/lib/Empty/index.js +9 -0
- package/lib/FullPage/FullPage.js +31 -0
- package/lib/FullPage/index.js +9 -0
- package/lib/Icon/icon.js +52 -0
- package/lib/Icon/index.js +9 -0
- package/lib/MonacoEditor/Monaco.js +238 -0
- package/lib/MonacoEditor/index.js +9 -0
- package/lib/PermissionButton/index.js +124 -0
- package/lib/ProLayout/Basic/BasicLayout.js +268 -0
- package/lib/ProLayout/Basic/BasicLayout.less +66 -0
- package/lib/ProLayout/Basic/Header.js +103 -0
- package/lib/ProLayout/Basic/Header.less +8 -0
- package/lib/ProLayout/PageContainer/index.js +327 -0
- package/lib/ProLayout/PageContainer/index.less +103 -0
- package/lib/ProLayout/PageContainer/typings.js +5 -0
- package/lib/ProLayout/RouteContext.js +28 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +290 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +287 -0
- package/lib/ProLayout/SiderMenu/index.js +20 -0
- package/lib/ProLayout/SiderMenu/index.less +212 -0
- package/lib/ProLayout/SiderMenu/typings.js +5 -0
- package/lib/ProLayout/TopHeader/index.js +168 -0
- package/lib/ProLayout/TopHeader/index.less +174 -0
- package/lib/ProLayout/defaultSettings.js +72 -0
- package/lib/ProLayout/index.js +16 -0
- package/lib/ProLayout/style/default.less +4 -0
- package/lib/ProLayout/style/index.js +3 -0
- package/lib/ProLayout/style/style.less +7 -0
- package/lib/ProLayout/typings.js +5 -0
- package/lib/ProLayout/util.js +72 -0
- package/lib/ProTable/index.js +417 -0
- package/lib/ProTable/proTableTypes.js +17 -0
- package/lib/ProTable/style/index.css +65 -0
- package/lib/ProTable/style/index.js +3 -0
- package/lib/ProTable/style/index.less +92 -0
- package/lib/Scrollbar/Bar.js +114 -0
- package/lib/Scrollbar/Scrollbar.js +212 -0
- package/lib/Scrollbar/Thumb.js +189 -0
- package/lib/Scrollbar/constants.js +7 -0
- package/lib/Scrollbar/index.js +9 -0
- package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/scrollbarProps.js} +106 -108
- package/lib/Scrollbar/thumbProps.js +16 -0
- package/lib/Scrollbar/util.js +37 -0
- package/lib/Search/Advanced/History.js +183 -0
- package/lib/Search/Advanced/SaveHistory.js +153 -0
- package/lib/Search/Advanced/index.js +520 -0
- package/lib/Search/Item.js +497 -0
- package/lib/Search/Search.js +249 -0
- package/lib/Search/hooks/index.js +16 -0
- package/lib/Search/hooks/useSearchItems.js +47 -0
- package/lib/Search/index.js +16 -0
- package/lib/Search/setting.js +97 -0
- package/lib/Search/style/Item.less +33 -0
- package/lib/Search/style/Search.less +179 -0
- package/lib/Search/style/index.js +4 -0
- package/lib/Search/typing.js +5 -0
- package/lib/Search/util.js +241 -0
- package/lib/ValueItem/ValueItem.js +233 -0
- package/lib/ValueItem/index.js +9 -0
- package/lib/ValueItem/util.js +22 -0
- package/lib/index.js +158 -0
- package/lib/style/components.less +1 -0
- package/lib/style/index.js +4 -0
- package/lib/style/variable.css +0 -0
- package/lib/style/variable.less +2 -0
- package/lib/style.js +5 -0
- package/package.json +122 -13
- package/index.ts +0 -64
- package/src/AMap/Map.vue +0 -110
- package/src/AMap/index.ts +0 -1
- package/src/AMap/util.ts +0 -56
- package/src/BadgeStatus/Badge.vue +0 -41
- package/src/BadgeStatus/color.ts +0 -25
- package/src/BadgeStatus/index.ts +0 -4
- package/src/CardSelect/CardSelect.vue +0 -136
- package/src/CardSelect/index.ts +0 -3
- package/src/CheckButton/CheckButton.vue +0 -146
- package/src/CheckButton/index.md +0 -27
- package/src/CheckButton/index.ts +0 -3
- package/src/ConfigProvider/context.ts +0 -17
- package/src/ConfigProvider/index.tsx +0 -42
- package/src/Echarts/Echarts.vue +0 -43
- package/src/Echarts/index.ts +0 -3
- package/src/Ellipsis/Ellipsis.vue +0 -182
- package/src/Ellipsis/index.ts +0 -3
- package/src/Empty/Empty.vue +0 -43
- package/src/Empty/image.ts +0 -3
- package/src/Empty/index.ts +0 -2
- package/src/FullPage/FullPage.vue +0 -30
- package/src/FullPage/index.ts +0 -3
- package/src/Icon/icon.tsx +0 -40
- package/src/MonacoEditor/Monaco.vue +0 -242
- package/src/MonacoEditor/index.md +0 -26
- package/src/MonacoEditor/index.ts +0 -2
- package/src/PermissionButton/index.tsx +0 -110
- package/src/ProLayout/Basic/BasicLayout.tsx +0 -392
- package/src/ProLayout/Basic/Header.tsx +0 -115
- package/src/ProLayout/PageContainer/index.tsx +0 -441
- package/src/ProLayout/PageContainer/typings.ts +0 -56
- package/src/ProLayout/RouteContext.ts +0 -87
- package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
- package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
- package/src/ProLayout/SiderMenu/index.ts +0 -2
- package/src/ProLayout/SiderMenu/typings.ts +0 -49
- package/src/ProLayout/TopHeader/index.tsx +0 -210
- package/src/ProLayout/defaultSettings.ts +0 -106
- package/src/ProLayout/style/index.ts +0 -1
- package/src/ProLayout/typings.ts +0 -87
- package/src/ProLayout/util.ts +0 -64
- package/src/ProTable/index.md +0 -53
- package/src/ProTable/index.tsx +0 -551
- package/src/ProTable/proTableTypes.ts +0 -70
- package/src/ProTable/style/index.ts +0 -1
- package/src/Scrollbar/Bar.vue +0 -75
- package/src/Scrollbar/Scrollbar.vue +0 -260
- package/src/Scrollbar/Thumb.vue +0 -163
- package/src/Scrollbar/constants.ts +0 -10
- package/src/Scrollbar/index.ts +0 -4
- package/src/Scrollbar/thumb.ts +0 -16
- package/src/Scrollbar/util.ts +0 -38
- package/src/Search/Advanced/History.vue +0 -140
- package/src/Search/Advanced/SaveHistory.vue +0 -108
- package/src/Search/Advanced/index.vue +0 -435
- package/src/Search/Item.vue +0 -525
- package/src/Search/Search.vue +0 -398
- package/src/Search/hooks/index.ts +0 -1
- package/src/Search/hooks/useSearchItems.ts +0 -68
- package/src/Search/index.md +0 -57
- package/src/Search/index.ts +0 -5
- package/src/Search/setting.ts +0 -55
- package/src/Search/typing.ts +0 -76
- package/src/Search/util.ts +0 -263
- package/src/ValueItem/ValueItem.vue +0 -192
- package/src/ValueItem/index.ts +0 -3
- package/src/ValueItem/util.ts +0 -16
- package/src/style/index.ts +0 -3
- /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
- /package/{src → es}/ProLayout/Basic/Header.less +0 -0
- /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
- /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
- /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
- /package/{src → es}/ProLayout/style/style.less +0 -0
- /package/{src → es}/ProTable/style/index.less +0 -0
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
|
|
2
|
+
const op = ops[i];
|
|
3
|
+
const fn = ops[i + 1];
|
|
4
|
+
i += 2;
|
|
5
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
9
|
+
lastAccessLHS = value;
|
|
10
|
+
value = fn(value);
|
|
11
|
+
}
|
|
12
|
+
else if (op === 'call' || op === 'optionalCall') {
|
|
13
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
14
|
+
lastAccessLHS = undefined;
|
|
15
|
+
}
|
|
16
|
+
} return value; }
|
|
17
|
+
/* Analyzed bindings: {
|
|
18
|
+
"columns": "props",
|
|
19
|
+
"index": "props",
|
|
20
|
+
"expand": "props",
|
|
21
|
+
"termsItem": "props",
|
|
22
|
+
"componentProps": "props",
|
|
23
|
+
"onlyValue": "props",
|
|
24
|
+
"reset": "setup-const",
|
|
25
|
+
"labelWidth": "props",
|
|
26
|
+
"typeOptions": "setup-maybe-ref",
|
|
27
|
+
"termType": "setup-maybe-ref",
|
|
28
|
+
"componentType": "setup-maybe-ref",
|
|
29
|
+
"optionsMapKey": "setup-maybe-ref",
|
|
30
|
+
"ref": "setup-const",
|
|
31
|
+
"reactive": "setup-const",
|
|
32
|
+
"nextTick": "setup-const",
|
|
33
|
+
"watch": "setup-const",
|
|
34
|
+
"computed": "setup-const",
|
|
35
|
+
"inject": "setup-const",
|
|
36
|
+
"cloneDeep": "setup-maybe-ref",
|
|
37
|
+
"debounce": "setup-maybe-ref",
|
|
38
|
+
"isArray": "setup-maybe-ref",
|
|
39
|
+
"isFunction": "setup-maybe-ref",
|
|
40
|
+
"omit": "setup-maybe-ref",
|
|
41
|
+
"filterTreeSelectNode": "setup-maybe-ref",
|
|
42
|
+
"filterSelectNode": "setup-maybe-ref",
|
|
43
|
+
"getTermTypeFn": "setup-maybe-ref",
|
|
44
|
+
"getTermOptions": "setup-maybe-ref",
|
|
45
|
+
"getTermTypes": "setup-maybe-ref",
|
|
46
|
+
"TreeSelect": "setup-maybe-ref",
|
|
47
|
+
"Select": "setup-maybe-ref",
|
|
48
|
+
"Input": "setup-maybe-ref",
|
|
49
|
+
"InputNumber": "setup-maybe-ref",
|
|
50
|
+
"DatePicker": "setup-maybe-ref",
|
|
51
|
+
"TimePicker": "setup-maybe-ref",
|
|
52
|
+
"InputPassword": "setup-maybe-ref",
|
|
53
|
+
"RangePicker": "setup-maybe-ref",
|
|
54
|
+
"TimeRangePicker": "setup-maybe-ref",
|
|
55
|
+
"FormItem": "setup-maybe-ref",
|
|
56
|
+
"isPromise": "setup-maybe-ref",
|
|
57
|
+
"props": "setup-reactive-const",
|
|
58
|
+
"emit": "setup-const",
|
|
59
|
+
"termsModel": "setup-reactive-const",
|
|
60
|
+
"isBtw": "setup-ref",
|
|
61
|
+
"component": "setup-ref",
|
|
62
|
+
"componentName": "setup-ref",
|
|
63
|
+
"cProps": "setup-ref",
|
|
64
|
+
"options": "setup-ref",
|
|
65
|
+
"columnOptions": "setup-ref",
|
|
66
|
+
"columnOptionMap": "setup-maybe-ref",
|
|
67
|
+
"termTypeOptions": "setup-reactive-const",
|
|
68
|
+
"optionLoading": "setup-ref",
|
|
69
|
+
"getTermType": "setup-const",
|
|
70
|
+
"getComponent": "setup-const",
|
|
71
|
+
"removeOptionByKey": "setup-const",
|
|
72
|
+
"handleItemOptions": "setup-maybe-ref",
|
|
73
|
+
"initModel": "setup-const",
|
|
74
|
+
"columnChange": "setup-const",
|
|
75
|
+
"handleItem": "setup-const",
|
|
76
|
+
"termTypeChange": "setup-const",
|
|
77
|
+
"valueChange": "setup-const"
|
|
78
|
+
} */
|
|
79
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
80
|
+
import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
81
|
+
const _withScopeId = n => (_pushScopeId("data-v-1712546547809"), n = n(), _popScopeId(), n);
|
|
82
|
+
const _hoisted_1 = { class: "JSearch-item" };
|
|
83
|
+
const _hoisted_2 = {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "JSearch-item--type"
|
|
86
|
+
};
|
|
87
|
+
const _hoisted_3 = { key: 1 };
|
|
88
|
+
const _hoisted_4 = { class: "JSearch-item--value" };
|
|
89
|
+
import { typeOptions, termType, componentType, optionsMapKey } from './setting';
|
|
90
|
+
import { ref, reactive, nextTick, watch, computed, inject } from 'vue';
|
|
91
|
+
import { cloneDeep, debounce, isArray, isFunction, omit } from 'lodash-es';
|
|
92
|
+
import { filterTreeSelectNode, filterSelectNode, getTermTypeFn, getTermOptions, getTermTypes, } from './util';
|
|
93
|
+
import { TreeSelect, Select, Input, InputNumber, DatePicker, TimePicker, InputPassword, RangePicker, TimeRangePicker, FormItem } from 'ant-design-vue';
|
|
94
|
+
import { isPromise } from '@jetlinks-web/utils';
|
|
95
|
+
const __sfc_main__ = _defineComponent({
|
|
96
|
+
props: {
|
|
97
|
+
columns: {
|
|
98
|
+
type: Array,
|
|
99
|
+
default: () => [],
|
|
100
|
+
required: true,
|
|
101
|
+
},
|
|
102
|
+
index: {
|
|
103
|
+
type: Number,
|
|
104
|
+
default: 1,
|
|
105
|
+
},
|
|
106
|
+
expand: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: false,
|
|
109
|
+
},
|
|
110
|
+
termsItem: {
|
|
111
|
+
type: Object,
|
|
112
|
+
default: () => ({}),
|
|
113
|
+
},
|
|
114
|
+
componentProps: {
|
|
115
|
+
type: Object,
|
|
116
|
+
default: () => ({}),
|
|
117
|
+
},
|
|
118
|
+
onlyValue: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
reset: {
|
|
123
|
+
type: Number,
|
|
124
|
+
default: 1,
|
|
125
|
+
},
|
|
126
|
+
labelWidth: {
|
|
127
|
+
type: Number,
|
|
128
|
+
default: 40,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
emits: ["change"],
|
|
132
|
+
setup(__props, { emit: __emit }) {
|
|
133
|
+
const props = __props;
|
|
134
|
+
const emit = __emit;
|
|
135
|
+
const termsModel = reactive({
|
|
136
|
+
type: _optionalChain([props, 'access', _2 => _2.termsItem, 'optionalAccess', _3 => _3.type]) || 'or',
|
|
137
|
+
value: _optionalChain([props, 'access', _4 => _4.termsItem, 'optionalAccess', _5 => _5.value]) || '',
|
|
138
|
+
termType: _optionalChain([props, 'access', _6 => _6.termsItem, 'optionalAccess', _7 => _7.termType]) || 'like',
|
|
139
|
+
column: _optionalChain([props, 'access', _8 => _8.termsItem, 'optionalAccess', _9 => _9.column]) || undefined,
|
|
140
|
+
});
|
|
141
|
+
const isBtw = computed(() => {
|
|
142
|
+
return ['in', 'nin'].includes(termsModel.termType);
|
|
143
|
+
});
|
|
144
|
+
const component = ref(componentType.input);
|
|
145
|
+
const componentName = ref();
|
|
146
|
+
const cProps = ref({});
|
|
147
|
+
const options = ref([]);
|
|
148
|
+
const columnOptions = ref([]);
|
|
149
|
+
const columnOptionMap = inject(optionsMapKey, new Map());
|
|
150
|
+
const termTypeOptions = reactive({ option: termType });
|
|
151
|
+
const optionLoading = ref(false);
|
|
152
|
+
/**
|
|
153
|
+
* 根据类型切换默termType值
|
|
154
|
+
* @param type {}
|
|
155
|
+
* @param column {}
|
|
156
|
+
* @param options {}
|
|
157
|
+
* @param defaultTermType {}
|
|
158
|
+
*/
|
|
159
|
+
const getTermType = (type, column, options, defaultTermType, termFilter) => {
|
|
160
|
+
termTypeOptions.option = _optionalChain([options, 'optionalAccess', _10 => _10.length])
|
|
161
|
+
? getTermTypes(options)
|
|
162
|
+
: getTermOptions(type, column);
|
|
163
|
+
if (_optionalChain([termFilter, 'optionalAccess', _11 => _11.length])) {
|
|
164
|
+
termTypeOptions.option = termTypeOptions.option.filter((item) => !termFilter.includes(item.value));
|
|
165
|
+
}
|
|
166
|
+
return defaultTermType || _optionalChain([options, 'optionalAccess', _12 => _12.length])
|
|
167
|
+
? termTypeOptions.option[0].value
|
|
168
|
+
: getTermTypeFn(type, column);
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* 根据类型返回组件
|
|
172
|
+
* @param type
|
|
173
|
+
*/
|
|
174
|
+
const getComponent = (type) => {
|
|
175
|
+
switch (type) {
|
|
176
|
+
case 'select':
|
|
177
|
+
component.value = componentType.select;
|
|
178
|
+
break;
|
|
179
|
+
case 'treeSelect':
|
|
180
|
+
component.value = componentType.treeSelect;
|
|
181
|
+
break;
|
|
182
|
+
case 'date':
|
|
183
|
+
component.value = componentType.date;
|
|
184
|
+
break;
|
|
185
|
+
case 'time':
|
|
186
|
+
component.value = componentType.time;
|
|
187
|
+
break;
|
|
188
|
+
case 'number':
|
|
189
|
+
component.value = componentType.inputNumber;
|
|
190
|
+
break;
|
|
191
|
+
case 'timeRange':
|
|
192
|
+
component.value = componentType.timeRange;
|
|
193
|
+
break;
|
|
194
|
+
case 'rangePicker':
|
|
195
|
+
component.value = componentType.rangePicker;
|
|
196
|
+
break;
|
|
197
|
+
case 'component':
|
|
198
|
+
component.value = componentType.component;
|
|
199
|
+
break;
|
|
200
|
+
default:
|
|
201
|
+
component.value = componentType.input;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const removeOptionByKey = (options) => {
|
|
206
|
+
return options.map((item) => {
|
|
207
|
+
if (item.children) {
|
|
208
|
+
item.children = removeOptionByKey(item.children);
|
|
209
|
+
}
|
|
210
|
+
return omit(item, ['key']);
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
const handleItemOptions = debounce((option) => {
|
|
214
|
+
options.value = [];
|
|
215
|
+
if (isArray(option)) {
|
|
216
|
+
options.value = option;
|
|
217
|
+
}
|
|
218
|
+
else if (isFunction(option)) {
|
|
219
|
+
optionLoading.value = true;
|
|
220
|
+
const fn = option();
|
|
221
|
+
if (isPromise(fn)) {
|
|
222
|
+
(fn)
|
|
223
|
+
.then((res) => {
|
|
224
|
+
optionLoading.value = false;
|
|
225
|
+
options.value = removeOptionByKey(res);
|
|
226
|
+
})
|
|
227
|
+
.catch((_) => {
|
|
228
|
+
optionLoading.value = false;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
optionLoading.value = false;
|
|
233
|
+
options.value = removeOptionByKey(fn || []);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}, 100);
|
|
237
|
+
const initModel = () => {
|
|
238
|
+
termsModel.type = 'or';
|
|
239
|
+
termsModel.column = undefined;
|
|
240
|
+
termsModel.value = undefined;
|
|
241
|
+
termsModel.termType = undefined;
|
|
242
|
+
termTypeOptions.option = termType;
|
|
243
|
+
};
|
|
244
|
+
const columnChange = (value, isChange, changeValue = true) => {
|
|
245
|
+
const item = _optionalChain([columnOptionMap, 'access', _13 => _13.value, 'optionalAccess', _14 => _14.get, 'call', _15 => _15(value)]);
|
|
246
|
+
if (!item) {
|
|
247
|
+
initModel();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
cProps.value = item.componentProps;
|
|
251
|
+
optionLoading.value = false;
|
|
252
|
+
// 设置value为undefined
|
|
253
|
+
termsModel.column = value;
|
|
254
|
+
getComponent(item.type); // 处理Item的组件类型
|
|
255
|
+
componentName.value = item.components;
|
|
256
|
+
// 处理options 以及 request
|
|
257
|
+
if ('options' in item) {
|
|
258
|
+
handleItemOptions(item.options);
|
|
259
|
+
}
|
|
260
|
+
const termsTypeValue = getTermType(item.type, value, item.termOptions, item.defaultTermType, item.termFilter);
|
|
261
|
+
if (changeValue) {
|
|
262
|
+
termsModel.value = undefined;
|
|
263
|
+
termsModel.termType = termsTypeValue;
|
|
264
|
+
}
|
|
265
|
+
if (isChange) {
|
|
266
|
+
valueChange();
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const handleItem = () => {
|
|
270
|
+
columnOptions.value = [];
|
|
271
|
+
if (!props.columns.length)
|
|
272
|
+
return;
|
|
273
|
+
columnOptions.value = props.columns.map((item) => {
|
|
274
|
+
// 对columns进行Map处理以及值处理
|
|
275
|
+
return {
|
|
276
|
+
label: item.title,
|
|
277
|
+
value: item.column,
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
console.log(props.onlyValue);
|
|
281
|
+
if (!props.onlyValue) {
|
|
282
|
+
// 获取第一个值
|
|
283
|
+
const sortColumn = cloneDeep(props.columns);
|
|
284
|
+
_optionalChain([sortColumn, 'optionalAccess', _16 => _16.sort, 'call', _17 => _17((a, b) => a.sortIndex - b.sortIndex)]);
|
|
285
|
+
const _index = props.index > sortColumn.length
|
|
286
|
+
? sortColumn.length - 1
|
|
287
|
+
: props.index;
|
|
288
|
+
if (props.index <= sortColumn.length) {
|
|
289
|
+
const _itemColumn = sortColumn[_index - 1];
|
|
290
|
+
columnChange(_itemColumn.column, false);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
columnChange(null, false);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
columnChange(_optionalChain([props, 'access', _18 => _18.columns, 'access', _19 => _19[props.index - 1], 'optionalAccess', _20 => _20.column]), false);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const termTypeChange = (v) => {
|
|
301
|
+
const isOldValueMultiple = ['in', 'nin'].includes(_optionalChain([props, 'access', _21 => _21.termsItem, 'optionalAccess', _22 => _22.termType]));
|
|
302
|
+
const isValueMultiple = ['in', 'nin'].includes(v);
|
|
303
|
+
if (isOldValueMultiple !== isValueMultiple) {
|
|
304
|
+
termsModel.value = isValueMultiple ? [] : undefined;
|
|
305
|
+
}
|
|
306
|
+
valueChange();
|
|
307
|
+
};
|
|
308
|
+
const valueChange = () => {
|
|
309
|
+
emit('change', {
|
|
310
|
+
type: props.onlyValue ? 'and' : termsModel.type || 'or',
|
|
311
|
+
value: termsModel.value,
|
|
312
|
+
termType: termsModel.termType || 'like',
|
|
313
|
+
column: termsModel.column,
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
const reset = () => {
|
|
317
|
+
termsModel.value = undefined;
|
|
318
|
+
};
|
|
319
|
+
watch(() => props.columns, () => {
|
|
320
|
+
console.log(props.columns);
|
|
321
|
+
if (props.columns) {
|
|
322
|
+
handleItem();
|
|
323
|
+
}
|
|
324
|
+
}, { immediate: true, deep: true });
|
|
325
|
+
watch(() => props.termsItem, (val, oldVal) => {
|
|
326
|
+
if (_optionalChain([val, 'optionalAccess', _23 => _23.column])) {
|
|
327
|
+
nextTick(() => {
|
|
328
|
+
Object.keys(props.termsItem).forEach((key) => {
|
|
329
|
+
termsModel[key] = props.termsItem[key];
|
|
330
|
+
if (key === 'column' && _optionalChain([val, 'optionalAccess', _24 => _24.column]) !== _optionalChain([oldVal, 'optionalAccess', _25 => _25.column])) {
|
|
331
|
+
columnChange(props.termsItem.column, false, false);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
handleItem();
|
|
338
|
+
}
|
|
339
|
+
}, { immediate: true, deep: true });
|
|
340
|
+
return (_ctx, _cache) => {
|
|
341
|
+
return (_openBlock(), _createElementBlock("div", _hoisted_1, [
|
|
342
|
+
(!__props.onlyValue)
|
|
343
|
+
? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [
|
|
344
|
+
(__props.expand)
|
|
345
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_2, [
|
|
346
|
+
(__props.index !== 1 && __props.index !== 4)
|
|
347
|
+
? (_openBlock(), _createBlock(_unref(Select), {
|
|
348
|
+
key: 0,
|
|
349
|
+
value: termsModel.type,
|
|
350
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => ((termsModel.type) = $event)),
|
|
351
|
+
options: _unref(typeOptions),
|
|
352
|
+
style: { "width": "100%" },
|
|
353
|
+
onChange: valueChange
|
|
354
|
+
}, null, 8 /* PROPS */, ["value", "options"]))
|
|
355
|
+
: (_openBlock(), _createElementBlock("span", _hoisted_3, _toDisplayString(__props.index === 1 ? '第一组' : '第二组'), 1 /* TEXT */))
|
|
356
|
+
]))
|
|
357
|
+
: _createCommentVNode("v-if", true),
|
|
358
|
+
_createVNode(_unref(Select), {
|
|
359
|
+
value: termsModel.column,
|
|
360
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => ((termsModel.column) = $event)),
|
|
361
|
+
placeholder: "请选择",
|
|
362
|
+
class: "JSearch-item--column",
|
|
363
|
+
options: columnOptions.value,
|
|
364
|
+
onChange: columnChange
|
|
365
|
+
}, null, 8 /* PROPS */, ["value", "options"]),
|
|
366
|
+
_createVNode(_unref(Select), {
|
|
367
|
+
value: termsModel.termType,
|
|
368
|
+
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => ((termsModel.termType) = $event)),
|
|
369
|
+
placeholder: "请选择",
|
|
370
|
+
class: "JSearch-item--termType",
|
|
371
|
+
options: termTypeOptions.option,
|
|
372
|
+
onChange: termTypeChange
|
|
373
|
+
}, null, 8 /* PROPS */, ["value", "options"])
|
|
374
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
375
|
+
: (_openBlock(), _createElementBlock("div", {
|
|
376
|
+
key: 1,
|
|
377
|
+
class: "JSearch-item--label",
|
|
378
|
+
style: _normalizeStyle({ minWidth: `${__props.labelWidth}px` })
|
|
379
|
+
}, _toDisplayString(columnOptions.value.length ? _optionalChain([columnOptions, 'access', _26 => _26.value, 'access', _27 => _27[__props.index - 1], 'optionalAccess', _28 => _28.label]) : ''), 5 /* TEXT, STYLE */)),
|
|
380
|
+
_createElementVNode("div", _hoisted_4, [
|
|
381
|
+
_createVNode(_unref(FormItem), { "no-style": "" }, {
|
|
382
|
+
default: _withCtx(() => [
|
|
383
|
+
(component.value === _unref(componentType).input)
|
|
384
|
+
? (_openBlock(), _createBlock(_unref(Input), _mergeProps({
|
|
385
|
+
key: 0,
|
|
386
|
+
value: termsModel.value,
|
|
387
|
+
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => ((termsModel.value) = $event)),
|
|
388
|
+
"allow-clear": ""
|
|
389
|
+
}, cProps.value, {
|
|
390
|
+
style: { "width": "100%" },
|
|
391
|
+
onChange: valueChange
|
|
392
|
+
}), null, 16 /* FULL_PROPS */, ["value"]))
|
|
393
|
+
: (component.value === _unref(componentType).select)
|
|
394
|
+
? (_openBlock(), _createBlock(_unref(Select), _mergeProps({
|
|
395
|
+
key: 1,
|
|
396
|
+
value: termsModel.value,
|
|
397
|
+
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => ((termsModel.value) = $event)),
|
|
398
|
+
"allow-clear": "",
|
|
399
|
+
"show-search": "",
|
|
400
|
+
mode: isBtw.value ? 'multiple' : 'combobox'
|
|
401
|
+
}, cProps.value, {
|
|
402
|
+
style: { "width": "100%", "min-width": "80px" },
|
|
403
|
+
loading: optionLoading.value,
|
|
404
|
+
options: options.value,
|
|
405
|
+
"filter-option": (v, option) => _unref(filterSelectNode)(v, option, 'label'),
|
|
406
|
+
onChange: valueChange
|
|
407
|
+
}), null, 16 /* FULL_PROPS */, ["value", "mode", "loading", "options", "filter-option"]))
|
|
408
|
+
: (component.value === _unref(componentType).inputNumber)
|
|
409
|
+
? (_openBlock(), _createBlock(_unref(InputNumber), _mergeProps({
|
|
410
|
+
key: 2,
|
|
411
|
+
value: termsModel.value,
|
|
412
|
+
"onUpdate:value": _cache[5] || (_cache[5] = ($event) => ((termsModel.value) = $event)),
|
|
413
|
+
"allow-clear": ""
|
|
414
|
+
}, cProps.value, {
|
|
415
|
+
style: { "width": "100%" },
|
|
416
|
+
onChange: valueChange
|
|
417
|
+
}), null, 16 /* FULL_PROPS */, ["value"]))
|
|
418
|
+
: (component.value === _unref(componentType).password)
|
|
419
|
+
? (_openBlock(), _createBlock(_unref(InputPassword), _mergeProps({
|
|
420
|
+
key: 3,
|
|
421
|
+
value: termsModel.value,
|
|
422
|
+
"onUpdate:value": _cache[6] || (_cache[6] = ($event) => ((termsModel.value) = $event)),
|
|
423
|
+
"allow-clear": ""
|
|
424
|
+
}, cProps.value, {
|
|
425
|
+
style: { "width": "100%" },
|
|
426
|
+
onChange: valueChange
|
|
427
|
+
}), null, 16 /* FULL_PROPS */, ["value"]))
|
|
428
|
+
: (component.value === _unref(componentType).time)
|
|
429
|
+
? (_openBlock(), _createBlock(_unref(TimePicker), _mergeProps({
|
|
430
|
+
key: 4,
|
|
431
|
+
value: termsModel.value,
|
|
432
|
+
"onUpdate:value": _cache[7] || (_cache[7] = ($event) => ((termsModel.value) = $event)),
|
|
433
|
+
"allow-clear": "",
|
|
434
|
+
"value-format": "HH:mm:ss",
|
|
435
|
+
style: { "width": "100%" }
|
|
436
|
+
}, cProps.value, { onChange: valueChange }), null, 16 /* FULL_PROPS */, ["value"]))
|
|
437
|
+
: (component.value === _unref(componentType).timeRange)
|
|
438
|
+
? (_openBlock(), _createBlock(_unref(TimeRangePicker), _mergeProps({
|
|
439
|
+
key: 5,
|
|
440
|
+
value: termsModel.value,
|
|
441
|
+
"onUpdate:value": _cache[8] || (_cache[8] = ($event) => ((termsModel.value) = $event)),
|
|
442
|
+
"allow-clear": "",
|
|
443
|
+
"value-format": "HH:mm:ss",
|
|
444
|
+
style: { "width": "100%" }
|
|
445
|
+
}, cProps.value, { onChange: valueChange }), null, 16 /* FULL_PROPS */, ["value"]))
|
|
446
|
+
: (component.value === _unref(componentType).date)
|
|
447
|
+
? (_openBlock(), _createBlock(_unref(DatePicker), _mergeProps({
|
|
448
|
+
key: 6,
|
|
449
|
+
value: termsModel.value,
|
|
450
|
+
"onUpdate:value": _cache[9] || (_cache[9] = ($event) => ((termsModel.value) = $event)),
|
|
451
|
+
"allow-clear": "",
|
|
452
|
+
"show-time": "",
|
|
453
|
+
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
454
|
+
style: { "width": "100%" }
|
|
455
|
+
}, cProps.value, { onChange: valueChange }), null, 16 /* FULL_PROPS */, ["value"]))
|
|
456
|
+
: (component.value === _unref(componentType).rangePicker)
|
|
457
|
+
? (_openBlock(), _createBlock(_unref(RangePicker), _mergeProps({
|
|
458
|
+
key: 7,
|
|
459
|
+
value: termsModel.value,
|
|
460
|
+
"onUpdate:value": _cache[10] || (_cache[10] = ($event) => ((termsModel.value) = $event)),
|
|
461
|
+
"allow-clear": "",
|
|
462
|
+
"show-time": "",
|
|
463
|
+
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
464
|
+
style: { "width": "100%" }
|
|
465
|
+
}, cProps.value, { onChange: valueChange }), null, 16 /* FULL_PROPS */, ["value"]))
|
|
466
|
+
: (component.value === _unref(componentType).treeSelect)
|
|
467
|
+
? (_openBlock(), _createBlock(_unref(TreeSelect), _mergeProps({
|
|
468
|
+
key: 8,
|
|
469
|
+
value: termsModel.value,
|
|
470
|
+
"onUpdate:value": _cache[11] || (_cache[11] = ($event) => ((termsModel.value) = $event)),
|
|
471
|
+
"allow-clear": "",
|
|
472
|
+
"show-search": "",
|
|
473
|
+
style: { "width": "100%" },
|
|
474
|
+
height: 350,
|
|
475
|
+
"field-names": { label: 'name', value: 'id' },
|
|
476
|
+
multiple: isBtw.value,
|
|
477
|
+
"filter-tree-node": (v, option) => _unref(filterTreeSelectNode)(v, option)
|
|
478
|
+
}, cProps.value, {
|
|
479
|
+
"tree-data": options.value,
|
|
480
|
+
onChange: valueChange
|
|
481
|
+
}), null, 16 /* FULL_PROPS */, ["value", "multiple", "filter-tree-node", "tree-data"]))
|
|
482
|
+
: (component.value === _unref(componentType).component && componentName.value)
|
|
483
|
+
? (_openBlock(), _createBlock(_resolveDynamicComponent(componentName.value), _mergeProps({ key: 9 }, cProps.value, {
|
|
484
|
+
value: termsModel.value,
|
|
485
|
+
"onUpdate:value": _cache[12] || (_cache[12] = ($event) => ((termsModel.value) = $event)),
|
|
486
|
+
onChange: valueChange
|
|
487
|
+
}), null, 16 /* FULL_PROPS */, ["value"]))
|
|
488
|
+
: _createCommentVNode("v-if", true)
|
|
489
|
+
]),
|
|
490
|
+
_: 1 /* STABLE */
|
|
491
|
+
})
|
|
492
|
+
])
|
|
493
|
+
]));
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
export default __sfc_main__;
|