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