@jetlinks-web/components 2.7.0 → 3.0.0

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.
Files changed (284) hide show
  1. package/es/AutoComplete/AutoComplete.js +2 -3
  2. package/es/BadgeStatus/Badge.js +2 -3
  3. package/es/CardSelect/CardSelect.js +23 -18
  4. package/es/CardSelect/style/index.js +25 -1
  5. package/es/CheckButton/CheckButton.js +12 -4
  6. package/es/CheckButton/style/index.js +41 -1
  7. package/es/ConfigProvider/index.js +1 -1
  8. package/es/DragModal/DragModal.js +15 -9
  9. package/es/DragModal/style/index.js +64 -1
  10. package/es/EditTable/Body.js +10 -3
  11. package/es/EditTable/EditTable.js +14 -8
  12. package/es/EditTable/FormItem.js +15 -10
  13. package/es/EditTable/Header.js +16 -6
  14. package/es/EditTable/components/ContextMenu/Menu.js +12 -6
  15. package/es/EditTable/components/Search/search.js +1 -2
  16. package/es/EditTable/components/Search/sort.js +1 -3
  17. package/es/EditTable/group.js +24 -19
  18. package/es/EditTable/hooks/useValidate.js +1 -1
  19. package/es/EditTable/style/body.js +53 -0
  20. package/es/EditTable/style/form.js +24 -0
  21. package/es/EditTable/style/group.js +25 -0
  22. package/es/EditTable/style/header.js +58 -0
  23. package/es/EditTable/style/index.js +42 -1
  24. package/es/EditTable/style/menu.js +27 -0
  25. package/es/EditTable/style/table.js +46 -0
  26. package/es/EditTable/utils.js +1 -1
  27. package/es/Ellipsis/Ellipsis.js +11 -3
  28. package/es/Ellipsis/style/index.js +24 -1
  29. package/es/Empty/Empty.js +1 -1
  30. package/es/FullPage/FullPage.js +1 -2
  31. package/es/LocaleProvider/index.js +1 -2
  32. package/es/PermissionButton/index.js +4 -5
  33. package/es/ProLayout/Basic/BasicLayout.js +46 -42
  34. package/es/ProLayout/Basic/BasicLayoutStyle.js +39 -0
  35. package/es/ProLayout/Basic/Header.js +4 -8
  36. package/es/ProLayout/Basic/HeaderStyle.js +10 -0
  37. package/es/ProLayout/PageContainer/index.js +20 -16
  38. package/es/ProLayout/PageContainer/style.js +46 -0
  39. package/es/ProLayout/SiderMenu/BaseMenu.js +14 -37
  40. package/es/ProLayout/SiderMenu/SiderMenu.js +25 -36
  41. package/es/ProLayout/SiderMenu/style.js +166 -0
  42. package/es/ProLayout/TopHeader/index.js +12 -11
  43. package/es/ProLayout/TopHeader/style.js +126 -0
  44. package/es/ProLayout/style/index.js +7 -1
  45. package/es/ProLayout/util.js +5 -5
  46. package/es/ProTable/Alert.js +13 -5
  47. package/es/ProTable/Content.js +22 -14
  48. package/es/ProTable/Header.js +22 -12
  49. package/es/ProTable/Pagination.js +13 -5
  50. package/es/ProTable/ProTable.js +43 -27
  51. package/es/ProTable/setting.js +1 -1
  52. package/es/ProTable/style/index.js +109 -1
  53. package/es/RadioButton/RadioButton.js +10 -4
  54. package/es/RadioButton/style/index.js +23 -1
  55. package/es/Scrollbar/Scrollbar.js +10 -3
  56. package/es/Scrollbar/Thumb.js +36 -25
  57. package/es/Scrollbar/style/index.js +63 -1
  58. package/es/Search/Advanced/History.js +24 -17
  59. package/es/Search/Advanced/SaveHistory.js +2 -3
  60. package/es/Search/Advanced/index.js +213 -293
  61. package/es/Search/Item.js +175 -415
  62. package/es/Search/Search.js +78 -172
  63. package/es/Search/hooks/index.js +108 -1
  64. package/es/Search/hooks/useRouteQuery.js +57 -0
  65. package/es/Search/setting.js +132 -14
  66. package/es/Search/style/index.js +4 -2
  67. package/es/Search/style/item.js +28 -0
  68. package/es/Search/style/search.js +133 -0
  69. package/es/Search/util.js +116 -124
  70. package/es/Skeleton/components/DashBoardCard.js +64 -0
  71. package/es/Skeleton/components/DashBoardChart.js +96 -0
  72. package/es/Skeleton/components/Detail.js +110 -0
  73. package/es/Skeleton/components/Drawer.js +91 -0
  74. package/es/Skeleton/components/Item.js +68 -0
  75. package/es/Skeleton/components/List.js +45 -0
  76. package/es/Skeleton/components/ListCard.js +63 -0
  77. package/es/Skeleton/components/ListCardItem.js +86 -0
  78. package/es/Skeleton/components/ListTable.js +76 -0
  79. package/es/Skeleton/components/Page.js +62 -0
  80. package/es/Skeleton/components/Search.js +54 -0
  81. package/es/Skeleton/components/Tree.js +72 -0
  82. package/es/Skeleton/index.js +15 -0
  83. package/es/Skeleton/skeleton.js +58 -0
  84. package/es/Skeleton/style/index.js +132 -0
  85. package/es/Title/style/index.js +29 -1
  86. package/es/Title/title.js +13 -5
  87. package/es/ValueItem/ValueItem.js +29 -72
  88. package/es/components.js +0 -3
  89. package/es/locale/en-US.js +0 -7
  90. package/es/locale/zh-CN.js +0 -7
  91. package/es/style/index.js +0 -3
  92. package/es/style/styleRegister.js +21 -0
  93. package/es/style/variable.js +4 -0
  94. package/es/style.js +0 -12
  95. package/lib/AutoComplete/AutoComplete.js +1 -2
  96. package/lib/BadgeStatus/Badge.js +2 -3
  97. package/lib/CardSelect/CardSelect.js +23 -18
  98. package/lib/CardSelect/style/index.js +30 -1
  99. package/lib/CheckButton/CheckButton.js +12 -4
  100. package/lib/CheckButton/style/index.js +46 -1
  101. package/lib/ConfigProvider/context.js +1 -1
  102. package/lib/ConfigProvider/index.js +3 -3
  103. package/lib/DragModal/DragModal.js +15 -9
  104. package/lib/DragModal/style/index.js +69 -1
  105. package/lib/EditTable/Body.js +10 -3
  106. package/lib/EditTable/EditTable.js +13 -7
  107. package/lib/EditTable/FormItem.js +16 -11
  108. package/lib/EditTable/Header.js +16 -6
  109. package/lib/EditTable/components/ContextMenu/Menu.js +12 -6
  110. package/lib/EditTable/components/Search/search.js +1 -2
  111. package/lib/EditTable/components/Search/sort.js +1 -3
  112. package/lib/EditTable/group.js +24 -19
  113. package/lib/EditTable/hooks/useValidate.js +1 -1
  114. package/lib/EditTable/style/body.js +60 -0
  115. package/lib/EditTable/style/form.js +31 -0
  116. package/lib/EditTable/style/group.js +32 -0
  117. package/lib/EditTable/style/header.js +65 -0
  118. package/lib/EditTable/style/index.js +47 -1
  119. package/lib/EditTable/style/menu.js +33 -0
  120. package/lib/EditTable/style/table.js +52 -0
  121. package/lib/EditTable/utils.js +1 -1
  122. package/lib/Ellipsis/Ellipsis.js +11 -3
  123. package/lib/Ellipsis/style/index.js +29 -1
  124. package/lib/Empty/Empty.js +1 -1
  125. package/lib/FullPage/FullPage.js +1 -2
  126. package/lib/LocaleProvider/index.js +1 -2
  127. package/lib/PermissionButton/index.js +9 -10
  128. package/lib/ProLayout/Basic/BasicLayout.js +55 -51
  129. package/lib/ProLayout/Basic/BasicLayoutStyle.js +46 -0
  130. package/lib/ProLayout/Basic/Header.js +6 -10
  131. package/lib/ProLayout/Basic/HeaderStyle.js +17 -0
  132. package/lib/ProLayout/PageContainer/index.js +24 -20
  133. package/lib/ProLayout/PageContainer/style.js +53 -0
  134. package/lib/ProLayout/SiderMenu/BaseMenu.js +18 -40
  135. package/lib/ProLayout/SiderMenu/SiderMenu.js +28 -39
  136. package/lib/ProLayout/SiderMenu/style.js +173 -0
  137. package/lib/ProLayout/TopHeader/index.js +12 -10
  138. package/lib/ProLayout/TopHeader/style.js +133 -0
  139. package/lib/ProLayout/defaultSettings.js +1 -1
  140. package/lib/ProLayout/style/index.js +12 -1
  141. package/lib/ProLayout/util.js +5 -5
  142. package/lib/ProTable/Alert.js +13 -5
  143. package/lib/ProTable/Content.js +22 -14
  144. package/lib/ProTable/Header.js +22 -12
  145. package/lib/ProTable/Pagination.js +13 -5
  146. package/lib/ProTable/ProTable.js +43 -27
  147. package/lib/ProTable/setting.js +3 -3
  148. package/lib/ProTable/style/index.js +114 -1
  149. package/lib/RadioButton/RadioButton.js +10 -4
  150. package/lib/RadioButton/style/index.js +28 -1
  151. package/lib/Scrollbar/Scrollbar.js +10 -3
  152. package/lib/Scrollbar/Thumb.js +36 -25
  153. package/lib/Scrollbar/style/index.js +68 -1
  154. package/lib/Search/Advanced/History.js +24 -17
  155. package/lib/Search/Advanced/SaveHistory.js +2 -3
  156. package/lib/Search/Advanced/index.js +213 -293
  157. package/lib/Search/Item.js +175 -415
  158. package/lib/Search/Search.js +78 -172
  159. package/lib/Search/hooks/index.js +130 -1
  160. package/lib/Search/hooks/useRouteQuery.js +64 -0
  161. package/lib/Search/setting.js +133 -15
  162. package/lib/Search/style/index.js +9 -2
  163. package/lib/Search/style/item.js +35 -0
  164. package/lib/Search/style/search.js +140 -0
  165. package/lib/Search/util.js +116 -124
  166. package/lib/Skeleton/components/DashBoardCard.js +64 -0
  167. package/lib/Skeleton/components/DashBoardChart.js +96 -0
  168. package/lib/Skeleton/components/Detail.js +110 -0
  169. package/lib/Skeleton/components/Drawer.js +91 -0
  170. package/lib/Skeleton/components/Item.js +68 -0
  171. package/lib/Skeleton/components/List.js +45 -0
  172. package/lib/Skeleton/components/ListCard.js +63 -0
  173. package/lib/Skeleton/components/ListCardItem.js +86 -0
  174. package/lib/Skeleton/components/ListTable.js +76 -0
  175. package/lib/Skeleton/components/Page.js +62 -0
  176. package/lib/Skeleton/components/Search.js +54 -0
  177. package/lib/Skeleton/components/Tree.js +72 -0
  178. package/lib/Skeleton/index.js +75 -0
  179. package/lib/Skeleton/skeleton.js +58 -0
  180. package/lib/Skeleton/style/index.js +139 -0
  181. package/lib/Title/style/index.js +34 -1
  182. package/lib/Title/title.js +13 -5
  183. package/lib/ValueItem/ValueItem.js +29 -72
  184. package/lib/components.js +0 -21
  185. package/lib/locale/en-US.js +0 -7
  186. package/lib/locale/zh-CN.js +0 -7
  187. package/lib/style/components.less +0 -1
  188. package/lib/style/index.js +1 -4
  189. package/lib/style/styleRegister.js +28 -0
  190. package/lib/style/variable.js +10 -0
  191. package/lib/style.js +1 -14
  192. package/package.json +13 -14
  193. package/es/AMap/Map.js +0 -133
  194. package/es/AMap/index.js +0 -5
  195. package/es/AMap/util.js +0 -56
  196. package/es/CardSelect/style/index.css +0 -24
  197. package/es/CardSelect/style/index.less +0 -26
  198. package/es/CheckButton/style/index.css +0 -37
  199. package/es/CheckButton/style/index.less +0 -40
  200. package/es/DragModal/style/index.css +0 -82
  201. package/es/DragModal/style/index.less +0 -97
  202. package/es/Echarts/Echarts.js +0 -48
  203. package/es/Echarts/index.js +0 -5
  204. package/es/EditTable/style/body.less +0 -66
  205. package/es/EditTable/style/form.less +0 -33
  206. package/es/EditTable/style/group.less +0 -32
  207. package/es/EditTable/style/header.less +0 -77
  208. package/es/EditTable/style/index.css +0 -267
  209. package/es/EditTable/style/index.less +0 -41
  210. package/es/EditTable/style/menu.less +0 -25
  211. package/es/EditTable/style/table.less +0 -47
  212. package/es/Ellipsis/style/index.css +0 -17
  213. package/es/Ellipsis/style/index.less +0 -20
  214. package/es/MonacoEditor/Monaco.js +0 -242
  215. package/es/MonacoEditor/index.js +0 -5
  216. package/es/MonacoEditor/style/index.css +0 -4
  217. package/es/MonacoEditor/style/index.js +0 -1
  218. package/es/MonacoEditor/style/index.less +0 -4
  219. package/es/ProLayout/Basic/BasicLayout.less +0 -66
  220. package/es/ProLayout/Basic/Header.less +0 -8
  221. package/es/ProLayout/PageContainer/index.less +0 -103
  222. package/es/ProLayout/SiderMenu/index.less +0 -231
  223. package/es/ProLayout/TopHeader/index.less +0 -174
  224. package/es/ProLayout/style/default.less +0 -4
  225. package/es/ProLayout/style/style.less +0 -7
  226. package/es/ProTable/style/ProTable.less +0 -141
  227. package/es/RadioButton/style/index.css +0 -20
  228. package/es/RadioButton/style/index.less +0 -19
  229. package/es/Scrollbar/style/index.css +0 -65
  230. package/es/Scrollbar/style/index.less +0 -83
  231. package/es/Search/style/Item.less +0 -33
  232. package/es/Search/style/Search.less +0 -179
  233. package/es/Title/style/index.css +0 -23
  234. package/es/Title/style/index.less +0 -25
  235. package/es/style/index.css +0 -5197
  236. package/es/style/index.less +0 -13
  237. package/es/style/variable.css +0 -4
  238. package/es/style/variable.less +0 -4
  239. package/lib/AMap/Map.js +0 -133
  240. package/lib/AMap/index.js +0 -12
  241. package/lib/AMap/util.js +0 -62
  242. package/lib/CardSelect/style/index.css +0 -24
  243. package/lib/CardSelect/style/index.less +0 -26
  244. package/lib/CheckButton/style/index.css +0 -37
  245. package/lib/CheckButton/style/index.less +0 -40
  246. package/lib/DragModal/style/index.css +0 -82
  247. package/lib/DragModal/style/index.less +0 -97
  248. package/lib/Echarts/Echarts.js +0 -48
  249. package/lib/Echarts/index.js +0 -12
  250. package/lib/EditTable/style/body.less +0 -66
  251. package/lib/EditTable/style/form.less +0 -33
  252. package/lib/EditTable/style/group.less +0 -32
  253. package/lib/EditTable/style/header.less +0 -77
  254. package/lib/EditTable/style/index.css +0 -267
  255. package/lib/EditTable/style/index.less +0 -41
  256. package/lib/EditTable/style/menu.less +0 -25
  257. package/lib/EditTable/style/table.less +0 -47
  258. package/lib/Ellipsis/style/index.css +0 -17
  259. package/lib/Ellipsis/style/index.less +0 -20
  260. package/lib/MonacoEditor/Monaco.js +0 -242
  261. package/lib/MonacoEditor/index.js +0 -12
  262. package/lib/MonacoEditor/style/index.css +0 -4
  263. package/lib/MonacoEditor/style/index.js +0 -3
  264. package/lib/MonacoEditor/style/index.less +0 -4
  265. package/lib/ProLayout/Basic/BasicLayout.less +0 -66
  266. package/lib/ProLayout/Basic/Header.less +0 -8
  267. package/lib/ProLayout/PageContainer/index.less +0 -103
  268. package/lib/ProLayout/SiderMenu/index.less +0 -231
  269. package/lib/ProLayout/TopHeader/index.less +0 -174
  270. package/lib/ProLayout/style/default.less +0 -4
  271. package/lib/ProLayout/style/style.less +0 -7
  272. package/lib/ProTable/style/ProTable.less +0 -141
  273. package/lib/RadioButton/style/index.css +0 -20
  274. package/lib/RadioButton/style/index.less +0 -19
  275. package/lib/Scrollbar/style/index.css +0 -65
  276. package/lib/Scrollbar/style/index.less +0 -83
  277. package/lib/Search/style/Item.less +0 -33
  278. package/lib/Search/style/Search.less +0 -179
  279. package/lib/Title/style/index.css +0 -23
  280. package/lib/Title/style/index.less +0 -25
  281. package/lib/style/index.css +0 -5197
  282. package/lib/style/index.less +0 -13
  283. package/lib/style/variable.css +0 -4
  284. package/lib/style/variable.less +0 -4
@@ -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
- "termsParamsFormat": "setup-maybe-ref",
28
- "SearchItem": "setup-const",
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
- "resetNumber": "setup-ref",
44
- "reset": "setup-const"
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, 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 } from "vue";
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 { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue/lib/';
51
- import { set } from 'lodash-es';
52
- import { reactive, ref, provide, watch, computed, inject } from 'vue';
53
- import { termsParamsFormat } from './util';
54
- import SearchItem from './Item.js';
55
- import { optionsMapKey } from './setting';
56
- import { SearchConfig } from '../utils/constants';
57
- import { useLocaleReceiver } from "../LocaleReciver/index";
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
- columns: {
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: ["search"],
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 terms = reactive({ terms: [] });
108
- const searchItems = ref([]); // 当前查询条件列表
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.terms, columnOptionMap.value, 'low', props.type));
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
- resetNumber.value += 1;
175
- handleItems(true);
176
- if (props.type == 'object') {
177
- emit('search', {});
178
- }
179
- else if (props.type == 'terms') {
180
- emit('search', []);
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(['JSearch-warp', props.class]),
197
- style: _normalizeStyle(__props.style)
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(searchItems.value, (item, index) => {
113
+ (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(terms.terms, (item, index) => {
204
114
  return (_openBlock(), _createBlock(_unref(Col), {
205
- key: index + '_' + item.column,
206
- span: item.span || 24 / __props.column
115
+ span: item._span || 24 / _ctx.column
207
116
  }, {
208
117
  default: _withCtx(() => [
209
- _createVNode(SearchItem, {
210
- "only-value": true,
211
- expand: false,
212
- index: index + 1,
213
- columns: searchItems.value,
214
- "component-props": item.componentProps,
215
- "terms-item": terms.terms[index],
216
- reset: resetNumber.value,
217
- "label-width": __props.labelWidth,
218
- onChange: (v) => itemValueChange(v, index)
219
- }, null, 8 /* PROPS */, ["index", "columns", "component-props", "terms-item", "reset", "label-width", "onChange"])
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
- }), 128 /* KEYED_FRAGMENT */)),
132
+ }), 256 /* UNKEYED_FRAGMENT */)),
224
133
  _createVNode(_unref(Col), {
225
- span: 24 / __props.column
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(__props.resetText || _unref(contextLocale).search.reset), 1 /* TEXT */)
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(__props.submitText || _unref(contextLocale).search.search), 1 /* TEXT */)
158
+ _createTextVNode(_toDisplayString(_ctx.submitText || _unref(contextLocale).search.search), 1 /* TEXT */)
253
159
  ]),
254
160
  _: 1 /* STABLE */
255
161
  })
@@ -1,11 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
7
+ var _exportNames = {
8
+ useOptionMapContent: true,
9
+ useOptionMap: true,
10
+ useColumnsMapContent: true,
11
+ useColumnsMap: true,
12
+ useDefaultValue: true,
13
+ useHandleColumns: true
14
+ };
15
+ exports.useOptionMapContent = exports.useOptionMap = exports.useHandleColumns = exports.useDefaultValue = exports.useColumnsMapContent = exports.useColumnsMap = void 0;
16
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
17
+ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
18
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
19
+ var _vue = require("vue");
20
+ var _util = require("../util");
6
21
  var _useSearchItems = require("./useSearchItems");
7
22
  Object.keys(_useSearchItems).forEach(function (key) {
8
23
  if (key === "default" || key === "__esModule") return;
24
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
25
  if (key in exports && exports[key] === _useSearchItems[key]) return;
10
26
  Object.defineProperty(exports, key, {
11
27
  enumerable: true,
@@ -13,4 +29,117 @@ Object.keys(_useSearchItems).forEach(function (key) {
13
29
  return _useSearchItems[key];
14
30
  }
15
31
  });
16
- });
32
+ });
33
+ var _useRouteQuery = require("./useRouteQuery");
34
+ Object.keys(_useRouteQuery).forEach(function (key) {
35
+ if (key === "default" || key === "__esModule") return;
36
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
37
+ if (key in exports && exports[key] === _useRouteQuery[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _useRouteQuery[key];
42
+ }
43
+ });
44
+ });
45
+ var optionMapKey = Symbol('optionMapKey');
46
+ var columnsMapKey = Symbol('columnMapKey');
47
+ var columnsValues = Symbol('columnsValues');
48
+ var useOptionMapContent = exports.useOptionMapContent = function useOptionMapContent(optionsMap) {
49
+ (0, _vue.provide)(optionMapKey, optionsMap);
50
+ };
51
+ var useOptionMap = exports.useOptionMap = function useOptionMap() {
52
+ return (0, _vue.inject)(optionMapKey);
53
+ };
54
+ var useColumnsMapContent = exports.useColumnsMapContent = function useColumnsMapContent(columnsMap) {
55
+ (0, _vue.provide)(columnsMapKey, columnsMap);
56
+ };
57
+ var useColumnsMap = exports.useColumnsMap = function useColumnsMap() {
58
+ return (0, _vue.inject)(columnsMapKey);
59
+ };
60
+ var useDefaultValue = exports.useDefaultValue = function useDefaultValue() {
61
+ return (0, _vue.inject)(columnsValues);
62
+ };
63
+ var useHandleColumns = exports.useHandleColumns = function useHandleColumns(props, terms) {
64
+ var columnsMap = (0, _vue.ref)({}); // 存储每个column
65
+ var defaultCacheValues = (0, _vue.ref)({});
66
+ useColumnsMapContent(columnsMap);
67
+ /**
68
+ * 处理search.first为true的排序
69
+ * @param arr
70
+ */
71
+ var moveFirstElementsToFront = function moveFirstElementsToFront(arr) {
72
+ // 提取所有 first: true 的元素
73
+ var firstElements = arr.filter(function (item) {
74
+ return item.search.first === true;
75
+ });
76
+ // 提取剩余的元素
77
+ var otherElements = arr.filter(function (item) {
78
+ return item.search.first !== true;
79
+ });
80
+ // 合并并返回
81
+ return [].concat((0, _toConsumableArray2.default)(firstElements), (0, _toConsumableArray2.default)(otherElements));
82
+ };
83
+ /**
84
+ * 处理默认值
85
+ * @param arr
86
+ */
87
+ var handleDefaultValue = function handleDefaultValue(arr) {
88
+ var _iterator = (0, _createForOfIteratorHelper2.default)(arr),
89
+ _step;
90
+ try {
91
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
92
+ var item = _step.value;
93
+ var search = item.search;
94
+ var _data = {
95
+ defaultValue: undefined,
96
+ defaultTermType: undefined
97
+ };
98
+ _data.defaultValue = search.defaultValue;
99
+ _data.defaultTermType = search.defaultTermType;
100
+ defaultCacheValues.value[item.dataIndex] = _data;
101
+ }
102
+ } catch (err) {
103
+ _iterator.e(err);
104
+ } finally {
105
+ _iterator.f();
106
+ }
107
+ (0, _vue.provide)(columnsValues, defaultCacheValues);
108
+ };
109
+ var initValues = function initValues() {
110
+ var arr = Object.values(columnsMap.value);
111
+ if (props.mode === 'advanced') {
112
+ // 设置第一位
113
+ terms.terms = [(0, _util.getItemDefaultValue)(arr[0], defaultCacheValues.value)];
114
+ } else {
115
+ terms.terms = arr.map(function (item) {
116
+ return (0, _util.getItemDefaultValue)(item, defaultCacheValues.value);
117
+ });
118
+ }
119
+ };
120
+ var handleColumns = function handleColumns(columns) {
121
+ var columnsSearch = columns.filter(function (item) {
122
+ return item.hasOwnProperty('search') && Object.keys(item.search).length;
123
+ });
124
+ // 排序
125
+ var columnsSort = moveFirstElementsToFront(columnsSearch);
126
+ columnsSort.forEach(function (item, index) {
127
+ columnsMap.value[item.dataIndex] = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
128
+ _sort_index: index
129
+ });
130
+ });
131
+ handleDefaultValue(columnsSort);
132
+ if (terms.terms.length === 0) {
133
+ // 高级模式处理数据
134
+ initValues();
135
+ }
136
+ };
137
+ (0, _vue.watchEffect)(function () {
138
+ handleColumns(props.columns);
139
+ });
140
+ return {
141
+ initValues: initValues,
142
+ columnsMap: columnsMap,
143
+ defaultCacheValues: defaultCacheValues
144
+ };
145
+ };
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useRouteQuery = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _vue = require("vue");
10
+ var _vueRouter = require("vue-router");
11
+ var _queue = new WeakMap();
12
+ var useRouteQuery = exports.useRouteQuery = function useRouteQuery(name) {
13
+ var router = (0, _vueRouter.useRouter)();
14
+ var route = (0, _vueRouter.useRoute)();
15
+ var transformGet = function transformGet(value) {
16
+ return value;
17
+ };
18
+ var transformSet = function transformSet(value) {
19
+ return value;
20
+ };
21
+ if (!_queue.has(router)) _queue.set(router, new Map());
22
+ var _queriesQueue = _queue.get(router);
23
+ var query = route.query[name];
24
+ var _trigger;
25
+ var proxy = (0, _vue.customRef)(function (track, trigger) {
26
+ _trigger = trigger;
27
+ return {
28
+ get: function get() {
29
+ track();
30
+ return transformGet(query !== undefined ? query : undefined);
31
+ },
32
+ set: function set(v) {
33
+ v = transformSet(v);
34
+ if (query === v) return;
35
+ query = v === undefined ? undefined : v;
36
+ _queriesQueue.set(name, v === undefined ? undefined : v);
37
+ trigger();
38
+ (0, _vue.nextTick)(function () {
39
+ if (_queriesQueue.size === 0) return;
40
+ var newQueries = Object.fromEntries(_queriesQueue.entries());
41
+ _queriesQueue.clear();
42
+ var params = route.params,
43
+ query = route.query,
44
+ hash = route.hash;
45
+ router.replace({
46
+ params: params,
47
+ query: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, query), newQueries),
48
+ hash: hash
49
+ });
50
+ });
51
+ }
52
+ };
53
+ });
54
+ (0, _vue.watch)(function () {
55
+ return route.query[name];
56
+ }, function (v) {
57
+ if (query === transformGet(v)) return;
58
+ query = v;
59
+ _trigger();
60
+ }, {
61
+ flush: 'sync'
62
+ });
63
+ return proxy;
64
+ };