@vue-start/element-pro 0.2.4 → 0.2.6

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.
package/dist/index.es.js CHANGED
@@ -1,470 +1,288 @@
1
- import { defineComponent, createVNode, mergeProps, reactive, ref, toRaw, isVNode } from 'vue';
2
- import { ElRow, ElCol, ElLoading, ElFormItem, ElForm, ElSelect, ElOption, ElRadioGroup, ElRadioButton, ElRadio, ElInput, ElInputNumber, ElDatePicker, ElTimePicker, ElTreeSelect, ElCheckboxGroup, ElSwitch, ElCascader, ElButton, ElTableColumn, ElTable, ElPagination, ElDescriptions, ElDescriptionsItem, ElDialog } from 'element-plus';
3
- import { isString, keys, omit, map, size, get } from 'lodash';
4
- import { createGrid, generateId, createExpose, createForm, createSearchForm, createFormItemCompFn, useProForm, createFormList, createTable, createCurdForm, CurdCurrentMode, useProCurd, createCurdList, createCurdDesc, CurdAction } from '@vue-start/pro';
5
- import { useEffect, setReactiveValue } from '@vue-start/hooks';
6
-
7
- function ownKeys(object, enumerableOnly) {
8
- var keys = Object.keys(object);
9
-
10
- if (Object.getOwnPropertySymbols) {
11
- var symbols = Object.getOwnPropertySymbols(object);
12
- enumerableOnly && (symbols = symbols.filter(function (sym) {
13
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
- })), keys.push.apply(keys, symbols);
15
- }
16
-
17
- return keys;
18
- }
19
-
20
- function _objectSpread2(target) {
21
- for (var i = 1; i < arguments.length; i++) {
22
- var source = null != arguments[i] ? arguments[i] : {};
23
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
24
- _defineProperty(target, key, source[key]);
25
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
26
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
27
- });
28
- }
29
-
30
- return target;
31
- }
32
-
33
- function _defineProperty(obj, key, value) {
34
- if (key in obj) {
35
- Object.defineProperty(obj, key, {
36
- value: value,
37
- enumerable: true,
38
- configurable: true,
39
- writable: true
40
- });
41
- } else {
42
- obj[key] = value;
1
+ import { defineComponent as c, createVNode as a, mergeProps as d, reactive as U, ref as V, toRaw as q, isVNode as S } from "vue";
2
+ import { ElRow as H, ElCol as _, ElLoading as J, ElFormItem as T, ElForm as v, ElSelect as E, ElOption as Q, ElRadioGroup as I, ElRadioButton as W, ElRadio as X, ElInput as Y, ElInputNumber as Z, ElDatePicker as $, ElTimePicker as ee, ElTreeSelect as te, ElCheckboxGroup as re, ElSwitch as oe, ElCascader as ne, ElButton as f, ElTableColumn as k, ElTable as x, ElPagination as ae, ElDescriptions as le, ElDescriptionsItem as ue, ElDialog as R } from "element-plus";
3
+ import { isString as ce, keys as C, omit as u, map as P, size as de, get as F } from "lodash";
4
+ import { createGrid as ie, createExpose as O, createForm as se, createSearchForm as me, createFormItemCompFn as pe, useProForm as fe, createFormList as ye, createTable as ge, createCurdForm as Ce, CurdCurrentMode as Pe, useProCurd as y, createCurdList as Fe, createCurdDesc as be, CurdAction as p } from "@vue-start/pro";
5
+ import { useEffect as j, generateId as Se, setReactiveValue as Te } from "@vue-start/hooks";
6
+ const ve = ie(H, _), M = (e = "comp") => e + "-" + Se(), Ee = () => ({
7
+ loading: {
8
+ type: Boolean
9
+ },
10
+ target: {
11
+ type: [String, Object]
12
+ },
13
+ body: {
14
+ type: Boolean
15
+ },
16
+ fullscreen: {
17
+ type: Boolean
18
+ },
19
+ lock: {
20
+ type: Boolean
21
+ },
22
+ text: {
23
+ type: String
24
+ },
25
+ spinner: {
26
+ type: String
27
+ },
28
+ background: {
29
+ type: String
30
+ },
31
+ customClass: {
32
+ type: String
43
33
  }
44
-
45
- return obj;
46
- }
47
-
48
- function _toConsumableArray(arr) {
49
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
50
- }
51
-
52
- function _arrayWithoutHoles(arr) {
53
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
54
- }
55
-
56
- function _iterableToArray(iter) {
57
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
58
- }
59
-
60
- function _unsupportedIterableToArray(o, minLen) {
61
- if (!o) return;
62
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
63
- var n = Object.prototype.toString.call(o).slice(8, -1);
64
- if (n === "Object" && o.constructor) n = o.constructor.name;
65
- if (n === "Map" || n === "Set") return Array.from(o);
66
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
67
- }
68
-
69
- function _arrayLikeToArray(arr, len) {
70
- if (len == null || len > arr.length) len = arr.length;
71
-
72
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
73
-
74
- return arr2;
75
- }
76
-
77
- function _nonIterableSpread() {
78
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
79
- }
80
-
81
- var ProGrid = createGrid(ElRow, ElCol);
82
-
83
- var createLoadingId = function createLoadingId() {
84
- var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "comp";
85
- return prefix + "-" + generateId();
86
- };
87
-
88
- var proLoadingProps = function proLoadingProps() {
89
- return {
90
- loading: {
91
- type: Boolean
92
- },
93
- target: {
94
- type: [String, Object]
95
- },
96
- body: {
97
- type: Boolean
98
- },
99
- fullscreen: {
100
- type: Boolean
101
- },
102
- lock: {
103
- type: Boolean
104
- },
105
- text: {
106
- type: String
107
- },
108
- spinner: {
109
- type: String
110
- },
111
- background: {
112
- type: String
113
- },
114
- customClass: {
115
- type: String
116
- }
117
- };
118
- };
119
-
120
- var ProLoading = defineComponent({
121
- props: _objectSpread2({}, proLoadingProps()),
122
- setup: function setup(props, _ref) {
123
- var slots = _ref.slots;
124
- var id = createLoadingId();
125
- useEffect(function () {
126
- if (!props.loading) {
34
+ }), Ie = c({
35
+ props: {
36
+ ...Ee()
37
+ },
38
+ setup: (e, {
39
+ slots: t
40
+ }) => {
41
+ const o = M();
42
+ return j(() => {
43
+ if (!e.loading)
127
44
  return;
128
- }
129
-
130
- var element = props.target;
131
-
132
- if (!slots["default"]) {
133
- //监听
134
- if (props.target && isString(props.target)) {
135
- element = document.querySelector("#" + props.target);
136
- }
137
- } else {
138
- //包裹
139
- element = document.getElementById(id);
140
- }
141
-
142
- if (!element) {
45
+ let n = e.target;
46
+ if (t.default ? n = document.getElementById(o) : e.target && ce(e.target) && (n = document.querySelector("#" + e.target)), !n)
143
47
  return;
144
- }
145
-
146
- var instance = ElLoading.service({
147
- target: element,
148
- body: props.body,
149
- fullscreen: props.fullscreen,
150
- lock: props.lock,
151
- text: props.text,
152
- spinner: props.spinner,
153
- background: props.background,
154
- customClass: props.customClass
48
+ const r = J.service({
49
+ target: n,
50
+ body: e.body,
51
+ fullscreen: e.fullscreen,
52
+ lock: e.lock,
53
+ text: e.text,
54
+ spinner: e.spinner,
55
+ background: e.background,
56
+ customClass: e.customClass
155
57
  });
156
- return function () {
157
- instance && instance.close();
58
+ return () => {
59
+ r && r.close();
158
60
  };
159
- }, function () {
160
- return props.loading;
161
- });
162
- return function () {
163
- if (!slots["default"]) {
164
- return null;
165
- }
166
-
167
- return createVNode("div", {
168
- "id": id
169
- }, [slots["default"]()]);
170
- };
61
+ }, () => e.loading), () => t.default ? a("div", {
62
+ id: o
63
+ }, [t.default()]) : null;
171
64
  }
172
- });
173
-
174
- var proFormItemProps = function proFormItemProps() {
175
- return {
176
- name: {
177
- type: [String, Array]
178
- }
179
- };
180
- };
181
-
182
- var ProFormItem = defineComponent({
183
- props: _objectSpread2(_objectSpread2({}, ElFormItem.props), proFormItemProps()),
184
- setup: function setup(props, _ref) {
185
- var slots = _ref.slots;
186
- var invalidKeys = keys(proFormItemProps());
187
- return function () {
188
- return createVNode(ElFormItem, mergeProps(omit.apply(void 0, [props].concat(_toConsumableArray(invalidKeys), ["name", "prop"])), {
189
- "prop": props.prop || props.name
190
- }), slots);
191
- };
65
+ }), h = () => ({
66
+ name: {
67
+ type: [String, Array]
192
68
  }
193
- });
194
- var FormMethods = ["clearValidate", "resetFields", "scrollToField", "validate", "validateField", "submit"];
195
- var Form = defineComponent({
196
- props: _objectSpread2({}, ElForm.props),
197
- setup: function setup(props, _ref2) {
198
- var slots = _ref2.slots,
199
- emit = _ref2.emit,
200
- expose = _ref2.expose;
201
- var formState = props.model || reactive({});
202
- var formRef = ref();
203
- useEffect(function () {
204
- if (!formRef.value) {
205
- return;
206
- }
207
-
208
- formRef.value.submit = function () {
209
- var _formRef$value;
210
-
211
- (_formRef$value = formRef.value) === null || _formRef$value === void 0 ? void 0 : _formRef$value.validate(function (isValid, invalidFields) {
212
- if (isValid) {
213
- emit("finish", toRaw(formState));
214
- } else {
215
- emit("finishFailed", invalidFields);
216
- }
69
+ }), z = c({
70
+ props: {
71
+ ...T.props,
72
+ ...h()
73
+ },
74
+ setup: (e, {
75
+ slots: t
76
+ }) => {
77
+ const o = C(h());
78
+ return () => a(T, d(u(e, ...o, "name", "prop"), {
79
+ prop: e.prop || e.name
80
+ }), t);
81
+ }
82
+ }), b = ["clearValidate", "resetFields", "scrollToField", "validate", "validateField", "submit"], ke = c({
83
+ props: {
84
+ ...v.props
85
+ },
86
+ setup: (e, {
87
+ slots: t,
88
+ emit: o,
89
+ expose: n
90
+ }) => {
91
+ const r = e.model || U({}), l = V();
92
+ return j(() => {
93
+ !l.value || (l.value.submit = () => {
94
+ var i;
95
+ (i = l.value) == null || i.validate((s, g) => {
96
+ s ? o("finish", q(r)) : o("finishFailed", g);
217
97
  });
218
- };
219
- }, []);
220
- expose(createExpose(FormMethods, formRef));
221
- return function () {
222
- return createVNode(ElForm, mergeProps({
223
- "ref": formRef
224
- }, omit(props, "model"), {
225
- "model": formState
226
- }), slots);
227
- };
98
+ });
99
+ }, []), n(O(b, l)), () => a(v, d({
100
+ ref: l
101
+ }, u(e, "model"), {
102
+ model: r
103
+ }), t);
228
104
  }
229
- });
230
- //emit;
231
- var ProForm = createForm(Form, ProGrid, FormMethods);
232
- var ProSearchForm = createSearchForm(ProForm, {
105
+ }), N = se(ke, ve, b), xe = me(N, {
233
106
  needRules: {
234
107
  type: Boolean,
235
- "default": false
108
+ default: !1
236
109
  },
237
110
  inline: {
238
111
  type: Boolean,
239
- "default": true
112
+ default: !0
240
113
  }
241
- }, FormMethods);
242
-
243
- var createFormItemComponent = createFormItemCompFn(ProFormItem, function (value, setValue, disabled) {
244
- return {
245
- modelValue: value,
246
- "onUpdate:modelValue": setValue,
247
- clearable: true,
248
- disabled: disabled
249
- };
250
- });
251
-
252
- var proSelectProps = function proSelectProps() {
253
- return {
254
- options: Array
255
- };
256
- };
257
-
258
- var ProSelect = defineComponent({
114
+ }, b), m = pe(z, (e, t, o) => ({
115
+ modelValue: e,
116
+ "onUpdate:modelValue": t,
117
+ clearable: !0,
118
+ disabled: o
119
+ })), B = () => ({
120
+ options: Array
121
+ }), Re = c({
259
122
  name: "PSelect",
260
- props: _objectSpread2(_objectSpread2({}, ElSelect.props), proSelectProps()),
261
- setup: function setup(props, _ref) {
262
- var slots = _ref.slots,
263
- emit = _ref.emit;
264
- var invalidKeys = keys(proSelectProps());
265
- return function () {
266
- var _slots$default;
267
-
268
- return createVNode(ElSelect, mergeProps(omit(props, invalidKeys), {
269
- "onUpdate:modelValue": function onUpdateModelValue(v) {
270
- emit("update:modelValue", v ? v : undefined);
271
- }
272
- }), _objectSpread2({
273
- "default": function _default() {
274
- return [map(props.options, function (item) {
275
- return createVNode(ElOption, mergeProps({
276
- "key": item.value
277
- }, item), null);
278
- }), (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
279
- }
280
- }, omit(slots, "default")));
281
- };
123
+ props: {
124
+ ...E.props,
125
+ ...B()
126
+ },
127
+ setup: (e, {
128
+ slots: t,
129
+ emit: o
130
+ }) => {
131
+ const n = C(B());
132
+ return () => a(E, d(u(e, n), {
133
+ "onUpdate:modelValue": (r) => {
134
+ o("update:modelValue", r || void 0);
135
+ }
136
+ }), {
137
+ default: () => {
138
+ var r;
139
+ return [P(e.options, (l) => a(Q, d({
140
+ key: l.value
141
+ }, l), null)), (r = t.default) == null ? void 0 : r.call(t)];
142
+ },
143
+ ...u(t, "default")
144
+ });
282
145
  }
283
146
  });
284
-
285
- function _isSlot(s) {
286
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
147
+ function he(e) {
148
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !S(e);
287
149
  }
288
-
289
- var proRadioProps = function proRadioProps() {
290
- return {
291
- options: {
292
- type: Array
293
- },
294
- buttonStyle: {
295
- type: String,
296
- "default": "default"
297
- }
298
- };
299
- };
300
-
301
- var ProRadio = defineComponent({
302
- props: _objectSpread2(_objectSpread2({}, ElRadioGroup.props), proRadioProps()),
303
- setup: function setup(props, _ref) {
304
- var emit = _ref.emit;
305
- var invalidKeys = keys(proRadioProps());
306
- return function () {
307
- var _slot;
308
-
309
- return createVNode(ElRadioGroup, mergeProps(omit(props, invalidKeys), {
310
- "onUpdate:modelValue": function onUpdateModelValue(v) {
311
- emit("update:modelValue", v);
312
- }
313
- }), _isSlot(_slot = map(props.options, function (item) {
314
- if (props.buttonStyle === "button") {
315
- return createVNode(ElRadioButton, mergeProps({
316
- "key": item.value
317
- }, item, {
318
- "label": item.value
319
- }), {
320
- "default": function _default() {
321
- return [item.label];
322
- }
323
- });
324
- }
325
-
326
- return createVNode(ElRadio, mergeProps({
327
- "key": item.value
328
- }, item, {
329
- "label": item.value
330
- }), {
331
- "default": function _default() {
332
- return [item.label];
333
- }
334
- });
335
- })) ? _slot : {
336
- "default": function _default() {
337
- return [_slot];
150
+ const D = () => ({
151
+ options: {
152
+ type: Array
153
+ },
154
+ buttonStyle: {
155
+ type: String,
156
+ default: "default"
157
+ }
158
+ }), Be = c({
159
+ props: {
160
+ ...I.props,
161
+ ...D()
162
+ },
163
+ setup: (e, {
164
+ emit: t
165
+ }) => {
166
+ const o = C(D());
167
+ return () => {
168
+ let n;
169
+ return a(I, d(u(e, o), {
170
+ "onUpdate:modelValue": (r) => {
171
+ t("update:modelValue", r);
338
172
  }
173
+ }), he(n = P(e.options, (r) => e.buttonStyle === "button" ? a(W, d({
174
+ key: r.value
175
+ }, r, {
176
+ label: r.value
177
+ }), {
178
+ default: () => [r.label]
179
+ }) : a(X, d({
180
+ key: r.value
181
+ }, r, {
182
+ label: r.value
183
+ }), {
184
+ default: () => [r.label]
185
+ }))) ? n : {
186
+ default: () => [n]
339
187
  });
340
188
  };
341
189
  }
342
- });
343
-
344
- var ProFormText = createFormItemComponent({
345
- InputComp: ElInput,
190
+ }), Ue = m({
191
+ InputComp: Y,
346
192
  valueType: "text",
347
193
  name: "PFromText"
348
- });
349
- var ProFormTextNumber = createFormItemComponent({
350
- InputComp: ElInputNumber,
194
+ }), qe = m({
195
+ InputComp: Z,
351
196
  valueType: "digit",
352
197
  name: "PFormNumber"
353
- });
354
- var ProFormDatePicker = createFormItemComponent({
355
- InputComp: ElDatePicker,
198
+ }), He = m({
199
+ InputComp: $,
356
200
  valueType: "date",
357
201
  name: "PFormDate"
358
- });
359
- var ProFormTimePicker = createFormItemComponent({
360
- InputComp: ElTimePicker,
202
+ }), _e = m({
203
+ InputComp: ee,
361
204
  valueType: "time",
362
205
  name: "PFormTime"
363
- });
364
- var ProFormSelect = createFormItemComponent({
365
- InputComp: ProSelect,
206
+ }), Je = m({
207
+ InputComp: Re,
366
208
  valueType: "select",
367
209
  name: "PFormSelect"
368
- });
369
- var ProFormTreeSelect = createFormItemComponent({
370
- InputComp: ElTreeSelect,
210
+ }), Qe = m({
211
+ InputComp: te,
371
212
  valueType: "treeSelect",
372
213
  name: "PFormTreeSelect"
373
- });
374
- var ProFormCheckbox = createFormItemComponent({
375
- InputComp: ElCheckboxGroup,
214
+ }), We = m({
215
+ InputComp: re,
376
216
  valueType: "checkbox",
377
217
  name: "PFromCheckbox"
378
- });
379
- var ProFormRadio = createFormItemComponent({
380
- InputComp: ProRadio,
218
+ }), Xe = m({
219
+ InputComp: Be,
381
220
  valueType: "radio",
382
221
  name: "PFromRadio"
383
- });
384
- var ProFormSwitch = createFormItemComponent({
385
- InputComp: ElSwitch,
222
+ }), Ye = m({
223
+ InputComp: oe,
386
224
  valueType: "switch",
387
225
  name: "PFromSwitch"
388
- });
389
- var ProFormCascader = createFormItemComponent({
390
- InputComp: ElCascader,
226
+ }), Ze = m({
227
+ InputComp: ne,
391
228
  valueType: "cascader",
392
229
  name: "PFormCascader"
393
- });
394
- var ProSubmitButton = defineComponent({
395
- props: _objectSpread2({}, ElButton.props),
396
- setup: function setup(props, _ref) {
397
- var slots = _ref.slots,
398
- emit = _ref.emit;
399
-
400
- var _useProForm = useProForm(),
401
- formRef = _useProForm.formRef;
402
-
403
- var handleClick = function handleClick(e) {
404
- var _formRef$value, _formRef$value$submit;
405
-
406
- emit("click", e);
407
- (_formRef$value = formRef.value) === null || _formRef$value === void 0 ? void 0 : (_formRef$value$submit = _formRef$value.submit) === null || _formRef$value$submit === void 0 ? void 0 : _formRef$value$submit.call(_formRef$value);
408
- };
409
-
410
- return function () {
411
- return createVNode(ElButton, mergeProps({
412
- "onClick": handleClick
413
- }, props), slots);
230
+ }), $e = c({
231
+ props: {
232
+ ...f.props
233
+ },
234
+ setup: (e, {
235
+ slots: t,
236
+ emit: o
237
+ }) => {
238
+ const {
239
+ formRef: n
240
+ } = fe(), r = (l) => {
241
+ var i, s;
242
+ o("click", l), (s = (i = n.value) == null ? void 0 : i.submit) == null || s.call(i);
414
243
  };
244
+ return () => a(f, d({
245
+ onClick: r
246
+ }, e), t);
415
247
  }
416
- });
417
-
418
- var FormList = createFormList(ProFormItem);
419
-
420
- var proFormListProps = function proFormListProps() {
421
- return {
422
- addButtonText: {
423
- type: String,
424
- "default": "添加一项"
425
- },
426
- addButtonProps: {
427
- type: Object
428
- },
429
- minusButtonText: {
430
- type: String,
431
- "default": "删除"
432
- },
433
- minusButtonProps: {
434
- type: Object
435
- }
436
- };
437
- };
438
-
439
- var ProFormList = defineComponent({
248
+ }), L = ye(z), A = () => ({
249
+ addButtonText: {
250
+ type: String,
251
+ default: "\u6DFB\u52A0\u4E00\u9879"
252
+ },
253
+ addButtonProps: {
254
+ type: Object
255
+ },
256
+ minusButtonText: {
257
+ type: String,
258
+ default: "\u5220\u9664"
259
+ },
260
+ minusButtonProps: {
261
+ type: Object
262
+ }
263
+ }), et = c({
440
264
  name: "PFormList",
441
- props: _objectSpread2(_objectSpread2({}, FormList.props), proFormListProps()),
442
- setup: function setup(props, _ref) {
443
- var slots = _ref.slots;
444
- var invalidKeys = keys(proFormListProps());
445
- return function () {
446
- return createVNode(FormList, omit(props, invalidKeys), _objectSpread2({
447
- itemMinus: function itemMinus() {
448
- return createVNode(ElButton, props.minusButtonProps, {
449
- "default": function _default() {
450
- return [props.minusButtonText];
451
- }
452
- });
453
- },
454
- add: function add() {
455
- return createVNode(ElButton, props.addButtonProps, {
456
- "default": function _default() {
457
- return [props.addButtonText];
458
- }
459
- });
460
- }
461
- }, slots));
462
- };
265
+ props: {
266
+ ...L.props,
267
+ ...A()
268
+ },
269
+ setup: (e, {
270
+ slots: t
271
+ }) => {
272
+ const o = C(A());
273
+ return () => a(L, u(e, o), {
274
+ itemMinus: () => a(f, e.minusButtonProps, {
275
+ default: () => [e.minusButtonText]
276
+ }),
277
+ add: () => a(f, e.addButtonProps, {
278
+ default: () => [e.addButtonText]
279
+ }),
280
+ ...t
281
+ });
463
282
  }
464
- });
465
-
466
- var ProTableColumn = defineComponent({
467
- props: _objectSpread2(_objectSpread2({}, omit(ElTableColumn.props, "label", "prop")), {}, {
283
+ }), G = c({
284
+ props: {
285
+ ...u(k.props, "label", "prop"),
468
286
  title: {
469
287
  type: String
470
288
  },
@@ -477,43 +295,26 @@ var ProTableColumn = defineComponent({
477
295
  customRender: {
478
296
  type: Function
479
297
  }
480
- }),
481
- setup: function setup(props) {
482
- return function () {
483
- return createVNode(ElTableColumn, mergeProps(omit(props, "title", "label", "renderHeader", "prop", "dataIndex", "formatter", "customRender", "children"), {
484
- "label": isVNode(props.title) ? undefined : props.title,
485
- "renderHeader": isVNode(props.title) ? function () {
486
- return props.title;
487
- } : undefined,
488
- "prop": props.dataIndex,
489
- "formatter": function formatter(record, column, value, index) {
490
- if (props.customRender) {
491
- return props.customRender({
492
- value: value,
493
- text: value,
494
- record: record,
495
- column: column,
496
- index: index
497
- });
498
- }
499
-
500
- return value;
501
- }
502
- }), {
503
- "default": function _default() {
504
- return [size(props.children) > 0 && map(props.children, function (item) {
505
- return createVNode(ProTableColumn, mergeProps({
506
- "key": item.dataIndex
507
- }, item), null);
508
- })];
509
- }
510
- });
511
- };
512
- }
513
- });
514
- var TableMethods = ["clearSelection", "getSelectionRows", "toggleRowSelection", "toggleAllSelection", "toggleRowExpansion", "setCurrentRow", "clearSort", "clearFilter", "doLayout", "sort", "scrollTo", "setScrollTop", "setScrollLeft"];
515
- var Table = defineComponent({
516
- props: _objectSpread2(_objectSpread2({}, ElTable.props), {}, {
298
+ },
299
+ setup: (e) => () => a(k, d(u(e, "title", "label", "renderHeader", "prop", "dataIndex", "formatter", "customRender", "children"), {
300
+ label: S(e.title) ? void 0 : e.title,
301
+ renderHeader: S(e.title) ? () => e.title : void 0,
302
+ prop: e.dataIndex,
303
+ formatter: (t, o, n, r) => e.customRender ? e.customRender({
304
+ value: n,
305
+ text: n,
306
+ record: t,
307
+ column: o,
308
+ index: r
309
+ }) : n
310
+ }), {
311
+ default: () => [de(e.children) > 0 && P(e.children, (t) => a(G, d({
312
+ key: t.dataIndex
313
+ }, t), null))]
314
+ })
315
+ }), K = ["clearSelection", "getSelectionRows", "toggleRowSelection", "toggleAllSelection", "toggleRowExpansion", "setCurrentRow", "clearSort", "clearFilter", "doLayout", "sort", "scrollTo", "setScrollTop", "setScrollLeft"], De = c({
316
+ props: {
317
+ ...x.props,
517
318
  columns: {
518
319
  type: Array
519
320
  },
@@ -523,167 +324,149 @@ var Table = defineComponent({
523
324
  loading: {
524
325
  type: Boolean
525
326
  }
526
- }),
527
- setup: function setup(props, _ref) {
528
- var slots = _ref.slots,
529
- expose = _ref.expose;
530
- var tableRef = ref();
531
- var id = createLoadingId("table");
532
- expose(createExpose(TableMethods, tableRef));
533
- return function () {
534
- var _slots$start, _slots$default;
535
-
536
- return createVNode(ElTable, mergeProps({
537
- "ref": tableRef,
538
- "id": id
539
- }, omit(props, "columns", "dataSource", "loading"), {
540
- "data": props.dataSource || props.data
541
- }), _objectSpread2({
542
- "default": function _default() {
543
- return [(_slots$start = slots.start) === null || _slots$start === void 0 ? void 0 : _slots$start.call(slots), map(props.columns, function (item) {
544
- return createVNode(ProTableColumn, mergeProps({
545
- "key": item.dataIndex
546
- }, item), null);
547
- }), (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots), props.loading && createVNode(ProLoading, {
548
- "target": id,
549
- "loading": true
550
- }, null)];
551
- }
552
- }, omit(slots, "default", "start")));
553
- };
327
+ },
328
+ setup: (e, {
329
+ slots: t,
330
+ expose: o
331
+ }) => {
332
+ const n = V(), r = M("table");
333
+ return o(O(K, n)), () => a(x, d({
334
+ ref: n,
335
+ id: r
336
+ }, u(e, "columns", "dataSource", "loading"), {
337
+ data: e.dataSource || e.data
338
+ }), {
339
+ default: () => {
340
+ var l, i;
341
+ return [(l = t.start) == null ? void 0 : l.call(t), P(e.columns, (s) => a(G, d({
342
+ key: s.dataIndex
343
+ }, s), null)), (i = t.default) == null ? void 0 : i.call(t), e.loading && a(Ie, {
344
+ target: r,
345
+ loading: !0
346
+ }, null)];
347
+ },
348
+ ...u(t, "default", "start")
349
+ });
554
350
  }
555
- });
556
- var ProTable = createTable(Table, undefined, TableMethods);
557
-
558
- var ProCurdForm = createCurdForm(ProForm, ElButton, function (curdState) {
559
- return {
560
- hideRequiredAsterisk: curdState.mode === CurdCurrentMode.DETAIL
561
- };
562
- }, FormMethods);
563
- var ProCurdFormConnect = defineComponent({
564
- setup: function setup() {
565
- var _useProCurd = useProCurd(),
566
- formProps = _useProCurd.formProps;
567
-
568
- return function () {
569
- return createVNode(ProCurdForm, omit(formProps === null || formProps === void 0 ? void 0 : formProps.value, "slots"), get(formProps === null || formProps === void 0 ? void 0 : formProps.value, "slots"));
570
- };
351
+ }), Le = ge(De, void 0, K), Ae = Ce(N, f, (e) => ({
352
+ hideRequiredAsterisk: e.mode === Pe.DETAIL
353
+ }), b), we = c({
354
+ setup: () => {
355
+ const {
356
+ formProps: e
357
+ } = y();
358
+ return () => a(Ae, u(e == null ? void 0 : e.value, "slots"), F(e == null ? void 0 : e.value, "slots"));
571
359
  }
572
- });
573
-
574
- var CurdList = createCurdList(ProSearchForm, ProTable);
575
-
576
- /**
577
- * 组合列表
578
- * SearchForm + Table + Pagination
579
- */
580
- var ProCurdList = defineComponent({
581
- props: _objectSpread2(_objectSpread2({}, CurdList.props), {}, {
360
+ }), w = Fe(xe, Le), Ve = c({
361
+ props: {
362
+ ...w.props,
582
363
  paginationProps: {
583
364
  type: Object
584
365
  }
585
- }),
586
- setup: function setup(props, _ref) {
587
- var slots = _ref.slots;
588
- return function () {
589
- return createVNode(CurdList, omit(props, "paginationProps"), _objectSpread2({
590
- pagination: function pagination(pageState, total, handleSearch) {
591
- return createVNode(ElPagination, mergeProps(props.paginationProps, {
592
- "total": total,
593
- "currentPage": pageState.page,
594
- "pageSize": pageState.pageSize,
595
- "onSizeChange": function onSizeChange(pageSize) {
596
- pageState.pageSize = pageSize;
597
- handleSearch();
598
- },
599
- "onCurrentChange": function onCurrentChange(current) {
600
- pageState.page = current;
601
- handleSearch();
602
- }
603
- }), null);
604
- }
605
- }, slots));
606
- };
607
- }
608
- });
609
- var ProCurdListConnect = defineComponent({
610
- setup: function setup() {
611
- var _useProCurd = useProCurd(),
612
- listProps = _useProCurd.listProps;
613
-
614
- return function () {
615
- return createVNode(ProCurdList, omit(listProps === null || listProps === void 0 ? void 0 : listProps.value, "slots"), get(listProps === null || listProps === void 0 ? void 0 : listProps.value, "slots"));
616
- };
366
+ },
367
+ setup: (e, {
368
+ slots: t
369
+ }) => () => a(w, u(e, "paginationProps"), {
370
+ pagination: (o, n, r) => a(ae, d(e.paginationProps, {
371
+ total: n,
372
+ currentPage: o.page,
373
+ pageSize: o.pageSize,
374
+ onSizeChange: (l) => {
375
+ o.pageSize = l, r();
376
+ },
377
+ onCurrentChange: (l) => {
378
+ o.page = l, r();
379
+ }
380
+ }), null),
381
+ ...t
382
+ })
383
+ }), tt = c({
384
+ setup: () => {
385
+ const {
386
+ listProps: e
387
+ } = y();
388
+ return () => a(Ve, u(e == null ? void 0 : e.value, "slots"), F(e == null ? void 0 : e.value, "slots"));
617
389
  }
618
- });
619
-
620
- var ProCurdDesc = createCurdDesc(ElDescriptions, ElDescriptionsItem);
621
- var ProCurdDescConnect = defineComponent({
622
- setup: function setup() {
623
- var _useProCurd = useProCurd(),
624
- descProps = _useProCurd.descProps;
625
-
626
- return function () {
627
- return createVNode(ProCurdDesc, omit(descProps === null || descProps === void 0 ? void 0 : descProps.value, "slots"), get(descProps === null || descProps === void 0 ? void 0 : descProps.value, "slots"));
628
- };
390
+ }), Oe = be(le, ue), rt = c({
391
+ setup: () => {
392
+ const {
393
+ descProps: e
394
+ } = y();
395
+ return () => a(Oe, u(e == null ? void 0 : e.value, "slots"), F(e == null ? void 0 : e.value, "slots"));
629
396
  }
630
- });
631
-
632
- var ProCurdModal = defineComponent({
633
- props: _objectSpread2({}, ElDialog.props),
634
- setup: function setup(props, _ref) {
635
- var slots = _ref.slots;
636
-
637
- var _useProCurd = useProCurd(),
638
- curdState = _useProCurd.curdState,
639
- getOperate = _useProCurd.getOperate; //根据当前模式展示不同的Title
640
-
641
-
642
- var getTitle = function getTitle() {
643
- var _getOperate, _getOperate2, _getOperate3;
644
-
645
- switch (curdState.mode) {
646
- case CurdAction.ADD:
647
- return (_getOperate = getOperate(CurdAction.ADD)) === null || _getOperate === void 0 ? void 0 : _getOperate.label;
648
-
649
- case CurdAction.EDIT:
650
- return (_getOperate2 = getOperate(CurdAction.EDIT)) === null || _getOperate2 === void 0 ? void 0 : _getOperate2.label;
651
-
652
- case CurdAction.DETAIL:
653
- return (_getOperate3 = getOperate(CurdAction.DETAIL)) === null || _getOperate3 === void 0 ? void 0 : _getOperate3.label;
397
+ }), je = c({
398
+ props: {
399
+ ...R.props
400
+ },
401
+ setup: (e, {
402
+ slots: t
403
+ }) => {
404
+ const {
405
+ curdState: o,
406
+ getOperate: n
407
+ } = y(), r = () => {
408
+ var i, s, g;
409
+ switch (o.mode) {
410
+ case p.ADD:
411
+ return (i = n(p.ADD)) == null ? void 0 : i.label;
412
+ case p.EDIT:
413
+ return (s = n(p.EDIT)) == null ? void 0 : s.label;
414
+ case p.DETAIL:
415
+ return (g = n(p.DETAIL)) == null ? void 0 : g.label;
654
416
  }
417
+ }, l = () => {
418
+ o.mode = void 0, Te(o.detailData, {}), o.detailLoading = !1, o.addAction = void 0;
655
419
  };
656
-
657
- var handleCancel = function handleCancel() {
658
- curdState.mode = undefined;
659
- setReactiveValue(curdState.detailData, {});
660
- curdState.detailLoading = false;
661
- curdState.addAction = undefined;
662
- };
663
-
664
- return function () {
665
- return createVNode(ElDialog, mergeProps({
666
- "destroyOnClose": true,
667
- "title": getTitle(),
668
- "modelValue": !!curdState.mode,
669
- "onClose": handleCancel
670
- }, props), slots);
671
- };
420
+ return () => a(R, d({
421
+ destroyOnClose: !0,
422
+ title: r(),
423
+ modelValue: !!o.mode,
424
+ onClose: l
425
+ }, e), t);
672
426
  }
673
- });
674
- var ProCurdModalConnect = defineComponent({
675
- setup: function setup() {
676
- var _useProCurd2 = useProCurd(),
677
- modalProps = _useProCurd2.modalProps;
678
-
679
- return function () {
680
- return createVNode(ProCurdModal, omit(modalProps === null || modalProps === void 0 ? void 0 : modalProps.value, "slots"), _objectSpread2({
681
- "default": function _default() {
682
- return [createVNode(ProCurdFormConnect, null, null)];
683
- }
684
- }, get(modalProps === null || modalProps === void 0 ? void 0 : modalProps.value, "slots")));
685
- };
427
+ }), ot = c({
428
+ setup: () => {
429
+ const {
430
+ modalProps: e
431
+ } = y();
432
+ return () => a(je, u(e == null ? void 0 : e.value, "slots"), {
433
+ default: () => [a(we, null, null)],
434
+ ...F(e == null ? void 0 : e.value, "slots")
435
+ });
686
436
  }
687
437
  });
688
-
689
- export { FormMethods, ProCurdDesc, ProCurdDescConnect, ProCurdForm, ProCurdFormConnect, ProCurdList, ProCurdListConnect, ProCurdModal, ProCurdModalConnect, ProForm, ProFormCascader, ProFormCheckbox, ProFormDatePicker, ProFormItem, ProFormList, ProFormRadio, ProFormSelect, ProFormSwitch, ProFormText, ProFormTextNumber, ProFormTimePicker, ProFormTreeSelect, ProGrid, ProLoading, ProRadio, ProSearchForm, ProSelect, ProSubmitButton, ProTable, ProTableColumn, TableMethods, createFormItemComponent, createLoadingId };
438
+ export {
439
+ b as FormMethods,
440
+ Oe as ProCurdDesc,
441
+ rt as ProCurdDescConnect,
442
+ Ae as ProCurdForm,
443
+ we as ProCurdFormConnect,
444
+ Ve as ProCurdList,
445
+ tt as ProCurdListConnect,
446
+ je as ProCurdModal,
447
+ ot as ProCurdModalConnect,
448
+ N as ProForm,
449
+ Ze as ProFormCascader,
450
+ We as ProFormCheckbox,
451
+ He as ProFormDatePicker,
452
+ z as ProFormItem,
453
+ et as ProFormList,
454
+ Xe as ProFormRadio,
455
+ Je as ProFormSelect,
456
+ Ye as ProFormSwitch,
457
+ Ue as ProFormText,
458
+ qe as ProFormTextNumber,
459
+ _e as ProFormTimePicker,
460
+ Qe as ProFormTreeSelect,
461
+ ve as ProGrid,
462
+ Ie as ProLoading,
463
+ Be as ProRadio,
464
+ xe as ProSearchForm,
465
+ Re as ProSelect,
466
+ $e as ProSubmitButton,
467
+ Le as ProTable,
468
+ G as ProTableColumn,
469
+ K as TableMethods,
470
+ m as createFormItemComponent,
471
+ M as createLoadingId
472
+ };