@jetlinks-web/components 2.0.2-2 → 2.0.2-4

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