@jetlinks-web/components 3.0.1-rc → 3.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 +13 -9
- package/es/BadgeStatus/Badge.js +1 -2
- package/es/BadgeStatus/color.js +3 -3
- package/es/CardSelect/CardSelect.js +23 -13
- package/es/CardSelect/style/index.js +25 -1
- package/es/CheckButton/CheckButton.js +12 -4
- package/es/CheckButton/style/index.js +41 -1
- package/es/DragModal/DragModal.js +14 -8
- package/es/DragModal/style/index.js +64 -1
- package/es/EditTable/Body.js +10 -3
- package/es/EditTable/EditTable.js +13 -7
- package/es/EditTable/FormItem.js +18 -19
- package/es/EditTable/Header.js +16 -6
- package/es/EditTable/components/ContextMenu/Menu.js +11 -5
- package/es/EditTable/components/Search/search.js +1 -2
- package/es/EditTable/components/Search/sort.js +1 -3
- package/es/EditTable/group.js +23 -18
- package/es/EditTable/hooks/useValidate.js +1 -1
- package/es/EditTable/style/body.js +53 -0
- package/es/EditTable/style/form.js +24 -0
- package/es/EditTable/style/group.js +25 -0
- package/es/EditTable/style/header.js +58 -0
- package/es/EditTable/style/index.js +42 -1
- package/es/EditTable/style/menu.js +27 -0
- package/es/EditTable/style/table.js +46 -0
- package/es/EditTable/utils.js +30 -3
- package/es/Ellipsis/Ellipsis.js +10 -2
- package/es/Ellipsis/style/index.js +24 -1
- package/es/FullPage/FullPage.js +1 -2
- package/es/LocaleProvider/index.js +1 -2
- package/es/PermissionButton/index.js +6 -7
- package/es/ProLayout/Basic/BasicLayout.js +45 -41
- package/es/ProLayout/Basic/BasicLayoutStyle.js +39 -0
- package/es/ProLayout/Basic/Header.js +3 -7
- package/es/ProLayout/Basic/HeaderStyle.js +10 -0
- package/es/ProLayout/PageContainer/index.js +21 -17
- package/es/ProLayout/PageContainer/style.js +46 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +18 -42
- package/es/ProLayout/SiderMenu/SiderMenu.js +24 -36
- package/es/ProLayout/SiderMenu/style.js +166 -0
- package/es/ProLayout/TopHeader/index.js +13 -12
- package/es/ProLayout/TopHeader/style.js +126 -0
- package/es/ProLayout/style/index.js +7 -1
- package/es/ProLayout/util.js +5 -5
- package/es/ProTable/Alert.js +12 -4
- package/es/ProTable/Content.js +108 -28
- package/es/ProTable/Header.js +21 -11
- package/es/ProTable/Pagination.js +12 -4
- package/es/ProTable/ProTable.js +46 -34
- package/es/ProTable/hooks/index.js +2 -0
- package/es/ProTable/hooks/useTableInject.js +5 -0
- package/es/ProTable/hooks/useTableSelection.js +95 -0
- package/es/ProTable/setting.js +1 -1
- package/es/ProTable/style/index.js +109 -1
- package/es/RadioButton/RadioButton.js +10 -4
- package/es/RadioButton/style/index.js +23 -1
- package/es/Scrollbar/Scrollbar.js +10 -3
- package/es/Scrollbar/Thumb.js +36 -25
- package/es/Scrollbar/style/index.js +63 -1
- package/es/Search/Advanced/History.js +23 -16
- package/es/Search/Advanced/SaveHistory.js +1 -2
- package/es/Search/Advanced/index.js +212 -292
- package/es/Search/Item.js +175 -415
- package/es/Search/Search.js +78 -172
- package/es/Search/hooks/index.js +108 -1
- package/es/Search/hooks/useRouteQuery.js +57 -0
- package/es/Search/setting.js +132 -14
- package/es/Search/style/index.js +4 -2
- package/es/Search/style/item.js +28 -0
- package/es/Search/style/search.js +133 -0
- package/es/Search/util.js +116 -124
- package/es/Skeleton/components/DashBoardCard.js +19 -12
- package/es/Skeleton/components/DashBoardChart.js +48 -45
- package/es/Skeleton/components/Detail.js +27 -21
- package/es/Skeleton/components/Drawer.js +23 -14
- package/es/Skeleton/components/Item.js +9 -1
- package/es/Skeleton/components/List.js +0 -1
- package/es/Skeleton/components/ListCard.js +20 -13
- package/es/Skeleton/components/ListCardItem.js +12 -13
- package/es/Skeleton/components/ListTable.js +19 -10
- package/es/Skeleton/components/Page.js +0 -1
- package/es/Skeleton/components/Tree.js +21 -14
- package/es/Skeleton/skeleton.js +17 -8
- package/es/Skeleton/style/index.js +132 -1
- package/es/Title/style/index.js +29 -1
- package/es/Title/title.js +13 -5
- package/es/ValueItem/ValueItem.js +44 -39
- package/es/components.js +1 -5
- package/es/locale/en-US.js +3 -7
- package/es/locale/zh-CN.js +3 -7
- package/es/style/index.js +0 -3
- package/es/style/styleRegister.js +21 -0
- package/es/style/variable.js +4 -0
- package/es/style.js +0 -13
- package/lib/AutoComplete/AutoComplete.js +13 -9
- package/lib/BadgeStatus/Badge.js +1 -2
- package/lib/BadgeStatus/color.js +3 -3
- package/lib/CardSelect/CardSelect.js +23 -13
- package/lib/CardSelect/style/index.js +30 -1
- package/lib/CheckButton/CheckButton.js +12 -4
- package/lib/CheckButton/style/index.js +46 -1
- package/lib/DragModal/DragModal.js +14 -8
- package/lib/DragModal/style/index.js +69 -1
- package/lib/EditTable/Body.js +10 -3
- package/lib/EditTable/EditTable.js +13 -7
- package/lib/EditTable/FormItem.js +18 -19
- package/lib/EditTable/Header.js +16 -6
- package/lib/EditTable/components/ContextMenu/Menu.js +11 -5
- package/lib/EditTable/components/Search/search.js +1 -2
- package/lib/EditTable/components/Search/sort.js +1 -3
- package/lib/EditTable/group.js +23 -18
- package/lib/EditTable/hooks/useValidate.js +1 -1
- package/lib/EditTable/style/body.js +60 -0
- package/lib/EditTable/style/form.js +31 -0
- package/lib/EditTable/style/group.js +32 -0
- package/lib/EditTable/style/header.js +65 -0
- package/lib/EditTable/style/index.js +47 -1
- package/lib/EditTable/style/menu.js +33 -0
- package/lib/EditTable/style/table.js +52 -0
- package/lib/EditTable/utils.js +31 -3
- package/lib/Ellipsis/Ellipsis.js +10 -2
- package/lib/Ellipsis/style/index.js +29 -1
- package/lib/FullPage/FullPage.js +1 -2
- package/lib/Icon/icon.js +1 -2
- package/lib/LocaleProvider/index.js +1 -2
- package/lib/PermissionButton/index.js +6 -7
- package/lib/ProLayout/Basic/BasicLayout.js +45 -42
- package/lib/ProLayout/Basic/BasicLayoutStyle.js +46 -0
- package/lib/ProLayout/Basic/Header.js +2 -6
- package/lib/ProLayout/Basic/HeaderStyle.js +17 -0
- package/lib/ProLayout/PageContainer/index.js +19 -15
- package/lib/ProLayout/PageContainer/style.js +53 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +19 -42
- package/lib/ProLayout/SiderMenu/SiderMenu.js +24 -37
- package/lib/ProLayout/SiderMenu/style.js +173 -0
- package/lib/ProLayout/TopHeader/index.js +14 -12
- package/lib/ProLayout/TopHeader/style.js +133 -0
- package/lib/ProLayout/style/index.js +12 -1
- package/lib/ProLayout/util.js +5 -5
- package/lib/ProTable/Alert.js +12 -4
- package/lib/ProTable/Content.js +108 -28
- package/lib/ProTable/Header.js +21 -11
- package/lib/ProTable/Pagination.js +12 -4
- package/lib/ProTable/ProTable.js +46 -34
- package/lib/ProTable/hooks/index.js +27 -0
- package/lib/ProTable/hooks/useTableInject.js +11 -0
- package/lib/ProTable/hooks/useTableSelection.js +102 -0
- package/lib/ProTable/setting.js +1 -1
- package/lib/ProTable/style/index.js +114 -1
- package/lib/RadioButton/RadioButton.js +10 -4
- package/lib/RadioButton/style/index.js +28 -1
- package/lib/Scrollbar/Scrollbar.js +10 -3
- package/lib/Scrollbar/Thumb.js +36 -25
- package/lib/Scrollbar/style/index.js +68 -1
- package/lib/Search/Advanced/History.js +23 -16
- package/lib/Search/Advanced/SaveHistory.js +1 -2
- package/lib/Search/Advanced/index.js +212 -292
- package/lib/Search/Item.js +175 -415
- package/lib/Search/Search.js +78 -172
- package/lib/Search/hooks/index.js +130 -1
- package/lib/Search/hooks/useRouteQuery.js +64 -0
- package/lib/Search/setting.js +133 -15
- package/lib/Search/style/index.js +9 -2
- package/lib/Search/style/item.js +35 -0
- package/lib/Search/style/search.js +140 -0
- package/lib/Search/util.js +116 -124
- package/lib/Skeleton/components/DashBoardCard.js +19 -12
- package/lib/Skeleton/components/DashBoardChart.js +48 -45
- package/lib/Skeleton/components/Detail.js +27 -21
- package/lib/Skeleton/components/Drawer.js +23 -14
- package/lib/Skeleton/components/Item.js +9 -1
- package/lib/Skeleton/components/List.js +0 -1
- package/lib/Skeleton/components/ListCard.js +20 -13
- package/lib/Skeleton/components/ListCardItem.js +12 -13
- package/lib/Skeleton/components/ListTable.js +19 -10
- package/lib/Skeleton/components/Page.js +0 -1
- package/lib/Skeleton/components/Tree.js +21 -14
- package/lib/Skeleton/skeleton.js +17 -8
- package/lib/Skeleton/style/index.js +137 -1
- package/lib/Title/style/index.js +34 -1
- package/lib/Title/title.js +13 -5
- package/lib/ValueItem/ValueItem.js +44 -39
- package/lib/components.js +1 -30
- package/lib/index.js +1 -2
- package/lib/locale/en-US.js +3 -7
- package/lib/locale/zh-CN.js +3 -7
- package/lib/style/components.less +0 -1
- package/lib/style/index.js +1 -4
- package/lib/style/styleRegister.js +28 -0
- package/lib/style/variable.js +10 -0
- package/lib/style.js +1 -15
- package/package.json +170 -173
- package/es/AMap/Map.js +0 -133
- package/es/AMap/index.js +0 -5
- package/es/AMap/util.js +0 -56
- package/es/CardSelect/style/index.css +0 -24
- package/es/CardSelect/style/index.less +0 -26
- package/es/CheckButton/style/index.css +0 -37
- package/es/CheckButton/style/index.less +0 -40
- package/es/DragModal/style/index.css +0 -82
- package/es/DragModal/style/index.less +0 -97
- package/es/Echarts/Echarts.js +0 -48
- package/es/Echarts/index.js +0 -5
- package/es/EditTable/style/body.less +0 -66
- package/es/EditTable/style/form.less +0 -33
- package/es/EditTable/style/group.less +0 -32
- package/es/EditTable/style/header.less +0 -77
- package/es/EditTable/style/index.css +0 -267
- package/es/EditTable/style/index.less +0 -41
- package/es/EditTable/style/menu.less +0 -25
- package/es/EditTable/style/table.less +0 -47
- package/es/Ellipsis/style/index.css +0 -17
- package/es/Ellipsis/style/index.less +0 -20
- package/es/FlameGraph/FlameGraph.js +0 -136
- package/es/FlameGraph/index.js +0 -5
- package/es/FlameGraph/style/index.css +0 -43
- package/es/FlameGraph/style/index.js +0 -1
- package/es/FlameGraph/style/index.less +0 -52
- package/es/ProLayout/Basic/BasicLayout.less +0 -66
- package/es/ProLayout/Basic/Header.less +0 -8
- package/es/ProLayout/PageContainer/index.less +0 -103
- package/es/ProLayout/SiderMenu/index.less +0 -231
- package/es/ProLayout/TopHeader/index.less +0 -174
- package/es/ProLayout/style/default.less +0 -4
- package/es/ProLayout/style/style.less +0 -7
- package/es/ProTable/style/ProTable.less +0 -139
- package/es/RadioButton/style/index.css +0 -20
- package/es/RadioButton/style/index.less +0 -19
- package/es/Scrollbar/style/index.css +0 -65
- package/es/Scrollbar/style/index.less +0 -83
- package/es/Search/style/Item.less +0 -33
- package/es/Search/style/Search.less +0 -179
- package/es/Skeleton/style/Skeleton.less +0 -166
- package/es/Title/style/index.css +0 -27
- package/es/Title/style/index.less +0 -27
- package/es/style/index.css +0 -5375
- package/es/style/index.less +0 -14
- package/es/style/variable.css +0 -4
- package/es/style/variable.less +0 -4
- package/lib/AMap/Map.js +0 -133
- package/lib/AMap/index.js +0 -12
- package/lib/AMap/util.js +0 -62
- package/lib/CardSelect/style/index.css +0 -24
- package/lib/CardSelect/style/index.less +0 -26
- package/lib/CheckButton/style/index.css +0 -37
- package/lib/CheckButton/style/index.less +0 -40
- package/lib/DragModal/style/index.css +0 -82
- package/lib/DragModal/style/index.less +0 -97
- package/lib/Echarts/Echarts.js +0 -48
- package/lib/Echarts/index.js +0 -12
- package/lib/EditTable/style/body.less +0 -66
- package/lib/EditTable/style/form.less +0 -33
- package/lib/EditTable/style/group.less +0 -32
- package/lib/EditTable/style/header.less +0 -77
- package/lib/EditTable/style/index.css +0 -267
- package/lib/EditTable/style/index.less +0 -41
- package/lib/EditTable/style/menu.less +0 -25
- package/lib/EditTable/style/table.less +0 -47
- package/lib/Ellipsis/style/index.css +0 -17
- package/lib/Ellipsis/style/index.less +0 -20
- package/lib/FlameGraph/FlameGraph.js +0 -136
- package/lib/FlameGraph/index.js +0 -12
- package/lib/FlameGraph/style/index.css +0 -43
- package/lib/FlameGraph/style/index.js +0 -3
- package/lib/FlameGraph/style/index.less +0 -52
- package/lib/ProLayout/Basic/BasicLayout.less +0 -66
- package/lib/ProLayout/Basic/Header.less +0 -8
- package/lib/ProLayout/PageContainer/index.less +0 -103
- package/lib/ProLayout/SiderMenu/index.less +0 -231
- package/lib/ProLayout/TopHeader/index.less +0 -174
- package/lib/ProLayout/style/default.less +0 -4
- package/lib/ProLayout/style/style.less +0 -7
- package/lib/ProTable/style/ProTable.less +0 -139
- package/lib/RadioButton/style/index.css +0 -20
- package/lib/RadioButton/style/index.less +0 -19
- package/lib/Scrollbar/style/index.css +0 -65
- package/lib/Scrollbar/style/index.less +0 -83
- package/lib/Search/style/Item.less +0 -33
- package/lib/Search/style/Search.less +0 -179
- package/lib/Skeleton/style/Skeleton.less +0 -166
- package/lib/Title/style/index.css +0 -27
- package/lib/Title/style/index.less +0 -27
- package/lib/style/index.css +0 -5375
- package/lib/style/index.less +0 -14
- package/lib/style/variable.css +0 -4
- package/lib/style/variable.less +0 -4
package/es/Search/Search.js
CHANGED
|
@@ -1,112 +1,73 @@
|
|
|
1
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
|
-
"align": "props",
|
|
11
|
-
"JColumnsProps": "setup-maybe-ref",
|
|
12
|
-
"SearchItemData": "setup-maybe-ref",
|
|
13
|
-
"SearchProps": "setup-maybe-ref",
|
|
14
|
-
"Terms": "setup-maybe-ref",
|
|
15
|
-
"Button": "setup-maybe-ref",
|
|
16
|
-
"Row": "setup-maybe-ref",
|
|
17
|
-
"Col": "setup-maybe-ref",
|
|
18
|
-
"Form": "setup-maybe-ref",
|
|
19
|
-
"FormItemRest": "setup-maybe-ref",
|
|
20
|
-
"set": "setup-maybe-ref",
|
|
21
2
|
"reactive": "setup-const",
|
|
22
3
|
"ref": "setup-const",
|
|
23
|
-
"provide": "setup-const",
|
|
24
|
-
"watch": "setup-const",
|
|
25
4
|
"computed": "setup-const",
|
|
26
5
|
"inject": "setup-const",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"optionsMapKey": "setup-maybe-ref",
|
|
30
|
-
"SearchConfig": "setup-maybe-ref",
|
|
6
|
+
"useAttrs": "setup-const",
|
|
7
|
+
"searchProps": "setup-maybe-ref",
|
|
31
8
|
"useLocaleReceiver": "setup-maybe-ref",
|
|
9
|
+
"Button": "setup-maybe-ref",
|
|
10
|
+
"Col": "setup-maybe-ref",
|
|
11
|
+
"Form": "setup-maybe-ref",
|
|
12
|
+
"FormItemRest": "setup-maybe-ref",
|
|
13
|
+
"Row": "setup-maybe-ref",
|
|
14
|
+
"SearchConfig": "setup-maybe-ref",
|
|
15
|
+
"Item": "setup-const",
|
|
16
|
+
"useHandleColumns": "setup-maybe-ref",
|
|
17
|
+
"useOptionMapContent": "setup-maybe-ref",
|
|
18
|
+
"termsParamsFormat": "setup-maybe-ref",
|
|
19
|
+
"useSearchStyle": "setup-maybe-ref",
|
|
32
20
|
"props": "setup-reactive-const",
|
|
33
|
-
"contextLocale": "setup-maybe-ref",
|
|
34
|
-
"columnOptionMap": "setup-ref",
|
|
35
21
|
"emit": "setup-const",
|
|
22
|
+
"contextLocale": "setup-maybe-ref",
|
|
23
|
+
"attrs": "setup-maybe-ref",
|
|
24
|
+
"columnsOptionMap": "setup-ref",
|
|
36
25
|
"terms": "setup-reactive-const",
|
|
37
|
-
"searchItems": "setup-ref",
|
|
38
26
|
"context": "setup-maybe-ref",
|
|
27
|
+
"initValues": "setup-maybe-ref",
|
|
28
|
+
"columnsMap": "setup-maybe-ref",
|
|
29
|
+
"prefixCls": "setup-ref",
|
|
30
|
+
"wrapSSR": "setup-maybe-ref",
|
|
31
|
+
"hashId": "setup-maybe-ref",
|
|
39
32
|
"footerStyles": "setup-ref",
|
|
40
|
-
"itemValueChange": "setup-const",
|
|
41
|
-
"handleItems": "setup-const",
|
|
42
33
|
"searchSubmit": "setup-const",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
34
|
+
"reset": "setup-const",
|
|
35
|
+
"handleDefaultValues": "setup-const"
|
|
45
36
|
} */
|
|
46
37
|
import { defineComponent as _defineComponent } from 'vue';
|
|
47
|
-
import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode,
|
|
38
|
+
import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from "vue";
|
|
48
39
|
const _hoisted_1 = { class: "JSearch-content simple" };
|
|
49
40
|
const _hoisted_2 = { class: "JSearch-items" };
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
41
|
+
import { reactive, ref, computed, inject, useAttrs } from 'vue';
|
|
42
|
+
import { searchProps } from "./setting";
|
|
43
|
+
import { useLocaleReceiver } from "../LocaleReciver";
|
|
44
|
+
import { Button, Col, Form, FormItemRest, Row } from "ant-design-vue";
|
|
45
|
+
import { SearchConfig } from "../utils/constants";
|
|
46
|
+
import Item from './Item.js';
|
|
47
|
+
import { useHandleColumns, useOptionMapContent } from "./hooks";
|
|
48
|
+
import { termsParamsFormat } from "./util";
|
|
49
|
+
import useSearchStyle from './style';
|
|
58
50
|
const __sfc_main__ = _defineComponent({
|
|
59
51
|
...{
|
|
60
52
|
name: 'JSearch',
|
|
53
|
+
inheritAttrs: false
|
|
61
54
|
},
|
|
62
55
|
props: {
|
|
63
|
-
|
|
64
|
-
type: Array,
|
|
65
|
-
default: () => [],
|
|
66
|
-
required: true,
|
|
67
|
-
},
|
|
68
|
-
type: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: 'terms',
|
|
71
|
-
required: true,
|
|
72
|
-
},
|
|
73
|
-
column: {
|
|
74
|
-
type: Number,
|
|
75
|
-
default: 4,
|
|
76
|
-
},
|
|
77
|
-
style: {
|
|
78
|
-
type: [String, Object],
|
|
79
|
-
default: undefined,
|
|
80
|
-
},
|
|
81
|
-
class: {
|
|
82
|
-
type: String,
|
|
83
|
-
default: '',
|
|
84
|
-
},
|
|
85
|
-
labelWidth: {
|
|
86
|
-
type: Number,
|
|
87
|
-
default: 40,
|
|
88
|
-
},
|
|
89
|
-
resetText: {
|
|
90
|
-
type: String,
|
|
91
|
-
},
|
|
92
|
-
submitText: {
|
|
93
|
-
type: String,
|
|
94
|
-
},
|
|
95
|
-
align: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: 'value'
|
|
98
|
-
}
|
|
56
|
+
...searchProps()
|
|
99
57
|
},
|
|
100
|
-
emits: [
|
|
58
|
+
emits: ['search'],
|
|
101
59
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
102
60
|
const props = __props;
|
|
103
|
-
const [contextLocale] = useLocaleReceiver('Search');
|
|
104
|
-
const columnOptionMap = ref(new Map());
|
|
105
61
|
const emit = __emit;
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
const
|
|
62
|
+
const [contextLocale] = useLocaleReceiver('Search');
|
|
63
|
+
const attrs = useAttrs();
|
|
64
|
+
const columnsOptionMap = ref({}); // 存储每个columnItem的option
|
|
65
|
+
const terms = reactive({ terms: [] }); // 当前查询条件
|
|
109
66
|
const context = inject(SearchConfig, { align: props.align });
|
|
67
|
+
const { initValues, columnsMap } = useHandleColumns(props, terms);
|
|
68
|
+
const prefixCls = computed(() => 'JSearch');
|
|
69
|
+
const [wrapSSR, hashId] = useSearchStyle(prefixCls);
|
|
70
|
+
useOptionMapContent(columnsOptionMap);
|
|
110
71
|
const footerStyles = computed(() => {
|
|
111
72
|
const align = context.align || props.align;
|
|
112
73
|
if (align === 'value') {
|
|
@@ -114,76 +75,25 @@ const __sfc_main__ = _defineComponent({
|
|
|
114
75
|
}
|
|
115
76
|
return {};
|
|
116
77
|
});
|
|
117
|
-
provide(optionsMapKey, columnOptionMap);
|
|
118
|
-
const itemValueChange = (value, index) => {
|
|
119
|
-
set(terms.terms, [index], value);
|
|
120
|
-
};
|
|
121
|
-
const handleItems = (reset = false) => {
|
|
122
|
-
searchItems.value = [];
|
|
123
|
-
terms.terms = [];
|
|
124
|
-
columnOptionMap.value.clear();
|
|
125
|
-
let hasSearch = false;
|
|
126
|
-
props.columns.forEach((item, index) => {
|
|
127
|
-
if (item.search && Object.keys(item.search).length) {
|
|
128
|
-
columnOptionMap.value.set(item.dataIndex, item.search);
|
|
129
|
-
// 默认值
|
|
130
|
-
const { search } = item;
|
|
131
|
-
let defaultTerms = null;
|
|
132
|
-
// 包含defaultValue 或者 defaultOnceValue
|
|
133
|
-
if (search.defaultValue !== undefined ||
|
|
134
|
-
search.defaultTermType ||
|
|
135
|
-
search.defaultOnceValue) {
|
|
136
|
-
const _value = search.defaultValue || reset
|
|
137
|
-
? search.defaultValue
|
|
138
|
-
: search.defaultOnceValue;
|
|
139
|
-
defaultTerms = {
|
|
140
|
-
type: 'and',
|
|
141
|
-
value: _value,
|
|
142
|
-
termType: search.defaultTermType || 'like',
|
|
143
|
-
column: item.dataIndex,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
if (search.defaultValue !== undefined ||
|
|
147
|
-
search.defaultOnceValue !== undefined) {
|
|
148
|
-
hasSearch = true;
|
|
149
|
-
}
|
|
150
|
-
terms.terms.push(defaultTerms);
|
|
151
|
-
searchItems.value.push({
|
|
152
|
-
...item.search,
|
|
153
|
-
sortIndex: item.search.first ? 0 : index + 1,
|
|
154
|
-
title: item.title,
|
|
155
|
-
column: item.dataIndex,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
if (hasSearch) {
|
|
160
|
-
searchSubmit();
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* 提交
|
|
165
|
-
*/
|
|
166
78
|
const searchSubmit = () => {
|
|
167
|
-
emit('search', termsParamsFormat(terms
|
|
79
|
+
emit('search', termsParamsFormat(terms, columnsMap.value, 'low', props.type));
|
|
168
80
|
};
|
|
169
|
-
/**
|
|
170
|
-
* 重置查询
|
|
171
|
-
*/
|
|
172
|
-
const resetNumber = ref(1);
|
|
173
81
|
const reset = () => {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
82
|
+
initValues();
|
|
83
|
+
};
|
|
84
|
+
const handleDefaultValues = (value) => {
|
|
85
|
+
const isObject = Object.prototype.toString.call(value) === '[object Object]';
|
|
86
|
+
let _params = isObject ? Object.keys(value).map((key) => ({ column: key, value: value[key], termType: 'eq' })) : [...value];
|
|
87
|
+
terms.terms.forEach((item) => {
|
|
88
|
+
const paramsItem = _params.find(paramsItem => paramsItem.column === item.column);
|
|
89
|
+
if (paramsItem) {
|
|
90
|
+
item.value = paramsItem.value;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
emit('search', termsParamsFormat(terms, columnsMap.value));
|
|
182
94
|
};
|
|
183
|
-
watch(() => props.columns, () => {
|
|
184
|
-
handleItems();
|
|
185
|
-
}, { immediate: true, deep: true });
|
|
186
95
|
__expose({
|
|
96
|
+
setValues: handleDefaultValues,
|
|
187
97
|
reset
|
|
188
98
|
});
|
|
189
99
|
return (_ctx, _cache) => {
|
|
@@ -193,36 +103,35 @@ const __sfc_main__ = _defineComponent({
|
|
|
193
103
|
}, {
|
|
194
104
|
default: _withCtx(() => [
|
|
195
105
|
_createElementVNode("div", {
|
|
196
|
-
class: _normalizeClass([
|
|
197
|
-
style: _normalizeStyle(
|
|
106
|
+
class: _normalizeClass(["JSearch-warp", [_unref(attrs).class, _unref(hashId)]]),
|
|
107
|
+
style: _normalizeStyle(_unref(attrs).style)
|
|
198
108
|
}, [
|
|
199
109
|
_createElementVNode("div", _hoisted_1, [
|
|
200
110
|
_createElementVNode("div", _hoisted_2, [
|
|
201
111
|
_createVNode(_unref(Row), { gutter: [16, 16] }, {
|
|
202
112
|
default: _withCtx(() => [
|
|
203
|
-
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(
|
|
113
|
+
(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms.terms, (item, index) => {
|
|
204
114
|
return (_openBlock(), _createBlock(_unref(Col), {
|
|
205
|
-
|
|
206
|
-
span: item.span || 24 / __props.column
|
|
115
|
+
span: item._span || 24 / _ctx.column
|
|
207
116
|
}, {
|
|
208
117
|
default: _withCtx(() => [
|
|
209
|
-
_createVNode(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
"
|
|
216
|
-
|
|
217
|
-
"
|
|
218
|
-
|
|
219
|
-
}, null, 8 /* PROPS */, ["
|
|
118
|
+
_createVNode(Item, {
|
|
119
|
+
value: item.value,
|
|
120
|
+
"onUpdate:value": ($event) => ((item.value) = $event),
|
|
121
|
+
termType: item.termType,
|
|
122
|
+
"onUpdate:termType": ($event) => ((item.termType) = $event),
|
|
123
|
+
column: item.column,
|
|
124
|
+
"onUpdate:column": ($event) => ((item.column) = $event),
|
|
125
|
+
type: item.type,
|
|
126
|
+
"onUpdate:type": ($event) => ((item.type) = $event),
|
|
127
|
+
labelWidth: _ctx.labelWidth
|
|
128
|
+
}, null, 8 /* PROPS */, ["value", "onUpdate:value", "termType", "onUpdate:termType", "column", "onUpdate:column", "type", "onUpdate:type", "labelWidth"])
|
|
220
129
|
]),
|
|
221
130
|
_: 2 /* DYNAMIC */
|
|
222
131
|
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["span"]));
|
|
223
|
-
}),
|
|
132
|
+
}), 256 /* UNKEYED_FRAGMENT */)),
|
|
224
133
|
_createVNode(_unref(Col), {
|
|
225
|
-
span: 24 /
|
|
134
|
+
span: 24 / _ctx.column
|
|
226
135
|
}, {
|
|
227
136
|
default: _withCtx(() => [
|
|
228
137
|
_renderSlot(_ctx.$slots, "footerRender", {
|
|
@@ -233,12 +142,9 @@ const __sfc_main__ = _defineComponent({
|
|
|
233
142
|
class: "JSearch-footer--btns",
|
|
234
143
|
style: _normalizeStyle(footerStyles.value)
|
|
235
144
|
}, [
|
|
236
|
-
_createVNode(_unref(Button), {
|
|
237
|
-
type: "stroke",
|
|
238
|
-
onClick: reset
|
|
239
|
-
}, {
|
|
145
|
+
_createVNode(_unref(Button), { onClick: reset }, {
|
|
240
146
|
default: _withCtx(() => [
|
|
241
|
-
_createTextVNode(_toDisplayString(
|
|
147
|
+
_createTextVNode(_toDisplayString(_ctx.resetText || _unref(contextLocale).search.reset), 1 /* TEXT */)
|
|
242
148
|
]),
|
|
243
149
|
_: 1 /* STABLE */
|
|
244
150
|
}),
|
|
@@ -249,7 +155,7 @@ const __sfc_main__ = _defineComponent({
|
|
|
249
155
|
type: "primary"
|
|
250
156
|
}, {
|
|
251
157
|
default: _withCtx(() => [
|
|
252
|
-
_createTextVNode(_toDisplayString(
|
|
158
|
+
_createTextVNode(_toDisplayString(_ctx.submitText || _unref(contextLocale).search.search), 1 /* TEXT */)
|
|
253
159
|
]),
|
|
254
160
|
_: 1 /* STABLE */
|
|
255
161
|
})
|
package/es/Search/hooks/index.js
CHANGED
|
@@ -1 +1,108 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import { provide, inject, watchEffect, ref } from 'vue';
|
|
5
|
+
import { getItemDefaultValue } from "../util";
|
|
6
|
+
export * from './useSearchItems';
|
|
7
|
+
export * from './useRouteQuery';
|
|
8
|
+
var optionMapKey = Symbol('optionMapKey');
|
|
9
|
+
var columnsMapKey = Symbol('columnMapKey');
|
|
10
|
+
var columnsValues = Symbol('columnsValues');
|
|
11
|
+
export var useOptionMapContent = function useOptionMapContent(optionsMap) {
|
|
12
|
+
provide(optionMapKey, optionsMap);
|
|
13
|
+
};
|
|
14
|
+
export var useOptionMap = function useOptionMap() {
|
|
15
|
+
return inject(optionMapKey);
|
|
16
|
+
};
|
|
17
|
+
export var useColumnsMapContent = function useColumnsMapContent(columnsMap) {
|
|
18
|
+
provide(columnsMapKey, columnsMap);
|
|
19
|
+
};
|
|
20
|
+
export var useColumnsMap = function useColumnsMap() {
|
|
21
|
+
return inject(columnsMapKey);
|
|
22
|
+
};
|
|
23
|
+
export var useDefaultValue = function useDefaultValue() {
|
|
24
|
+
return inject(columnsValues);
|
|
25
|
+
};
|
|
26
|
+
export var useHandleColumns = function useHandleColumns(props, terms) {
|
|
27
|
+
var columnsMap = ref({}); // 存储每个column
|
|
28
|
+
var defaultCacheValues = ref({});
|
|
29
|
+
useColumnsMapContent(columnsMap);
|
|
30
|
+
/**
|
|
31
|
+
* 处理search.first为true的排序
|
|
32
|
+
* @param arr
|
|
33
|
+
*/
|
|
34
|
+
var moveFirstElementsToFront = function moveFirstElementsToFront(arr) {
|
|
35
|
+
// 提取所有 first: true 的元素
|
|
36
|
+
var firstElements = arr.filter(function (item) {
|
|
37
|
+
return item.search.first === true;
|
|
38
|
+
});
|
|
39
|
+
// 提取剩余的元素
|
|
40
|
+
var otherElements = arr.filter(function (item) {
|
|
41
|
+
return item.search.first !== true;
|
|
42
|
+
});
|
|
43
|
+
// 合并并返回
|
|
44
|
+
return [].concat(_toConsumableArray(firstElements), _toConsumableArray(otherElements));
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 处理默认值
|
|
48
|
+
* @param arr
|
|
49
|
+
*/
|
|
50
|
+
var handleDefaultValue = function handleDefaultValue(arr) {
|
|
51
|
+
var _iterator = _createForOfIteratorHelper(arr),
|
|
52
|
+
_step;
|
|
53
|
+
try {
|
|
54
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
55
|
+
var item = _step.value;
|
|
56
|
+
var search = item.search;
|
|
57
|
+
var _data = {
|
|
58
|
+
defaultValue: undefined,
|
|
59
|
+
defaultTermType: undefined
|
|
60
|
+
};
|
|
61
|
+
_data.defaultValue = search.defaultValue;
|
|
62
|
+
_data.defaultTermType = search.defaultTermType;
|
|
63
|
+
defaultCacheValues.value[item.dataIndex] = _data;
|
|
64
|
+
}
|
|
65
|
+
} catch (err) {
|
|
66
|
+
_iterator.e(err);
|
|
67
|
+
} finally {
|
|
68
|
+
_iterator.f();
|
|
69
|
+
}
|
|
70
|
+
provide(columnsValues, defaultCacheValues);
|
|
71
|
+
};
|
|
72
|
+
var initValues = function initValues() {
|
|
73
|
+
var arr = Object.values(columnsMap.value);
|
|
74
|
+
if (props.mode === 'advanced') {
|
|
75
|
+
// 设置第一位
|
|
76
|
+
terms.terms = [getItemDefaultValue(arr[0], defaultCacheValues.value)];
|
|
77
|
+
} else {
|
|
78
|
+
terms.terms = arr.map(function (item) {
|
|
79
|
+
return getItemDefaultValue(item, defaultCacheValues.value);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var handleColumns = function handleColumns(columns) {
|
|
84
|
+
var columnsSearch = columns.filter(function (item) {
|
|
85
|
+
return item.hasOwnProperty('search') && Object.keys(item.search).length;
|
|
86
|
+
});
|
|
87
|
+
// 排序
|
|
88
|
+
var columnsSort = moveFirstElementsToFront(columnsSearch);
|
|
89
|
+
columnsSort.forEach(function (item, index) {
|
|
90
|
+
columnsMap.value[item.dataIndex] = _objectSpread(_objectSpread({}, item), {}, {
|
|
91
|
+
_sort_index: index
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
handleDefaultValue(columnsSort);
|
|
95
|
+
if (terms.terms.length === 0) {
|
|
96
|
+
// 高级模式处理数据
|
|
97
|
+
initValues();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
watchEffect(function () {
|
|
101
|
+
handleColumns(props.columns);
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
initValues: initValues,
|
|
105
|
+
columnsMap: columnsMap,
|
|
106
|
+
defaultCacheValues: defaultCacheValues
|
|
107
|
+
};
|
|
108
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { customRef, nextTick, watch } from 'vue';
|
|
3
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
4
|
+
var _queue = new WeakMap();
|
|
5
|
+
export var useRouteQuery = function useRouteQuery(name) {
|
|
6
|
+
var router = useRouter();
|
|
7
|
+
var route = useRoute();
|
|
8
|
+
var transformGet = function transformGet(value) {
|
|
9
|
+
return value;
|
|
10
|
+
};
|
|
11
|
+
var transformSet = function transformSet(value) {
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
if (!_queue.has(router)) _queue.set(router, new Map());
|
|
15
|
+
var _queriesQueue = _queue.get(router);
|
|
16
|
+
var query = route.query[name];
|
|
17
|
+
var _trigger;
|
|
18
|
+
var proxy = customRef(function (track, trigger) {
|
|
19
|
+
_trigger = trigger;
|
|
20
|
+
return {
|
|
21
|
+
get: function get() {
|
|
22
|
+
track();
|
|
23
|
+
return transformGet(query !== undefined ? query : undefined);
|
|
24
|
+
},
|
|
25
|
+
set: function set(v) {
|
|
26
|
+
v = transformSet(v);
|
|
27
|
+
if (query === v) return;
|
|
28
|
+
query = v === undefined ? undefined : v;
|
|
29
|
+
_queriesQueue.set(name, v === undefined ? undefined : v);
|
|
30
|
+
trigger();
|
|
31
|
+
nextTick(function () {
|
|
32
|
+
if (_queriesQueue.size === 0) return;
|
|
33
|
+
var newQueries = Object.fromEntries(_queriesQueue.entries());
|
|
34
|
+
_queriesQueue.clear();
|
|
35
|
+
var params = route.params,
|
|
36
|
+
query = route.query,
|
|
37
|
+
hash = route.hash;
|
|
38
|
+
router.replace({
|
|
39
|
+
params: params,
|
|
40
|
+
query: _objectSpread(_objectSpread({}, query), newQueries),
|
|
41
|
+
hash: hash
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
watch(function () {
|
|
48
|
+
return route.query[name];
|
|
49
|
+
}, function (v) {
|
|
50
|
+
if (query === transformGet(v)) return;
|
|
51
|
+
query = v;
|
|
52
|
+
_trigger();
|
|
53
|
+
}, {
|
|
54
|
+
flush: 'sync'
|
|
55
|
+
});
|
|
56
|
+
return proxy;
|
|
57
|
+
};
|
package/es/Search/setting.js
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
import 'vue';
|
|
2
|
-
import
|
|
1
|
+
import { TreeSelect, Select, Input, InputNumber, DatePicker, TimePicker, InputPassword, RangePicker, TimeRangePicker } from 'ant-design-vue';
|
|
2
|
+
import { filterSelectNode, filterTreeSelectNode } from "./util";
|
|
3
3
|
export var optionsMapKey = Symbol('searchOptionsMap');
|
|
4
|
-
export var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type:
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
export var searchProps = function searchProps() {
|
|
5
|
+
return {
|
|
6
|
+
columns: {
|
|
7
|
+
type: Array,
|
|
8
|
+
default: function _default() {
|
|
9
|
+
return [];
|
|
10
|
+
},
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'terms',
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
mode: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'default'
|
|
21
|
+
},
|
|
22
|
+
column: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 4
|
|
25
|
+
},
|
|
26
|
+
labelWidth: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 40
|
|
29
|
+
},
|
|
30
|
+
resetText: {
|
|
31
|
+
type: String
|
|
32
|
+
},
|
|
33
|
+
submitText: {
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
36
|
+
align: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'value'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
16
41
|
};
|
|
17
42
|
export var typeOptions = function typeOptions(locale) {
|
|
18
43
|
return [{
|
|
@@ -94,4 +119,97 @@ export var componentType = {
|
|
|
94
119
|
tree: 'tree',
|
|
95
120
|
select: 'select',
|
|
96
121
|
component: 'component'
|
|
122
|
+
};
|
|
123
|
+
export var componentProps = function componentProps(record) {
|
|
124
|
+
var type = record.type;
|
|
125
|
+
switch (type) {
|
|
126
|
+
case 'string':
|
|
127
|
+
case componentType.input:
|
|
128
|
+
return {
|
|
129
|
+
type: type,
|
|
130
|
+
name: Input
|
|
131
|
+
};
|
|
132
|
+
case componentType.inputNumber:
|
|
133
|
+
return {
|
|
134
|
+
type: type,
|
|
135
|
+
name: InputNumber
|
|
136
|
+
};
|
|
137
|
+
case componentType.password:
|
|
138
|
+
return {
|
|
139
|
+
type: type,
|
|
140
|
+
name: InputPassword
|
|
141
|
+
};
|
|
142
|
+
case componentType.time:
|
|
143
|
+
return {
|
|
144
|
+
type: type,
|
|
145
|
+
name: TimePicker,
|
|
146
|
+
props: {
|
|
147
|
+
valueFormat: 'HH:mm:ss'
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
case componentType.date:
|
|
151
|
+
return {
|
|
152
|
+
type: type,
|
|
153
|
+
name: DatePicker,
|
|
154
|
+
props: {
|
|
155
|
+
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
case componentType.timeRange:
|
|
159
|
+
return {
|
|
160
|
+
type: type,
|
|
161
|
+
name: TimeRangePicker,
|
|
162
|
+
props: {
|
|
163
|
+
valueFormat: 'HH:mm:ss'
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
case componentType.rangePicker:
|
|
167
|
+
return {
|
|
168
|
+
type: type,
|
|
169
|
+
name: RangePicker,
|
|
170
|
+
props: {
|
|
171
|
+
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
172
|
+
showTime: true
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
case componentType.treeSelect:
|
|
176
|
+
return {
|
|
177
|
+
type: type,
|
|
178
|
+
name: TreeSelect,
|
|
179
|
+
props: {
|
|
180
|
+
showSearch: true,
|
|
181
|
+
height: 350,
|
|
182
|
+
fieldNames: {
|
|
183
|
+
label: 'name',
|
|
184
|
+
value: 'id'
|
|
185
|
+
},
|
|
186
|
+
filterTreeNode: function filterTreeNode(v, option) {
|
|
187
|
+
return filterTreeSelectNode(v, option);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
case componentType.select:
|
|
192
|
+
return {
|
|
193
|
+
type: type,
|
|
194
|
+
name: Select,
|
|
195
|
+
props: {
|
|
196
|
+
showSearch: true,
|
|
197
|
+
// mode: isBtw ? 'multiple' : 'combobox',
|
|
198
|
+
filterOption: function filterOption(v, option) {
|
|
199
|
+
return filterSelectNode(v, option, 'label');
|
|
200
|
+
},
|
|
201
|
+
style: {
|
|
202
|
+
width: '100%',
|
|
203
|
+
minWidth: '80px'
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
case componentType.component:
|
|
208
|
+
return {
|
|
209
|
+
type: type,
|
|
210
|
+
name: record.components
|
|
211
|
+
};
|
|
212
|
+
default:
|
|
213
|
+
return {};
|
|
214
|
+
}
|
|
97
215
|
};
|
package/es/Search/style/index.js
CHANGED