@jetlinks-web/components 3.0.0-rc → 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 (286) hide show
  1. package/es/AutoComplete/AutoComplete.js +13 -9
  2. package/es/BadgeStatus/Badge.js +1 -2
  3. package/es/BadgeStatus/color.js +3 -3
  4. package/es/CardSelect/CardSelect.js +23 -13
  5. package/es/CardSelect/style/index.js +25 -1
  6. package/es/CheckButton/CheckButton.js +12 -4
  7. package/es/CheckButton/style/index.js +41 -1
  8. package/es/DragModal/DragModal.js +14 -8
  9. package/es/DragModal/style/index.js +64 -1
  10. package/es/EditTable/Body.js +10 -3
  11. package/es/EditTable/EditTable.js +13 -7
  12. package/es/EditTable/FormItem.js +18 -19
  13. package/es/EditTable/Header.js +16 -6
  14. package/es/EditTable/components/ContextMenu/Menu.js +11 -5
  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 +23 -18
  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 +30 -3
  27. package/es/Ellipsis/Ellipsis.js +10 -2
  28. package/es/Ellipsis/style/index.js +24 -1
  29. package/es/FullPage/FullPage.js +1 -2
  30. package/es/LocaleProvider/index.js +1 -2
  31. package/es/PermissionButton/index.js +3 -4
  32. package/es/ProLayout/Basic/BasicLayout.js +45 -41
  33. package/es/ProLayout/Basic/BasicLayoutStyle.js +39 -0
  34. package/es/ProLayout/Basic/Header.js +3 -7
  35. package/es/ProLayout/Basic/HeaderStyle.js +10 -0
  36. package/es/ProLayout/PageContainer/index.js +21 -17
  37. package/es/ProLayout/PageContainer/style.js +46 -0
  38. package/es/ProLayout/SiderMenu/BaseMenu.js +13 -37
  39. package/es/ProLayout/SiderMenu/SiderMenu.js +24 -36
  40. package/es/ProLayout/SiderMenu/style.js +166 -0
  41. package/es/ProLayout/TopHeader/index.js +13 -12
  42. package/es/ProLayout/TopHeader/style.js +126 -0
  43. package/es/ProLayout/style/index.js +7 -1
  44. package/es/ProLayout/util.js +5 -5
  45. package/es/ProTable/Alert.js +12 -4
  46. package/es/ProTable/Content.js +108 -28
  47. package/es/ProTable/Header.js +21 -11
  48. package/es/ProTable/Pagination.js +12 -4
  49. package/es/ProTable/ProTable.js +42 -26
  50. package/es/ProTable/hooks/index.js +2 -0
  51. package/es/ProTable/hooks/useTableInject.js +5 -0
  52. package/es/ProTable/hooks/useTableSelection.js +95 -0
  53. package/es/ProTable/setting.js +1 -1
  54. package/es/ProTable/style/index.js +109 -1
  55. package/es/RadioButton/RadioButton.js +10 -4
  56. package/es/RadioButton/style/index.js +23 -1
  57. package/es/Scrollbar/Scrollbar.js +10 -3
  58. package/es/Scrollbar/Thumb.js +36 -25
  59. package/es/Scrollbar/style/index.js +63 -1
  60. package/es/Search/Advanced/History.js +23 -16
  61. package/es/Search/Advanced/SaveHistory.js +1 -2
  62. package/es/Search/Advanced/index.js +213 -292
  63. package/es/Search/Item.js +175 -415
  64. package/es/Search/Search.js +78 -172
  65. package/es/Search/hooks/index.js +108 -1
  66. package/es/Search/hooks/useRouteQuery.js +57 -0
  67. package/es/Search/setting.js +132 -14
  68. package/es/Search/style/index.js +4 -2
  69. package/es/Search/style/item.js +28 -0
  70. package/es/Search/style/search.js +133 -0
  71. package/es/Search/util.js +116 -124
  72. package/es/Skeleton/components/DashBoardCard.js +64 -0
  73. package/es/Skeleton/components/DashBoardChart.js +96 -0
  74. package/es/Skeleton/components/Detail.js +110 -0
  75. package/es/Skeleton/components/Drawer.js +91 -0
  76. package/es/Skeleton/components/Item.js +68 -0
  77. package/es/Skeleton/components/List.js +45 -0
  78. package/es/Skeleton/components/ListCard.js +63 -0
  79. package/es/Skeleton/components/ListCardItem.js +86 -0
  80. package/es/Skeleton/components/ListTable.js +76 -0
  81. package/es/Skeleton/components/Page.js +62 -0
  82. package/es/Skeleton/components/Search.js +54 -0
  83. package/es/Skeleton/components/Tree.js +72 -0
  84. package/es/Skeleton/index.js +15 -0
  85. package/es/Skeleton/skeleton.js +58 -0
  86. package/es/Skeleton/style/index.js +132 -0
  87. package/es/Title/style/index.js +29 -1
  88. package/es/Title/title.js +13 -5
  89. package/es/ValueItem/ValueItem.js +44 -39
  90. package/es/components.js +1 -4
  91. package/es/locale/en-US.js +3 -7
  92. package/es/locale/zh-CN.js +3 -7
  93. package/es/style/index.js +0 -3
  94. package/es/style/styleRegister.js +21 -0
  95. package/es/style/variable.js +4 -0
  96. package/es/style.js +0 -12
  97. package/lib/AutoComplete/AutoComplete.js +13 -9
  98. package/lib/BadgeStatus/Badge.js +1 -2
  99. package/lib/BadgeStatus/color.js +3 -3
  100. package/lib/CardSelect/CardSelect.js +23 -13
  101. package/lib/CardSelect/style/index.js +30 -1
  102. package/lib/CheckButton/CheckButton.js +12 -4
  103. package/lib/CheckButton/style/index.js +46 -1
  104. package/lib/DragModal/DragModal.js +14 -8
  105. package/lib/DragModal/style/index.js +69 -1
  106. package/lib/EditTable/Body.js +10 -3
  107. package/lib/EditTable/EditTable.js +13 -7
  108. package/lib/EditTable/FormItem.js +18 -19
  109. package/lib/EditTable/Header.js +16 -6
  110. package/lib/EditTable/components/ContextMenu/Menu.js +11 -5
  111. package/lib/EditTable/components/Search/search.js +1 -2
  112. package/lib/EditTable/components/Search/sort.js +1 -3
  113. package/lib/EditTable/group.js +23 -18
  114. package/lib/EditTable/hooks/useValidate.js +1 -1
  115. package/lib/EditTable/style/body.js +60 -0
  116. package/lib/EditTable/style/form.js +31 -0
  117. package/lib/EditTable/style/group.js +32 -0
  118. package/lib/EditTable/style/header.js +65 -0
  119. package/lib/EditTable/style/index.js +47 -1
  120. package/lib/EditTable/style/menu.js +33 -0
  121. package/lib/EditTable/style/table.js +52 -0
  122. package/lib/EditTable/utils.js +31 -3
  123. package/lib/Ellipsis/Ellipsis.js +10 -2
  124. package/lib/Ellipsis/style/index.js +29 -1
  125. package/lib/FullPage/FullPage.js +1 -2
  126. package/lib/LocaleProvider/index.js +1 -2
  127. package/lib/PermissionButton/index.js +3 -4
  128. package/lib/ProLayout/Basic/BasicLayout.js +44 -40
  129. package/lib/ProLayout/Basic/BasicLayoutStyle.js +46 -0
  130. package/lib/ProLayout/Basic/Header.js +2 -6
  131. package/lib/ProLayout/Basic/HeaderStyle.js +17 -0
  132. package/lib/ProLayout/PageContainer/index.js +19 -15
  133. package/lib/ProLayout/PageContainer/style.js +53 -0
  134. package/lib/ProLayout/SiderMenu/BaseMenu.js +14 -37
  135. package/lib/ProLayout/SiderMenu/SiderMenu.js +23 -35
  136. package/lib/ProLayout/SiderMenu/style.js +173 -0
  137. package/lib/ProLayout/TopHeader/index.js +14 -12
  138. package/lib/ProLayout/TopHeader/style.js +133 -0
  139. package/lib/ProLayout/style/index.js +12 -1
  140. package/lib/ProLayout/util.js +5 -5
  141. package/lib/ProTable/Alert.js +12 -4
  142. package/lib/ProTable/Content.js +108 -28
  143. package/lib/ProTable/Header.js +21 -11
  144. package/lib/ProTable/Pagination.js +12 -4
  145. package/lib/ProTable/ProTable.js +42 -26
  146. package/lib/ProTable/hooks/index.js +27 -0
  147. package/lib/ProTable/hooks/useTableInject.js +11 -0
  148. package/lib/ProTable/hooks/useTableSelection.js +102 -0
  149. package/lib/ProTable/setting.js +1 -1
  150. package/lib/ProTable/style/index.js +114 -1
  151. package/lib/RadioButton/RadioButton.js +10 -4
  152. package/lib/RadioButton/style/index.js +28 -1
  153. package/lib/Scrollbar/Scrollbar.js +10 -3
  154. package/lib/Scrollbar/Thumb.js +36 -25
  155. package/lib/Scrollbar/style/index.js +68 -1
  156. package/lib/Search/Advanced/History.js +23 -16
  157. package/lib/Search/Advanced/SaveHistory.js +1 -2
  158. package/lib/Search/Advanced/index.js +213 -292
  159. package/lib/Search/Item.js +175 -415
  160. package/lib/Search/Search.js +78 -172
  161. package/lib/Search/hooks/index.js +130 -1
  162. package/lib/Search/hooks/useRouteQuery.js +64 -0
  163. package/lib/Search/setting.js +133 -15
  164. package/lib/Search/style/index.js +9 -2
  165. package/lib/Search/style/item.js +35 -0
  166. package/lib/Search/style/search.js +140 -0
  167. package/lib/Search/util.js +116 -124
  168. package/lib/Skeleton/components/DashBoardCard.js +64 -0
  169. package/lib/Skeleton/components/DashBoardChart.js +96 -0
  170. package/lib/Skeleton/components/Detail.js +110 -0
  171. package/lib/Skeleton/components/Drawer.js +91 -0
  172. package/lib/Skeleton/components/Item.js +68 -0
  173. package/lib/Skeleton/components/List.js +45 -0
  174. package/lib/Skeleton/components/ListCard.js +63 -0
  175. package/lib/Skeleton/components/ListCardItem.js +86 -0
  176. package/lib/Skeleton/components/ListTable.js +76 -0
  177. package/lib/Skeleton/components/Page.js +62 -0
  178. package/lib/Skeleton/components/Search.js +54 -0
  179. package/lib/Skeleton/components/Tree.js +72 -0
  180. package/lib/Skeleton/index.js +75 -0
  181. package/lib/Skeleton/skeleton.js +58 -0
  182. package/lib/Skeleton/style/index.js +139 -0
  183. package/lib/Title/style/index.js +34 -1
  184. package/lib/Title/title.js +13 -5
  185. package/lib/ValueItem/ValueItem.js +44 -39
  186. package/lib/components.js +0 -21
  187. package/lib/locale/en-US.js +3 -7
  188. package/lib/locale/zh-CN.js +3 -7
  189. package/lib/style/components.less +0 -1
  190. package/lib/style/index.js +1 -4
  191. package/lib/style/styleRegister.js +28 -0
  192. package/lib/style/variable.js +10 -0
  193. package/lib/style.js +1 -14
  194. package/package.json +10 -13
  195. package/es/AMap/Map.js +0 -133
  196. package/es/AMap/index.js +0 -5
  197. package/es/AMap/util.js +0 -56
  198. package/es/CardSelect/style/index.css +0 -24
  199. package/es/CardSelect/style/index.less +0 -26
  200. package/es/CheckButton/style/index.css +0 -37
  201. package/es/CheckButton/style/index.less +0 -40
  202. package/es/DragModal/style/index.css +0 -82
  203. package/es/DragModal/style/index.less +0 -97
  204. package/es/Echarts/Echarts.js +0 -48
  205. package/es/Echarts/index.js +0 -5
  206. package/es/EditTable/style/body.less +0 -66
  207. package/es/EditTable/style/form.less +0 -33
  208. package/es/EditTable/style/group.less +0 -32
  209. package/es/EditTable/style/header.less +0 -77
  210. package/es/EditTable/style/index.css +0 -267
  211. package/es/EditTable/style/index.less +0 -41
  212. package/es/EditTable/style/menu.less +0 -25
  213. package/es/EditTable/style/table.less +0 -47
  214. package/es/Ellipsis/style/index.css +0 -17
  215. package/es/Ellipsis/style/index.less +0 -20
  216. package/es/FlameGraph/FlameGraph.js +0 -136
  217. package/es/FlameGraph/index.js +0 -5
  218. package/es/FlameGraph/style/index.css +0 -43
  219. package/es/FlameGraph/style/index.js +0 -1
  220. package/es/FlameGraph/style/index.less +0 -52
  221. package/es/ProLayout/Basic/BasicLayout.less +0 -66
  222. package/es/ProLayout/Basic/Header.less +0 -8
  223. package/es/ProLayout/PageContainer/index.less +0 -103
  224. package/es/ProLayout/SiderMenu/index.less +0 -231
  225. package/es/ProLayout/TopHeader/index.less +0 -174
  226. package/es/ProLayout/style/default.less +0 -4
  227. package/es/ProLayout/style/style.less +0 -7
  228. package/es/ProTable/style/ProTable.less +0 -139
  229. package/es/RadioButton/style/index.css +0 -20
  230. package/es/RadioButton/style/index.less +0 -19
  231. package/es/Scrollbar/style/index.css +0 -65
  232. package/es/Scrollbar/style/index.less +0 -83
  233. package/es/Search/style/Item.less +0 -33
  234. package/es/Search/style/Search.less +0 -179
  235. package/es/Title/style/index.css +0 -23
  236. package/es/Title/style/index.less +0 -25
  237. package/es/style/index.css +0 -5234
  238. package/es/style/index.less +0 -13
  239. package/es/style/variable.css +0 -4
  240. package/es/style/variable.less +0 -4
  241. package/lib/AMap/Map.js +0 -133
  242. package/lib/AMap/index.js +0 -12
  243. package/lib/AMap/util.js +0 -62
  244. package/lib/CardSelect/style/index.css +0 -24
  245. package/lib/CardSelect/style/index.less +0 -26
  246. package/lib/CheckButton/style/index.css +0 -37
  247. package/lib/CheckButton/style/index.less +0 -40
  248. package/lib/DragModal/style/index.css +0 -82
  249. package/lib/DragModal/style/index.less +0 -97
  250. package/lib/Echarts/Echarts.js +0 -48
  251. package/lib/Echarts/index.js +0 -12
  252. package/lib/EditTable/style/body.less +0 -66
  253. package/lib/EditTable/style/form.less +0 -33
  254. package/lib/EditTable/style/group.less +0 -32
  255. package/lib/EditTable/style/header.less +0 -77
  256. package/lib/EditTable/style/index.css +0 -267
  257. package/lib/EditTable/style/index.less +0 -41
  258. package/lib/EditTable/style/menu.less +0 -25
  259. package/lib/EditTable/style/table.less +0 -47
  260. package/lib/Ellipsis/style/index.css +0 -17
  261. package/lib/Ellipsis/style/index.less +0 -20
  262. package/lib/FlameGraph/FlameGraph.js +0 -136
  263. package/lib/FlameGraph/index.js +0 -12
  264. package/lib/FlameGraph/style/index.css +0 -43
  265. package/lib/FlameGraph/style/index.js +0 -3
  266. package/lib/FlameGraph/style/index.less +0 -52
  267. package/lib/ProLayout/Basic/BasicLayout.less +0 -66
  268. package/lib/ProLayout/Basic/Header.less +0 -8
  269. package/lib/ProLayout/PageContainer/index.less +0 -103
  270. package/lib/ProLayout/SiderMenu/index.less +0 -231
  271. package/lib/ProLayout/TopHeader/index.less +0 -174
  272. package/lib/ProLayout/style/default.less +0 -4
  273. package/lib/ProLayout/style/style.less +0 -7
  274. package/lib/ProTable/style/ProTable.less +0 -139
  275. package/lib/RadioButton/style/index.css +0 -20
  276. package/lib/RadioButton/style/index.less +0 -19
  277. package/lib/Scrollbar/style/index.css +0 -65
  278. package/lib/Scrollbar/style/index.less +0 -83
  279. package/lib/Search/style/Item.less +0 -33
  280. package/lib/Search/style/Search.less +0 -179
  281. package/lib/Title/style/index.css +0 -23
  282. package/lib/Title/style/index.less +0 -25
  283. package/lib/style/index.css +0 -5234
  284. package/lib/style/index.less +0 -13
  285. package/lib/style/variable.css +0 -4
  286. 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';
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 +1,108 @@
1
- export * from './useSearchItems';
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
+ };
@@ -1,18 +1,43 @@
1
- import 'vue';
2
- import './typing';
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 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
- }
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
  };
@@ -1,2 +1,4 @@
1
- import './Search.less';
2
- import './Item.less';
1
+ import genCompoentStyle from "../../style/styleRegister";
2
+ import { genSearchStyle } from "./search";
3
+ import { genItemStyle } from "./item";
4
+ export default genCompoentStyle([genSearchStyle, genItemStyle]);