@jetlinks-web/components 2.0.2-2 → 2.0.2-4
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 +43 -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 +255 -0
- package/es/ProLayout/Basic/Header.js +93 -0
- package/es/ProLayout/PageContainer/index.js +318 -0
- package/es/ProLayout/PageContainer/typings.js +1 -0
- package/es/ProLayout/RouteContext.js +22 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +262 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +258 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/typings.js +1 -0
- package/es/ProLayout/TopHeader/index.js +155 -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 +406 -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 +100 -0
- package/es/Scrollbar/Thumb.js +10 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +2 -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/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/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 +264 -0
- package/lib/ProLayout/Basic/BasicLayout.less +66 -0
- package/lib/ProLayout/Basic/Header.js +99 -0
- package/lib/ProLayout/Basic/Header.less +8 -0
- package/lib/ProLayout/PageContainer/index.js +323 -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 +268 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +267 -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 +161 -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 +412 -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/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/Scrollbar.js} +106 -108
- package/lib/Scrollbar/Thumb.js +16 -0
- package/lib/Scrollbar/constants.js +7 -0
- package/lib/Scrollbar/index.js +9 -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/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/package.json +121 -12
- 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 -40
- 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 -395
- 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,249 @@
|
|
|
1
|
+
/* Analyzed bindings: {
|
|
2
|
+
"columns": "props",
|
|
3
|
+
"type": "props",
|
|
4
|
+
"column": "props",
|
|
5
|
+
"style": "props",
|
|
6
|
+
"class": "props",
|
|
7
|
+
"labelWidth": "props",
|
|
8
|
+
"resetText": "props",
|
|
9
|
+
"submitText": "props",
|
|
10
|
+
"JColumnsProps": "setup-maybe-ref",
|
|
11
|
+
"SearchItemData": "setup-maybe-ref",
|
|
12
|
+
"SearchProps": "setup-maybe-ref",
|
|
13
|
+
"Terms": "setup-maybe-ref",
|
|
14
|
+
"Button": "setup-maybe-ref",
|
|
15
|
+
"Row": "setup-maybe-ref",
|
|
16
|
+
"Col": "setup-maybe-ref",
|
|
17
|
+
"Form": "setup-maybe-ref",
|
|
18
|
+
"FormItemRest": "setup-maybe-ref",
|
|
19
|
+
"set": "setup-maybe-ref",
|
|
20
|
+
"reactive": "setup-const",
|
|
21
|
+
"ref": "setup-const",
|
|
22
|
+
"provide": "setup-const",
|
|
23
|
+
"termsParamsFormat": "setup-maybe-ref",
|
|
24
|
+
"SearchItem": "setup-const",
|
|
25
|
+
"optionsMapKey": "setup-maybe-ref",
|
|
26
|
+
"props": "setup-reactive-const",
|
|
27
|
+
"columnOptionMap": "setup-ref",
|
|
28
|
+
"emit": "setup-const",
|
|
29
|
+
"terms": "setup-reactive-const",
|
|
30
|
+
"searchItems": "setup-ref",
|
|
31
|
+
"itemValueChange": "setup-const",
|
|
32
|
+
"handleItems": "setup-const",
|
|
33
|
+
"searchSubmit": "setup-const",
|
|
34
|
+
"resetNumber": "setup-ref",
|
|
35
|
+
"reset": "setup-const"
|
|
36
|
+
} */
|
|
37
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
38
|
+
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
39
|
+
const _withScopeId = n => (_pushScopeId("data-v-1712538746257"), n = n(), _popScopeId(), n);
|
|
40
|
+
const _hoisted_1 = { class: "JSearch-content simple" };
|
|
41
|
+
const _hoisted_2 = { class: "JSearch-items" };
|
|
42
|
+
import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
|
|
43
|
+
import { set } from 'lodash-es';
|
|
44
|
+
import { reactive, ref, provide } from 'vue';
|
|
45
|
+
import { termsParamsFormat } from './util';
|
|
46
|
+
import SearchItem from './Item.js';
|
|
47
|
+
import { optionsMapKey } from './setting';
|
|
48
|
+
const __sfc_main__ = _defineComponent({
|
|
49
|
+
props: {
|
|
50
|
+
columns: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => [],
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
type: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'terms',
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
column: {
|
|
61
|
+
type: Number,
|
|
62
|
+
default: 4,
|
|
63
|
+
},
|
|
64
|
+
style: {
|
|
65
|
+
type: [String, Object],
|
|
66
|
+
default: undefined,
|
|
67
|
+
},
|
|
68
|
+
class: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: '',
|
|
71
|
+
},
|
|
72
|
+
labelWidth: {
|
|
73
|
+
type: Number,
|
|
74
|
+
default: 40,
|
|
75
|
+
},
|
|
76
|
+
resetText: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: '重置',
|
|
79
|
+
},
|
|
80
|
+
submitText: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: '搜索',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
emits: ["search"],
|
|
86
|
+
setup(__props, { emit: __emit }) {
|
|
87
|
+
const props = __props;
|
|
88
|
+
const columnOptionMap = ref(new Map());
|
|
89
|
+
const emit = __emit;
|
|
90
|
+
// 当前查询条件
|
|
91
|
+
const terms = reactive({ terms: [] });
|
|
92
|
+
const searchItems = ref([]); // 当前查询条件列表
|
|
93
|
+
provide(optionsMapKey, columnOptionMap);
|
|
94
|
+
const itemValueChange = (value, index) => {
|
|
95
|
+
set(terms.terms, [index], value);
|
|
96
|
+
};
|
|
97
|
+
const handleItems = (reset = false) => {
|
|
98
|
+
searchItems.value = [];
|
|
99
|
+
terms.terms = [];
|
|
100
|
+
columnOptionMap.value.clear();
|
|
101
|
+
let hasSearch = false;
|
|
102
|
+
props.columns.forEach((item, index) => {
|
|
103
|
+
if (item.search && Object.keys(item.search).length) {
|
|
104
|
+
columnOptionMap.value.set(item.dataIndex, item.search);
|
|
105
|
+
// 默认值
|
|
106
|
+
const { search } = item;
|
|
107
|
+
let defaultTerms = null;
|
|
108
|
+
// 包含defaultValue 或者 defaultOnceValue
|
|
109
|
+
if (search.defaultValue !== undefined ||
|
|
110
|
+
search.defaultTermType ||
|
|
111
|
+
search.defaultOnceValue) {
|
|
112
|
+
const _value = search.defaultValue || reset
|
|
113
|
+
? search.defaultValue
|
|
114
|
+
: search.defaultOnceValue;
|
|
115
|
+
defaultTerms = {
|
|
116
|
+
type: 'and',
|
|
117
|
+
value: _value,
|
|
118
|
+
termType: search.defaultTermType || 'like',
|
|
119
|
+
column: item.dataIndex,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (search.defaultValue !== undefined ||
|
|
123
|
+
search.defaultOnceValue !== undefined) {
|
|
124
|
+
hasSearch = true;
|
|
125
|
+
}
|
|
126
|
+
terms.terms.push(defaultTerms);
|
|
127
|
+
searchItems.value.push({
|
|
128
|
+
...item.search,
|
|
129
|
+
sortIndex: item.search.first ? 0 : index + 1,
|
|
130
|
+
title: item.title,
|
|
131
|
+
column: item.dataIndex,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
if (hasSearch) {
|
|
136
|
+
searchSubmit();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* 提交
|
|
141
|
+
*/
|
|
142
|
+
const searchSubmit = () => {
|
|
143
|
+
emit('search', termsParamsFormat(terms.terms, columnOptionMap.value, 'low', props.type));
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* 重置查询
|
|
147
|
+
*/
|
|
148
|
+
const resetNumber = ref(1);
|
|
149
|
+
const reset = () => {
|
|
150
|
+
resetNumber.value += 1;
|
|
151
|
+
handleItems(true);
|
|
152
|
+
if (props.type == 'object') {
|
|
153
|
+
emit('search', {});
|
|
154
|
+
}
|
|
155
|
+
else if (props.type == 'terms') {
|
|
156
|
+
emit('search', []);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
handleItems();
|
|
160
|
+
return (_ctx, _cache) => {
|
|
161
|
+
return (_openBlock(), _createBlock(_unref(Form), {
|
|
162
|
+
model: terms,
|
|
163
|
+
onFinish: searchSubmit
|
|
164
|
+
}, {
|
|
165
|
+
default: _withCtx(() => [
|
|
166
|
+
_createElementVNode("div", {
|
|
167
|
+
class: _normalizeClass(['JSearch-warp', props.class]),
|
|
168
|
+
style: _normalizeStyle(__props.style)
|
|
169
|
+
}, [
|
|
170
|
+
_createElementVNode("div", _hoisted_1, [
|
|
171
|
+
_createElementVNode("div", _hoisted_2, [
|
|
172
|
+
_createVNode(_unref(Row), { gutter: [16, 16] }, {
|
|
173
|
+
default: _withCtx(() => [
|
|
174
|
+
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(searchItems.value, (item, index) => {
|
|
175
|
+
return (_openBlock(), _createBlock(_unref(Col), {
|
|
176
|
+
key: index + '_' + item.column,
|
|
177
|
+
span: item.span || 24 / __props.column
|
|
178
|
+
}, {
|
|
179
|
+
default: _withCtx(() => [
|
|
180
|
+
_createVNode(SearchItem, {
|
|
181
|
+
"only-value": true,
|
|
182
|
+
expand: false,
|
|
183
|
+
index: index + 1,
|
|
184
|
+
columns: searchItems.value,
|
|
185
|
+
"component-props": item.componentProps,
|
|
186
|
+
"terms-item": terms.terms[index],
|
|
187
|
+
reset: resetNumber.value,
|
|
188
|
+
"label-width": __props.labelWidth,
|
|
189
|
+
onChange: (v) => itemValueChange(v, index)
|
|
190
|
+
}, null, 8 /* PROPS */, ["index", "columns", "component-props", "terms-item", "reset", "label-width", "onChange"])
|
|
191
|
+
]),
|
|
192
|
+
_: 2 /* DYNAMIC */
|
|
193
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["span"]));
|
|
194
|
+
}), 128 /* KEYED_FRAGMENT */)),
|
|
195
|
+
_createVNode(_unref(Col), {
|
|
196
|
+
span: 24 / __props.column
|
|
197
|
+
}, {
|
|
198
|
+
default: _withCtx(() => [
|
|
199
|
+
_renderSlot(_ctx.$slots, "footerRender", {
|
|
200
|
+
reset: reset,
|
|
201
|
+
submit: searchSubmit
|
|
202
|
+
}, () => [
|
|
203
|
+
_createElementVNode("div", {
|
|
204
|
+
class: "JSearch-footer--btns",
|
|
205
|
+
style: _normalizeStyle({
|
|
206
|
+
paddingLeft: `${__props.labelWidth + 8}px`,
|
|
207
|
+
})
|
|
208
|
+
}, [
|
|
209
|
+
_createVNode(_unref(Button), {
|
|
210
|
+
type: "stroke",
|
|
211
|
+
onClick: reset
|
|
212
|
+
}, {
|
|
213
|
+
default: _withCtx(() => [
|
|
214
|
+
_createTextVNode(_toDisplayString(__props.resetText), 1 /* TEXT */)
|
|
215
|
+
]),
|
|
216
|
+
_: 1 /* STABLE */
|
|
217
|
+
}),
|
|
218
|
+
_createVNode(_unref(FormItemRest), null, {
|
|
219
|
+
default: _withCtx(() => [
|
|
220
|
+
_createVNode(_unref(Button), {
|
|
221
|
+
"html-type": "submit",
|
|
222
|
+
type: "primary"
|
|
223
|
+
}, {
|
|
224
|
+
default: _withCtx(() => [
|
|
225
|
+
_createTextVNode(_toDisplayString(__props.submitText), 1 /* TEXT */)
|
|
226
|
+
]),
|
|
227
|
+
_: 1 /* STABLE */
|
|
228
|
+
})
|
|
229
|
+
]),
|
|
230
|
+
_: 1 /* STABLE */
|
|
231
|
+
})
|
|
232
|
+
], 4 /* STYLE */)
|
|
233
|
+
])
|
|
234
|
+
]),
|
|
235
|
+
_: 3 /* FORWARDED */
|
|
236
|
+
}, 8 /* PROPS */, ["span"])
|
|
237
|
+
]),
|
|
238
|
+
_: 3 /* FORWARDED */
|
|
239
|
+
})
|
|
240
|
+
])
|
|
241
|
+
])
|
|
242
|
+
], 6 /* CLASS, STYLE */)
|
|
243
|
+
]),
|
|
244
|
+
_: 3 /* FORWARDED */
|
|
245
|
+
}, 8 /* PROPS */, ["model"]));
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useSearchItems';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { sortBy } from 'lodash-es';
|
|
4
|
+
var hasDefaultValue = function hasDefaultValue(item) {
|
|
5
|
+
return item.defaultValue !== undefined || item.defaultTermType || item.defaultOnceValue;
|
|
6
|
+
};
|
|
7
|
+
export var useSearchItems = function useSearchItems(columns, options) {
|
|
8
|
+
var items = ref([]);
|
|
9
|
+
var optionsMap = ref(new Map());
|
|
10
|
+
var handleColumns = function handleColumns() {
|
|
11
|
+
var _items = [];
|
|
12
|
+
var values = [];
|
|
13
|
+
columns.forEach(function (item, index) {
|
|
14
|
+
var search = item.search;
|
|
15
|
+
if (search && Object.keys(search).length) {
|
|
16
|
+
optionsMap.value.set(item.dataIndex, search);
|
|
17
|
+
if (hasDefaultValue(search)) {
|
|
18
|
+
var _value = search.defaultValue || search.defaultOnceValue;
|
|
19
|
+
values.push({
|
|
20
|
+
type: 'and',
|
|
21
|
+
value: _value,
|
|
22
|
+
termType: search.defaultTermType || 'like',
|
|
23
|
+
column: item.dataIndex
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
_items.push(_objectSpread(_objectSpread({}, item.search), {}, {
|
|
27
|
+
sortIndex: item.search.first ? 0 : index + 1,
|
|
28
|
+
column: item.dataIndex
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
items.value = sortBy(_items, 'sortIndex');
|
|
33
|
+
options === null || options === void 0 ? void 0 : options.getDefaultValue(values);
|
|
34
|
+
};
|
|
35
|
+
handleColumns();
|
|
36
|
+
return {
|
|
37
|
+
searchItems: items,
|
|
38
|
+
searchOptionsMap: optionsMap
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import 'vue';
|
|
2
|
+
import './typing';
|
|
3
|
+
export var optionsMapKey = Symbol('searchOptionsMap');
|
|
4
|
+
export var basicSearch = {
|
|
5
|
+
columns: {
|
|
6
|
+
type: Array,
|
|
7
|
+
default: function _default() {
|
|
8
|
+
return [];
|
|
9
|
+
},
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'advanced'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export var typeOptions = [{
|
|
18
|
+
label: '或者',
|
|
19
|
+
value: 'or'
|
|
20
|
+
}, {
|
|
21
|
+
label: '并且',
|
|
22
|
+
value: 'and'
|
|
23
|
+
}];
|
|
24
|
+
export var TermTypeMap = {
|
|
25
|
+
EQ: {
|
|
26
|
+
label: '=',
|
|
27
|
+
value: 'eq'
|
|
28
|
+
},
|
|
29
|
+
NOT: {
|
|
30
|
+
label: '!=',
|
|
31
|
+
value: 'not'
|
|
32
|
+
},
|
|
33
|
+
LIKE: {
|
|
34
|
+
label: '包含',
|
|
35
|
+
value: 'like'
|
|
36
|
+
},
|
|
37
|
+
NLIKE: {
|
|
38
|
+
label: '不包含',
|
|
39
|
+
value: 'nlike'
|
|
40
|
+
},
|
|
41
|
+
GT: {
|
|
42
|
+
label: '>',
|
|
43
|
+
value: 'gt'
|
|
44
|
+
},
|
|
45
|
+
GTE: {
|
|
46
|
+
label: '>=',
|
|
47
|
+
value: 'gte'
|
|
48
|
+
},
|
|
49
|
+
LT: {
|
|
50
|
+
label: '<',
|
|
51
|
+
value: 'lt'
|
|
52
|
+
},
|
|
53
|
+
LTE: {
|
|
54
|
+
label: '<=',
|
|
55
|
+
value: 'lte'
|
|
56
|
+
},
|
|
57
|
+
IN: {
|
|
58
|
+
label: '在...之中',
|
|
59
|
+
value: 'in'
|
|
60
|
+
},
|
|
61
|
+
NIN: {
|
|
62
|
+
label: '不在...之中',
|
|
63
|
+
value: 'nin'
|
|
64
|
+
},
|
|
65
|
+
BTW: {
|
|
66
|
+
label: '在...之间',
|
|
67
|
+
value: 'btw'
|
|
68
|
+
},
|
|
69
|
+
NBTW: {
|
|
70
|
+
label: '不在...之间',
|
|
71
|
+
value: 'nbtw'
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export var termType = Object.values(TermTypeMap);
|
|
75
|
+
export var componentType = {
|
|
76
|
+
input: 'input',
|
|
77
|
+
inputNumber: 'inputNumber',
|
|
78
|
+
password: 'password',
|
|
79
|
+
switch: 'switch',
|
|
80
|
+
radio: 'radio',
|
|
81
|
+
checkbox: 'checkbox',
|
|
82
|
+
time: 'time',
|
|
83
|
+
date: 'date',
|
|
84
|
+
timeRange: 'timeRange',
|
|
85
|
+
rangePicker: 'rangePicker',
|
|
86
|
+
treeSelect: 'treeSelect',
|
|
87
|
+
upload: 'upload',
|
|
88
|
+
tree: 'tree',
|
|
89
|
+
select: 'select',
|
|
90
|
+
component: 'component'
|
|
91
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import { cloneDeep, isArray, isFunction, isString } from 'lodash-es';
|
|
4
|
+
import { termType } from './setting';
|
|
5
|
+
import './typing';
|
|
6
|
+
/**
|
|
7
|
+
* 处理like,nlike特殊值
|
|
8
|
+
* @param v
|
|
9
|
+
*/
|
|
10
|
+
export var handleLikeValue = function handleLikeValue(v) {
|
|
11
|
+
if (isString(v)) {
|
|
12
|
+
return v.split('').reduce(function (pre, next) {
|
|
13
|
+
var _next = next;
|
|
14
|
+
if (next === '\\') {
|
|
15
|
+
_next = '\\\\';
|
|
16
|
+
} else if (next === '%') {
|
|
17
|
+
_next = '\\%';
|
|
18
|
+
}
|
|
19
|
+
return pre + _next;
|
|
20
|
+
}, '');
|
|
21
|
+
}
|
|
22
|
+
return v;
|
|
23
|
+
};
|
|
24
|
+
var handleItemValue = function handleItemValue(item, columnOptionMap) {
|
|
25
|
+
var _item = columnOptionMap.get(item.column);
|
|
26
|
+
if (!_item) return item;
|
|
27
|
+
if (_item.rename) {
|
|
28
|
+
item.column = _item.rename;
|
|
29
|
+
}
|
|
30
|
+
if (_item.handleValue && isFunction(_item.handleValue)) {
|
|
31
|
+
item.value = _item.handleValue(item.value, item);
|
|
32
|
+
}
|
|
33
|
+
if (['like', 'nlike'].includes(item.termType) && !!item.value) {
|
|
34
|
+
item.value = "%".concat(handleLikeValue(item.value), "%");
|
|
35
|
+
}
|
|
36
|
+
return item;
|
|
37
|
+
};
|
|
38
|
+
var isEmpty = function isEmpty(v) {
|
|
39
|
+
return v === undefined || v === null || v === '' || isArray(v) && v.length === 0;
|
|
40
|
+
};
|
|
41
|
+
var handleArrayToTerms = function handleArrayToTerms(terms, columnOptionMap) {
|
|
42
|
+
return terms.map(function (item) {
|
|
43
|
+
if (item.terms) {
|
|
44
|
+
var filterTerms = item.terms.filter(function (filterItem) {
|
|
45
|
+
return filterItem && !isEmpty(filterItem.value) && filterItem.termType !== undefined && filterItem.column !== undefined;
|
|
46
|
+
});
|
|
47
|
+
item.terms = filterTerms.map(function (result) {
|
|
48
|
+
return handleItemValue(result, columnOptionMap);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return item;
|
|
52
|
+
}).filter(function (item) {
|
|
53
|
+
var _item$terms;
|
|
54
|
+
return (_item$terms = item.terms) === null || _item$terms === void 0 ? void 0 : _item$terms.length;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 处理为外部使用
|
|
59
|
+
* @terms {Array} 表单数据
|
|
60
|
+
* @columnOptionMap {Map} column的Map对象
|
|
61
|
+
*/
|
|
62
|
+
export var termsParamsFormat = function termsParamsFormat(terms, columnOptionMap) {
|
|
63
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'adv';
|
|
64
|
+
var searchType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'terms';
|
|
65
|
+
// 过滤掉terms中value无效的item
|
|
66
|
+
var cloneParams = cloneDeep(terms);
|
|
67
|
+
if (searchType === 'terms') {
|
|
68
|
+
return type === 'adv' ? {
|
|
69
|
+
terms: handleArrayToTerms(cloneParams.terms, columnOptionMap)
|
|
70
|
+
} : cloneParams.filter(function (item) {
|
|
71
|
+
return item && !isEmpty(item.value) && item.column !== undefined;
|
|
72
|
+
}).map(function (item) {
|
|
73
|
+
return handleItemValue(item, columnOptionMap);
|
|
74
|
+
});
|
|
75
|
+
} else if (searchType == 'object') {
|
|
76
|
+
var result = {};
|
|
77
|
+
cloneParams.filter(function (item) {
|
|
78
|
+
return item && item.value !== undefined && item.value !== '';
|
|
79
|
+
}).forEach(function (item) {
|
|
80
|
+
_extends(result, _defineProperty({}, item.column, item.value));
|
|
81
|
+
});
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* TreeSelect过滤
|
|
87
|
+
* @param value 过滤值
|
|
88
|
+
* @param treeNode
|
|
89
|
+
* @param key
|
|
90
|
+
*/
|
|
91
|
+
export var filterTreeSelectNode = function filterTreeSelectNode(value, treeNode) {
|
|
92
|
+
var _treeNode$key;
|
|
93
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'name';
|
|
94
|
+
return (_treeNode$key = treeNode[key]) === null || _treeNode$key === void 0 ? void 0 : _treeNode$key.includes(value);
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Select过滤
|
|
98
|
+
* @param value 过滤值
|
|
99
|
+
* @param option
|
|
100
|
+
* @param key
|
|
101
|
+
*/
|
|
102
|
+
export var filterSelectNode = function filterSelectNode(value, option) {
|
|
103
|
+
var _option$key;
|
|
104
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
|
|
105
|
+
return (_option$key = option[key]) === null || _option$key === void 0 ? void 0 : _option$key.includes(value);
|
|
106
|
+
};
|
|
107
|
+
export var handleQData = function handleQData(terms) {
|
|
108
|
+
// 排序, null 往后放
|
|
109
|
+
terms.terms.forEach(function (a) {
|
|
110
|
+
for (var i = 0; i < a.terms.length; i++) {
|
|
111
|
+
for (var j = 0; j < a.terms.length - i - 1; j++) {
|
|
112
|
+
if (!a.terms[j] && a.terms[j + 1]) {
|
|
113
|
+
var temp = a.terms[j];
|
|
114
|
+
a.terms[j] = a.terms[j + 1];
|
|
115
|
+
a.terms[j + 1] = temp;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return terms;
|
|
121
|
+
};
|
|
122
|
+
export var hasExpand = function hasExpand(terms) {
|
|
123
|
+
var itemCount = 0;
|
|
124
|
+
terms.forEach(function (a) {
|
|
125
|
+
a.terms.forEach(function (b) {
|
|
126
|
+
if (b) {
|
|
127
|
+
itemCount += 1;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
return itemCount >= 2;
|
|
132
|
+
};
|
|
133
|
+
export var compatibleOldTerms = function compatibleOldTerms(q) {
|
|
134
|
+
var _terms = [{
|
|
135
|
+
terms: [null, null, null]
|
|
136
|
+
}, {
|
|
137
|
+
terms: [null, null, null],
|
|
138
|
+
type: 'and'
|
|
139
|
+
}];
|
|
140
|
+
try {
|
|
141
|
+
var _terms$terms;
|
|
142
|
+
var terms = JSON.parse(q || '{}');
|
|
143
|
+
(_terms$terms = terms.terms) === null || _terms$terms === void 0 ? void 0 : _terms$terms.forEach(function (a, aIndex) {
|
|
144
|
+
var _a$terms;
|
|
145
|
+
a === null || a === void 0 ? void 0 : (_a$terms = a.terms) === null || _a$terms === void 0 ? void 0 : _a$terms.forEach(function (b, bIndex) {
|
|
146
|
+
_terms[aIndex].terms[bIndex] = b;
|
|
147
|
+
});
|
|
148
|
+
if (a.type) {
|
|
149
|
+
_terms[aIndex].type = a.type;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return {
|
|
153
|
+
terms: _terms
|
|
154
|
+
};
|
|
155
|
+
} catch (e) {
|
|
156
|
+
return {
|
|
157
|
+
terms: _terms
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
export var handleParamsToString = function handleParamsToString() {
|
|
162
|
+
var terms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
163
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'and';
|
|
164
|
+
var _terms = [{
|
|
165
|
+
terms: [null, null, null]
|
|
166
|
+
}, {
|
|
167
|
+
terms: [null, null, null],
|
|
168
|
+
type: type
|
|
169
|
+
}];
|
|
170
|
+
var termsIndex = 0;
|
|
171
|
+
var termsStar = 0;
|
|
172
|
+
terms.forEach(function (item, index) {
|
|
173
|
+
if (index > 2) {
|
|
174
|
+
termsIndex = 1;
|
|
175
|
+
termsStar = 4;
|
|
176
|
+
}
|
|
177
|
+
_terms[termsIndex].terms[index - termsStar] = item;
|
|
178
|
+
});
|
|
179
|
+
return JSON.stringify({
|
|
180
|
+
terms: _terms
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
export var getTermTypeFn = function getTermTypeFn(type) {
|
|
184
|
+
// if (column?.includes('id') && type === 'string') {
|
|
185
|
+
// // 默认id为 eq
|
|
186
|
+
// return 'eq';
|
|
187
|
+
// }
|
|
188
|
+
switch (type) {
|
|
189
|
+
case 'select':
|
|
190
|
+
case 'treeSelect':
|
|
191
|
+
case 'number':
|
|
192
|
+
return 'eq';
|
|
193
|
+
case 'date':
|
|
194
|
+
case 'time':
|
|
195
|
+
return 'gt';
|
|
196
|
+
case 'timeRange':
|
|
197
|
+
case 'rangePicker':
|
|
198
|
+
return 'btw';
|
|
199
|
+
default:
|
|
200
|
+
return 'like';
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
export var getTermTypes = function getTermTypes(types) {
|
|
204
|
+
return termType.filter(function (item) {
|
|
205
|
+
return types.includes(item.value);
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
export var getTermOptions = function getTermOptions(type, column) {
|
|
209
|
+
var keys = [];
|
|
210
|
+
switch (type) {
|
|
211
|
+
case 'select':
|
|
212
|
+
case 'treeSelect':
|
|
213
|
+
keys = ['not', 'eq', 'in', 'nin'];
|
|
214
|
+
break;
|
|
215
|
+
case 'time':
|
|
216
|
+
case 'date':
|
|
217
|
+
keys = ['gt', 'lt', 'gte', 'lte'];
|
|
218
|
+
break;
|
|
219
|
+
case 'timeRange':
|
|
220
|
+
case 'rangePicker':
|
|
221
|
+
keys = ['btw', 'nbtw'];
|
|
222
|
+
break;
|
|
223
|
+
case 'number':
|
|
224
|
+
keys = ['eq', 'not', 'gt', 'lt', 'gte', 'lte'];
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
keys = ['like', 'nlike'];
|
|
228
|
+
// column?.includes('id') && type === 'string'
|
|
229
|
+
// ? ['eq']
|
|
230
|
+
// : ['like', 'nlike'];
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
return keys.length ? getTermTypes(keys) : termType;
|
|
234
|
+
};
|