@jetlinks-web/components 2.0.31 → 2.0.33

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 (44) hide show
  1. package/es/FullPage/FullPage.js +1 -1
  2. package/es/ProLayout/Basic/BasicLayout.js +2 -0
  3. package/es/ProLayout/Basic/Header.js +1 -0
  4. package/es/ProLayout/TopHeader/index.js +8 -1
  5. package/es/ProTable/Alert.js +73 -0
  6. package/es/ProTable/Content.js +122 -0
  7. package/es/ProTable/Header.js +73 -0
  8. package/es/ProTable/Pagination.js +46 -0
  9. package/es/ProTable/ProTable.js +310 -0
  10. package/es/ProTable/index.js +1 -410
  11. package/es/ProTable/setting.js +119 -0
  12. package/es/ProTable/style/ProTable.less +83 -0
  13. package/es/ProTable/style/index.js +1 -1
  14. package/es/Search/Advanced/SaveHistory.js +1 -1
  15. package/es/Search/Item.js +1 -1
  16. package/es/Search/Search.js +1 -1
  17. package/es/style/index.css +20 -20
  18. package/es/style/index.less +7 -7
  19. package/lib/FullPage/FullPage.js +1 -1
  20. package/lib/ProLayout/Basic/BasicLayout.js +2 -0
  21. package/lib/ProLayout/Basic/Header.js +1 -0
  22. package/lib/ProLayout/TopHeader/index.js +8 -1
  23. package/lib/ProTable/Alert.js +73 -0
  24. package/lib/ProTable/Content.js +122 -0
  25. package/lib/ProTable/Header.js +73 -0
  26. package/lib/ProTable/Pagination.js +46 -0
  27. package/lib/ProTable/ProTable.js +310 -0
  28. package/lib/ProTable/index.js +4 -412
  29. package/lib/ProTable/setting.js +126 -0
  30. package/lib/ProTable/style/ProTable.less +83 -0
  31. package/lib/ProTable/style/index.js +1 -1
  32. package/lib/Search/Advanced/SaveHistory.js +1 -1
  33. package/lib/Search/Item.js +1 -1
  34. package/lib/Search/Search.js +1 -1
  35. package/lib/style/components.less +0 -1
  36. package/lib/style/index.css +20 -20
  37. package/lib/style/index.less +7 -7
  38. package/package.json +2 -2
  39. package/es/ProTable/proTableTypes.js +0 -11
  40. package/es/ProTable/style/index.css +0 -69
  41. package/es/ProTable/style/index.less +0 -92
  42. package/lib/ProTable/proTableTypes.js +0 -17
  43. package/lib/ProTable/style/index.css +0 -69
  44. package/lib/ProTable/style/index.less +0 -92
@@ -1,420 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
- var _vue = require("vue");
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
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
19
- function _isSlot(s) {
20
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !(0, _vue.isVNode)(s);
21
- }
22
- var tableProps = function tableProps() {
23
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _table.tableProps)()), {}, {
24
- loading: {
25
- type: Boolean,
26
- default: undefined
27
- },
28
- request: {
29
- type: Function,
30
- default: undefined
31
- },
32
- cardBodyClass: {
33
- type: String,
34
- default: ''
35
- },
36
- bodyStyle: {
37
- type: Object,
38
- default: {}
39
- },
40
- columns: {
41
- type: Array,
42
- default: function _default() {
43
- return [];
44
- }
45
- },
46
- model: {
47
- type: [String, undefined],
48
- default: undefined
49
- },
50
- modelValue: {
51
- type: String,
52
- default: undefined
53
- },
54
- noPagination: {
55
- type: Boolean,
56
- default: false
57
- },
58
- rowSelection: {
59
- type: Object,
60
- default: function _default() {
61
- return undefined;
62
- }
63
- },
64
- dataSource: {
65
- type: Array,
66
- default: function _default() {
67
- return [];
68
- }
69
- },
70
- gridColumns: {
71
- type: Array,
72
- default: function _default() {
73
- return [];
74
- }
75
- },
76
- gridColumn: {
77
- type: Number,
78
- default: 4
79
- },
80
- alertRender: {
81
- type: Boolean,
82
- default: true
83
- },
84
- params: {
85
- type: Object,
86
- default: function _default() {}
87
- },
88
- type: {
89
- type: String,
90
- default: 'PAGE'
91
- },
92
- scroll: {
93
- type: Object,
94
- default: function _default() {
95
- x: 1366;
96
- }
97
- },
98
- defaultParams: {
99
- type: Object,
100
- default: function _default() {}
101
- },
102
- rowKey: {
103
- type: [String, Function],
104
- default: 'id'
105
- },
106
- pagination: {
107
- type: Object,
108
- default: function _default() {
109
- return {
110
- showSizeChanger: true,
111
- showQuickJumper: false,
112
- size: 'size',
113
- pageSizeOptions: ['12', '24', '48', '96']
114
- };
115
- }
116
- }
117
- });
8
+ var _ProTable = _interopRequireDefault(require("./ProTable.js"));
9
+ _ProTable.default.install = function (app) {
10
+ app.component(_ProTable.default.name, _ProTable.default);
118
11
  };
119
- var ProTable = (0, _vue.defineComponent)({
120
- name: 'JProTable',
121
- slots: ['headerTitle', 'card', 'rightExtraRender', 'paginationRender' // 分页
122
- ],
123
- props: tableProps(),
124
- emits: ['update:modelValue', 'modelChange'],
125
- setup: function setup(props, _ref) {
126
- var _props$pagination;
127
- var slots = _ref.slots,
128
- expose = _ref.expose,
129
- emit = _ref.emit;
130
- var _model = (0, _vue.ref)(props.model ? props.model : _proTableTypes.ModelEnum.CARD); // 模式切换
131
- var _dataSource = (0, _vue.ref)([]);
132
- var pageIndex = (0, _vue.ref)(0);
133
- var pageSize = (0, _vue.ref)(12);
134
- var total = (0, _vue.ref)(0);
135
- var _loading = (0, _vue.ref)(false);
136
- var column = (0, _vue.ref)(props.gridColumn || 4);
137
- if (!props.noPagination && props.pagination && (0, _lodashEs.isArray)((_props$pagination = props.pagination) === null || _props$pagination === void 0 ? void 0 : _props$pagination.pageSizeOptions)) {
138
- pageSize.value = props.pagination.pageSizeOptions[0];
139
- }
140
- /**
141
- * 监听宽度,计算显示卡片个数
142
- */
143
- var windowChange = function windowChange() {
144
- if (window.innerWidth <= 1440) {
145
- var _props$gridColumns;
146
- var _column = props.gridColumn && props.gridColumn < 2 ? props.gridColumn : 2;
147
- column.value = ((_props$gridColumns = props.gridColumns) === null || _props$gridColumns === void 0 ? void 0 : _props$gridColumns[0]) ? props.gridColumns[0] : _column;
148
- } else if (window.innerWidth > 1440 && window.innerWidth <= 1600) {
149
- var _props$gridColumns2;
150
- var _column2 = props.gridColumn && props.gridColumn < 3 ? props.gridColumn : 3;
151
- column.value = ((_props$gridColumns2 = props.gridColumns) === null || _props$gridColumns2 === void 0 ? void 0 : _props$gridColumns2[1]) ? props.gridColumns[1] : _column2;
152
- } else if (window.innerWidth > 1600) {
153
- var _props$gridColumns3;
154
- var _column3 = props.gridColumn && props.gridColumn < 4 ? props.gridColumn : 4;
155
- column.value = ((_props$gridColumns3 = props.gridColumns) === null || _props$gridColumns3 === void 0 ? void 0 : _props$gridColumns3[2]) ? props.gridColumns[2] : _column3;
156
- }
157
- };
158
- var handleSearch = /*#__PURE__*/function () {
159
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_params) {
160
- var _props$defaultParams, resp, _resp$result, _resp$result2, _resp$result3, _resp$result4, _resp$result4$data, _resp$result5, _resp$result6, _resp$result7, _resp$result8;
161
- return _regeneratorRuntime().wrap(function _callee$(_context) {
162
- while (1) switch (_context.prev = _context.next) {
163
- case 0:
164
- _loading.value = props.loading !== undefined ? props.loading : true;
165
- if (!props.request) {
166
- _context.next = 9;
167
- break;
168
- }
169
- console.log(_params);
170
- _context.next = 5;
171
- return props.request((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
172
- pageIndex: 0,
173
- pageSize: Number(pageSize.value)
174
- }, props.defaultParams), _params), {}, {
175
- 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) || []))
176
- })).catch(function () {
177
- _loading.value = props.loading !== undefined ? props.loading : false;
178
- });
179
- case 5:
180
- resp = _context.sent;
181
- if (resp.status === 200) {
182
- if (props.type === 'PAGE') {
183
- // 判断如果是最后一页且最后一页为空,就跳转到前一页
184
- if ((resp === null || resp === void 0 ? void 0 : (_resp$result = resp.result) === null || _resp$result === void 0 ? void 0 : _resp$result.total) && (resp === null || resp === void 0 ? void 0 : (_resp$result2 = resp.result) === null || _resp$result2 === void 0 ? void 0 : _resp$result2.pageSize) && (resp === null || resp === void 0 ? void 0 : (_resp$result3 = resp.result) === null || _resp$result3 === void 0 ? 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) {
185
- pageIndex.value = pageIndex.value > 0 ? pageIndex.value - 1 : 0;
186
- handleSearch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _params), {}, {
187
- pageSize: pageSize.value,
188
- pageIndex: pageIndex.value
189
- }));
190
- } else {
191
- _dataSource.value = (resp === null || resp === void 0 ? void 0 : (_resp$result5 = resp.result) === null || _resp$result5 === void 0 ? void 0 : _resp$result5.data) || [];
192
- pageIndex.value = (resp === null || resp === void 0 ? void 0 : (_resp$result6 = resp.result) === null || _resp$result6 === void 0 ? void 0 : _resp$result6.pageIndex) || 0;
193
- pageSize.value = (resp === null || resp === void 0 ? void 0 : (_resp$result7 = resp.result) === null || _resp$result7 === void 0 ? void 0 : _resp$result7.pageSize) || 12;
194
- total.value = (resp === null || resp === void 0 ? void 0 : (_resp$result8 = resp.result) === null || _resp$result8 === void 0 ? void 0 : _resp$result8.total) || 0;
195
- }
196
- } else {
197
- _dataSource.value = (resp === null || resp === void 0 ? void 0 : resp.result) || [];
198
- }
199
- } else {
200
- _dataSource.value = [];
201
- }
202
- _context.next = 10;
203
- break;
204
- case 9:
205
- _dataSource.value = (props === null || props === void 0 ? void 0 : props.dataSource) || [];
206
- case 10:
207
- _loading.value = props.loading !== undefined ? props.loading : false;
208
- case 11:
209
- case "end":
210
- return _context.stop();
211
- }
212
- }, _callee);
213
- }));
214
- return function handleSearch(_x) {
215
- return _ref2.apply(this, arguments);
216
- };
217
- }();
218
- var _debounceFn = (0, _lodashEs.debounce)(handleSearch, 300);
219
- (0, _vue.watch)(function () {
220
- return props.params;
221
- }, function (newValue) {
222
- _debounceFn(newValue || {});
223
- }, {
224
- deep: true,
225
- immediate: true
226
- });
227
- (0, _vue.watch)(function () {
228
- return props.dataSource;
229
- }, function (newVal) {
230
- if (newVal && !props.request) {
231
- handleSearch(props.params);
232
- }
233
- }, {
234
- deep: true,
235
- immediate: true
236
- });
237
- (0, _vue.watch)(function () {
238
- return props.modelValue;
239
- }, function () {
240
- if (props.modelValue) {
241
- _model.value = props.modelValue;
242
- }
243
- }, {
244
- immediate: true
245
- });
246
- /**
247
- * 刷新数据
248
- * @param _params
249
- */
250
- var reload = function reload(_params) {
251
- handleSearch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props.params), _params), {}, {
252
- pageSize: pageSize.value || 12,
253
- pageIndex: pageIndex.value || 0
254
- }));
255
- };
256
- (0, _vue.onMounted)(function () {
257
- windowChange(); // 初始化
258
- window.onresize = function () {
259
- windowChange();
260
- };
261
- });
262
- (0, _vue.onUnmounted)(function () {
263
- window.onresize = null;
264
- });
265
- /**
266
- * 导出方法
267
- */
268
- expose({
269
- reload: reload,
270
- _dataSource: _dataSource
271
- });
272
- return function () {
273
- var _props$rowSelection, _props$rowSelection$s, _props$rowSelection2, _props$rowSelection2$;
274
- var _slot, _slot2, _slot3;
275
- return (0, _vue.createVNode)("div", {
276
- "class": "jtable-body-spin",
277
- "style": (0, _objectSpread2.default)({}, props.bodyStyle)
278
- }, [(0, _vue.createVNode)(_antDesignVue.Spin, {
279
- "spinning": _loading.value
280
- }, _isSlot(_slot3 = (0, _vue.createVNode)("div", {
281
- "class": 'jtable-body'
282
- }, [(0, _vue.createVNode)("div", {
283
- "class": 'jtable-body-header'
284
- }, [(0, _vue.createVNode)("div", {
285
- "class": 'jtable-body-header-left'
286
- }, [slots.headerTitle && slots.headerTitle()]), (0, _vue.createVNode)("div", {
287
- "class": 'jtable-body-header-right'
288
- }, [slots.rightExtraRender && slots.rightExtraRender(), !props.model && (0, _vue.createVNode)("div", {
289
- "class": 'jtable-body-header-right-button'
290
- }, [(0, _vue.createVNode)(_antDesignVue.RadioGroup, {
291
- "class": "jtable-body-header-right-button",
292
- "value": _model.value,
293
- "onChange": function onChange(e) {
294
- _model.value = e.target.value;
295
- emit('update:modelValue', e.target.value);
296
- emit('modelChange', e.target.value);
297
- }
298
- }, {
299
- default: function _default() {
300
- return [(0, _vue.createVNode)(_antDesignVue.RadioButton, {
301
- "value": _proTableTypes.ModelEnum.TABLE
302
- }, _isSlot(_slot = (0, _vue.createVNode)(_index.AIcon, {
303
- "class": 'right-button-icon',
304
- "type": "UnorderedListOutlined"
305
- }, null)) ? _slot : {
306
- default: function _default() {
307
- return [_slot];
308
- }
309
- }), (0, _vue.createVNode)(_antDesignVue.RadioButton, {
310
- "value": _proTableTypes.ModelEnum.CARD
311
- }, _isSlot(_slot2 = (0, _vue.createVNode)(_index.AIcon, {
312
- "class": 'right-button-icon',
313
- "type": "AppstoreOutlined"
314
- }, null)) ? _slot2 : {
315
- default: function _default() {
316
- return [_slot2];
317
- }
318
- })];
319
- }
320
- })])])]), (0, _vue.createVNode)("div", {
321
- "class": 'jtable-content'
322
- }, [props.alertRender && (props === null || props === void 0 ? void 0 : props.rowSelection) && (props === null || props === void 0 ? void 0 : (_props$rowSelection = props.rowSelection) === null || _props$rowSelection === void 0 ? void 0 : _props$rowSelection.selectedRowKeys) && ((_props$rowSelection$s = props.rowSelection.selectedRowKeys) === null || _props$rowSelection$s === void 0 ? void 0 : _props$rowSelection$s.length) ? (0, _vue.createVNode)("div", {
323
- "class": 'jtable-alert'
324
- }, [(0, _vue.createVNode)(_antDesignVue.Alert, {
325
- "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) + '项',
326
- "type": "info",
327
- "onClose": function onClose() {
328
- var _props$rowSelection3, _props$rowSelection3$, _props$rowSelection4, _props$rowSelection4$;
329
- // if (props.rowSelection?.onSelectNone) {
330
- // // 取消选择清空被选数据
331
- // }
332
- (_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, [], []);
333
- (_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);
334
- },
335
- "closeText": (0, _vue.createVNode)(_antDesignVue.Button, {
336
- "type": "link"
337
- }, {
338
- default: function _default() {
339
- return [(0, _vue.createTextVNode)("\u53D6\u6D88\u9009\u62E9")];
340
- }
341
- })
342
- }, null)]) : null, _model.value === _proTableTypes.ModelEnum.CARD ? (0, _vue.createVNode)("div", {
343
- "class": 'jtable-card',
344
- "style": props.scroll && props.scroll.y ? {
345
- maxHeight: props.scroll.y + 'px',
346
- overflow: 'auto'
347
- } : undefined
348
- }, [_dataSource.value.length ? (0, _vue.createVNode)("div", {
349
- "class": 'jtable-card-items',
350
- "style": {
351
- gridTemplateColumns: "repeat(".concat(column.value, ", 1fr)")
352
- }
353
- }, [_dataSource.value.map(function (item) {
354
- return slots.card ? (0, _vue.createVNode)("div", {
355
- "class": ['jtable-card-item', props.cardBodyClass]
356
- }, [slots.card(item)]) : null;
357
- })]) : (0, _vue.createVNode)("div", {
358
- "class": "j-table-empty"
359
- }, [(0, _vue.createVNode)(_index.Empty, null, null)])]) : (0, _vue.createVNode)("div", null, [(0, _vue.createVNode)(_antDesignVue.Table, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
360
- "dataSource": _dataSource.value,
361
- "columns": props.columns.filter(function (i) {
362
- return !(i === null || i === void 0 ? void 0 : i.hideInTable);
363
- }),
364
- "pagination": false,
365
- "rowSelection": props.rowSelection,
366
- "scroll": props.scroll
367
- }), {
368
- headerCell: function headerCell(dt) {
369
- var column = dt.column,
370
- title = dt.title;
371
- if (column === null || column === void 0 ? void 0 : column.headerCell) {
372
- return slots === null || slots === void 0 ? void 0 : slots[column === null || column === void 0 ? void 0 : column.headerCell](column.title);
373
- } else {
374
- return title || '';
375
- }
376
- },
377
- bodyCell: function bodyCell(dt) {
378
- var column = dt.column,
379
- record = dt.record;
380
- if (((column === null || column === void 0 ? void 0 : column.key) || (column === null || column === void 0 ? void 0 : column.dataIndex)) && (column === null || column === void 0 ? void 0 : column.scopedSlots) && ((slots === null || slots === void 0 ? void 0 : slots[column === null || column === void 0 ? void 0 : column.dataIndex]) || (slots === null || slots === void 0 ? void 0 : slots[column === null || column === void 0 ? void 0 : column.key]))) {
381
- var _key = (column === null || column === void 0 ? void 0 : column.key) || (column === null || column === void 0 ? void 0 : column.dataIndex);
382
- return slots === null || slots === void 0 ? void 0 : slots[_key](record);
383
- } else {
384
- var _value = (0, _lodashEs.get)(record, column === null || column === void 0 ? void 0 : column.dataIndex);
385
- // 获取数据
386
- return _value;
387
- }
388
- },
389
- emptyText: function emptyText() {
390
- return (0, _vue.createVNode)(_index.Empty, null, null);
391
- }
392
- })])]), !!_dataSource.value.length && !props.noPagination && props.type === 'PAGE' && (0, _vue.createVNode)("div", {
393
- "class": 'jtable-pagination'
394
- }, [(slots === null || slots === void 0 ? void 0 : slots.paginationRender) ? slots.paginationRender() : (0, _vue.createVNode)(_antDesignVue.Pagination, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props.pagination), {}, {
395
- "total": total.value,
396
- "current": pageIndex.value + 1,
397
- "pageSize": pageSize.value,
398
- "showTotal": function showTotal(num) {
399
- var minSize = pageIndex.value * pageSize.value + 1;
400
- var MaxSize = (pageIndex.value + 1) * pageSize.value;
401
- return "\u7B2C ".concat(minSize, " - ").concat(MaxSize > num ? num : MaxSize, " \u6761/\u603B\u5171 ").concat(num, " \u6761");
402
- },
403
- "onChange": function onChange(page, size) {
404
- handleSearch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, props.params), {}, {
405
- pageSize: size,
406
- pageIndex: pageSize.value === size ? page ? page - 1 : 0 : 0
407
- }));
408
- }
409
- }), null)])])) ? _slot3 : {
410
- default: function _default() {
411
- return [_slot3];
412
- }
413
- })]);
414
- };
415
- }
416
- });
417
- ProTable.install = function (app) {
418
- app.component(ProTable.name, ProTable);
419
- };
420
- var _default2 = exports.default = ProTable;
12
+ var _default = exports.default = _ProTable.default;
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.proTableProps = exports.paginationProps = exports._headerProps = exports._contentProps = exports._alertProps = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _Table = require("ant-design-vue/es/table/Table");
10
+ require("vue");
11
+ require("ant-design-vue/es/table");
12
+ var _headerProps = exports._headerProps = {
13
+ mode: {
14
+ type: [String, undefined],
15
+ default: undefined
16
+ },
17
+ modeValue: {
18
+ type: String,
19
+ default: 'TABLE'
20
+ }
21
+ };
22
+ var _alertProps = exports._alertProps = {
23
+ alertShow: {
24
+ type: Boolean,
25
+ default: true
26
+ },
27
+ rowSelection: {
28
+ type: Object,
29
+ default: function _default() {
30
+ return undefined;
31
+ }
32
+ }
33
+ };
34
+ var _contentProps = exports._contentProps = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _Table.tableProps)()), _headerProps), {}, {
35
+ cardBodyClass: {
36
+ type: String,
37
+ default: ''
38
+ },
39
+ columns: {
40
+ type: Array,
41
+ default: function _default() {
42
+ return [];
43
+ }
44
+ },
45
+ dataSource: {
46
+ type: Array,
47
+ default: undefined
48
+ },
49
+ gridColumns: {
50
+ type: Array,
51
+ default: function _default() {
52
+ return [1, 2, 3, 4];
53
+ }
54
+ },
55
+ scroll: {
56
+ type: Object,
57
+ default: function _default() {
58
+ return {
59
+ x: 1366
60
+ };
61
+ }
62
+ },
63
+ rowKey: {
64
+ type: [String, Function],
65
+ default: 'id'
66
+ }
67
+ });
68
+ var paginationProps = exports.paginationProps = {
69
+ total: {
70
+ type: Number,
71
+ default: 0
72
+ },
73
+ pageSize: {
74
+ type: Number,
75
+ default: 12
76
+ },
77
+ pageIndex: {
78
+ type: Number,
79
+ default: 0
80
+ }
81
+ };
82
+ var proTableProps = exports.proTableProps = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _contentProps), _alertProps), {}, {
83
+ bodyStyle: {
84
+ type: Object,
85
+ default: function _default() {
86
+ return {
87
+ padding: '16px 24px 24px'
88
+ };
89
+ }
90
+ },
91
+ request: {
92
+ type: Function,
93
+ default: undefined
94
+ },
95
+ params: {
96
+ type: Object,
97
+ default: function _default() {
98
+ return {};
99
+ }
100
+ },
101
+ type: {
102
+ type: String,
103
+ default: 'PAGE'
104
+ },
105
+ defaultParams: {
106
+ type: Object,
107
+ default: function _default() {
108
+ return {};
109
+ }
110
+ },
111
+ noPagination: {
112
+ type: Boolean,
113
+ default: false
114
+ },
115
+ pagination: {
116
+ type: Object,
117
+ default: function _default() {
118
+ return {
119
+ showSizeChanger: true,
120
+ showQuickJumper: false,
121
+ size: 'size',
122
+ pageSizeOptions: ['12', '24', '48', '96']
123
+ };
124
+ }
125
+ }
126
+ });
@@ -0,0 +1,83 @@
1
+ @import '../../style/variable.less';
2
+
3
+ .jtable-body-spin {
4
+ min-height: 100%;
5
+ width: 100%;
6
+ background-color: #fff;
7
+
8
+ .ant-spin-nested-loading {
9
+ height: 100%;
10
+
11
+ .ant-spin-container {
12
+ height: 100%;
13
+ }
14
+ }
15
+
16
+ .jtable-body {
17
+ width: 100%;
18
+ box-sizing: border-box;
19
+ height: 100%;
20
+ display: flex;
21
+ flex-direction: column;
22
+ }
23
+ }
24
+
25
+ .jtable-body-header {
26
+ display: flex;
27
+ justify-content: space-between;
28
+ align-items: center;
29
+ margin-bottom: 16px;
30
+ width: 100%;
31
+ gap: 8px;
32
+
33
+ .jtable-body-header-left {
34
+ flex: 1;
35
+ min-width: 0;
36
+ }
37
+
38
+ .jtable-body-header-right {
39
+ display: flex;
40
+ gap: 8px;
41
+ align-items: center;
42
+
43
+ .jtable-body-header-right-button {
44
+ width: 62px;
45
+
46
+ .right-button-icon {
47
+ font-size: 16px;
48
+ color: #d9d9d9;
49
+ }
50
+
51
+ .ant-radio-button-wrapper {
52
+ padding: 0 8px;
53
+ }
54
+
55
+ :deep(.ant-radio-button-wrapper-checked) {
56
+ color: @primary-color;
57
+ }
58
+ }
59
+ }
60
+ }
61
+
62
+ .jtable-alert {
63
+ margin-bottom: 16px;
64
+ }
65
+
66
+ .jtable-card {
67
+ .jtable-card-items {
68
+ display: grid;
69
+ grid-gap: 26px;
70
+
71
+ .jtable-card-item {
72
+ display: flex;
73
+ min-width: 0;
74
+ }
75
+ }
76
+ }
77
+
78
+ .jtable-pagination {
79
+ width: 100%;
80
+ display: flex;
81
+ justify-content: flex-end;
82
+ margin-top: 16px;
83
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
 
3
- require("./index.less");
3
+ require("./ProTable.less");
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
23
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
24
- const _withScopeId = n => (_pushScopeId("data-v-1715741797603"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1716520754723"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  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";
81
- const _withScopeId = n => (_pushScopeId("data-v-1715741797002"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1716520753930"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,