@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,72 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.clearMenuItem = clearMenuItem;
8
+ exports.flatMap = flatMap;
9
+ exports.getMenuFirstChildren = getMenuFirstChildren;
10
+ exports.getSlot = getSlot;
11
+ exports.getSlotVNode = getSlotVNode;
12
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
+ function clearMenuItem(menusData) {
14
+ return menusData.map(function (item) {
15
+ var _finalItem$meta;
16
+ var finalItem = (0, _objectSpread2.default)({}, item);
17
+ if ((_finalItem$meta = finalItem.meta) !== null && _finalItem$meta !== void 0 && _finalItem$meta.hideInMenu) {
18
+ return null;
19
+ }
20
+ if (finalItem && finalItem !== null && finalItem !== void 0 && finalItem.children) {
21
+ var _finalItem$meta2;
22
+ if (!((_finalItem$meta2 = finalItem.meta) !== null && _finalItem$meta2 !== void 0 && _finalItem$meta2.hideChildInMenu) && finalItem.children.some(function (child) {
23
+ var _child$meta;
24
+ return child && child.name && !((_child$meta = child.meta) !== null && _child$meta !== void 0 && _child$meta.hideInMenu);
25
+ })) {
26
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
27
+ children: clearMenuItem(finalItem.children)
28
+ });
29
+ }
30
+ delete finalItem.children;
31
+ }
32
+ return finalItem;
33
+ }).filter(function (item) {
34
+ return item;
35
+ });
36
+ }
37
+ function flatMap(menusData) {
38
+ return menusData.map(function (item) {
39
+ var _finalItem$meta3;
40
+ var finalItem = (0, _objectSpread2.default)({}, item);
41
+ if (!finalItem.name || (_finalItem$meta3 = finalItem.meta) !== null && _finalItem$meta3 !== void 0 && _finalItem$meta3.hideInMenu) {
42
+ return null;
43
+ }
44
+ if (finalItem.children) {
45
+ delete finalItem.children;
46
+ }
47
+ return finalItem;
48
+ }).filter(function (item) {
49
+ return item;
50
+ });
51
+ }
52
+ function getMenuFirstChildren(menus, key) {
53
+ return key === undefined ? [] : (menus[menus.findIndex(function (menu) {
54
+ return menu.path === key;
55
+ })] || {}).children || [];
56
+ }
57
+ function getSlot(slots, props) {
58
+ var prop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'default';
59
+ if (props[prop] === false) {
60
+ // force not render
61
+ return false;
62
+ }
63
+ return props[prop] || slots[prop];
64
+ }
65
+ function getSlotVNode(slots, props) {
66
+ var _slots$prop;
67
+ var prop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'default';
68
+ if (props[prop] === false) {
69
+ return false;
70
+ }
71
+ return props[prop] || ((_slots$prop = slots[prop]) === null || _slots$prop === void 0 ? void 0 : _slots$prop.call(slots));
72
+ }
@@ -0,0 +1,412 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _vue = require("vue");
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
+ var _index = require("../index");
14
+ var _antDesignVue = require("ant-design-vue");
15
+ var _table = require("ant-design-vue/es/table");
16
+ var _proTableTypes = require("./proTableTypes");
17
+ var _lodashEs = require("lodash");
18
+ var tableProps = function tableProps() {
19
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _table.tableProps)()), {}, {
20
+ loading: {
21
+ type: Boolean,
22
+ default: undefined
23
+ },
24
+ request: {
25
+ type: Function,
26
+ default: undefined
27
+ },
28
+ cardBodyClass: {
29
+ type: String,
30
+ default: ''
31
+ },
32
+ bodyStyle: {
33
+ type: Object,
34
+ default: {}
35
+ },
36
+ columns: {
37
+ type: Array,
38
+ default: function _default() {
39
+ return [];
40
+ }
41
+ },
42
+ model: {
43
+ type: [String, undefined],
44
+ default: undefined
45
+ },
46
+ modelValue: {
47
+ type: String,
48
+ default: undefined
49
+ },
50
+ noPagination: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ rowSelection: {
55
+ type: Object,
56
+ default: function _default() {
57
+ return undefined;
58
+ }
59
+ },
60
+ dataSource: {
61
+ type: Array,
62
+ default: function _default() {
63
+ return [];
64
+ }
65
+ },
66
+ gridColumns: {
67
+ type: Array,
68
+ default: function _default() {
69
+ return [];
70
+ }
71
+ },
72
+ gridColumn: {
73
+ type: Number,
74
+ default: 4
75
+ },
76
+ alertRender: {
77
+ type: Boolean,
78
+ default: true
79
+ },
80
+ params: {
81
+ type: Object,
82
+ default: function _default() {}
83
+ },
84
+ type: {
85
+ type: String,
86
+ default: 'PAGE'
87
+ },
88
+ scroll: {
89
+ type: Object,
90
+ default: function _default() {
91
+ x: 1366;
92
+ }
93
+ },
94
+ defaultParams: {
95
+ type: Object,
96
+ default: function _default() {}
97
+ },
98
+ rowKey: {
99
+ type: [String, Function],
100
+ default: 'id'
101
+ },
102
+ pagination: {
103
+ type: Object,
104
+ default: function _default() {
105
+ return {
106
+ showSizeChanger: true,
107
+ showQuickJumper: false,
108
+ size: 'size',
109
+ pageSizeOptions: ['12', '24', '48', '96']
110
+ };
111
+ }
112
+ }
113
+ });
114
+ };
115
+ var ProTable = (0, _vue.defineComponent)({
116
+ name: 'ProTable',
117
+ slots: ['headerTitle', 'card', 'rightExtraRender', 'paginationRender' // 分页
118
+ ],
119
+ props: tableProps(),
120
+ emits: ['update:modelValue', 'modelChange'],
121
+ setup: function setup(props, _ref) {
122
+ var _props$pagination;
123
+ var slots = _ref.slots,
124
+ expose = _ref.expose,
125
+ emit = _ref.emit;
126
+ var _model = (0, _vue.ref)(props.model ? props.model : _proTableTypes.ModelEnum.CARD); // 模式切换
127
+ var _dataSource = (0, _vue.ref)([]);
128
+ var pageIndex = (0, _vue.ref)(0);
129
+ var pageSize = (0, _vue.ref)(12);
130
+ var total = (0, _vue.ref)(0);
131
+ var _loading = (0, _vue.ref)(false);
132
+ var column = (0, _vue.ref)(props.gridColumn || 4);
133
+ if (!props.noPagination && props.pagination && (0, _lodashEs.isArray)((_props$pagination = props.pagination) === null || _props$pagination === void 0 ? void 0 : _props$pagination.pageSizeOptions)) {
134
+ pageSize.value = props.pagination.pageSizeOptions[0];
135
+ }
136
+ /**
137
+ * 监听宽度,计算显示卡片个数
138
+ */
139
+ var windowChange = function windowChange() {
140
+ if (window.innerWidth <= 1440) {
141
+ var _props$gridColumns;
142
+ var _column = props.gridColumn && props.gridColumn < 2 ? props.gridColumn : 2;
143
+ column.value = (_props$gridColumns = props.gridColumns) !== null && _props$gridColumns !== void 0 && _props$gridColumns[0] ? props.gridColumns[0] : _column;
144
+ } else if (window.innerWidth > 1440 && window.innerWidth <= 1600) {
145
+ var _props$gridColumns2;
146
+ var _column2 = props.gridColumn && props.gridColumn < 3 ? props.gridColumn : 3;
147
+ column.value = (_props$gridColumns2 = props.gridColumns) !== null && _props$gridColumns2 !== void 0 && _props$gridColumns2[1] ? props.gridColumns[1] : _column2;
148
+ } else if (window.innerWidth > 1600) {
149
+ var _props$gridColumns3;
150
+ var _column3 = props.gridColumn && props.gridColumn < 4 ? props.gridColumn : 4;
151
+ column.value = (_props$gridColumns3 = props.gridColumns) !== null && _props$gridColumns3 !== void 0 && _props$gridColumns3[2] ? props.gridColumns[2] : _column3;
152
+ }
153
+ };
154
+ var handleSearch = /*#__PURE__*/function () {
155
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_params) {
156
+ var _props$defaultParams, resp, _resp$result, _resp$result2, _resp$result3, _resp$result4, _resp$result4$data, _resp$result5, _resp$result6, _resp$result7, _resp$result8;
157
+ return _regenerator.default.wrap(function _callee$(_context) {
158
+ while (1) switch (_context.prev = _context.next) {
159
+ case 0:
160
+ _loading.value = props.loading !== undefined ? props.loading : true;
161
+ if (!props.request) {
162
+ _context.next = 9;
163
+ break;
164
+ }
165
+ console.log(_params);
166
+ _context.next = 5;
167
+ return props.request((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
168
+ pageIndex: 0,
169
+ pageSize: Number(pageSize.value)
170
+ }, props.defaultParams), _params), {}, {
171
+ terms: [].concat((0, _toConsumableArray2.default)(((_props$defaultParams = props.defaultParams) === null || _props$defaultParams === void 0 ? void 0 : _props$defaultParams.terms) || []), (0, _toConsumableArray2.default)((_params === null || _params === void 0 ? void 0 : _params.terms) || []))
172
+ })).catch(function () {
173
+ _loading.value = props.loading !== undefined ? props.loading : false;
174
+ });
175
+ case 5:
176
+ resp = _context.sent;
177
+ if (resp.status === 200) {
178
+ if (props.type === 'PAGE') {
179
+ // 判断如果是最后一页且最后一页为空,就跳转到前一页
180
+ if (resp !== null && resp !== void 0 && (_resp$result = resp.result) !== null && _resp$result !== void 0 && _resp$result.total && resp !== null && resp !== void 0 && (_resp$result2 = resp.result) !== null && _resp$result2 !== void 0 && _resp$result2.pageSize && resp !== null && resp !== void 0 && (_resp$result3 = resp.result) !== null && _resp$result3 !== void 0 && _resp$result3.pageIndex && (resp === null || resp === void 0 ? void 0 : (_resp$result4 = resp.result) === null || _resp$result4 === void 0 ? void 0 : (_resp$result4$data = _resp$result4.data) === null || _resp$result4$data === void 0 ? void 0 : _resp$result4$data.length) === 0) {
181
+ pageIndex.value = pageIndex.value > 0 ? pageIndex.value - 1 : 0;
182
+ handleSearch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _params), {}, {
183
+ pageSize: pageSize.value,
184
+ pageIndex: pageIndex.value
185
+ }));
186
+ } else {
187
+ _dataSource.value = (resp === null || resp === void 0 ? void 0 : (_resp$result5 = resp.result) === null || _resp$result5 === void 0 ? void 0 : _resp$result5.data) || [];
188
+ pageIndex.value = (resp === null || resp === void 0 ? void 0 : (_resp$result6 = resp.result) === null || _resp$result6 === void 0 ? void 0 : _resp$result6.pageIndex) || 0;
189
+ pageSize.value = (resp === null || resp === void 0 ? void 0 : (_resp$result7 = resp.result) === null || _resp$result7 === void 0 ? void 0 : _resp$result7.pageSize) || 12;
190
+ total.value = (resp === null || resp === void 0 ? void 0 : (_resp$result8 = resp.result) === null || _resp$result8 === void 0 ? void 0 : _resp$result8.total) || 0;
191
+ }
192
+ } else {
193
+ _dataSource.value = (resp === null || resp === void 0 ? void 0 : resp.result) || [];
194
+ }
195
+ } else {
196
+ _dataSource.value = [];
197
+ }
198
+ _context.next = 10;
199
+ break;
200
+ case 9:
201
+ _dataSource.value = (props === null || props === void 0 ? void 0 : props.dataSource) || [];
202
+ case 10:
203
+ _loading.value = props.loading !== undefined ? props.loading : false;
204
+ case 11:
205
+ case "end":
206
+ return _context.stop();
207
+ }
208
+ }, _callee);
209
+ }));
210
+ return function handleSearch(_x) {
211
+ return _ref2.apply(this, arguments);
212
+ };
213
+ }();
214
+ var _debounceFn = (0, _lodashEs.debounce)(handleSearch, 300);
215
+ (0, _vue.watch)(function () {
216
+ return props.params;
217
+ }, function (newValue) {
218
+ _debounceFn(newValue || {});
219
+ }, {
220
+ deep: true,
221
+ immediate: true
222
+ });
223
+ (0, _vue.watch)(function () {
224
+ return props.dataSource;
225
+ }, function (newVal) {
226
+ if (newVal && !props.request) {
227
+ handleSearch(props.params);
228
+ }
229
+ }, {
230
+ deep: true,
231
+ immediate: true
232
+ });
233
+ (0, _vue.watch)(function () {
234
+ return props.modelValue;
235
+ }, function () {
236
+ if (props.modelValue) {
237
+ _model.value = props.modelValue;
238
+ }
239
+ }, {
240
+ immediate: true
241
+ });
242
+ /**
243
+ * 刷新数据
244
+ * @param _params
245
+ */
246
+ var reload = function reload(_params) {
247
+ handleSearch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props.params), _params), {}, {
248
+ pageSize: pageSize.value || 12,
249
+ pageIndex: pageIndex.value || 0
250
+ }));
251
+ };
252
+ (0, _vue.onMounted)(function () {
253
+ windowChange(); // 初始化
254
+ window.onresize = function () {
255
+ windowChange();
256
+ };
257
+ });
258
+ (0, _vue.onUnmounted)(function () {
259
+ window.onresize = null;
260
+ });
261
+ /**
262
+ * 导出方法
263
+ */
264
+ expose({
265
+ reload: reload,
266
+ _dataSource: _dataSource
267
+ });
268
+ return function () {
269
+ var _props$rowSelection, _props$rowSelection$s, _props$rowSelection2, _props$rowSelection2$;
270
+ return (0, _vue.createVNode)("div", {
271
+ "class": "jtable-body-spin",
272
+ "style": (0, _objectSpread2.default)({}, props.bodyStyle)
273
+ }, [(0, _vue.createVNode)(_antDesignVue.Spin, {
274
+ "spinning": _loading.value
275
+ }, {
276
+ default: function _default() {
277
+ return [(0, _vue.createVNode)("div", {
278
+ "class": 'jtable-body'
279
+ }, [(0, _vue.createVNode)("div", {
280
+ "class": 'jtable-body-header'
281
+ }, [(0, _vue.createVNode)("div", {
282
+ "class": 'jtable-body-header-left'
283
+ }, [slots.headerTitle && slots.headerTitle()]), (0, _vue.createVNode)("div", {
284
+ "class": 'jtable-body-header-right'
285
+ }, [slots.rightExtraRender && slots.rightExtraRender(), !props.model && (0, _vue.createVNode)("div", {
286
+ "class": 'jtable-body-header-right-button'
287
+ }, [(0, _vue.createVNode)(_antDesignVue.RadioGroup, {
288
+ "class": "jtable-body-header-right-button",
289
+ "value": _model.value,
290
+ "onChange": function onChange(e) {
291
+ _model.value = e.target.value;
292
+ emit('update:modelValue', e.target.value);
293
+ emit('modelChange', e.target.value);
294
+ }
295
+ }, {
296
+ default: function _default() {
297
+ return [(0, _vue.createVNode)(_antDesignVue.RadioButton, {
298
+ "value": _proTableTypes.ModelEnum.TABLE
299
+ }, {
300
+ default: function _default() {
301
+ return [(0, _vue.createVNode)(_index.AIcon, {
302
+ "class": 'right-button-icon',
303
+ "type": "UnorderedListOutlined"
304
+ }, null)];
305
+ }
306
+ }), (0, _vue.createVNode)(_antDesignVue.RadioButton, {
307
+ "value": _proTableTypes.ModelEnum.CARD
308
+ }, {
309
+ default: function _default() {
310
+ return [(0, _vue.createVNode)(_index.AIcon, {
311
+ "class": 'right-button-icon',
312
+ "type": "AppstoreOutlined"
313
+ }, null)];
314
+ }
315
+ })];
316
+ }
317
+ })])])]), (0, _vue.createVNode)("div", {
318
+ "class": 'jtable-content'
319
+ }, [props.alertRender && props !== null && props !== void 0 && props.rowSelection && props !== null && props !== void 0 && (_props$rowSelection = props.rowSelection) !== null && _props$rowSelection !== void 0 && _props$rowSelection.selectedRowKeys && (_props$rowSelection$s = props.rowSelection.selectedRowKeys) !== null && _props$rowSelection$s !== void 0 && _props$rowSelection$s.length ? (0, _vue.createVNode)("div", {
320
+ "class": 'jtable-alert'
321
+ }, [(0, _vue.createVNode)(_antDesignVue.Alert, {
322
+ "message": '已选择' + (props === null || props === void 0 ? void 0 : (_props$rowSelection2 = props.rowSelection) === null || _props$rowSelection2 === void 0 ? void 0 : (_props$rowSelection2$ = _props$rowSelection2.selectedRowKeys) === null || _props$rowSelection2$ === void 0 ? void 0 : _props$rowSelection2$.length) + '项',
323
+ "type": "info",
324
+ "onClose": function onClose() {
325
+ var _props$rowSelection3, _props$rowSelection3$, _props$rowSelection4, _props$rowSelection4$;
326
+ // if (props.rowSelection?.onSelectNone) {
327
+ // // 取消选择清空被选数据
328
+ // }
329
+ (_props$rowSelection3 = props.rowSelection) === null || _props$rowSelection3 === void 0 ? void 0 : (_props$rowSelection3$ = _props$rowSelection3.onChange) === null || _props$rowSelection3$ === void 0 ? void 0 : _props$rowSelection3$.call(_props$rowSelection3, [], []);
330
+ (_props$rowSelection4 = props.rowSelection) === null || _props$rowSelection4 === void 0 ? void 0 : (_props$rowSelection4$ = _props$rowSelection4.onSelectNone) === null || _props$rowSelection4$ === void 0 ? void 0 : _props$rowSelection4$.call(_props$rowSelection4);
331
+ },
332
+ "closeText": (0, _vue.createVNode)(_antDesignVue.Button, {
333
+ "type": "link"
334
+ }, {
335
+ default: function _default() {
336
+ return [(0, _vue.createTextVNode)("\u53D6\u6D88\u9009\u62E9")];
337
+ }
338
+ })
339
+ }, null)]) : null, _model.value === _proTableTypes.ModelEnum.CARD ? (0, _vue.createVNode)("div", {
340
+ "class": 'jtable-card',
341
+ "style": props.scroll && props.scroll.y ? {
342
+ maxHeight: props.scroll.y + 'px',
343
+ overflow: 'auto'
344
+ } : undefined
345
+ }, [_dataSource.value.length ? (0, _vue.createVNode)("div", {
346
+ "class": 'jtable-card-items',
347
+ "style": {
348
+ gridTemplateColumns: "repeat(".concat(column.value, ", 1fr)")
349
+ }
350
+ }, [_dataSource.value.map(function (item) {
351
+ return slots.card ? (0, _vue.createVNode)("div", {
352
+ "class": ['jtable-card-item', props.cardBodyClass]
353
+ }, [slots.card(item)]) : null;
354
+ })]) : (0, _vue.createVNode)("div", {
355
+ "class": "j-table-empty"
356
+ }, [(0, _vue.createVNode)(_index.Empty, null, null)])]) : (0, _vue.createVNode)("div", null, [(0, _vue.createVNode)(_antDesignVue.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
357
+ "dataSource": _dataSource.value,
358
+ "columns": props.columns.filter(function (i) {
359
+ return !(i !== null && i !== void 0 && i.hideInTable);
360
+ }),
361
+ "pagination": false,
362
+ "rowSelection": props.rowSelection,
363
+ "scroll": props.scroll
364
+ }), {
365
+ headerCell: function headerCell(dt) {
366
+ var column = dt.column,
367
+ title = dt.title;
368
+ if (column !== null && column !== void 0 && column.headerCell) {
369
+ return slots === null || slots === void 0 ? void 0 : slots[column === null || column === void 0 ? void 0 : column.headerCell](column.title);
370
+ } else {
371
+ return title || '';
372
+ }
373
+ },
374
+ bodyCell: function bodyCell(dt) {
375
+ var column = dt.column,
376
+ record = dt.record;
377
+ if ((column !== null && column !== void 0 && column.key || column !== null && column !== void 0 && column.dataIndex) && column !== null && column !== void 0 && column.scopedSlots && (slots !== null && slots !== void 0 && slots[column === null || column === void 0 ? void 0 : column.dataIndex] || slots !== null && slots !== void 0 && slots[column === null || column === void 0 ? void 0 : column.key])) {
378
+ var _key = (column === null || column === void 0 ? void 0 : column.key) || (column === null || column === void 0 ? void 0 : column.dataIndex);
379
+ return slots === null || slots === void 0 ? void 0 : slots[_key](record);
380
+ } else {
381
+ var _value = (0, _lodashEs.get)(record, column === null || column === void 0 ? void 0 : column.dataIndex);
382
+ // 获取数据
383
+ return _value;
384
+ }
385
+ },
386
+ emptyText: function emptyText() {
387
+ return (0, _vue.createVNode)(_index.Empty, null, null);
388
+ }
389
+ })])]), !!_dataSource.value.length && !props.noPagination && props.type === 'PAGE' && (0, _vue.createVNode)("div", {
390
+ "class": 'jtable-pagination'
391
+ }, [slots !== null && slots !== void 0 && slots.paginationRender ? slots.paginationRender() : (0, _vue.createVNode)(_antDesignVue.Pagination, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props.pagination), {}, {
392
+ "total": total.value,
393
+ "current": pageIndex.value + 1,
394
+ "pageSize": pageSize.value,
395
+ "showTotal": function showTotal(num) {
396
+ var minSize = pageIndex.value * pageSize.value + 1;
397
+ var MaxSize = (pageIndex.value + 1) * pageSize.value;
398
+ return "\u7B2C ".concat(minSize, " - ").concat(MaxSize > num ? num : MaxSize, " \u6761/\u603B\u5171 ").concat(num, " \u6761");
399
+ },
400
+ "onChange": function onChange(page, size) {
401
+ handleSearch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props.params), {}, {
402
+ pageSize: size,
403
+ pageIndex: pageSize.value === size ? page ? page - 1 : 0 : 0
404
+ }));
405
+ }
406
+ }), null)])])];
407
+ }
408
+ })]);
409
+ };
410
+ }
411
+ });
412
+ var _default2 = exports.default = ProTable;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TypeEnum = exports.ModelEnum = void 0;
7
+ require("vue");
8
+ var TypeEnum;
9
+ (function (TypeEnum) {
10
+ TypeEnum["TREE"] = "TREE";
11
+ TypeEnum["PAGE"] = "PAGE";
12
+ })(TypeEnum || (exports.TypeEnum = TypeEnum = {}));
13
+ var ModelEnum;
14
+ (function (ModelEnum) {
15
+ ModelEnum["TABLE"] = "TABLE";
16
+ ModelEnum["CARD"] = "CARD";
17
+ })(ModelEnum || (exports.ModelEnum = ModelEnum = {}));
@@ -0,0 +1,65 @@
1
+ .jtable-body-spin {
2
+ min-height: 100%;
3
+ width: 100%;
4
+ padding: 16px 24px 24px;
5
+ background-color: #fff;
6
+ }
7
+ .jtable-body-spin .ant-spin-nested-loading {
8
+ height: 100%;
9
+ }
10
+ .jtable-body-spin .ant-spin-nested-loading .ant-spin-container {
11
+ height: 100%;
12
+ }
13
+ .jtable-body-spin .jtable-body {
14
+ width: 100%;
15
+ box-sizing: border-box;
16
+ height: 100%;
17
+ display: flex;
18
+ flex-direction: column;
19
+ }
20
+ .jtable-body-spin .jtable-body .jtable-body-header {
21
+ display: flex;
22
+ justify-content: space-between;
23
+ align-items: center;
24
+ }
25
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right {
26
+ display: flex;
27
+ gap: 8px;
28
+ align-items: center;
29
+ }
30
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right .jtable-body-header-right-button .right-button-icon {
31
+ font-size: 16px;
32
+ color: #d9d9d9;
33
+ }
34
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right .jtable-body-header-right-button .ant-radio-button-wrapper {
35
+ padding: 0 8px;
36
+ }
37
+ .jtable-body-spin .jtable-body .jtable-body-header .jtable-body-header-right .jtable-body-header-right-button .ant-radio-button-wrapper-checked .right-button-icon {
38
+ color: #315EFB;
39
+ }
40
+ .jtable-body-spin .jtable-body .jtable-content {
41
+ flex: 1;
42
+ padding: 16px 0;
43
+ }
44
+ .jtable-body-spin .jtable-body .jtable-content .jtable-alert {
45
+ margin-bottom: 16px;
46
+ }
47
+ .jtable-body-spin .jtable-body .jtable-content .jtable-card .jtable-card-items {
48
+ display: grid;
49
+ grid-gap: 26px;
50
+ }
51
+ .jtable-body-spin .jtable-body .jtable-content .jtable-card .jtable-card-items .jtable-card-item {
52
+ display: flex;
53
+ min-width: 0;
54
+ }
55
+ .jtable-body-spin .jtable-body .jtable-pagination {
56
+ width: 100%;
57
+ display: flex;
58
+ justify-content: flex-end;
59
+ }
60
+ .jtable-body-spin .jtable-body .j-table-empty {
61
+ display: flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ margin: 10% 0;
65
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ require("./index.less");
@@ -0,0 +1,92 @@
1
+ @import '../../style/variable.less';
2
+ //@import 'ant-design-vue/es/style/themes/variable.less';
3
+
4
+ .jtable-body-spin {
5
+ min-height: 100%;
6
+ width: 100%;
7
+ padding: 16px 24px 24px;
8
+ background-color: #fff;
9
+
10
+ .ant-spin-nested-loading {
11
+ height: 100%;
12
+ .ant-spin-container {
13
+ height: 100%;
14
+ }
15
+ }
16
+
17
+ .jtable-body {
18
+ width: 100%;
19
+ box-sizing: border-box;
20
+ height: 100%;
21
+ display: flex;
22
+ flex-direction: column;
23
+
24
+ .jtable-body-header {
25
+ display: flex;
26
+ justify-content: space-between;
27
+ align-items: center;
28
+
29
+ .jtable-body-header-right {
30
+ display: flex;
31
+ gap: 8px;
32
+ align-items: center;
33
+
34
+ .jtable-body-header-right-button {
35
+ .right-button-icon {
36
+ font-size: 16px;
37
+ color: #d9d9d9;
38
+ }
39
+
40
+ .ant-radio-button-wrapper {
41
+ padding: 0 8px;
42
+ }
43
+
44
+ .ant-radio-button-wrapper-checked {
45
+ .right-button-icon {
46
+ color: @primary-color;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ .jtable-content {
54
+ flex: 1;
55
+ padding: 16px 0;
56
+
57
+ .jtable-alert {
58
+ margin-bottom: 16px;
59
+ }
60
+
61
+ .jtable-card {
62
+ .jtable-card-items {
63
+ display: grid;
64
+ grid-gap: 26px;
65
+
66
+ .jtable-card-item {
67
+ display: flex;
68
+ min-width: 0;
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ .jtable-pagination {
75
+ // position: absolute;
76
+ // background-color: white;
77
+ // padding: 10px 0;
78
+ // right: 0;
79
+ // bottom: 0;
80
+ width: 100%;
81
+ display: flex;
82
+ justify-content: flex-end;
83
+ }
84
+
85
+ .j-table-empty {
86
+ display: flex;
87
+ justify-content: center;
88
+ align-items: center;
89
+ margin: 10% 0;
90
+ }
91
+ }
92
+ }