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