@vue-start/element-pro 0.1.1 → 0.1.2

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.js CHANGED
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var vue = require('vue');
6
6
  var elementPlus = require('element-plus');
7
7
  var lodash = require('lodash');
8
- var hooks = require('@vue-start/hooks');
9
8
  var pro = require('@vue-start/pro');
9
+ var hooks = require('@vue-start/hooks');
10
10
 
11
11
  function ownKeys(object, enumerableOnly) {
12
12
  var keys = Object.keys(object);
@@ -82,156 +82,251 @@ function _nonIterableSpread() {
82
82
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
83
83
  }
84
84
 
85
- /**
86
- * ProForm ctx
87
- */
88
- var ProFormKey = Symbol("pro-form");
89
- var useProForm = function useProForm() {
90
- return vue.inject(ProFormKey);
91
- };
92
- var provideProForm = function provideProForm(ctx) {
93
- vue.provide(ProFormKey, ctx);
94
- };
95
- /**
96
- * ProFormList ctx
97
- */
85
+ var Content = vue.defineComponent(function () {
86
+ var _useProTable = pro.useProTable(),
87
+ columns = _useProTable.columns;
88
+
89
+ return function () {
90
+ return vue.createVNode(vue.Fragment, null, [lodash.map(columns.value, function (item) {
91
+ var formatter = function formatter(record, column, value, index) {
92
+ if (item.customRender) {
93
+ return item.customRender({
94
+ value: value,
95
+ text: value,
96
+ record: record,
97
+ column: column,
98
+ index: index
99
+ });
100
+ }
98
101
 
99
- var ProFormListKey = Symbol("pro-form-list");
100
- var useProFormList = function useProFormList() {
101
- return vue.inject(ProFormListKey);
102
- };
103
- var provideProFormList = function provideProFormList(ctx) {
104
- vue.provide(ProFormListKey, ctx);
105
- };
102
+ return value;
103
+ };
106
104
 
107
- var proFormItemProps$1 = function proFormItemProps() {
108
- return {
109
- name: {
110
- type: [String, Array]
111
- }
105
+ return vue.createVNode(elementPlus.ElTableColumn, vue.mergeProps({
106
+ "key": item.dataIndex
107
+ }, lodash.omit(item, "title", "label", "renderHeader", "prop", "dataIndex", "formatter", "customRender"), {
108
+ "label": vue.isVNode(item.title) ? undefined : item.title || lodash.get(item, "label"),
109
+ "renderHeader": vue.isVNode(item.title) ? function () {
110
+ return item.title;
111
+ } : undefined,
112
+ "prop": item.dataIndex,
113
+ "formatter": formatter
114
+ }), null);
115
+ })]);
112
116
  };
113
- };
114
-
115
- var ProFormItem = vue.defineComponent({
116
- props: _objectSpread2(_objectSpread2({}, elementPlus.ElFormItem.props), proFormItemProps$1()),
117
+ });
118
+ var ProTable = vue.defineComponent({
119
+ inheritAttrs: false,
120
+ props: _objectSpread2(_objectSpread2({}, elementPlus.ElTable.props), pro.ProTable.props),
117
121
  setup: function setup(props, _ref) {
118
- var slots = _ref.slots;
119
- var invalidKeys = lodash.keys(proFormItemProps$1());
122
+ var slots = _ref.slots,
123
+ expose = _ref.expose,
124
+ attrs = _ref.attrs;
125
+ var tableRef = vue.ref();
126
+ var originKeys = lodash.keys(pro.ProTable.props);
120
127
  return function () {
121
- return vue.createVNode(elementPlus.ElFormItem, vue.mergeProps(lodash.omit.apply(void 0, [props].concat(_toConsumableArray(invalidKeys), ["name", "prop"])), {
122
- "prop": props.prop || props.name
123
- }), slots);
128
+ var _slots$default;
129
+
130
+ return vue.createVNode(pro.ProTable, vue.mergeProps(attrs, lodash.pick.apply(void 0, [props].concat(_toConsumableArray(originKeys), ["provideExtra"])), {
131
+ "provideExtra": _objectSpread2({
132
+ tableRef: tableRef
133
+ }, props.provideExtra)
134
+ }), {
135
+ "default": function _default() {
136
+ return [vue.createVNode(elementPlus.ElTable, vue.mergeProps({
137
+ "ref": function ref(el) {
138
+ expose(el);
139
+ tableRef.value = el;
140
+ }
141
+ }, lodash.omit(props, originKeys)), _objectSpread2({
142
+ "default": function _default() {
143
+ return [vue.createVNode(Content, null, null), (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
144
+ }
145
+ }, lodash.omit(slots, "default")))];
146
+ }
147
+ });
124
148
  };
125
149
  }
126
150
  });
127
151
 
128
- var proFormProps = function proFormProps() {
152
+ var defaultPage = {
153
+ page: 1,
154
+ pageSize: 10
155
+ };
156
+
157
+ var proListProps = function proListProps() {
129
158
  return {
130
159
  /**
131
- * 子组件是否只读样式
160
+ * extra 是否放到SearchForm中
132
161
  */
133
- readonly: {
162
+ extraInSearch: {
134
163
  type: Boolean,
135
164
  "default": undefined
136
165
  },
137
-
138
- /**
139
- * FormComponent 根据此项来确定组件是否显示
140
- * rules 根据rules中方法生成showState对象
141
- */
142
- showState: {
166
+ //search
167
+ searchProps: {
143
168
  type: Object
144
169
  },
145
- showStateRules: {
170
+ //table
171
+ tableProps: {
146
172
  type: Object
147
173
  },
148
-
149
- /**
150
- * 是否只读
151
- */
152
- readonlyState: {
174
+ //pagination
175
+ paginationProps: {
153
176
  type: Object
154
177
  },
155
- readonlyStateRules: {
178
+ //pageState
179
+ pageState: {
156
180
  type: Object
157
- },
181
+ }
182
+ };
183
+ };
158
184
 
185
+ var ProList = vue.defineComponent({
186
+ props: _objectSpread2({}, proListProps()),
187
+ setup: function setup(props, _ref) {
188
+ var slots = _ref.slots,
189
+ emit = _ref.emit;
190
+
191
+ /******************* search pagination ********************/
192
+ var pageState = props.pageState || vue.reactive(_objectSpread2({}, defaultPage));
193
+ var prevValues;
194
+
195
+ var handleSearch = function handleSearch() {
196
+ emit("list", _objectSpread2(_objectSpread2({}, prevValues), pageState));
197
+ }; //页数重置1 且搜索
198
+
199
+
200
+ var executeSearchWithResetPage = function executeSearchWithResetPage(values) {
201
+ prevValues = values;
202
+ pageState.page = 1;
203
+ handleSearch();
204
+ };
205
+
206
+ return function () {
207
+ var _slots$divide, _slots$divide2, _slots$footerLeft, _slots$footerRight;
208
+
209
+ var searchProps = props.searchProps;
210
+ var tableProps = props.tableProps;
211
+ var paginationProps = props.paginationProps; //操作按钮
212
+
213
+ var extra = slots.extra ? vue.createVNode("div", {
214
+ "class": "pro-list-search"
215
+ }, [slots.extra()]) : null; //分页参数
216
+
217
+ var pagination = _objectSpread2(_objectSpread2({}, paginationProps), {}, {
218
+ currentPage: pageState.page,
219
+ pageSize: pageState.pageSize,
220
+ onSizeChange: function onSizeChange(pageSize) {
221
+ pageState.pageSize = pageSize;
222
+ handleSearch();
223
+ },
224
+ onCurrentChange: function onCurrentChange(current) {
225
+ pageState.page = current;
226
+ handleSearch();
227
+ }
228
+ });
229
+
230
+ return vue.createVNode(vue.Fragment, null, [vue.createVNode(ProSearchForm, vue.mergeProps(searchProps, {
231
+ "onFinish": executeSearchWithResetPage
232
+ }), {
233
+ "default": function _default() {
234
+ return [props.extraInSearch && extra];
235
+ }
236
+ }), (_slots$divide = slots.divide) === null || _slots$divide === void 0 ? void 0 : _slots$divide.call(slots), !props.extraInSearch && extra, slots["default"] ? slots["default"]() : vue.createVNode(ProTable, lodash.omit(tableProps, "slots"), tableProps === null || tableProps === void 0 ? void 0 : tableProps.slots), (_slots$divide2 = slots.divide2) === null || _slots$divide2 === void 0 ? void 0 : _slots$divide2.call(slots), vue.createVNode("div", {
237
+ "class": "pro-list-footer"
238
+ }, [(_slots$footerLeft = slots.footerLeft) === null || _slots$footerLeft === void 0 ? void 0 : _slots$footerLeft.call(slots), lodash.isNumber(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.total) && paginationProps.total > 0 && vue.createVNode(vue.Fragment, null, [slots.pagination ? slots.pagination(pagination) : vue.createVNode(elementPlus.ElPagination, pagination, null)]), (_slots$footerRight = slots.footerRight) === null || _slots$footerRight === void 0 ? void 0 : _slots$footerRight.call(slots)])]);
239
+ };
240
+ }
241
+ });
242
+
243
+ function _isSlot$1(s) {
244
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
245
+ }
246
+
247
+ var proGridProps = function proGridProps() {
248
+ return {
159
249
  /**
160
- * 是否disabled
250
+ * row属性
161
251
  */
162
- disableState: {
163
- type: Object
164
- },
165
- disableStateRules: {
166
- type: Object
252
+ row: {
253
+ type: Object,
254
+ "default": undefined
167
255
  },
168
256
 
169
257
  /**
170
- * 展示控件集合,readonly模式下使用这些组件渲染
258
+ * 公共col属性
171
259
  */
172
- elementMap: {
260
+ col: {
173
261
  type: Object
174
262
  },
175
263
 
176
264
  /**
177
- * provide传递
265
+ *
178
266
  */
179
- provideExtra: {
180
- type: Object
267
+ items: {
268
+ type: Array
181
269
  }
182
270
  };
183
271
  };
184
272
 
273
+ var ProGrid = vue.defineComponent({
274
+ props: _objectSpread2({}, proGridProps()),
275
+ setup: function setup(props) {
276
+ return function () {
277
+ var _slot;
278
+
279
+ return vue.createVNode(elementPlus.ElRow, props.row, _isSlot$1(_slot = lodash.map(props.items, function (item) {
280
+ return vue.createVNode(elementPlus.ElCol, vue.mergeProps({
281
+ "key": item.rowKey
282
+ }, lodash.merge(props.col, item.col)), {
283
+ "default": function _default() {
284
+ return [item.vNode];
285
+ }
286
+ });
287
+ })) ? _slot : {
288
+ "default": function _default() {
289
+ return [_slot];
290
+ }
291
+ });
292
+ };
293
+ }
294
+ });
295
+
296
+ var proFormItemProps = function proFormItemProps() {
297
+ return {
298
+ name: {
299
+ type: [String, Array]
300
+ }
301
+ };
302
+ };
303
+
304
+ var ProFormItem = vue.defineComponent({
305
+ props: _objectSpread2(_objectSpread2({}, elementPlus.ElFormItem.props), proFormItemProps()),
306
+ setup: function setup(props, _ref) {
307
+ var slots = _ref.slots;
308
+ var invalidKeys = lodash.keys(proFormItemProps());
309
+ return function () {
310
+ return vue.createVNode(elementPlus.ElFormItem, vue.mergeProps(lodash.omit.apply(void 0, [props].concat(_toConsumableArray(invalidKeys), ["name", "prop"])), {
311
+ "prop": props.prop || props.name
312
+ }), slots);
313
+ };
314
+ }
315
+ });
185
316
  //emit;
186
317
  var ProForm = vue.defineComponent({
187
- props: _objectSpread2(_objectSpread2({}, elementPlus.ElForm.props), proFormProps()),
318
+ inheritAttrs: false,
319
+ props: _objectSpread2(_objectSpread2(_objectSpread2({}, elementPlus.ElForm.props), lodash.omit(pro.ProForm.props, "model")), lodash.omit(ProGrid.props, "items")),
188
320
  setup: function setup(props, _ref2) {
189
321
  var slots = _ref2.slots,
190
322
  expose = _ref2.expose,
191
- emit = _ref2.emit;
192
- var form = vue.ref();
193
- var formState = props.model || vue.reactive({}); //组件状态相关
194
-
323
+ emit = _ref2.emit,
324
+ attrs = _ref2.attrs;
325
+ var formRef = vue.ref();
326
+ var formState = props.model || vue.reactive({});
195
327
  var showState = props.showState || vue.reactive({});
196
- var readonlyState = props.readonlyState || vue.reactive({});
197
- var disableState = props.disableState || vue.reactive({}); //formState改变情况下,更新 showState,readonlyState,disableState状态
198
-
199
- hooks.useEffect(function () {
200
- if (props.showStateRules) {
201
- lodash.forEach(props.showStateRules, function (fn, key) {
202
- showState[key] = fn(formState);
203
- });
204
- }
205
-
206
- if (props.readonlyStateRules) {
207
- lodash.forEach(props.readonlyStateRules, function (fn, key) {
208
- readonlyState[key] = fn(formState);
209
- });
210
- }
211
328
 
212
- if (props.disableStateRules) {
213
- lodash.forEach(props.disableStateRules, function (fn, key) {
214
- disableState[key] = fn(formState);
215
- });
216
- }
217
- }, formState); //转换为ref对象
218
-
219
- var readonly = vue.computed(function () {
220
- return props.readonly;
221
- });
222
- provideProForm(_objectSpread2({
223
- formRef: form,
224
- formState: formState,
225
- showState: showState,
226
- readonlyState: readonlyState,
227
- disableState: disableState,
228
- //
229
- elementMap: props.elementMap,
230
- //
231
- readonly: readonly
232
- }, props.provideExtra));
233
-
234
- var formRef = function formRef(el) {
329
+ var handleRef = function handleRef(el) {
235
330
  var nexEl = _objectSpread2(_objectSpread2({}, el), {}, {
236
331
  submit: function submit() {
237
332
  var _el$validate;
@@ -251,259 +346,90 @@ var ProForm = vue.defineComponent({
251
346
  });
252
347
 
253
348
  expose(nexEl);
254
- form.value = nexEl;
349
+ formRef.value = nexEl;
255
350
  };
256
351
 
257
- var invalidKeys = lodash.keys(proFormProps());
258
- return function () {
259
- return vue.createVNode(elementPlus.ElForm, vue.mergeProps({
260
- "ref": formRef
261
- }, lodash.omit.apply(void 0, [props].concat(_toConsumableArray(invalidKeys), ["model"])), {
262
- "model": formState
263
- }), slots);
264
- };
265
- }
266
- });
267
-
268
- var proSchemaFormProps = function proSchemaFormProps() {
269
- return {
270
- columns: {
271
- type: Array
272
- },
273
-
274
- /**
275
- * 录入控件集合,通过column->valueType 查找对应的录入组件
276
- */
277
- formElementMap: {
278
- type: Object
279
- },
280
-
281
- /**
282
- * 是否启用rules验证
283
- */
284
- needRules: {
285
- type: Boolean,
286
- "default": true
287
- }
288
- };
289
- };
290
-
291
- var ProSchemaForm = vue.defineComponent({
292
- name: "PSchemaForm",
293
- props: _objectSpread2(_objectSpread2({}, ProForm.props), proSchemaFormProps()),
294
- setup: function setup(props, _ref) {
295
- var slots = _ref.slots,
296
- expose = _ref.expose;
297
- var formItemList = vue.computed(function () {
298
- if (!props.formElementMap || lodash.size(props.formElementMap) <= 0) {
299
- return null;
300
- }
301
-
302
- return lodash.map(props.columns, function (item) {
303
- return pro.getFormItemEl(props.formElementMap, item, props.needRules);
304
- });
305
- });
306
- var invalidKeys = lodash.keys(proSchemaFormProps());
352
+ var originKeys = lodash.keys(lodash.omit(pro.ProForm.props, "model"));
307
353
  return function () {
308
354
  var _slots$default;
309
355
 
310
- return vue.createVNode(ProForm, vue.mergeProps({
311
- "ref": function ref(el) {
312
- return expose(el);
313
- }
314
- }, lodash.omit(props, invalidKeys)), _objectSpread2({
356
+ return vue.createVNode(pro.ProForm, vue.mergeProps(lodash.pick.apply(void 0, [props].concat(_toConsumableArray(originKeys), ["provideExtra"])), {
357
+ "model": formState,
358
+ "showState": showState,
359
+ "provideExtra": _objectSpread2({
360
+ formRef: formRef
361
+ }, props.provideExtra)
362
+ }), {
315
363
  "default": function _default() {
316
- return [formItemList.value, (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
364
+ return [vue.createVNode(elementPlus.ElForm, vue.mergeProps({
365
+ "ref": handleRef
366
+ }, attrs, lodash.omit.apply(void 0, [props].concat(_toConsumableArray(originKeys), ["model"])), {
367
+ "model": formState
368
+ }), {
369
+ "default": function _default() {
370
+ return [props.formElementMap && lodash.size(props.columns) > 0 && vue.createVNode(vue.Fragment, null, [props.row ? vue.createVNode(ProGrid, {
371
+ "row": props.row,
372
+ "col": props.col,
373
+ "items": lodash.map(props.columns, function (item) {
374
+ var vNode = pro.getFormItemEl(props.formElementMap, item, props.needRules);
375
+ return {
376
+ rowKey: pro.getColumnFormItemName(item),
377
+ vNode: vNode,
378
+ col: lodash.get(item, ["extra", "col"])
379
+ };
380
+ })
381
+ }, null) : vue.createVNode(vue.Fragment, null, [lodash.map(props.columns, function (item) {
382
+ return pro.getFormItemEl(props.formElementMap, item, props.needRules);
383
+ })])]), (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
384
+ }
385
+ })];
317
386
  }
318
- }, lodash.omit(slots, "default")));
387
+ });
319
388
  };
320
389
  }
321
390
  });
322
391
 
323
- exports.SearchMode = void 0;
324
-
325
- (function (SearchMode) {
326
- SearchMode["AUTO"] = "AUTO";
327
- SearchMode["MANUAL"] = "MANUAL";
328
- })(exports.SearchMode || (exports.SearchMode = {}));
329
-
330
- var proSearchFormProps = function proSearchFormProps() {
331
- return {
332
- /**
333
- * 初始化触发 onFinish
334
- */
335
- initEmit: {
336
- type: Boolean,
337
- "default": true
338
- },
339
-
340
- /**
341
- * 模式 自动触发或者手动触发 onFinish
342
- */
343
- searchMode: {
344
- type: String,
345
- "default": exports.SearchMode.AUTO
346
- },
347
-
348
- /**
349
- * 需要debounce处理的字段
350
- */
351
- debounceKeys: {
352
- type: Array
353
- },
354
- debounceTime: {
355
- type: Number,
356
- "default": 800
357
- },
358
- //
392
+ var ProSearchForm = vue.defineComponent({
393
+ inheritAttrs: false,
394
+ props: _objectSpread2(_objectSpread2(_objectSpread2({}, lodash.omit(ProForm.props, "inline")), lodash.omit(pro.ProSearchForm.props, "model", "columns")), {}, {
359
395
  inline: {
360
396
  type: Boolean,
361
397
  "default": true
362
398
  }
363
- };
364
- };
365
-
366
- var ProSearchForm = vue.defineComponent({
367
- name: "PSearchForm",
368
- props: _objectSpread2(_objectSpread2({}, lodash.omit(ProSchemaForm.props, "inline")), proSearchFormProps()),
399
+ }),
369
400
  setup: function setup(props, _ref) {
370
401
  var slots = _ref.slots,
371
- emit = _ref.emit,
372
- expose = _ref.expose;
402
+ attrs = _ref.attrs;
403
+ var formRef = vue.ref();
373
404
  var formState = props.model || vue.reactive({});
374
-
375
- var handleFinish = function handleFinish() {
376
- var values = vue.toRaw(formState);
377
- var showValues = pro.getValidValues(values, props.showState, props.showStateRules);
378
- emit("finish", showValues, values);
379
- };
380
-
381
- var debounceFinish = lodash.debounce(function () {
382
- handleFinish();
383
- }, props.debounceTime); //初始化
384
-
385
- hooks.useEffect(function () {
386
- if (props.initEmit) {
387
- handleFinish();
388
- }
389
- }, []);
390
-
391
- var isDebounceDataChange = function isDebounceDataChange(state, prevState, debounceKeys) {
392
- return lodash.some(debounceKeys, function (key) {
393
- return lodash.get(state, key) !== lodash.get(prevState, key);
394
- });
395
- }; //监听
396
-
397
-
398
- hooks.useEffect(function (state, prevState) {
399
- if (props.searchMode !== exports.SearchMode.AUTO) {
400
- return;
401
- } //如果改变的值中包括debounceKeys中注册的 延时触发
402
-
403
-
404
- if (props.debounceKeys && lodash.size(props.debounceKeys) > 0 && isDebounceDataChange(state, prevState, props.debounceKeys)) {
405
- debounceFinish();
406
- return;
407
- }
408
-
409
- handleFinish();
410
- }, function () {
411
- return lodash.clone(formState);
412
- });
413
- var invalidKeys = lodash.keys(proSearchFormProps());
405
+ var originKeys = lodash.keys(lodash.omit(pro.ProSearchForm.props, "model", "columns"));
414
406
  return function () {
415
- return vue.createVNode(ProSchemaForm, vue.mergeProps({
416
- "ref": function ref(el) {
417
- return expose(el);
418
- },
419
- "inline": props.inline
420
- }, lodash.omit.apply(void 0, [props].concat(_toConsumableArray(invalidKeys), ["model"])), {
421
- "needRules": false,
422
- "model": formState
423
- }), slots);
407
+ return vue.createVNode(vue.Fragment, null, [vue.createVNode(ProForm, vue.mergeProps({
408
+ "ref": formRef
409
+ }, attrs, lodash.omit.apply(void 0, [props].concat(_toConsumableArray(originKeys), ["needRules", "model"])), {
410
+ "model": formState,
411
+ "needRules": false
412
+ }), slots), vue.createVNode(pro.ProSearchForm, vue.mergeProps(lodash.pick(props, originKeys), {
413
+ "model": formState,
414
+ "columns": props.columns,
415
+ "onFinish": function onFinish() {
416
+ var _formRef$value;
417
+
418
+ (_formRef$value = formRef.value) === null || _formRef$value === void 0 ? void 0 : _formRef$value.submit();
419
+ }
420
+ }), null)]);
424
421
  };
425
422
  }
426
423
  });
427
424
 
428
- var proFormItemProps = function proFormItemProps() {
425
+ var createFormItemComponent = pro.createFormItemCompFn(ProFormItem, function (value, setValue, disabled) {
429
426
  return {
430
- readonly: {
431
- type: Boolean,
432
- "default": undefined
433
- },
434
- fieldProps: {
435
- type: Object
436
- },
437
- showProps: {
438
- type: Object
439
- }
427
+ modelValue: value,
428
+ "onUpdate:modelValue": setValue,
429
+ clearable: true,
430
+ disabled: disabled
440
431
  };
441
- };
442
-
443
- var createFormItemComponent = function createFormItemComponent(_ref) {
444
- var InputComp = _ref.InputComp,
445
- valueType = _ref.valueType,
446
- name = _ref.name;
447
- return vue.defineComponent({
448
- name: name,
449
- props: _objectSpread2(_objectSpread2({}, ProFormItem.props), proFormItemProps()),
450
- setup: function setup(props, _ref2) {
451
- var slots = _ref2.slots;
452
-
453
- var _useProForm = useProForm(),
454
- formState = _useProForm.formState,
455
- showState = _useProForm.showState,
456
- readonlyState = _useProForm.readonlyState,
457
- disableState = _useProForm.disableState,
458
- formReadonly = _useProForm.readonly,
459
- elementMap = _useProForm.elementMap;
460
-
461
- var formListCtx = useProFormList(); //优先级 props.readonly > readonlyState > formContext.readonly
462
-
463
- var readonly = vue.computed(function () {
464
- if (lodash.isBoolean(props.readonly)) {
465
- return props.readonly;
466
- } else if (lodash.isBoolean(readonlyState[props.name])) {
467
- return readonlyState[props.name];
468
- }
469
-
470
- return formReadonly.value;
471
- });
472
- var nameList = pro.convertPathToList(props.name);
473
- var path = formListCtx !== null && formListCtx !== void 0 && formListCtx.pathList ? [].concat(_toConsumableArray(formListCtx.pathList), _toConsumableArray(nameList)) : nameList;
474
- var invalidKeys = lodash.keys(proFormItemProps());
475
- return function () {
476
- var show = lodash.get(showState, props.name);
477
-
478
- if (lodash.isBoolean(show) && !show) {
479
- return null;
480
- }
481
-
482
- var value = lodash.get(formState, path); //valueType对应的展示组件
483
-
484
- var ShowComp = lodash.get(elementMap, valueType);
485
- return vue.createVNode(ProFormItem, vue.mergeProps(lodash.omit.apply(void 0, [props].concat(_toConsumableArray(invalidKeys), ["name"])), {
486
- "name": path
487
- }), {
488
- "default": function _default() {
489
- return [readonly.value ? vue.createVNode(vue.Fragment, null, [ShowComp ? vue.createVNode(ShowComp, vue.mergeProps({
490
- "value": value
491
- }, props.fieldProps, {
492
- "showProps": props.showProps
493
- }), slots) : vue.createVNode("span", null, [value])]) : vue.createVNode(InputComp, vue.mergeProps({
494
- "modelValue": value,
495
- "onUpdate:modelValue": function onUpdateModelValue(v) {
496
- lodash.set(formState, path, v);
497
- },
498
- "clearable": true,
499
- "disabled": lodash.get(disableState, props.name)
500
- }, props.fieldProps), slots)];
501
- }
502
- });
503
- };
504
- }
505
- });
506
- };
432
+ });
507
433
 
508
434
  var proSelectProps = function proSelectProps() {
509
435
  return {
@@ -594,7 +520,7 @@ var ProSubmitButton = vue.defineComponent({
594
520
  var slots = _ref.slots,
595
521
  emit = _ref.emit;
596
522
 
597
- var _useProForm = useProForm(),
523
+ var _useProForm = pro.useProForm(),
598
524
  formRef = _useProForm.formRef;
599
525
 
600
526
  var handleClick = function handleClick(e) {
@@ -612,25 +538,6 @@ var ProSubmitButton = vue.defineComponent({
612
538
  }
613
539
  });
614
540
 
615
- var FormListProvider = vue.defineComponent({
616
- props: {
617
- pathList: {
618
- type: Array
619
- }
620
- },
621
- setup: function setup(props, _ref) {
622
- var slots = _ref.slots;
623
- provideProFormList({
624
- pathList: props.pathList
625
- });
626
- return function () {
627
- var _slots$default;
628
-
629
- return (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots);
630
- };
631
- }
632
- });
633
-
634
541
  var proFormListProps = function proFormListProps() {
635
542
  return {
636
543
  addButtonText: {
@@ -640,10 +547,12 @@ var proFormListProps = function proFormListProps() {
640
547
  addButtonProps: {
641
548
  type: Object
642
549
  },
643
- //每行默认id
644
- rowKey: {
550
+ minusButtonText: {
645
551
  type: String,
646
- "default": "id"
552
+ "default": "删除"
553
+ },
554
+ minusButtonProps: {
555
+ type: Object
647
556
  }
648
557
  };
649
558
  };
@@ -651,352 +560,39 @@ var proFormListProps = function proFormListProps() {
651
560
  var ProFormList = vue.defineComponent({
652
561
  name: "PFormList",
653
562
  props: _objectSpread2(_objectSpread2({}, ProFormItem.props), proFormListProps()),
654
- setup: function setup(props, _ref2) {
655
- var slots = _ref2.slots;
656
-
657
- var _useProForm = useProForm(),
658
- formState = _useProForm.formState,
659
- readonly = _useProForm.readonly;
660
-
661
- var formListCtx = useProFormList();
662
- var nameList = pro.convertPathToList(props.prop);
663
- var path = formListCtx !== null && formListCtx !== void 0 && formListCtx.pathList ? [].concat(_toConsumableArray(formListCtx.pathList), _toConsumableArray(nameList)) : nameList;
664
-
665
- var handleAdd = function handleAdd() {
666
- var targetList = lodash.get(formState, path);
667
-
668
- if (!lodash.isArray(targetList)) {
669
- targetList = [];
670
- }
671
-
672
- targetList.push(_defineProperty({}, props.rowKey, new Date().valueOf()));
673
- lodash.set(formState, path, targetList);
674
- };
675
-
676
- var handleRemove = function handleRemove(index) {
677
- var targetList = lodash.get(formState, path);
678
-
679
- if (lodash.size(targetList) <= 0) {
680
- return;
681
- }
682
-
683
- targetList.splice(index, 1);
684
- };
685
-
563
+ setup: function setup(props, _ref) {
564
+ var slots = _ref.slots;
565
+ var originKeys = lodash.keys(pro.ProFormList.props);
686
566
  var invalidKeys = lodash.keys(proFormListProps());
687
567
  return function () {
688
- return vue.createVNode(ProFormItem, lodash.omit(props, invalidKeys), {
568
+ return vue.createVNode(ProFormItem, vue.mergeProps(lodash.omit.apply(void 0, [props].concat(_toConsumableArray(originKeys), _toConsumableArray(invalidKeys))), {
569
+ "name": props.name
570
+ }), {
689
571
  "default": function _default() {
690
- return [lodash.map(lodash.get(formState, path), function (item, index) {
691
- var _slots$default2;
692
-
693
- return vue.createVNode(FormListProvider, {
694
- "key": index,
695
- "pathList": [].concat(_toConsumableArray(path), [index])
696
- }, {
697
- "default": function _default() {
698
- return [vue.createVNode("div", {
699
- "class": "pro-form-list-item"
700
- }, [(_slots$default2 = slots["default"]) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots), !readonly.value && vue.createVNode("div", {
701
- "class": "pro-form-list-item-minus",
702
- "onClick": function onClick() {
703
- return handleRemove(index);
704
- }
705
- }, [slots.minus ? slots.minus() : vue.createVNode(elementPlus.ElButton, {
706
- "link": true
707
- }, {
708
- "default": function _default() {
709
- return [vue.createTextVNode("\u5220\u9664")];
710
- }
711
- })])])];
712
- }
713
- });
714
- }), !readonly.value && vue.createVNode("div", {
715
- "class": "pro-form-list-item-add",
716
- "onClick": handleAdd
717
- }, [slots.add ? slots.add() : vue.createVNode(elementPlus.ElButton, vue.mergeProps({
718
- "type": "primary"
719
- }, props.addButtonProps), {
720
- "default": function _default() {
721
- return [props.addButtonText];
722
- }
723
- })])];
724
- }
725
- });
726
- };
727
- }
728
- });
729
-
730
- var proTableProps = function proTableProps() {
731
- return {
732
- //操作栏
733
- operate: {
734
- type: Object
735
- },
736
- //默认空字符串
737
- columnEmptyText: {
738
- type: String
739
- },
740
-
741
- /**
742
- * 公共column,会merge到columns item中
743
- */
744
- column: {
745
- type: Object
746
- },
747
- //
748
- columns: {
749
- type: Array
750
- },
751
-
752
- /**
753
- * 展示控件集合,readonly模式下使用这些组件渲染
754
- */
755
- elementMap: {
756
- type: Object
757
- },
758
-
759
- /**
760
- * loading
761
- */
762
- loading: {
763
- type: Boolean,
764
- "default": false
765
- }
766
- };
767
- };
768
-
769
- var ProTable = vue.defineComponent({
770
- props: _objectSpread2(_objectSpread2({}, elementPlus.ElTable.props), proTableProps()),
771
- setup: function setup(props, _ref) {
772
- var slots = _ref.slots,
773
- expose = _ref.expose;
774
- var columns = vue.computed(function () {
775
- //根据valueType选择对应的展示组件
776
- var columns = lodash.map(props.columns, function (item) {
777
- //merge从共item
778
- var nextItem = lodash.merge(props.column, item);
779
-
780
- if (!item.customRender || !item.formatter) {
781
- nextItem.customRender = function (_ref2) {
782
- var text = _ref2.text;
783
- return pro.getItemEl(props.elementMap, _objectSpread2(_objectSpread2({}, item), {}, {
784
- showProps: _objectSpread2(_objectSpread2({}, item.showProps), {}, {
785
- content: props.columnEmptyText
786
- })
787
- }), text) || text || props.columnEmptyText;
788
- };
789
- }
790
-
791
- return nextItem;
792
- });
793
- var operate = props.operate; //处理operate
794
-
795
- if (operate && lodash.size(operate.items) > 0) {
796
- //将itemState补充的信息拼到item中
797
- var completeItems = lodash.map(operate.items, function (i) {
798
- return _objectSpread2(_objectSpread2({}, i), lodash.get(operate.itemState, i.value));
799
- }); //排序
800
-
801
- var operateList = lodash.sortBy(completeItems, function (item) {
802
- return item.sort;
803
- });
804
- columns.push(_objectSpread2(_objectSpread2({
805
- title: "操作",
806
- valueType: "option",
807
- fixed: "right"
808
- }, props.column), {}, {
809
- customRender: function customRender(_ref3) {
810
- var record = _ref3.record;
811
- var validList = lodash.filter(operateList, function (item) {
812
- if (lodash.isFunction(item.show)) {
813
- return item.show(record);
814
- }
815
-
816
- if (item.show === false) {
817
- return false;
818
- }
819
-
820
- return true;
821
- });
822
- return vue.createVNode("div", {
823
- "class": "pro-table-operate"
824
- }, [lodash.map(validList, function (item) {
825
- // 自定义
826
- if (lodash.isFunction(item.element)) {
827
- return item.element(record, item);
828
- }
829
-
830
- return vue.createVNode(elementPlus.ElButton, {
831
- "key": item.value,
832
- "type": "primary",
833
- "link": true,
834
- "disabled": lodash.isFunction(item.disabled) ? item.disabled(record) : item.disabled,
835
- "onClick": function onClick() {
836
- var _item$onClick;
837
-
838
- (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, record);
572
+ return [vue.createVNode(pro.ProFormList, vue.mergeProps(lodash.pick(props, originKeys), {
573
+ "name": props.name
574
+ }), _objectSpread2({
575
+ itemMinus: function itemMinus() {
576
+ return vue.createVNode(elementPlus.ElButton, vue.mergeProps({
577
+ "link": true
578
+ }, props.minusButtonProps), {
579
+ "default": function _default() {
580
+ return [props.minusButtonText];
839
581
  }
840
- }, {
582
+ });
583
+ },
584
+ add: function add() {
585
+ return vue.createVNode(elementPlus.ElButton, vue.mergeProps({
586
+ "type": "primary"
587
+ }, props.addButtonProps), {
841
588
  "default": function _default() {
842
- return [item.label];
589
+ return [props.addButtonText];
843
590
  }
844
591
  });
845
- })]);
846
- }
847
- }, operate.column));
848
- }
849
-
850
- return columns;
851
- });
852
- var invalidKeys = lodash.keys(proTableProps());
853
- return function () {
854
- var _slots$default;
855
-
856
- return vue.withDirectives(vue.createVNode(elementPlus.ElTable, vue.mergeProps({
857
- "ref": function ref(el) {
858
- expose(el);
859
- }
860
- }, lodash.omit(props, invalidKeys)), _objectSpread2({
861
- "default": function _default() {
862
- return [lodash.map(columns.value, function (item) {
863
- var formatter = function formatter(record, column, value, index) {
864
- if (item.formatter) {
865
- return item.formatter(record, column, value, index);
866
- }
867
-
868
- if (item.customRender) {
869
- return item.customRender({
870
- value: value,
871
- text: value,
872
- record: record,
873
- column: column
874
- });
875
- }
876
-
877
- return null;
878
- };
879
-
880
- return vue.createVNode(elementPlus.ElTableColumn, vue.mergeProps({
881
- "key": item.dataIndex || item.prop
882
- }, lodash.omit(item, "title", "label", "renderHeader", "prop", "dataIndex", "formatter", "customRender"), {
883
- "label": vue.isVNode(item.title) ? undefined : item.title || item.label,
884
- "renderHeader": vue.isVNode(item.title) ? function () {
885
- return item.title;
886
- } : undefined,
887
- "prop": item.dataIndex || item.prop,
888
- "formatter": item.formatter || item.customRender ? formatter : undefined
889
- }), null);
890
- }), (_slots$default = slots["default"]) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)];
891
- }
892
- }, lodash.omit(slots, "default"))), [[vue.resolveDirective("loading"), props.loading]]);
893
- };
894
- }
895
- });
896
-
897
- var defaultPage = {
898
- page: 1,
899
- pageSize: 10
900
- };
901
-
902
- var proListProps = function proListProps() {
903
- return {
904
- /**
905
- * extra 是否放到SearchForm中
906
- */
907
- extraInSearch: {
908
- type: Boolean,
909
- "default": undefined
910
- },
911
- //search
912
- searchProps: {
913
- type: Object
914
- },
915
- //table
916
- tableProps: {
917
- type: Object
918
- },
919
- //pagination
920
- paginationProps: {
921
- type: Object
922
- },
923
- //pageState
924
- pageState: {
925
- type: Object
926
- }
927
- };
928
- };
929
-
930
- var ProList = vue.defineComponent({
931
- props: _objectSpread2({}, proListProps()),
932
- setup: function setup(props, _ref) {
933
- var _props$searchProps;
934
-
935
- var slots = _ref.slots,
936
- emit = _ref.emit;
937
-
938
- /******************* search pagination ********************/
939
- var searchState = ((_props$searchProps = props.searchProps) === null || _props$searchProps === void 0 ? void 0 : _props$searchProps.model) || vue.reactive({});
940
- var pageState = props.pageState || vue.reactive(_objectSpread2({}, defaultPage));
941
-
942
- var handleSearch = function handleSearch() {
943
- emit("list", _objectSpread2(_objectSpread2({}, searchState), pageState));
944
- }; //页数重置1 且搜索
945
-
946
-
947
- var executeSearchWithResetPage = function executeSearchWithResetPage() {
948
- pageState.page = 1;
949
- handleSearch();
950
- }; //无SearchForm组件 初始化 触发
951
-
952
-
953
- hooks.useEffect(function () {
954
- var _props$searchProps2, _props$searchProps3;
955
-
956
- if (lodash.size((_props$searchProps2 = props.searchProps) === null || _props$searchProps2 === void 0 ? void 0 : _props$searchProps2.columns) <= 0 && ((_props$searchProps3 = props.searchProps) === null || _props$searchProps3 === void 0 ? void 0 : _props$searchProps3.initEmit) !== false) {
957
- handleSearch();
958
- }
959
- }, []); //无SearchForm组件 订阅searchState
960
-
961
- hooks.useWatch(function () {
962
- var _props$searchProps4;
963
-
964
- if (lodash.size((_props$searchProps4 = props.searchProps) === null || _props$searchProps4 === void 0 ? void 0 : _props$searchProps4.columns) <= 0) {
965
- executeSearchWithResetPage();
966
- }
967
- }, searchState);
968
- return function () {
969
- var _slots$divide, _slots$divide2;
970
-
971
- var searchProps = props.searchProps;
972
- var tableProps = props.tableProps;
973
- var paginationProps = props.paginationProps; //操作按钮
974
-
975
- var extra = slots.extra ? vue.createVNode("div", {
976
- "class": "pro-list-search"
977
- }, [slots.extra()]) : null; //分页参数
978
-
979
- var pagination = _objectSpread2(_objectSpread2({}, paginationProps), {}, {
980
- currentPage: pageState.page,
981
- pageSize: pageState.pageSize,
982
- onSizeChange: function onSizeChange(pageSize) {
983
- pageState.pageSize = pageSize;
984
- handleSearch();
985
- },
986
- onCurrentChange: function onCurrentChange(current) {
987
- pageState.page = current;
988
- handleSearch();
592
+ }
593
+ }, slots))];
989
594
  }
990
595
  });
991
-
992
- return vue.createVNode(vue.Fragment, null, [lodash.size(searchProps === null || searchProps === void 0 ? void 0 : searchProps.columns) > 0 && vue.createVNode(ProSearchForm, vue.mergeProps(searchProps, {
993
- "model": searchState,
994
- "onFinish": executeSearchWithResetPage
995
- }), {
996
- "default": function _default() {
997
- return [props.extraInSearch && extra];
998
- }
999
- }), (_slots$divide = slots.divide) === null || _slots$divide === void 0 ? void 0 : _slots$divide.call(slots), (lodash.size(searchProps === null || searchProps === void 0 ? void 0 : searchProps.columns) <= 0 || !props.extraInSearch) && extra, slots["default"] ? slots["default"]() : vue.createVNode(ProTable, lodash.omit(tableProps, "slots"), tableProps === null || tableProps === void 0 ? void 0 : tableProps.slots), (_slots$divide2 = slots.divide2) === null || _slots$divide2 === void 0 ? void 0 : _slots$divide2.call(slots), lodash.isNumber(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.total) && paginationProps.total > 0 && vue.createVNode(vue.Fragment, null, [slots.pagination ? slots.pagination(pagination) : vue.createVNode(elementPlus.ElPagination, pagination, null)])]);
1000
596
  };
1001
597
  }
1002
598
  });
@@ -1118,7 +714,7 @@ var proCurdFormProps = function proCurdFormProps() {
1118
714
  };
1119
715
 
1120
716
  var ProCurdForm = vue.defineComponent({
1121
- props: _objectSpread2(_objectSpread2({}, ProSchemaForm.props), proCurdFormProps()),
717
+ props: _objectSpread2(_objectSpread2({}, ProForm.props), proCurdFormProps()),
1122
718
  setup: function setup(props, _ref4) {
1123
719
  var slots = _ref4.slots;
1124
720
 
@@ -1136,14 +732,14 @@ var ProCurdForm = vue.defineComponent({
1136
732
  //edit
1137
733
  sendCurdEvent({
1138
734
  action: pro.CurdAction.EDIT,
1139
- type: "execute",
735
+ type: pro.CurdSubAction.EXECUTE,
1140
736
  values: values
1141
737
  });
1142
738
  } else {
1143
739
  //add
1144
740
  sendCurdEvent({
1145
741
  action: pro.CurdAction.ADD,
1146
- type: "execute",
742
+ type: pro.CurdSubAction.EXECUTE,
1147
743
  values: values
1148
744
  });
1149
745
  }
@@ -1152,11 +748,10 @@ var ProCurdForm = vue.defineComponent({
1152
748
  return function () {
1153
749
  var _slots$default;
1154
750
 
1155
- return vue.createVNode(ProSchemaForm, vue.mergeProps({
1156
- "elementMap": elementMap,
1157
- "formElementMap": formElementMap
1158
- }, props, {
1159
- "columns": formColumns,
751
+ return vue.createVNode(ProForm, vue.mergeProps(lodash.omit(props, "elementMap", "formElementMap"), {
752
+ "elementMap": props.elementMap || elementMap,
753
+ "formElementMap": props.formElementMap || formElementMap,
754
+ "columns": formColumns.value,
1160
755
  "model": curdState.detailData,
1161
756
  "readonly": curdState.mode === pro.CurdCurrentMode.DETAIL,
1162
757
  "hideRequiredAsterisk": curdState.mode === pro.CurdCurrentMode.DETAIL,
@@ -1175,7 +770,7 @@ var ProCurdFormConnect = vue.defineComponent({
1175
770
  formProps = _useProCurd5.formProps;
1176
771
 
1177
772
  return function () {
1178
- return vue.createVNode(ProCurdForm, lodash.omit(formProps, "slots"), lodash.get(formProps, "slots"));
773
+ return vue.createVNode(ProCurdForm, lodash.omit(formProps === null || formProps === void 0 ? void 0 : formProps.value, "slots"), lodash.get(formProps === null || formProps === void 0 ? void 0 : formProps.value, "slots"));
1179
774
  };
1180
775
  }
1181
776
  });
@@ -1203,7 +798,21 @@ var ProCurdList = vue.defineComponent({
1203
798
 
1204
799
 
1205
800
  var prepareTableItem = function prepareTableItem(action) {
1206
- return _objectSpread2(_objectSpread2({}, lodash.pick(getOperate(action), "label", "element", "show", "disabled", "onClick", "sort")), {}, {
801
+ var item = getOperate(action);
802
+ return _objectSpread2(_objectSpread2({}, lodash.pick(item, "label", "element", "disabled", "sort")), {}, {
803
+ show: !lodash.isUndefined(item === null || item === void 0 ? void 0 : item.show) ? item === null || item === void 0 ? void 0 : item.show : false,
804
+ onClick: function onClick(record) {
805
+ if (item !== null && item !== void 0 && item.onClick) {
806
+ item.onClick(record);
807
+ return;
808
+ }
809
+
810
+ sendCurdEvent({
811
+ action: action,
812
+ type: pro.CurdSubAction.EMIT,
813
+ record: record
814
+ });
815
+ },
1207
816
  value: action
1208
817
  });
1209
818
  }; //table操作栏 items
@@ -1211,14 +820,14 @@ var ProCurdList = vue.defineComponent({
1211
820
 
1212
821
  var tableOperateItems = [prepareTableItem(pro.CurdAction.DETAIL), prepareTableItem(pro.CurdAction.EDIT), prepareTableItem(pro.CurdAction.DELETE)];
1213
822
  return function () {
1214
- var _tableProps$operate, _tableProps$operate2, _curdState$listData, _curdState$listData2;
823
+ var _curdState$listData, _curdState$listData2;
1215
824
 
1216
825
  var tableProps = props.tableProps;
1217
826
  return vue.createVNode(ProList, vue.mergeProps({
1218
827
  "onList": function onList(values) {
1219
828
  sendCurdEvent({
1220
829
  action: pro.CurdAction.LIST,
1221
- type: "emit",
830
+ type: pro.CurdSubAction.EMIT,
1222
831
  values: values
1223
832
  });
1224
833
  }
@@ -1231,8 +840,32 @@ var ProCurdList = vue.defineComponent({
1231
840
  "tableProps": _objectSpread2(_objectSpread2({
1232
841
  elementMap: elementMap
1233
842
  }, tableProps), {}, {
1234
- operate: _objectSpread2(_objectSpread2({}, tableProps === null || tableProps === void 0 ? void 0 : tableProps.operate), {}, {
1235
- items: tableProps !== null && tableProps !== void 0 && (_tableProps$operate = tableProps.operate) !== null && _tableProps$operate !== void 0 && _tableProps$operate.items ? [].concat(tableOperateItems, _toConsumableArray(tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$operate2 = tableProps.operate) === null || _tableProps$operate2 === void 0 ? void 0 : _tableProps$operate2.items)) : tableOperateItems
843
+ operate: lodash.mergeWith({
844
+ items: tableOperateItems
845
+ }, tableProps === null || tableProps === void 0 ? void 0 : tableProps.operate, function (objValue, srcValue) {
846
+ if (lodash.isArray(objValue)) {
847
+ if (lodash.isArray(srcValue)) {
848
+ //合并
849
+ return lodash.concat(objValue, lodash.map(srcValue, function (item) {
850
+ var nextItem = _objectSpread2({}, item);
851
+
852
+ if (!item.onClick) {
853
+ nextItem.onClick = function (record) {
854
+ sendCurdEvent({
855
+ action: pro.CurdAction.LIST,
856
+ type: "operate-".concat(item.value),
857
+ record: record
858
+ });
859
+ };
860
+ }
861
+
862
+ return nextItem;
863
+ }));
864
+ } else {
865
+ //使用curd默认
866
+ return objValue;
867
+ }
868
+ }
1236
869
  }),
1237
870
  columns: tableColumns.value,
1238
871
  loading: curdState.listLoading,
@@ -1251,7 +884,7 @@ var ProCurdListConnect = vue.defineComponent({
1251
884
  listProps = _useProCurd2.listProps;
1252
885
 
1253
886
  return function () {
1254
- return vue.createVNode(ProCurdList, lodash.omit(listProps, "slots"), lodash.get(listProps, "slots"));
887
+ return vue.createVNode(ProCurdList, lodash.omit(listProps === null || listProps === void 0 ? void 0 : listProps.value, "slots"), lodash.get(listProps === null || listProps === void 0 ? void 0 : listProps.value, "slots"));
1255
888
  };
1256
889
  }
1257
890
  });
@@ -1302,7 +935,64 @@ var ProCurdDescConnect = vue.defineComponent({
1302
935
  descProps = _useProCurd2.descProps;
1303
936
 
1304
937
  return function () {
1305
- return vue.createVNode(ProCurdList, lodash.omit(descProps, "slots"), lodash.get(descProps, "slots"));
938
+ return vue.createVNode(ProCurdList, lodash.omit(descProps === null || descProps === void 0 ? void 0 : descProps.value, "slots"), lodash.get(descProps === null || descProps === void 0 ? void 0 : descProps.value, "slots"));
939
+ };
940
+ }
941
+ });
942
+
943
+ var ProCurdModal = vue.defineComponent({
944
+ props: _objectSpread2({}, elementPlus.ElDialog.props),
945
+ setup: function setup(props, _ref) {
946
+ var slots = _ref.slots;
947
+
948
+ var _useProCurd = pro.useProCurd(),
949
+ curdState = _useProCurd.curdState,
950
+ getOperate = _useProCurd.getOperate; //根据当前模式展示不同的Title
951
+
952
+
953
+ var getTitle = function getTitle() {
954
+ var _getOperate, _getOperate2, _getOperate3;
955
+
956
+ switch (curdState.mode) {
957
+ case pro.CurdAction.ADD:
958
+ return (_getOperate = getOperate(pro.CurdAction.ADD)) === null || _getOperate === void 0 ? void 0 : _getOperate.label;
959
+
960
+ case pro.CurdAction.EDIT:
961
+ return (_getOperate2 = getOperate(pro.CurdAction.EDIT)) === null || _getOperate2 === void 0 ? void 0 : _getOperate2.label;
962
+
963
+ case pro.CurdAction.DETAIL:
964
+ return (_getOperate3 = getOperate(pro.CurdAction.DETAIL)) === null || _getOperate3 === void 0 ? void 0 : _getOperate3.label;
965
+ }
966
+ };
967
+
968
+ var handleCancel = function handleCancel() {
969
+ curdState.mode = undefined;
970
+ hooks.setReactiveValue(curdState.detailData, {});
971
+ curdState.detailLoading = false;
972
+ curdState.addAction = undefined;
973
+ };
974
+
975
+ return function () {
976
+ return vue.createVNode(elementPlus.ElDialog, vue.mergeProps({
977
+ "destroyOnClose": true,
978
+ "title": getTitle(),
979
+ "modelValue": !!curdState.mode,
980
+ "onClose": handleCancel
981
+ }, props), slots);
982
+ };
983
+ }
984
+ });
985
+ var ProCurdModalConnect = vue.defineComponent({
986
+ setup: function setup() {
987
+ var _useProCurd2 = pro.useProCurd(),
988
+ modalProps = _useProCurd2.modalProps;
989
+
990
+ return function () {
991
+ return vue.createVNode(ProCurdModal, lodash.omit(modalProps === null || modalProps === void 0 ? void 0 : modalProps.value, "slots"), _objectSpread2({
992
+ "default": function _default() {
993
+ return [vue.createVNode(ProCurdFormConnect, null, null)];
994
+ }
995
+ }, lodash.get(modalProps === null || modalProps === void 0 ? void 0 : modalProps.value, "slots")));
1306
996
  };
1307
997
  }
1308
998
  });
@@ -1315,6 +1005,8 @@ exports.ProCurdForm = ProCurdForm;
1315
1005
  exports.ProCurdFormConnect = ProCurdFormConnect;
1316
1006
  exports.ProCurdList = ProCurdList;
1317
1007
  exports.ProCurdListConnect = ProCurdListConnect;
1008
+ exports.ProCurdModal = ProCurdModal;
1009
+ exports.ProCurdModalConnect = ProCurdModalConnect;
1318
1010
  exports.ProForm = ProForm;
1319
1011
  exports.ProFormCascader = ProFormCascader;
1320
1012
  exports.ProFormCheckbox = ProFormCheckbox;
@@ -1328,16 +1020,12 @@ exports.ProFormText = ProFormText;
1328
1020
  exports.ProFormTextNumber = ProFormTextNumber;
1329
1021
  exports.ProFormTimePicker = ProFormTimePicker;
1330
1022
  exports.ProFormTreeSelect = ProFormTreeSelect;
1023
+ exports.ProGrid = ProGrid;
1331
1024
  exports.ProList = ProList;
1332
1025
  exports.ProOperateButton = ProOperateButton;
1333
- exports.ProSchemaForm = ProSchemaForm;
1334
1026
  exports.ProSearchForm = ProSearchForm;
1335
1027
  exports.ProSelect = ProSelect;
1336
1028
  exports.ProSubmitButton = ProSubmitButton;
1337
1029
  exports.ProTable = ProTable;
1338
1030
  exports.createFormItemComponent = createFormItemComponent;
1339
1031
  exports.defaultPage = defaultPage;
1340
- exports.provideProForm = provideProForm;
1341
- exports.provideProFormList = provideProFormList;
1342
- exports.useProForm = useProForm;
1343
- exports.useProFormList = useProFormList;