@tmagic/form 1.6.0 → 1.7.0-beta.0
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/style.css +29 -3
- package/dist/tmagic-form.js +1788 -1581
- package/dist/tmagic-form.umd.cjs +1830 -1619
- package/package.json +6 -6
- package/src/Form.vue +18 -5
- package/src/containers/Container.vue +109 -134
- package/src/containers/Fieldset.vue +31 -7
- package/src/containers/FlexLayout.vue +59 -0
- package/src/containers/Tabs.vue +11 -1
- package/src/fields/Cascader.vue +25 -16
- package/src/fields/Checkbox.vue +3 -3
- package/src/fields/CheckboxGroup.vue +1 -1
- package/src/fields/ColorPicker.vue +2 -2
- package/src/fields/Date.vue +2 -2
- package/src/fields/DateTime.vue +2 -2
- package/src/fields/Daterange.vue +2 -2
- package/src/fields/Number.vue +2 -2
- package/src/fields/NumberRange.vue +6 -6
- package/src/fields/RadioGroup.vue +18 -16
- package/src/fields/Select.vue +2 -2
- package/src/fields/Switch.vue +2 -2
- package/src/fields/Text.vue +21 -9
- package/src/fields/Textarea.vue +2 -2
- package/src/fields/Time.vue +2 -2
- package/src/fields/Timerange.vue +2 -2
- package/src/index.ts +5 -2
- package/src/table/ActionsColumn.vue +97 -0
- package/src/table/SortColumn.vue +101 -0
- package/src/table/Table.vue +170 -0
- package/src/table/type.ts +18 -0
- package/src/table/useAdd.ts +111 -0
- package/src/table/useFullscreen.ts +28 -0
- package/src/table/useImport.ts +68 -0
- package/src/table/usePagination.ts +30 -0
- package/src/table/useSelection.ts +34 -0
- package/src/table/useSortable.ts +48 -0
- package/src/table/useTableColumns.ts +194 -0
- package/src/theme/container.scss +17 -0
- package/src/theme/form.scss +15 -3
- package/src/theme/text.scss +6 -0
- package/src/utils/form.ts +56 -2
- package/types/index.d.ts +103 -56
- package/src/containers/Table.vue +0 -681
package/dist/tmagic-form.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock,
|
|
1
|
+
import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createBlock, createCommentVNode, mergeProps, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, renderList, createTextVNode, toDisplayString, readonly, withDirectives, vShow, renderSlot, getCurrentInstance, createSlots, reactive, onBeforeUnmount, vModelText, useTemplateRef, provide, shallowRef, onBeforeMount, nextTick, resolveDirective, withModifiers, Teleport, h } from 'vue';
|
|
2
2
|
import { WarningFilled, CaretBottom, CaretRight, Delete, DocumentCopy, CaretTop, Position, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
|
|
3
3
|
import { cloneDeep, isEqual, isEmpty, debounce } from 'lodash-es';
|
|
4
|
-
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep,
|
|
5
|
-
import {
|
|
4
|
+
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessage, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, useZIndex, TMagicTable, TMagicUpload, TMagicPagination, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
|
|
5
|
+
import { getValueByKeyPath, setValueByKeyPath, isNumber, asyncLoadJs } from '@tmagic/utils';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import utc from 'dayjs/plugin/utc';
|
|
8
|
-
import Sortable from 'sortablejs';
|
|
9
8
|
import { createPopper } from '@popperjs/core';
|
|
9
|
+
import Sortable from 'sortablejs';
|
|
10
10
|
export * from '@tmagic/form-schema';
|
|
11
11
|
|
|
12
12
|
const isTableSelect = (type) => typeof type === "string" && ["table-select", "tableSelect"].includes(type);
|
|
@@ -38,8 +38,10 @@ const setValue = (mForm, value, initValue2, item) => {
|
|
|
38
38
|
value[name] = getDefaultValue(mForm, item);
|
|
39
39
|
}
|
|
40
40
|
if (type === "fieldset" && checkbox) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const checkboxName = typeof checkbox === "object" && typeof checkbox.name === "string" ? checkbox.name : "value";
|
|
42
|
+
const checkboxFalseValue = typeof checkbox === "object" && typeof checkbox.falseValue !== "undefined" ? checkbox.falseValue : 0;
|
|
43
|
+
if (name && typeof value[name] === "object") {
|
|
44
|
+
value[name][checkboxName] = typeof initValue2[name] === "object" ? initValue2[name][checkboxName] || checkboxFalseValue : checkboxFalseValue;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
};
|
|
@@ -69,6 +71,16 @@ const initValueItem = function(mForm, item, initValue2, value) {
|
|
|
69
71
|
return createValues(mForm, items, initValue2, value);
|
|
70
72
|
}
|
|
71
73
|
setValue(mForm, value, initValue2, item);
|
|
74
|
+
if (type === "table") {
|
|
75
|
+
if (item.defautSort) {
|
|
76
|
+
sortChange(value[name], item.defautSort);
|
|
77
|
+
} else if (item.defaultSort) {
|
|
78
|
+
sortChange(value[name], item.defaultSort);
|
|
79
|
+
}
|
|
80
|
+
if (item.sort && item.sortKey) {
|
|
81
|
+
value[name].sort((a, b) => b[item.sortKey] - a[item.sortKey]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
72
84
|
return value;
|
|
73
85
|
};
|
|
74
86
|
const createValues = function(mForm, config = [], initValue2 = {}, value = {}) {
|
|
@@ -109,7 +121,8 @@ const filterFunction = (mForm, config, props) => {
|
|
|
109
121
|
formValue: mForm?.values || props.model,
|
|
110
122
|
prop: props.prop,
|
|
111
123
|
config: props.config,
|
|
112
|
-
index: props.index
|
|
124
|
+
index: props.index,
|
|
125
|
+
getFormValue: (prop) => getValueByKeyPath(prop, mForm?.values || props.model)
|
|
113
126
|
});
|
|
114
127
|
}
|
|
115
128
|
return config;
|
|
@@ -186,25 +199,47 @@ const datetimeFormatter = (v, defaultValue = "-", format = "YYYY-MM-DD HH:mm:ss"
|
|
|
186
199
|
}
|
|
187
200
|
return defaultValue;
|
|
188
201
|
};
|
|
202
|
+
const getDataByPage = (data = [], pagecontext, pagesize) => data.filter(
|
|
203
|
+
(item, index) => index >= pagecontext * pagesize && index + 1 <= (pagecontext + 1) * pagesize
|
|
204
|
+
);
|
|
205
|
+
const sortArray = (data, newIndex, oldIndex, sortKey) => {
|
|
206
|
+
if (newIndex === oldIndex) {
|
|
207
|
+
return data;
|
|
208
|
+
}
|
|
209
|
+
if (newIndex < 0 || newIndex >= data.length || oldIndex < 0 || oldIndex >= data.length) {
|
|
210
|
+
return data;
|
|
211
|
+
}
|
|
212
|
+
const newData = data.toSpliced(newIndex, 0, ...data.splice(oldIndex, 1));
|
|
213
|
+
if (sortKey) {
|
|
214
|
+
for (let i = newData.length - 1, v = 0; i >= 0; i--, v++) {
|
|
215
|
+
newData[v][sortKey] = i;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return newData;
|
|
219
|
+
};
|
|
220
|
+
const sortChange = (data, { prop, order }) => {
|
|
221
|
+
if (order === "ascending") {
|
|
222
|
+
data = data.sort((a, b) => a[prop] - b[prop]);
|
|
223
|
+
} else if (order === "descending") {
|
|
224
|
+
data = data.sort((a, b) => b[prop] - a[prop]);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
189
227
|
|
|
190
|
-
const _hoisted_1$
|
|
228
|
+
const _hoisted_1$d = ["data-tmagic-id", "data-tmagic-form-item-prop"];
|
|
191
229
|
const _hoisted_2$7 = ["innerHTML", "title"];
|
|
192
|
-
const _hoisted_3$
|
|
230
|
+
const _hoisted_3$6 = ["innerHTML"];
|
|
193
231
|
const _hoisted_4$3 = ["innerHTML"];
|
|
194
|
-
const _hoisted_5$3 = ["innerHTML"];
|
|
195
|
-
const _hoisted_6$
|
|
232
|
+
const _hoisted_5$3 = ["innerHTML", "title"];
|
|
233
|
+
const _hoisted_6$1 = ["innerHTML"];
|
|
196
234
|
const _hoisted_7$1 = ["innerHTML"];
|
|
197
|
-
const _hoisted_8$1 = ["innerHTML"];
|
|
235
|
+
const _hoisted_8$1 = ["innerHTML", "title"];
|
|
198
236
|
const _hoisted_9 = ["innerHTML"];
|
|
199
|
-
const _hoisted_10 = ["innerHTML"
|
|
200
|
-
const _hoisted_11 =
|
|
201
|
-
const _hoisted_12 = ["innerHTML"];
|
|
202
|
-
const _hoisted_13 = ["innerHTML"];
|
|
203
|
-
const _hoisted_14 = {
|
|
237
|
+
const _hoisted_10 = ["innerHTML"];
|
|
238
|
+
const _hoisted_11 = {
|
|
204
239
|
key: 5,
|
|
205
240
|
style: { "text-align": "center" }
|
|
206
241
|
};
|
|
207
|
-
const _sfc_main$
|
|
242
|
+
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
208
243
|
...{
|
|
209
244
|
name: "MFormContainer"
|
|
210
245
|
},
|
|
@@ -258,8 +293,19 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
258
293
|
});
|
|
259
294
|
const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
|
|
260
295
|
const text = computed(() => filterFunction(mForm, props.config.text, props));
|
|
261
|
-
const tooltip = computed(() =>
|
|
262
|
-
|
|
296
|
+
const tooltip = computed(() => {
|
|
297
|
+
const config = filterFunction(mForm, props.config.tooltip, props);
|
|
298
|
+
if (typeof config === "string") {
|
|
299
|
+
return {
|
|
300
|
+
text: config,
|
|
301
|
+
placement: "top"
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
return {
|
|
305
|
+
text: config?.text,
|
|
306
|
+
placement: config?.placement || "top"
|
|
307
|
+
};
|
|
308
|
+
});
|
|
263
309
|
const rule = computed(() => getRules(mForm, props.config.rules, props));
|
|
264
310
|
const type = computed(() => {
|
|
265
311
|
let { type: type2 } = props.config;
|
|
@@ -275,6 +321,22 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
275
321
|
}
|
|
276
322
|
return value;
|
|
277
323
|
});
|
|
324
|
+
const fieldsProps = computed(() => ({
|
|
325
|
+
size: props.size,
|
|
326
|
+
config: props.config,
|
|
327
|
+
name: name.value,
|
|
328
|
+
disabled: disabled.value,
|
|
329
|
+
prop: itemProp.value,
|
|
330
|
+
key: props.config[mForm?.keyProps],
|
|
331
|
+
style: props.config.fieldStyle
|
|
332
|
+
}));
|
|
333
|
+
const formItemProps = computed(() => ({
|
|
334
|
+
prop: itemProp.value,
|
|
335
|
+
labelWidth: itemLabelWidth.value,
|
|
336
|
+
labelPosition: props.config.labelPosition,
|
|
337
|
+
rules: rule.value,
|
|
338
|
+
extra: filterFunction(mForm, props.config.extra, props)
|
|
339
|
+
}));
|
|
278
340
|
const itemLabelWidth = computed(() => props.config.labelWidth ?? props.labelWidth);
|
|
279
341
|
watchEffect(() => {
|
|
280
342
|
expand.value = props.expandMore;
|
|
@@ -301,7 +363,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
301
363
|
values: mForm?.initValues,
|
|
302
364
|
formValue: mForm?.values,
|
|
303
365
|
prop: itemProp.value,
|
|
304
|
-
config: props.config
|
|
366
|
+
config: props.config,
|
|
367
|
+
getFormValue: (prop) => getValueByKeyPath(prop, mForm?.values || props.model)
|
|
305
368
|
});
|
|
306
369
|
}
|
|
307
370
|
if (filter === "number") {
|
|
@@ -329,27 +392,50 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
329
392
|
}
|
|
330
393
|
return true;
|
|
331
394
|
};
|
|
395
|
+
const createModelProxy = (target, setModelFn, pathPrefix = "") => {
|
|
396
|
+
return new Proxy(target, {
|
|
397
|
+
get: (obj, key2) => {
|
|
398
|
+
const value = obj[key2];
|
|
399
|
+
if (value && typeof value === "object") {
|
|
400
|
+
const newPath = pathPrefix ? `${pathPrefix}.${key2}` : key2;
|
|
401
|
+
return createModelProxy(value, setModelFn, newPath);
|
|
402
|
+
}
|
|
403
|
+
return value;
|
|
404
|
+
},
|
|
405
|
+
set: (obj, key2, value) => {
|
|
406
|
+
setModelFn(pathPrefix ? `${pathPrefix}.${key2}` : key2, value);
|
|
407
|
+
return true;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
};
|
|
332
411
|
const onChangeHandler = async function(v, eventData = {}) {
|
|
333
|
-
const { filter, onChange, trim
|
|
412
|
+
const { filter, onChange, trim } = props.config;
|
|
334
413
|
let value = toRaw(v);
|
|
335
414
|
const changeRecords = eventData.changeRecords || [];
|
|
336
415
|
const newChangeRecords = [...changeRecords];
|
|
337
416
|
try {
|
|
338
417
|
value = filterHandler(filter, v);
|
|
339
418
|
if (typeof onChange === "function") {
|
|
419
|
+
const setModel = (key2, value2) => {
|
|
420
|
+
if (props.config.name) {
|
|
421
|
+
newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
|
|
422
|
+
} else {
|
|
423
|
+
newChangeRecords.push({ propPath: itemProp.value, value: value2 });
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
const setFormValue = (key2, value2) => {
|
|
427
|
+
newChangeRecords.push({ propPath: key2, value: value2 });
|
|
428
|
+
};
|
|
340
429
|
value = await onChange(mForm, value, {
|
|
341
|
-
model: props.model,
|
|
342
|
-
values: mForm
|
|
343
|
-
formValue: mForm?.values,
|
|
430
|
+
model: createModelProxy(props.model, setModel),
|
|
431
|
+
values: mForm ? readonly(mForm.initValues) : null,
|
|
432
|
+
formValue: createModelProxy(mForm?.values || {}, setFormValue),
|
|
344
433
|
prop: itemProp.value,
|
|
345
434
|
config: props.config,
|
|
346
435
|
changeRecords: newChangeRecords,
|
|
347
|
-
setModel
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
|
|
351
|
-
}
|
|
352
|
-
}
|
|
436
|
+
setModel,
|
|
437
|
+
setFormValue,
|
|
438
|
+
getFormValue: (prop) => getValueByKeyPath(prop, mForm?.values || props.model)
|
|
353
439
|
}) ?? value;
|
|
354
440
|
}
|
|
355
441
|
value = trimHandler(trim, value) ?? value;
|
|
@@ -358,15 +444,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
358
444
|
}
|
|
359
445
|
let valueProp = itemProp.value;
|
|
360
446
|
if (hasModifyKey(eventData)) {
|
|
361
|
-
if (dynamicKey) {
|
|
362
|
-
props.model[eventData.modifyKey] = value;
|
|
363
|
-
} else if (isValidName()) {
|
|
364
|
-
props.model[name.value][eventData.modifyKey] = value;
|
|
365
|
-
}
|
|
366
447
|
valueProp = valueProp ? `${valueProp}.${eventData.modifyKey}` : eventData.modifyKey;
|
|
367
448
|
delete eventData.modifyKey;
|
|
368
|
-
} else if (isValidName() && props.model !== value && (v !== value || props.model[name.value] !== value)) {
|
|
369
|
-
props.model[name.value] = value;
|
|
370
449
|
}
|
|
371
450
|
if (changeRecords.length === 0) {
|
|
372
451
|
newChangeRecords.push({
|
|
@@ -382,103 +461,73 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
382
461
|
return (_ctx, _cache) => {
|
|
383
462
|
const _component_m_fields_hidden = resolveComponent("m-fields-hidden");
|
|
384
463
|
const _component_Container = resolveComponent("Container", true);
|
|
385
|
-
return
|
|
386
|
-
|
|
387
|
-
"data-tmagic-id": _ctx.config.id,
|
|
464
|
+
return openBlock(), createElementBlock("div", {
|
|
465
|
+
"data-tmagic-id": __props.config.id,
|
|
388
466
|
"data-tmagic-form-item-prop": itemProp.value,
|
|
389
|
-
|
|
390
|
-
|
|
467
|
+
class: normalizeClass(`m-form-container m-container-${type.value || ""} ${__props.config.className || ""}${__props.config.tip ? " has-tip" : ""}`),
|
|
468
|
+
style: normalizeStyle(__props.config.style)
|
|
391
469
|
}, [
|
|
392
|
-
type.value === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
disabled: disabled.value,
|
|
398
|
-
prop: itemProp.value
|
|
399
|
-
}, null, 8, ["model", "config", "name", "disabled", "prop"])) : items.value && !text.value && type.value && display$1.value ? (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
400
|
-
key: key(_ctx.config),
|
|
401
|
-
size: _ctx.size,
|
|
402
|
-
model: _ctx.model,
|
|
403
|
-
"last-values": _ctx.lastValues,
|
|
404
|
-
"is-compare": _ctx.isCompare,
|
|
405
|
-
config: _ctx.config,
|
|
406
|
-
disabled: disabled.value,
|
|
407
|
-
name: name.value,
|
|
408
|
-
prop: itemProp.value,
|
|
409
|
-
"step-active": _ctx.stepActive,
|
|
470
|
+
type.value === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, mergeProps({ key: 0 }, fieldsProps.value, { model: __props.model }), null, 16, ["model"])) : items.value && !text.value && type.value && display$1.value ? (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
|
|
471
|
+
model: __props.model,
|
|
472
|
+
"last-values": __props.lastValues,
|
|
473
|
+
"is-compare": __props.isCompare,
|
|
474
|
+
"step-active": __props.stepActive,
|
|
410
475
|
"expand-more": expand.value,
|
|
411
476
|
"label-width": itemLabelWidth.value,
|
|
477
|
+
style: __props.config.fieldStyle,
|
|
412
478
|
onChange: onChangeHandler,
|
|
413
479
|
onAddDiffCount
|
|
414
|
-
}, null,
|
|
480
|
+
}), null, 16, ["model", "last-values", "is-compare", "step-active", "expand-more", "label-width", "style"])) : type.value && display$1.value && !showDiff.value ? (openBlock(), createElementBlock(
|
|
415
481
|
Fragment,
|
|
416
482
|
{ key: 2 },
|
|
417
483
|
[
|
|
418
|
-
createVNode(unref(TMagicFormItem), {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
prop: itemProp.value,
|
|
422
|
-
"label-width": itemLabelWidth.value,
|
|
423
|
-
"label-position": _ctx.config.labelPosition,
|
|
424
|
-
rules: rule.value
|
|
425
|
-
}, {
|
|
484
|
+
createVNode(unref(TMagicFormItem), mergeProps(formItemProps.value, {
|
|
485
|
+
class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }
|
|
486
|
+
}), {
|
|
426
487
|
label: withCtx(() => [
|
|
427
488
|
createElementVNode("span", {
|
|
428
|
-
innerHTML: type.value === "checkbox" ? "" : text.value,
|
|
429
|
-
title:
|
|
489
|
+
innerHTML: type.value === "checkbox" && !__props.config.useLabel ? "" : text.value,
|
|
490
|
+
title: __props.config.labelTitle
|
|
430
491
|
}, null, 8, _hoisted_2$7)
|
|
431
492
|
]),
|
|
432
493
|
default: withCtx(() => [
|
|
433
|
-
tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
494
|
+
tooltip.value.text ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
495
|
+
key: 0,
|
|
496
|
+
placement: tooltip.value.placement
|
|
497
|
+
}, {
|
|
434
498
|
content: withCtx(() => [
|
|
435
|
-
createElementVNode("div", {
|
|
499
|
+
createElementVNode("div", {
|
|
500
|
+
innerHTML: tooltip.value.text
|
|
501
|
+
}, null, 8, _hoisted_3$6)
|
|
436
502
|
]),
|
|
437
503
|
default: withCtx(() => [
|
|
438
|
-
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
model: _ctx.model,
|
|
442
|
-
"last-values": _ctx.lastValues,
|
|
443
|
-
config: _ctx.config,
|
|
444
|
-
name: name.value,
|
|
445
|
-
disabled: disabled.value,
|
|
446
|
-
prop: itemProp.value,
|
|
504
|
+
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
|
|
505
|
+
model: __props.model,
|
|
506
|
+
"last-values": __props.lastValues,
|
|
447
507
|
onChange: onChangeHandler,
|
|
448
508
|
onAddDiffCount
|
|
449
|
-
}, null,
|
|
509
|
+
}), null, 16, ["model", "last-values"]))
|
|
450
510
|
]),
|
|
451
511
|
_: 1
|
|
452
512
|
/* STABLE */
|
|
453
|
-
})) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
model: _ctx.model,
|
|
457
|
-
"last-values": _ctx.lastValues,
|
|
458
|
-
config: _ctx.config,
|
|
459
|
-
name: name.value,
|
|
460
|
-
disabled: disabled.value,
|
|
461
|
-
prop: itemProp.value,
|
|
513
|
+
}, 8, ["placement"])) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
|
|
514
|
+
model: __props.model,
|
|
515
|
+
"last-values": __props.lastValues,
|
|
462
516
|
onChange: onChangeHandler,
|
|
463
517
|
onAddDiffCount
|
|
464
|
-
}, null,
|
|
465
|
-
extra.value && type.value !== "table" ? (openBlock(), createElementBlock("div", {
|
|
466
|
-
key: 2,
|
|
467
|
-
innerHTML: extra.value,
|
|
468
|
-
class: "m-form-tip"
|
|
469
|
-
}, null, 8, _hoisted_4$3)) : createCommentVNode("v-if", true)
|
|
518
|
+
}), null, 16, ["model", "last-values"]))
|
|
470
519
|
]),
|
|
471
520
|
_: 1
|
|
472
521
|
/* STABLE */
|
|
473
|
-
},
|
|
474
|
-
|
|
522
|
+
}, 16, ["class"]),
|
|
523
|
+
__props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
475
524
|
key: 0,
|
|
476
525
|
placement: "left"
|
|
477
526
|
}, {
|
|
478
527
|
content: withCtx(() => [
|
|
479
528
|
createElementVNode("div", {
|
|
480
|
-
innerHTML:
|
|
481
|
-
}, null, 8,
|
|
529
|
+
innerHTML: __props.config.tip
|
|
530
|
+
}, null, 8, _hoisted_4$3)
|
|
482
531
|
]),
|
|
483
532
|
default: withCtx(() => [
|
|
484
533
|
createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
|
|
@@ -501,66 +550,49 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
501
550
|
[
|
|
502
551
|
createCommentVNode(" 对比 "),
|
|
503
552
|
createCommentVNode(" 上次内容 "),
|
|
504
|
-
createVNode(unref(TMagicFormItem), {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
prop: itemProp.value,
|
|
508
|
-
"label-width": itemLabelWidth.value,
|
|
509
|
-
"label-position": _ctx.config.labelPosition,
|
|
510
|
-
rules: rule.value
|
|
511
|
-
}, {
|
|
553
|
+
createVNode(unref(TMagicFormItem), mergeProps(formItemProps.value, {
|
|
554
|
+
class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value, "show-diff": true }
|
|
555
|
+
}), {
|
|
512
556
|
label: withCtx(() => [
|
|
513
557
|
createElementVNode("span", {
|
|
514
558
|
innerHTML: type.value === "checkbox" ? "" : text.value,
|
|
515
|
-
title:
|
|
516
|
-
}, null, 8,
|
|
559
|
+
title: __props.config.labelTitle
|
|
560
|
+
}, null, 8, _hoisted_5$3)
|
|
517
561
|
]),
|
|
518
562
|
default: withCtx(() => [
|
|
519
|
-
tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
563
|
+
tooltip.value.text ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
564
|
+
key: 0,
|
|
565
|
+
placement: tooltip.value.placement
|
|
566
|
+
}, {
|
|
520
567
|
content: withCtx(() => [
|
|
521
|
-
createElementVNode("div", {
|
|
568
|
+
createElementVNode("div", {
|
|
569
|
+
innerHTML: tooltip.value.text
|
|
570
|
+
}, null, 8, _hoisted_6$1)
|
|
522
571
|
]),
|
|
523
572
|
default: withCtx(() => [
|
|
524
|
-
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
525
|
-
|
|
526
|
-
size: _ctx.size,
|
|
527
|
-
model: _ctx.lastValues,
|
|
528
|
-
config: _ctx.config,
|
|
529
|
-
name: name.value,
|
|
530
|
-
disabled: disabled.value,
|
|
531
|
-
prop: itemProp.value,
|
|
573
|
+
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
|
|
574
|
+
model: __props.lastValues,
|
|
532
575
|
onChange: onChangeHandler
|
|
533
|
-
}, null,
|
|
576
|
+
}), null, 16, ["model"]))
|
|
534
577
|
]),
|
|
535
578
|
_: 1
|
|
536
579
|
/* STABLE */
|
|
537
|
-
})) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
538
|
-
|
|
539
|
-
size: _ctx.size,
|
|
540
|
-
model: _ctx.lastValues,
|
|
541
|
-
config: _ctx.config,
|
|
542
|
-
name: name.value,
|
|
543
|
-
disabled: disabled.value,
|
|
544
|
-
prop: itemProp.value,
|
|
580
|
+
}, 8, ["placement"])) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
|
|
581
|
+
model: __props.lastValues,
|
|
545
582
|
onChange: onChangeHandler
|
|
546
|
-
}, null,
|
|
547
|
-
extra.value ? (openBlock(), createElementBlock("div", {
|
|
548
|
-
key: 2,
|
|
549
|
-
innerHTML: extra.value,
|
|
550
|
-
class: "m-form-tip"
|
|
551
|
-
}, null, 8, _hoisted_8$1)) : createCommentVNode("v-if", true)
|
|
583
|
+
}), null, 16, ["model"]))
|
|
552
584
|
]),
|
|
553
585
|
_: 1
|
|
554
586
|
/* STABLE */
|
|
555
|
-
},
|
|
556
|
-
|
|
587
|
+
}, 16, ["class"]),
|
|
588
|
+
__props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
557
589
|
key: 0,
|
|
558
590
|
placement: "left"
|
|
559
591
|
}, {
|
|
560
592
|
content: withCtx(() => [
|
|
561
593
|
createElementVNode("div", {
|
|
562
|
-
innerHTML:
|
|
563
|
-
}, null, 8,
|
|
594
|
+
innerHTML: __props.config.tip
|
|
595
|
+
}, null, 8, _hoisted_7$1)
|
|
564
596
|
]),
|
|
565
597
|
default: withCtx(() => [
|
|
566
598
|
createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
|
|
@@ -575,66 +607,50 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
575
607
|
/* STABLE */
|
|
576
608
|
})) : createCommentVNode("v-if", true),
|
|
577
609
|
createCommentVNode(" 当前内容 "),
|
|
578
|
-
createVNode(unref(TMagicFormItem), {
|
|
579
|
-
style:
|
|
580
|
-
class:
|
|
581
|
-
|
|
582
|
-
"label-width": itemLabelWidth.value,
|
|
583
|
-
"label-position": _ctx.config.labelPosition,
|
|
584
|
-
rules: rule.value
|
|
585
|
-
}, {
|
|
610
|
+
createVNode(unref(TMagicFormItem), mergeProps(formItemProps.value, {
|
|
611
|
+
style: __props.config.tip ? "flex: 1" : "",
|
|
612
|
+
class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value, "show-diff": true }
|
|
613
|
+
}), {
|
|
586
614
|
label: withCtx(() => [
|
|
587
615
|
createElementVNode("span", {
|
|
588
616
|
innerHTML: type.value === "checkbox" ? "" : text.value,
|
|
589
|
-
title:
|
|
590
|
-
}, null, 8,
|
|
617
|
+
title: __props.config.labelTitle
|
|
618
|
+
}, null, 8, _hoisted_8$1)
|
|
591
619
|
]),
|
|
592
620
|
default: withCtx(() => [
|
|
593
|
-
tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
621
|
+
tooltip.value.text ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
622
|
+
key: 0,
|
|
623
|
+
placement: tooltip.value.placement
|
|
624
|
+
}, {
|
|
594
625
|
content: withCtx(() => [
|
|
595
|
-
createElementVNode("div", {
|
|
626
|
+
createElementVNode("div", {
|
|
627
|
+
innerHTML: tooltip.value.text
|
|
628
|
+
}, null, 8, _hoisted_9)
|
|
596
629
|
]),
|
|
597
630
|
default: withCtx(() => [
|
|
598
|
-
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
599
|
-
|
|
600
|
-
size: _ctx.size,
|
|
601
|
-
model: _ctx.model,
|
|
602
|
-
config: _ctx.config,
|
|
603
|
-
name: name.value,
|
|
604
|
-
disabled: disabled.value,
|
|
605
|
-
prop: itemProp.value,
|
|
631
|
+
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
|
|
632
|
+
model: __props.model,
|
|
606
633
|
onChange: onChangeHandler
|
|
607
|
-
}, null,
|
|
634
|
+
}), null, 16, ["model"]))
|
|
608
635
|
]),
|
|
609
636
|
_: 1
|
|
610
637
|
/* STABLE */
|
|
611
|
-
})) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
612
|
-
|
|
613
|
-
size: _ctx.size,
|
|
614
|
-
model: _ctx.model,
|
|
615
|
-
config: _ctx.config,
|
|
616
|
-
name: name.value,
|
|
617
|
-
disabled: disabled.value,
|
|
618
|
-
prop: itemProp.value,
|
|
638
|
+
}, 8, ["placement"])) : (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps({ key: 1 }, fieldsProps.value, {
|
|
639
|
+
model: __props.model,
|
|
619
640
|
onChange: onChangeHandler
|
|
620
|
-
}, null,
|
|
621
|
-
extra.value ? (openBlock(), createElementBlock("div", {
|
|
622
|
-
key: 2,
|
|
623
|
-
innerHTML: extra.value,
|
|
624
|
-
class: "m-form-tip"
|
|
625
|
-
}, null, 8, _hoisted_12)) : createCommentVNode("v-if", true)
|
|
641
|
+
}), null, 16, ["model"]))
|
|
626
642
|
]),
|
|
627
643
|
_: 1
|
|
628
644
|
/* STABLE */
|
|
629
|
-
},
|
|
630
|
-
|
|
645
|
+
}, 16, ["style", "class"]),
|
|
646
|
+
__props.config.tip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
631
647
|
key: 1,
|
|
632
648
|
placement: "left"
|
|
633
649
|
}, {
|
|
634
650
|
content: withCtx(() => [
|
|
635
651
|
createElementVNode("div", {
|
|
636
|
-
innerHTML:
|
|
637
|
-
}, null, 8,
|
|
652
|
+
innerHTML: __props.config.tip
|
|
653
|
+
}, null, 8, _hoisted_10)
|
|
638
654
|
]),
|
|
639
655
|
default: withCtx(() => [
|
|
640
656
|
createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
|
|
@@ -655,19 +671,19 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
655
671
|
Fragment,
|
|
656
672
|
{ key: 4 },
|
|
657
673
|
[
|
|
658
|
-
(isValidName() ?
|
|
674
|
+
(isValidName() ? __props.model[name.value] : __props.model) ? (openBlock(true), createElementBlock(
|
|
659
675
|
Fragment,
|
|
660
676
|
{ key: 0 },
|
|
661
677
|
renderList(items.value, (item) => {
|
|
662
678
|
return openBlock(), createBlock(_component_Container, {
|
|
663
679
|
key: key(item),
|
|
664
|
-
model: isValidName() ?
|
|
665
|
-
"last-values": isValidName() ?
|
|
666
|
-
"is-compare":
|
|
680
|
+
model: isValidName() ? __props.model[name.value] : __props.model,
|
|
681
|
+
"last-values": isValidName() ? __props.lastValues[name.value] || {} : __props.lastValues,
|
|
682
|
+
"is-compare": __props.isCompare,
|
|
667
683
|
config: item,
|
|
668
|
-
size:
|
|
684
|
+
size: __props.size,
|
|
669
685
|
disabled: disabled.value,
|
|
670
|
-
"step-active":
|
|
686
|
+
"step-active": __props.stepActive,
|
|
671
687
|
"expand-more": expand.value,
|
|
672
688
|
"label-width": itemLabelWidth.value,
|
|
673
689
|
prop: itemProp.value,
|
|
@@ -682,7 +698,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
682
698
|
64
|
|
683
699
|
/* STABLE_FRAGMENT */
|
|
684
700
|
)) : createCommentVNode("v-if", true),
|
|
685
|
-
|
|
701
|
+
__props.config.expand && type.value !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_11, [
|
|
686
702
|
createVNode(unref(TMagicButton), {
|
|
687
703
|
type: "primary",
|
|
688
704
|
size: "small",
|
|
@@ -701,23 +717,23 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
701
717
|
/* STABLE */
|
|
702
718
|
})
|
|
703
719
|
])) : createCommentVNode("v-if", true)
|
|
704
|
-
], 14, _hoisted_1$
|
|
720
|
+
], 14, _hoisted_1$d);
|
|
705
721
|
};
|
|
706
722
|
}
|
|
707
723
|
});
|
|
708
724
|
|
|
709
|
-
const _hoisted_1$
|
|
725
|
+
const _hoisted_1$c = ["innerHTML"];
|
|
710
726
|
const _hoisted_2$6 = ["innerHTML"];
|
|
711
|
-
const _hoisted_3$
|
|
727
|
+
const _hoisted_3$5 = { key: 1 };
|
|
712
728
|
const _hoisted_4$2 = ["innerHTML"];
|
|
713
729
|
const _hoisted_5$2 = ["innerHTML"];
|
|
714
|
-
const _hoisted_6
|
|
730
|
+
const _hoisted_6 = {
|
|
715
731
|
key: 2,
|
|
716
732
|
style: { "display": "flex" }
|
|
717
733
|
};
|
|
718
734
|
const _hoisted_7 = { style: { "flex": "1" } };
|
|
719
735
|
const _hoisted_8 = ["src"];
|
|
720
|
-
const _sfc_main$
|
|
736
|
+
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
721
737
|
...{
|
|
722
738
|
name: "MFormFieldset"
|
|
723
739
|
},
|
|
@@ -739,9 +755,27 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
739
755
|
const emit = __emit;
|
|
740
756
|
const mForm = inject("mForm");
|
|
741
757
|
const name = computed(() => props.config.name || "");
|
|
758
|
+
const checkboxName = computed(() => {
|
|
759
|
+
if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.name === "string") {
|
|
760
|
+
return props.config.checkbox.name;
|
|
761
|
+
}
|
|
762
|
+
return "value";
|
|
763
|
+
});
|
|
764
|
+
const checkboxTrueValue = computed(() => {
|
|
765
|
+
if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.trueValue !== "undefined") {
|
|
766
|
+
return props.config.checkbox.trueValue;
|
|
767
|
+
}
|
|
768
|
+
return 1;
|
|
769
|
+
});
|
|
770
|
+
const checkboxFalseValue = computed(() => {
|
|
771
|
+
if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.falseValue !== "undefined") {
|
|
772
|
+
return props.config.checkbox.falseValue;
|
|
773
|
+
}
|
|
774
|
+
return 0;
|
|
775
|
+
});
|
|
742
776
|
const show = computed(() => {
|
|
743
|
-
if (props.config.expand &&
|
|
744
|
-
return props.model[name.value]?.value;
|
|
777
|
+
if (props.config.expand && checkboxName.value) {
|
|
778
|
+
return (name.value ? props.model[name.value] : props.model)?.[checkboxName.value] === checkboxTrueValue.value;
|
|
745
779
|
}
|
|
746
780
|
return true;
|
|
747
781
|
});
|
|
@@ -752,13 +786,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
752
786
|
return props.config.labelWidth || props.labelWidth || (props.config.text ? void 0 : "0");
|
|
753
787
|
});
|
|
754
788
|
const valueChangeHandler = (value) => {
|
|
755
|
-
emit("change", value, { modifyKey:
|
|
789
|
+
emit("change", value, { modifyKey: checkboxName.value });
|
|
756
790
|
};
|
|
757
791
|
const changeHandler = (v, eventData) => emit("change", v, eventData);
|
|
758
792
|
const key = (item, index) => item[mForm?.keyProp || "__key"] ?? index;
|
|
759
793
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
760
794
|
return (_ctx, _cache) => {
|
|
761
|
-
return (name.value ?
|
|
795
|
+
return (name.value ? __props.model[name.value] : __props.model) ? (openBlock(), createElementBlock(
|
|
762
796
|
"fieldset",
|
|
763
797
|
{
|
|
764
798
|
key: 0,
|
|
@@ -766,63 +800,60 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
766
800
|
style: normalizeStyle(show.value ? "padding: 15px" : "border: 0")
|
|
767
801
|
},
|
|
768
802
|
[
|
|
769
|
-
name.value &&
|
|
803
|
+
name.value && __props.config.checkbox ? (openBlock(), createBlock(resolveDynamicComponent(!show.value ? "div" : "legend"), { key: 0 }, {
|
|
770
804
|
default: withCtx(() => [
|
|
771
805
|
createVNode(unref(TMagicCheckbox), {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
|
|
778
|
-
"true-value": 1,
|
|
779
|
-
"false-value": 0
|
|
806
|
+
"model-value": (name.value ? __props.model[name.value] : __props.model)[checkboxName.value],
|
|
807
|
+
prop: `${__props.prop}${__props.prop ? "." : ""}${__props.config.name}.${checkboxName.value}`,
|
|
808
|
+
"true-value": checkboxTrueValue.value,
|
|
809
|
+
"false-value": checkboxFalseValue.value,
|
|
810
|
+
"onUpdate:modelValue": valueChangeHandler
|
|
780
811
|
}, {
|
|
781
812
|
default: withCtx(() => [
|
|
782
813
|
createElementVNode("span", {
|
|
783
|
-
innerHTML:
|
|
784
|
-
}, null, 8, _hoisted_1$
|
|
785
|
-
|
|
814
|
+
innerHTML: __props.config.legend
|
|
815
|
+
}, null, 8, _hoisted_1$c),
|
|
816
|
+
__props.config.extra ? (openBlock(), createElementBlock("span", {
|
|
786
817
|
key: 0,
|
|
787
|
-
innerHTML:
|
|
818
|
+
innerHTML: __props.config.extra,
|
|
788
819
|
class: "m-form-tip"
|
|
789
820
|
}, null, 8, _hoisted_2$6)) : createCommentVNode("v-if", true)
|
|
790
821
|
]),
|
|
791
822
|
_: 1
|
|
792
823
|
/* STABLE */
|
|
793
|
-
}, 8, ["
|
|
824
|
+
}, 8, ["model-value", "prop", "true-value", "false-value"])
|
|
794
825
|
]),
|
|
795
826
|
_: 1
|
|
796
827
|
/* STABLE */
|
|
797
|
-
})) : (openBlock(), createElementBlock("legend", _hoisted_3$
|
|
828
|
+
})) : (openBlock(), createElementBlock("legend", _hoisted_3$5, [
|
|
798
829
|
createElementVNode("span", {
|
|
799
|
-
innerHTML:
|
|
830
|
+
innerHTML: __props.config.legend
|
|
800
831
|
}, null, 8, _hoisted_4$2),
|
|
801
|
-
|
|
832
|
+
__props.config.extra ? (openBlock(), createElementBlock("span", {
|
|
802
833
|
key: 0,
|
|
803
|
-
innerHTML:
|
|
834
|
+
innerHTML: __props.config.extra,
|
|
804
835
|
class: "m-form-tip"
|
|
805
836
|
}, null, 8, _hoisted_5$2)) : createCommentVNode("v-if", true)
|
|
806
837
|
])),
|
|
807
|
-
|
|
838
|
+
__props.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
808
839
|
createElementVNode("div", _hoisted_7, [
|
|
809
840
|
(openBlock(true), createElementBlock(
|
|
810
841
|
Fragment,
|
|
811
842
|
null,
|
|
812
|
-
renderList(
|
|
813
|
-
return openBlock(), createBlock(_sfc_main$
|
|
843
|
+
renderList(__props.config.items, (item, index) => {
|
|
844
|
+
return openBlock(), createBlock(_sfc_main$A, {
|
|
814
845
|
key: key(item, index),
|
|
815
|
-
model: name.value ?
|
|
816
|
-
lastValues: name.value ?
|
|
817
|
-
"is-compare":
|
|
818
|
-
rules: name.value ?
|
|
846
|
+
model: name.value ? __props.model[name.value] : __props.model,
|
|
847
|
+
lastValues: name.value ? __props.lastValues[name.value] : __props.lastValues,
|
|
848
|
+
"is-compare": __props.isCompare,
|
|
849
|
+
rules: name.value ? __props.rules[name.value] : [],
|
|
819
850
|
config: item,
|
|
820
|
-
prop:
|
|
821
|
-
disabled:
|
|
851
|
+
prop: __props.prop,
|
|
852
|
+
disabled: __props.disabled,
|
|
822
853
|
labelWidth: lWidth.value,
|
|
823
|
-
size:
|
|
854
|
+
size: __props.size,
|
|
824
855
|
onChange: changeHandler,
|
|
825
|
-
onAddDiffCount: _cache[
|
|
856
|
+
onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
|
|
826
857
|
}, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "disabled", "labelWidth", "size"]);
|
|
827
858
|
}),
|
|
828
859
|
128
|
|
@@ -831,25 +862,25 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
831
862
|
]),
|
|
832
863
|
createElementVNode("img", {
|
|
833
864
|
class: "m-form-schematic",
|
|
834
|
-
src:
|
|
865
|
+
src: __props.config.schematic
|
|
835
866
|
}, null, 8, _hoisted_8)
|
|
836
867
|
])) : show.value ? (openBlock(true), createElementBlock(
|
|
837
868
|
Fragment,
|
|
838
869
|
{ key: 3 },
|
|
839
|
-
renderList(
|
|
840
|
-
return openBlock(), createBlock(_sfc_main$
|
|
870
|
+
renderList(__props.config.items, (item, index) => {
|
|
871
|
+
return openBlock(), createBlock(_sfc_main$A, {
|
|
841
872
|
key: key(item, index),
|
|
842
|
-
model: name.value ?
|
|
843
|
-
lastValues: name.value ?
|
|
844
|
-
"is-compare":
|
|
845
|
-
rules: name.value ?
|
|
873
|
+
model: name.value ? __props.model[name.value] : __props.model,
|
|
874
|
+
lastValues: name.value ? __props.lastValues[name.value] : __props.lastValues,
|
|
875
|
+
"is-compare": __props.isCompare,
|
|
876
|
+
rules: name.value ? __props.rules[name.value] : [],
|
|
846
877
|
config: item,
|
|
847
|
-
prop:
|
|
878
|
+
prop: __props.prop,
|
|
848
879
|
labelWidth: lWidth.value,
|
|
849
|
-
size:
|
|
850
|
-
disabled:
|
|
880
|
+
size: __props.size,
|
|
881
|
+
disabled: __props.disabled,
|
|
851
882
|
onChange: changeHandler,
|
|
852
|
-
onAddDiffCount: _cache[
|
|
883
|
+
onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
|
|
853
884
|
}, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "labelWidth", "size", "disabled"]);
|
|
854
885
|
}),
|
|
855
886
|
128
|
|
@@ -863,10 +894,73 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
863
894
|
}
|
|
864
895
|
});
|
|
865
896
|
|
|
866
|
-
const
|
|
897
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
898
|
+
...{
|
|
899
|
+
name: "MFormFlexLayout"
|
|
900
|
+
},
|
|
901
|
+
__name: "FlexLayout",
|
|
902
|
+
props: {
|
|
903
|
+
model: {},
|
|
904
|
+
lastValues: {},
|
|
905
|
+
isCompare: { type: Boolean },
|
|
906
|
+
config: {},
|
|
907
|
+
name: {},
|
|
908
|
+
labelWidth: {},
|
|
909
|
+
prop: {},
|
|
910
|
+
size: {},
|
|
911
|
+
disabled: { type: Boolean }
|
|
912
|
+
},
|
|
913
|
+
emits: ["change", "addDiffCount"],
|
|
914
|
+
setup(__props, { emit: __emit }) {
|
|
915
|
+
const props = __props;
|
|
916
|
+
const emit = __emit;
|
|
917
|
+
const mForm = inject("mForm");
|
|
918
|
+
const gap = computed(() => props.config.gap || "16px");
|
|
919
|
+
const changeHandler = (v, eventData) => {
|
|
920
|
+
emit("change", props.model, eventData);
|
|
921
|
+
};
|
|
922
|
+
const onAddDiffCount = () => emit("addDiffCount");
|
|
923
|
+
return (_ctx, _cache) => {
|
|
924
|
+
return openBlock(), createElementBlock(
|
|
925
|
+
"div",
|
|
926
|
+
{
|
|
927
|
+
class: "m-form-flex-layout",
|
|
928
|
+
style: normalizeStyle({ display: "flex", flexWrap: "wrap", gap: gap.value })
|
|
929
|
+
},
|
|
930
|
+
[
|
|
931
|
+
(openBlock(true), createElementBlock(
|
|
932
|
+
Fragment,
|
|
933
|
+
null,
|
|
934
|
+
renderList(__props.config.items, (item, index) => {
|
|
935
|
+
return openBlock(), createBlock(_sfc_main$A, {
|
|
936
|
+
key: item[unref(mForm)?.keyProp || "__key"] ?? index,
|
|
937
|
+
config: item,
|
|
938
|
+
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
939
|
+
lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
|
|
940
|
+
"is-compare": __props.isCompare,
|
|
941
|
+
prop: __props.prop,
|
|
942
|
+
size: __props.size,
|
|
943
|
+
disabled: __props.disabled,
|
|
944
|
+
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
945
|
+
onChange: changeHandler,
|
|
946
|
+
onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
|
|
947
|
+
}, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
|
|
948
|
+
}),
|
|
949
|
+
128
|
|
950
|
+
/* KEYED_FRAGMENT */
|
|
951
|
+
))
|
|
952
|
+
],
|
|
953
|
+
4
|
|
954
|
+
/* STYLE */
|
|
955
|
+
);
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
const _hoisted_1$b = { class: "m-fields-group-list-item" };
|
|
867
961
|
const _hoisted_2$5 = { style: { "text-align": "right", "margin-top": "20px" } };
|
|
868
|
-
const _hoisted_3$
|
|
869
|
-
const _sfc_main$
|
|
962
|
+
const _hoisted_3$4 = ["innerHTML"];
|
|
963
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
870
964
|
...{
|
|
871
965
|
name: "MFormGroupListItem"
|
|
872
966
|
},
|
|
@@ -944,11 +1038,11 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
944
1038
|
emit("swap-item", props.index, moveSpecifyLocationIndex.value - 1);
|
|
945
1039
|
};
|
|
946
1040
|
return (_ctx, _cache) => {
|
|
947
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1041
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
948
1042
|
createElementVNode("div", null, [
|
|
949
1043
|
createVNode(unref(TMagicButton), {
|
|
950
1044
|
link: "",
|
|
951
|
-
disabled:
|
|
1045
|
+
disabled: __props.disabled,
|
|
952
1046
|
onClick: expandHandler
|
|
953
1047
|
}, {
|
|
954
1048
|
default: withCtx(() => [
|
|
@@ -973,7 +1067,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
973
1067
|
size: "small",
|
|
974
1068
|
link: "",
|
|
975
1069
|
icon: unref(Delete),
|
|
976
|
-
disabled:
|
|
1070
|
+
disabled: __props.disabled,
|
|
977
1071
|
onClick: removeHandler
|
|
978
1072
|
}, null, 8, ["icon", "disabled"]), [
|
|
979
1073
|
[vShow, showDelete.value]
|
|
@@ -984,7 +1078,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
984
1078
|
size: "small",
|
|
985
1079
|
type: "primary",
|
|
986
1080
|
icon: unref(DocumentCopy),
|
|
987
|
-
disabled:
|
|
1081
|
+
disabled: __props.disabled,
|
|
988
1082
|
onClick: copyHandler
|
|
989
1083
|
}, {
|
|
990
1084
|
default: withCtx(() => [..._cache[6] || (_cache[6] = [
|
|
@@ -1004,7 +1098,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1004
1098
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
1005
1099
|
link: "",
|
|
1006
1100
|
size: "small",
|
|
1007
|
-
disabled:
|
|
1101
|
+
disabled: __props.disabled,
|
|
1008
1102
|
icon: unref(CaretTop),
|
|
1009
1103
|
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
1010
1104
|
}, {
|
|
@@ -1018,12 +1112,12 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1018
1112
|
_: 1
|
|
1019
1113
|
/* STABLE */
|
|
1020
1114
|
}, 8, ["disabled", "icon"]), [
|
|
1021
|
-
[vShow,
|
|
1115
|
+
[vShow, __props.index !== 0]
|
|
1022
1116
|
]),
|
|
1023
1117
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
1024
1118
|
link: "",
|
|
1025
1119
|
size: "small",
|
|
1026
|
-
disabled:
|
|
1120
|
+
disabled: __props.disabled,
|
|
1027
1121
|
icon: unref(CaretBottom),
|
|
1028
1122
|
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
1029
1123
|
}, {
|
|
@@ -1037,13 +1131,13 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1037
1131
|
_: 1
|
|
1038
1132
|
/* STABLE */
|
|
1039
1133
|
}, 8, ["disabled", "icon"]), [
|
|
1040
|
-
[vShow,
|
|
1134
|
+
[vShow, __props.index !== length.value - 1]
|
|
1041
1135
|
])
|
|
1042
1136
|
],
|
|
1043
1137
|
64
|
|
1044
1138
|
/* STABLE_FRAGMENT */
|
|
1045
1139
|
)) : createCommentVNode("v-if", true),
|
|
1046
|
-
|
|
1140
|
+
__props.config.moveSpecifyLocation ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
1047
1141
|
key: 2,
|
|
1048
1142
|
trigger: "click",
|
|
1049
1143
|
placement: "top",
|
|
@@ -1056,7 +1150,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1056
1150
|
size: "small",
|
|
1057
1151
|
type: "primary",
|
|
1058
1152
|
icon: unref(Position),
|
|
1059
|
-
disabled:
|
|
1153
|
+
disabled: __props.disabled,
|
|
1060
1154
|
onClick: _cache[2] || (_cache[2] = ($event) => moveSpecifyLocationVisible.value = true)
|
|
1061
1155
|
}, {
|
|
1062
1156
|
default: withCtx(() => [..._cache[9] || (_cache[9] = [
|
|
@@ -1084,7 +1178,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1084
1178
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moveSpecifyLocationIndex.value = $event),
|
|
1085
1179
|
size: "small",
|
|
1086
1180
|
min: 1,
|
|
1087
|
-
disabled:
|
|
1181
|
+
disabled: __props.disabled
|
|
1088
1182
|
}, null, 8, ["modelValue", "disabled"]),
|
|
1089
1183
|
_cache[11] || (_cache[11] = createTextVNode(
|
|
1090
1184
|
"行 ",
|
|
@@ -1133,18 +1227,18 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1133
1227
|
key: 3,
|
|
1134
1228
|
innerHTML: itemExtra.value,
|
|
1135
1229
|
class: "m-form-tip"
|
|
1136
|
-
}, null, 8, _hoisted_3$
|
|
1230
|
+
}, null, 8, _hoisted_3$4)) : createCommentVNode("v-if", true)
|
|
1137
1231
|
]),
|
|
1138
|
-
expand.value ? (openBlock(), createBlock(_sfc_main$
|
|
1232
|
+
expand.value ? (openBlock(), createBlock(_sfc_main$A, {
|
|
1139
1233
|
key: 0,
|
|
1140
1234
|
config: rowConfig.value,
|
|
1141
|
-
model:
|
|
1142
|
-
lastValues:
|
|
1143
|
-
"is-compare":
|
|
1144
|
-
labelWidth:
|
|
1145
|
-
prop: `${
|
|
1146
|
-
size:
|
|
1147
|
-
disabled:
|
|
1235
|
+
model: __props.model,
|
|
1236
|
+
lastValues: __props.lastValues,
|
|
1237
|
+
"is-compare": __props.isCompare,
|
|
1238
|
+
labelWidth: __props.labelWidth,
|
|
1239
|
+
prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
|
|
1240
|
+
size: __props.size,
|
|
1241
|
+
disabled: __props.disabled,
|
|
1148
1242
|
onChange: changeHandler,
|
|
1149
1243
|
onAddDiffCount: _cache[5] || (_cache[5] = ($event) => onAddDiffCount())
|
|
1150
1244
|
}, null, 8, ["config", "model", "lastValues", "is-compare", "labelWidth", "prop", "size", "disabled"])) : createCommentVNode("v-if", true)
|
|
@@ -1153,13 +1247,13 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1153
1247
|
}
|
|
1154
1248
|
});
|
|
1155
1249
|
|
|
1156
|
-
const _hoisted_1$
|
|
1250
|
+
const _hoisted_1$a = { class: "m-fields-group-list" };
|
|
1157
1251
|
const _hoisted_2$4 = ["innerHTML"];
|
|
1158
|
-
const _hoisted_3$
|
|
1252
|
+
const _hoisted_3$3 = {
|
|
1159
1253
|
key: 1,
|
|
1160
1254
|
class: "el-table__empty-block"
|
|
1161
1255
|
};
|
|
1162
|
-
const _sfc_main$
|
|
1256
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
1163
1257
|
...{
|
|
1164
1258
|
name: "MFormGroupList"
|
|
1165
1259
|
},
|
|
@@ -1249,13 +1343,13 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1249
1343
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
1250
1344
|
const getLastValues = (item, index) => item?.[index] || {};
|
|
1251
1345
|
return (_ctx, _cache) => {
|
|
1252
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1253
|
-
|
|
1346
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
1347
|
+
__props.config.extra ? (openBlock(), createElementBlock("div", {
|
|
1254
1348
|
key: 0,
|
|
1255
|
-
innerHTML:
|
|
1349
|
+
innerHTML: __props.config.extra,
|
|
1256
1350
|
style: { "color": "rgba(0, 0, 0, 0.45)" }
|
|
1257
1351
|
}, null, 8, _hoisted_2$4)) : createCommentVNode("v-if", true),
|
|
1258
|
-
!
|
|
1352
|
+
!__props.model[__props.name] || !__props.model[__props.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$3, [..._cache[1] || (_cache[1] = [
|
|
1259
1353
|
createElementVNode(
|
|
1260
1354
|
"span",
|
|
1261
1355
|
{ class: "el-table__empty-text" },
|
|
@@ -1266,19 +1360,19 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1266
1360
|
])])) : (openBlock(true), createElementBlock(
|
|
1267
1361
|
Fragment,
|
|
1268
1362
|
{ key: 2 },
|
|
1269
|
-
renderList(
|
|
1270
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1363
|
+
renderList(__props.model[__props.name], (item, index) => {
|
|
1364
|
+
return openBlock(), createBlock(_sfc_main$x, {
|
|
1271
1365
|
key: index,
|
|
1272
1366
|
model: item,
|
|
1273
|
-
lastValues: getLastValues(
|
|
1274
|
-
"is-compare":
|
|
1275
|
-
config:
|
|
1276
|
-
prop:
|
|
1367
|
+
lastValues: getLastValues(__props.lastValues[__props.name], index),
|
|
1368
|
+
"is-compare": __props.isCompare,
|
|
1369
|
+
config: __props.config,
|
|
1370
|
+
prop: __props.prop,
|
|
1277
1371
|
index,
|
|
1278
|
-
"label-width":
|
|
1279
|
-
size:
|
|
1280
|
-
disabled:
|
|
1281
|
-
"group-model":
|
|
1372
|
+
"label-width": __props.labelWidth,
|
|
1373
|
+
size: __props.size,
|
|
1374
|
+
disabled: __props.disabled,
|
|
1375
|
+
"group-model": __props.model[__props.name],
|
|
1282
1376
|
onRemoveItem: removeHandler,
|
|
1283
1377
|
onCopyItem: copyHandler,
|
|
1284
1378
|
onSwapItem: swapHandler,
|
|
@@ -1292,8 +1386,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1292
1386
|
addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
1293
1387
|
key: 3,
|
|
1294
1388
|
type: "primary",
|
|
1295
|
-
size:
|
|
1296
|
-
disabled:
|
|
1389
|
+
size: __props.config.enableToggleMode ? "small" : "default",
|
|
1390
|
+
disabled: __props.disabled,
|
|
1297
1391
|
onClick: addHandler
|
|
1298
1392
|
}, {
|
|
1299
1393
|
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
@@ -1306,7 +1400,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1306
1400
|
_: 1
|
|
1307
1401
|
/* STABLE */
|
|
1308
1402
|
}, 8, ["size", "disabled"])) : createCommentVNode("v-if", true),
|
|
1309
|
-
|
|
1403
|
+
__props.config.enableToggleMode ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
1310
1404
|
key: 4,
|
|
1311
1405
|
icon: unref(Grid),
|
|
1312
1406
|
size: "small",
|
|
@@ -1327,15 +1421,15 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1327
1421
|
}
|
|
1328
1422
|
});
|
|
1329
1423
|
|
|
1330
|
-
const _hoisted_1$
|
|
1424
|
+
const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
1331
1425
|
const _hoisted_2$3 = ["innerHTML"];
|
|
1332
|
-
const _hoisted_3$
|
|
1426
|
+
const _hoisted_3$2 = {
|
|
1333
1427
|
key: 0,
|
|
1334
1428
|
style: { "display": "flex" }
|
|
1335
1429
|
};
|
|
1336
1430
|
const _hoisted_4$1 = { style: { "flex": "1" } };
|
|
1337
1431
|
const _hoisted_5$1 = ["src"];
|
|
1338
|
-
const _sfc_main$
|
|
1432
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
1339
1433
|
...{
|
|
1340
1434
|
name: "MFormPanel"
|
|
1341
1435
|
},
|
|
@@ -1370,21 +1464,21 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1370
1464
|
"body-style": { display: expand.value ? "block" : "none" }
|
|
1371
1465
|
}, {
|
|
1372
1466
|
header: withCtx(() => [
|
|
1373
|
-
createElementVNode("div", _hoisted_1$
|
|
1467
|
+
createElementVNode("div", _hoisted_1$9, [
|
|
1374
1468
|
createVNode(unref(TMagicButton), {
|
|
1375
1469
|
style: { "padding": "0" },
|
|
1376
1470
|
link: "",
|
|
1377
1471
|
icon: expand.value ? unref(CaretBottom) : unref(CaretRight),
|
|
1378
1472
|
onClick: _cache[0] || (_cache[0] = ($event) => expand.value = !expand.value)
|
|
1379
1473
|
}, null, 8, ["icon"]),
|
|
1380
|
-
|
|
1474
|
+
__props.config && __props.config.extra ? (openBlock(), createElementBlock("span", {
|
|
1381
1475
|
key: 0,
|
|
1382
|
-
innerHTML:
|
|
1476
|
+
innerHTML: __props.config.extra,
|
|
1383
1477
|
class: "m-form-tip"
|
|
1384
1478
|
}, null, 8, _hoisted_2$3)) : createCommentVNode("v-if", true),
|
|
1385
1479
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
1386
1480
|
createTextVNode(
|
|
1387
|
-
toDisplayString(filter(
|
|
1481
|
+
toDisplayString(filter(__props.config.title)),
|
|
1388
1482
|
1
|
|
1389
1483
|
/* TEXT */
|
|
1390
1484
|
)
|
|
@@ -1394,22 +1488,22 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1394
1488
|
default: withCtx(() => [
|
|
1395
1489
|
createElementVNode("div", null, [
|
|
1396
1490
|
renderSlot(_ctx.$slots, "default"),
|
|
1397
|
-
|
|
1491
|
+
__props.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
|
|
1398
1492
|
createElementVNode("div", _hoisted_4$1, [
|
|
1399
1493
|
(openBlock(true), createElementBlock(
|
|
1400
1494
|
Fragment,
|
|
1401
1495
|
null,
|
|
1402
1496
|
renderList(items.value, (item, index) => {
|
|
1403
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1497
|
+
return openBlock(), createBlock(_sfc_main$A, {
|
|
1404
1498
|
key: item[unref(mForm)?.keyProp || "__key"] ?? index,
|
|
1405
1499
|
config: item,
|
|
1406
|
-
model:
|
|
1407
|
-
lastValues:
|
|
1408
|
-
"is-compare":
|
|
1409
|
-
prop:
|
|
1410
|
-
size:
|
|
1411
|
-
disabled:
|
|
1412
|
-
"label-width":
|
|
1500
|
+
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
1501
|
+
lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
|
|
1502
|
+
"is-compare": __props.isCompare,
|
|
1503
|
+
prop: __props.prop,
|
|
1504
|
+
size: __props.size,
|
|
1505
|
+
disabled: __props.disabled,
|
|
1506
|
+
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
1413
1507
|
onChange: changeHandler,
|
|
1414
1508
|
onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
|
|
1415
1509
|
}, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
|
|
@@ -1420,22 +1514,22 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1420
1514
|
]),
|
|
1421
1515
|
createElementVNode("img", {
|
|
1422
1516
|
class: "m-form-schematic",
|
|
1423
|
-
src:
|
|
1517
|
+
src: __props.config.schematic
|
|
1424
1518
|
}, null, 8, _hoisted_5$1)
|
|
1425
1519
|
])) : (openBlock(true), createElementBlock(
|
|
1426
1520
|
Fragment,
|
|
1427
1521
|
{ key: 1 },
|
|
1428
1522
|
renderList(items.value, (item, index) => {
|
|
1429
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1523
|
+
return openBlock(), createBlock(_sfc_main$A, {
|
|
1430
1524
|
key: item[unref(mForm)?.keyProp || "__key"] ?? index,
|
|
1431
1525
|
config: item,
|
|
1432
|
-
model:
|
|
1433
|
-
lastValues:
|
|
1434
|
-
"is-compare":
|
|
1435
|
-
prop:
|
|
1436
|
-
size:
|
|
1437
|
-
disabled:
|
|
1438
|
-
"label-width":
|
|
1526
|
+
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
1527
|
+
lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
|
|
1528
|
+
"is-compare": __props.isCompare,
|
|
1529
|
+
prop: __props.prop,
|
|
1530
|
+
size: __props.size,
|
|
1531
|
+
disabled: __props.disabled,
|
|
1532
|
+
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
1439
1533
|
onChange: changeHandler,
|
|
1440
1534
|
onAddDiffCount: _cache[2] || (_cache[2] = ($event) => onAddDiffCount())
|
|
1441
1535
|
}, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
|
|
@@ -1452,7 +1546,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1452
1546
|
}
|
|
1453
1547
|
});
|
|
1454
1548
|
|
|
1455
|
-
const _sfc_main$
|
|
1549
|
+
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
1456
1550
|
...{
|
|
1457
1551
|
name: "MFormCol"
|
|
1458
1552
|
},
|
|
@@ -1478,18 +1572,18 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
1478
1572
|
const changeHandler = (v, eventData) => emit("change", v, eventData);
|
|
1479
1573
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
1480
1574
|
return (_ctx, _cache) => {
|
|
1481
|
-
return withDirectives((openBlock(), createBlock(unref(TMagicCol), { span:
|
|
1575
|
+
return withDirectives((openBlock(), createBlock(unref(TMagicCol), { span: __props.span }, {
|
|
1482
1576
|
default: withCtx(() => [
|
|
1483
|
-
createVNode(_sfc_main$
|
|
1484
|
-
model:
|
|
1485
|
-
lastValues:
|
|
1486
|
-
"is-compare":
|
|
1487
|
-
config:
|
|
1488
|
-
prop:
|
|
1489
|
-
"label-width":
|
|
1490
|
-
"expand-more":
|
|
1491
|
-
size:
|
|
1492
|
-
disabled:
|
|
1577
|
+
createVNode(_sfc_main$A, {
|
|
1578
|
+
model: __props.model,
|
|
1579
|
+
lastValues: __props.lastValues,
|
|
1580
|
+
"is-compare": __props.isCompare,
|
|
1581
|
+
config: __props.config,
|
|
1582
|
+
prop: __props.prop,
|
|
1583
|
+
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
1584
|
+
"expand-more": __props.expandMore,
|
|
1585
|
+
size: __props.size,
|
|
1586
|
+
disabled: __props.disabled,
|
|
1493
1587
|
onChange: changeHandler,
|
|
1494
1588
|
onAddDiffCount
|
|
1495
1589
|
}, null, 8, ["model", "lastValues", "is-compare", "config", "prop", "label-width", "expand-more", "size", "disabled"])
|
|
@@ -1497,13 +1591,13 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
1497
1591
|
_: 1
|
|
1498
1592
|
/* STABLE */
|
|
1499
1593
|
}, 8, ["span"])), [
|
|
1500
|
-
[vShow, display$1.value &&
|
|
1594
|
+
[vShow, display$1.value && __props.config.type !== "hidden"]
|
|
1501
1595
|
]);
|
|
1502
1596
|
};
|
|
1503
1597
|
}
|
|
1504
1598
|
});
|
|
1505
1599
|
|
|
1506
|
-
const _sfc_main$
|
|
1600
|
+
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
1507
1601
|
...{
|
|
1508
1602
|
name: "MFormRow"
|
|
1509
1603
|
},
|
|
@@ -1535,19 +1629,19 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
1535
1629
|
(openBlock(true), createElementBlock(
|
|
1536
1630
|
Fragment,
|
|
1537
1631
|
null,
|
|
1538
|
-
renderList(
|
|
1539
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1632
|
+
renderList(__props.config.items, (col, index) => {
|
|
1633
|
+
return openBlock(), createBlock(_sfc_main$u, {
|
|
1540
1634
|
key: col[unref(mForm)?.keyProp || "__key"] ?? index,
|
|
1541
|
-
span: col.span ||
|
|
1635
|
+
span: col.span || __props.config.span || 24 / __props.config.items.length,
|
|
1542
1636
|
config: col,
|
|
1543
|
-
labelWidth:
|
|
1544
|
-
expandMore:
|
|
1545
|
-
model:
|
|
1546
|
-
lastValues:
|
|
1547
|
-
"is-compare":
|
|
1548
|
-
prop:
|
|
1549
|
-
size:
|
|
1550
|
-
disabled:
|
|
1637
|
+
labelWidth: __props.config.labelWidth || __props.labelWidth,
|
|
1638
|
+
expandMore: __props.expandMore,
|
|
1639
|
+
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
1640
|
+
lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
|
|
1641
|
+
"is-compare": __props.isCompare,
|
|
1642
|
+
prop: __props.prop,
|
|
1643
|
+
size: __props.size,
|
|
1644
|
+
disabled: __props.disabled,
|
|
1551
1645
|
onChange: changeHandler,
|
|
1552
1646
|
onAddDiffCount
|
|
1553
1647
|
}, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "lastValues", "is-compare", "prop", "size", "disabled"]);
|
|
@@ -1563,7 +1657,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
1563
1657
|
}
|
|
1564
1658
|
});
|
|
1565
1659
|
|
|
1566
|
-
const _sfc_main$
|
|
1660
|
+
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
1567
1661
|
...{
|
|
1568
1662
|
name: "MFormStep"
|
|
1569
1663
|
},
|
|
@@ -1601,13 +1695,13 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
1601
1695
|
createVNode(unref(TMagicSteps), {
|
|
1602
1696
|
active: active.value,
|
|
1603
1697
|
"align-center": "",
|
|
1604
|
-
space:
|
|
1698
|
+
space: __props.config.space
|
|
1605
1699
|
}, {
|
|
1606
1700
|
default: withCtx(() => [
|
|
1607
1701
|
(openBlock(true), createElementBlock(
|
|
1608
1702
|
Fragment,
|
|
1609
1703
|
null,
|
|
1610
|
-
renderList(
|
|
1704
|
+
renderList(__props.config.items, (item, index) => {
|
|
1611
1705
|
return openBlock(), createBlock(unref(TMagicStep), {
|
|
1612
1706
|
key: item.__key,
|
|
1613
1707
|
title: item.title,
|
|
@@ -1625,7 +1719,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
1625
1719
|
(openBlock(true), createElementBlock(
|
|
1626
1720
|
Fragment,
|
|
1627
1721
|
null,
|
|
1628
|
-
renderList(
|
|
1722
|
+
renderList(__props.config.items, (step, index) => {
|
|
1629
1723
|
return openBlock(), createElementBlock(
|
|
1630
1724
|
Fragment,
|
|
1631
1725
|
null,
|
|
@@ -1638,16 +1732,16 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
1638
1732
|
Fragment,
|
|
1639
1733
|
null,
|
|
1640
1734
|
[
|
|
1641
|
-
item ? withDirectives((openBlock(), createBlock(_sfc_main$
|
|
1735
|
+
item ? withDirectives((openBlock(), createBlock(_sfc_main$A, {
|
|
1642
1736
|
key: item[unref(mForm)?.keyProp || "__key"],
|
|
1643
1737
|
config: item,
|
|
1644
|
-
model: step.name ?
|
|
1645
|
-
lastValues: step.name ?
|
|
1646
|
-
"is-compare":
|
|
1738
|
+
model: step.name ? __props.model[step.name] : __props.model,
|
|
1739
|
+
lastValues: step.name ? __props.lastValues[step.name] : __props.lastValues,
|
|
1740
|
+
"is-compare": __props.isCompare,
|
|
1647
1741
|
prop: `${step.name}`,
|
|
1648
|
-
size:
|
|
1649
|
-
disabled:
|
|
1650
|
-
"label-width":
|
|
1742
|
+
size: __props.size,
|
|
1743
|
+
disabled: __props.disabled,
|
|
1744
|
+
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
1651
1745
|
onChange: changeHandler,
|
|
1652
1746
|
onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
|
|
1653
1747
|
}, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"])), [
|
|
@@ -1674,812 +1768,86 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
1674
1768
|
}
|
|
1675
1769
|
});
|
|
1676
1770
|
|
|
1677
|
-
const
|
|
1678
|
-
const _hoisted_2$2 = ["innerHTML"];
|
|
1679
|
-
const _hoisted_3 = ["innerHTML"];
|
|
1680
|
-
const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
|
|
1681
|
-
const _hoisted_5 = { style: { "display": "flex" } };
|
|
1682
|
-
const _hoisted_6 = {
|
|
1683
|
-
key: 1,
|
|
1684
|
-
class: "bottom",
|
|
1685
|
-
style: { "text-align": "right" }
|
|
1686
|
-
};
|
|
1687
|
-
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
1771
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
1688
1772
|
...{
|
|
1689
|
-
name: "
|
|
1773
|
+
name: "MFormTabs"
|
|
1690
1774
|
},
|
|
1691
|
-
__name: "
|
|
1775
|
+
__name: "Tabs",
|
|
1692
1776
|
props: {
|
|
1693
1777
|
model: {},
|
|
1694
1778
|
lastValues: { default: () => ({}) },
|
|
1695
1779
|
isCompare: { type: Boolean, default: false },
|
|
1696
1780
|
config: {},
|
|
1697
1781
|
name: {},
|
|
1698
|
-
prop: { default: "" },
|
|
1699
|
-
labelWidth: {},
|
|
1700
|
-
sort: { type: Boolean },
|
|
1701
|
-
disabled: { type: Boolean },
|
|
1702
|
-
sortKey: { default: "" },
|
|
1703
|
-
text: {},
|
|
1704
1782
|
size: {},
|
|
1705
|
-
|
|
1706
|
-
|
|
1783
|
+
labelWidth: {},
|
|
1784
|
+
prop: {},
|
|
1785
|
+
expandMore: { type: Boolean },
|
|
1786
|
+
disabled: { type: Boolean }
|
|
1707
1787
|
},
|
|
1708
|
-
emits: ["change", "
|
|
1709
|
-
setup(__props, {
|
|
1710
|
-
const
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
const pagecontext = ref(0);
|
|
1720
|
-
const updateKey = ref(1);
|
|
1721
|
-
const isFullscreen = ref(false);
|
|
1722
|
-
const modelName = computed(() => props.name || props.config.name || "");
|
|
1723
|
-
const getDataByPage = (data2 = []) => data2.filter(
|
|
1724
|
-
(item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value
|
|
1725
|
-
);
|
|
1726
|
-
const pageinationData = computed(() => getDataByPage(props.model[modelName.value]));
|
|
1727
|
-
const data = computed(() => props.config.pagination ? pageinationData.value : props.model[modelName.value]);
|
|
1728
|
-
const lastData = computed(
|
|
1729
|
-
() => props.config.pagination ? getDataByPage(props.lastValues[modelName.value]) : props.lastValues[modelName.value] || []
|
|
1730
|
-
);
|
|
1731
|
-
const sortChange = ({ prop, order }) => {
|
|
1732
|
-
if (order === "ascending") {
|
|
1733
|
-
props.model[modelName.value] = props.model[modelName.value].sort((a, b) => a[prop] - b[prop]);
|
|
1734
|
-
} else if (order === "descending") {
|
|
1735
|
-
props.model[modelName.value] = props.model[modelName.value].sort((a, b) => b[prop] - a[prop]);
|
|
1736
|
-
}
|
|
1737
|
-
};
|
|
1738
|
-
const swapArray = (index1, index2) => {
|
|
1739
|
-
props.model[modelName.value].splice(index1, 0, props.model[modelName.value].splice(index2, 1)[0]);
|
|
1740
|
-
if (props.sortKey) {
|
|
1741
|
-
for (let i = props.model[modelName.value].length - 1, v = 0; i >= 0; i--, v++) {
|
|
1742
|
-
props.model[modelName.value][v][props.sortKey] = i;
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
1746
|
-
};
|
|
1747
|
-
let sortable;
|
|
1748
|
-
const rowDrop = () => {
|
|
1749
|
-
sortable?.destroy();
|
|
1750
|
-
const tableEl = tMagicTable.value?.instance.$el;
|
|
1751
|
-
const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
|
|
1752
|
-
if (!tBodyEl) {
|
|
1753
|
-
return;
|
|
1754
|
-
}
|
|
1755
|
-
sortable = Sortable.create(tBodyEl, {
|
|
1756
|
-
draggable: ".tmagic-design-table-row",
|
|
1757
|
-
filter: "input",
|
|
1758
|
-
// 表单组件选字操作和触发拖拽会冲突,优先保证选字操作
|
|
1759
|
-
preventOnFilter: false,
|
|
1760
|
-
// 允许选字
|
|
1761
|
-
direction: "vertical",
|
|
1762
|
-
onEnd: ({ newIndex, oldIndex }) => {
|
|
1763
|
-
if (typeof newIndex === "undefined") return;
|
|
1764
|
-
if (typeof oldIndex === "undefined") return;
|
|
1765
|
-
swapArray(newIndex, oldIndex);
|
|
1766
|
-
emit("change", props.model[modelName.value]);
|
|
1767
|
-
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
1768
|
-
}
|
|
1769
|
-
});
|
|
1788
|
+
emits: ["change", "addDiffCount"],
|
|
1789
|
+
setup(__props, { emit: __emit }) {
|
|
1790
|
+
const tabPaneComponent = getDesignConfig("components")?.tabPane;
|
|
1791
|
+
const tabsComponent = getDesignConfig("components")?.tabs;
|
|
1792
|
+
const getActive = (mForm2, props2, activeTabName2) => {
|
|
1793
|
+
const { config, model, prop } = props2;
|
|
1794
|
+
const { active } = config;
|
|
1795
|
+
if (typeof active === "function") return active(mForm2, { model, formValue: mForm2?.values, prop });
|
|
1796
|
+
if (0 >= props2.config.items.length) return "0";
|
|
1797
|
+
if (typeof active !== "undefined") return active;
|
|
1798
|
+
return "0";
|
|
1770
1799
|
};
|
|
1771
|
-
const
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
if (typeof props.config.beforeAddRow === "function") {
|
|
1777
|
-
const beforeCheckRes = props.config.beforeAddRow(mForm, {
|
|
1778
|
-
model: props.model[modelName.value],
|
|
1779
|
-
formValue: mForm?.values,
|
|
1780
|
-
prop: props.prop
|
|
1781
|
-
});
|
|
1782
|
-
if (!beforeCheckRes) return;
|
|
1783
|
-
}
|
|
1784
|
-
const columns = props.config.items;
|
|
1785
|
-
const enumValues = props.config.enum || [];
|
|
1786
|
-
let enumV = [];
|
|
1787
|
-
const { length } = props.model[modelName.value];
|
|
1788
|
-
const key = props.config.key || "id";
|
|
1789
|
-
let inputs = {};
|
|
1790
|
-
if (enumValues.length) {
|
|
1791
|
-
if (length >= enumValues.length) {
|
|
1792
|
-
return;
|
|
1793
|
-
}
|
|
1794
|
-
enumV = enumValues.filter((item) => {
|
|
1795
|
-
let i = 0;
|
|
1796
|
-
for (; i < length; i++) {
|
|
1797
|
-
if (item[key] === props.model[modelName.value][i][key]) {
|
|
1798
|
-
break;
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
return i === length;
|
|
1802
|
-
});
|
|
1803
|
-
if (enumV.length > 0) {
|
|
1804
|
-
inputs = enumV[0];
|
|
1805
|
-
}
|
|
1806
|
-
} else if (Array.isArray(row)) {
|
|
1807
|
-
columns.forEach((column, index) => {
|
|
1808
|
-
column.name && (inputs[column.name] = row[index]);
|
|
1809
|
-
});
|
|
1810
|
-
} else {
|
|
1811
|
-
if (typeof props.config.defaultAdd === "function") {
|
|
1812
|
-
inputs = await props.config.defaultAdd(mForm, {
|
|
1813
|
-
model: props.model[modelName.value],
|
|
1814
|
-
formValue: mForm?.values
|
|
1815
|
-
});
|
|
1816
|
-
} else if (props.config.defaultAdd) {
|
|
1817
|
-
inputs = props.config.defaultAdd;
|
|
1818
|
-
}
|
|
1819
|
-
inputs = await initValue(mForm, {
|
|
1820
|
-
config: columns,
|
|
1821
|
-
initValues: inputs
|
|
1822
|
-
});
|
|
1800
|
+
const tabClick = (mForm2, tab, props2) => {
|
|
1801
|
+
const { config, model, prop } = props2;
|
|
1802
|
+
tab.name = tab.paneName;
|
|
1803
|
+
if (typeof config.onTabClick === "function") {
|
|
1804
|
+
config.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
|
|
1823
1805
|
}
|
|
1824
|
-
|
|
1825
|
-
|
|
1806
|
+
const tabConfig = config.items.find((item) => tab.name === item.status);
|
|
1807
|
+
if (tabConfig && typeof tabConfig.onTabClick === "function") {
|
|
1808
|
+
tabConfig.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
|
|
1826
1809
|
}
|
|
1827
|
-
props.model[modelName.value].push(inputs);
|
|
1828
|
-
emit("change", props.model[modelName.value], {
|
|
1829
|
-
changeRecords: [
|
|
1830
|
-
{
|
|
1831
|
-
propPath: `${props.prop}.${props.model[modelName.value].length - 1}`,
|
|
1832
|
-
value: inputs
|
|
1833
|
-
}
|
|
1834
|
-
]
|
|
1835
|
-
});
|
|
1836
1810
|
};
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
if (props.
|
|
1844
|
-
props.
|
|
1811
|
+
const props = __props;
|
|
1812
|
+
const emit = __emit;
|
|
1813
|
+
const mForm = inject("mForm");
|
|
1814
|
+
const activeTabName = ref(getActive(mForm, props));
|
|
1815
|
+
const diffCount = ref({});
|
|
1816
|
+
const tabs = computed(() => {
|
|
1817
|
+
if (props.config.dynamic) {
|
|
1818
|
+
if (!props.config.name) throw new Error("dynamic tab 必须配置name");
|
|
1819
|
+
return props.model[props.config.name] || [];
|
|
1845
1820
|
}
|
|
1821
|
+
return props.config.items.filter((item) => display(mForm, item.display, props));
|
|
1846
1822
|
});
|
|
1823
|
+
const filter = (config) => filterFunction(mForm, config, props);
|
|
1847
1824
|
watchEffect(() => {
|
|
1848
|
-
if (props.config.
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
});
|
|
1852
|
-
const addable = computed(() => {
|
|
1853
|
-
if (!props.model[modelName.value].length) {
|
|
1854
|
-
return true;
|
|
1855
|
-
}
|
|
1856
|
-
if (typeof props.config.addable === "function") {
|
|
1857
|
-
return props.config.addable(mForm, {
|
|
1858
|
-
model: props.model[modelName.value],
|
|
1859
|
-
formValue: mForm?.values,
|
|
1825
|
+
if (typeof props.config.activeChange === "function") {
|
|
1826
|
+
props.config.activeChange(mForm, activeTabName.value, {
|
|
1827
|
+
model: props.model,
|
|
1860
1828
|
prop: props.prop
|
|
1861
1829
|
});
|
|
1862
1830
|
}
|
|
1863
|
-
return typeof props.config.addable === "undefined" ? true : props.config.addable;
|
|
1864
|
-
});
|
|
1865
|
-
const selection = computed(() => {
|
|
1866
|
-
if (typeof props.config.selection === "function") {
|
|
1867
|
-
return props.config.selection(mForm, { model: props.model[modelName.value] });
|
|
1868
|
-
}
|
|
1869
|
-
return props.config.selection;
|
|
1870
1831
|
});
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1832
|
+
const tabItems = (tab) => props.config.dynamic ? props.config.items : tab.items;
|
|
1833
|
+
const tabClickHandler = (tab) => {
|
|
1834
|
+
if (typeof tab === "object") {
|
|
1835
|
+
tabClick(mForm, tab, props);
|
|
1836
|
+
} else {
|
|
1837
|
+
let item = tabs.value.find((tab2) => tab2.status === tab2);
|
|
1838
|
+
if (!item) {
|
|
1839
|
+
item = tabs.value[tab];
|
|
1840
|
+
}
|
|
1841
|
+
tabClick(mForm, item, props);
|
|
1877
1842
|
}
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
return fuc(mForm, {
|
|
1884
|
-
values: mForm?.initValues,
|
|
1843
|
+
};
|
|
1844
|
+
const onTabAdd = async () => {
|
|
1845
|
+
if (!props.name) throw new Error("dynamic tab 必须配置name");
|
|
1846
|
+
if (typeof props.config.onTabAdd === "function") {
|
|
1847
|
+
props.config.onTabAdd(mForm, {
|
|
1885
1848
|
model: props.model,
|
|
1886
|
-
formValue: mForm ? mForm.values : props.model,
|
|
1887
1849
|
prop: props.prop,
|
|
1888
|
-
|
|
1889
|
-
});
|
|
1890
|
-
}
|
|
1891
|
-
return fuc;
|
|
1892
|
-
};
|
|
1893
|
-
const removeHandler = (index) => {
|
|
1894
|
-
if (props.disabled) return;
|
|
1895
|
-
props.model[modelName.value].splice(index, 1);
|
|
1896
|
-
emit("change", props.model[modelName.value]);
|
|
1897
|
-
};
|
|
1898
|
-
const selectHandle = (selection2, row) => {
|
|
1899
|
-
if (typeof props.config.selection === "string" && props.config.selection === "single") {
|
|
1900
|
-
tMagicTable.value?.clearSelection();
|
|
1901
|
-
tMagicTable.value?.toggleRowSelection(row, true);
|
|
1902
|
-
}
|
|
1903
|
-
emit("select", selection2, row);
|
|
1904
|
-
if (typeof props.config.onSelect === "function") {
|
|
1905
|
-
props.config.onSelect(mForm, { selection: selection2, row, config: props.config });
|
|
1906
|
-
}
|
|
1907
|
-
};
|
|
1908
|
-
const toggleRowSelection = (row, selected) => {
|
|
1909
|
-
tMagicTable.value?.toggleRowSelection.call(tMagicTable.value, row, selected);
|
|
1910
|
-
};
|
|
1911
|
-
const makeConfig = (config, row) => {
|
|
1912
|
-
const newConfig = cloneDeep(config);
|
|
1913
|
-
if (typeof config.itemsFunction === "function") {
|
|
1914
|
-
newConfig.items = config.itemsFunction(row);
|
|
1915
|
-
}
|
|
1916
|
-
delete newConfig.display;
|
|
1917
|
-
return newConfig;
|
|
1918
|
-
};
|
|
1919
|
-
const upHandler = (index) => {
|
|
1920
|
-
if (timer) {
|
|
1921
|
-
clearTimeout(timer);
|
|
1922
|
-
}
|
|
1923
|
-
timer = setTimeout(() => {
|
|
1924
|
-
swapArray(index, index - 1);
|
|
1925
|
-
timer = void 0;
|
|
1926
|
-
}, 300);
|
|
1927
|
-
};
|
|
1928
|
-
const topHandler = (index) => {
|
|
1929
|
-
if (timer) {
|
|
1930
|
-
clearTimeout(timer);
|
|
1931
|
-
}
|
|
1932
|
-
const moveNum = index;
|
|
1933
|
-
for (let i = 0; i < moveNum; i++) {
|
|
1934
|
-
swapArray(index, index - 1);
|
|
1935
|
-
index -= 1;
|
|
1936
|
-
}
|
|
1937
|
-
};
|
|
1938
|
-
const downHandler = (index) => {
|
|
1939
|
-
if (timer) {
|
|
1940
|
-
clearTimeout(timer);
|
|
1941
|
-
}
|
|
1942
|
-
timer = setTimeout(() => {
|
|
1943
|
-
swapArray(index, index + 1);
|
|
1944
|
-
timer = void 0;
|
|
1945
|
-
}, 300);
|
|
1946
|
-
};
|
|
1947
|
-
const bottomHandler = (index) => {
|
|
1948
|
-
if (timer) {
|
|
1949
|
-
clearTimeout(timer);
|
|
1950
|
-
}
|
|
1951
|
-
const moveNum = props.model[modelName.value].length - 1 - index;
|
|
1952
|
-
for (let i = 0; i < moveNum; i++) {
|
|
1953
|
-
swapArray(index, index + 1);
|
|
1954
|
-
index += 1;
|
|
1955
|
-
}
|
|
1956
|
-
};
|
|
1957
|
-
const showDelete = (index) => {
|
|
1958
|
-
const deleteFunc = props.config.delete;
|
|
1959
|
-
if (deleteFunc && typeof deleteFunc === "function") {
|
|
1960
|
-
return deleteFunc(props.model[modelName.value], index, mForm?.values);
|
|
1961
|
-
}
|
|
1962
|
-
return true;
|
|
1963
|
-
};
|
|
1964
|
-
const copyable = (index) => {
|
|
1965
|
-
const copyableFunc = props.config.copyable;
|
|
1966
|
-
if (copyableFunc && typeof copyableFunc === "function") {
|
|
1967
|
-
return copyableFunc(mForm, {
|
|
1968
|
-
values: mForm?.initValues || {},
|
|
1969
|
-
model: props.model,
|
|
1970
|
-
parent: mForm?.parentValues || {},
|
|
1971
|
-
formValue: mForm?.values || props.model,
|
|
1972
|
-
prop: props.prop,
|
|
1973
|
-
config: props.config,
|
|
1974
|
-
index
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
return true;
|
|
1978
|
-
};
|
|
1979
|
-
const clearHandler = () => {
|
|
1980
|
-
const len = props.model[modelName.value].length;
|
|
1981
|
-
props.model[modelName.value].splice(0, len);
|
|
1982
|
-
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
1983
|
-
};
|
|
1984
|
-
const excelHandler = async (file) => {
|
|
1985
|
-
if (!file?.raw) {
|
|
1986
|
-
return false;
|
|
1987
|
-
}
|
|
1988
|
-
if (!globalThis.XLSX) {
|
|
1989
|
-
await asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
|
|
1990
|
-
}
|
|
1991
|
-
const reader = new FileReader();
|
|
1992
|
-
reader.onload = () => {
|
|
1993
|
-
const data2 = reader.result;
|
|
1994
|
-
const pdata = globalThis.XLSX.read(data2, { type: "array" });
|
|
1995
|
-
pdata.SheetNames.forEach((sheetName) => {
|
|
1996
|
-
const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
|
|
1997
|
-
if (arr?.[0]) {
|
|
1998
|
-
arr.forEach((row) => {
|
|
1999
|
-
newHandler(row);
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
setTimeout(() => {
|
|
2003
|
-
excelBtn.value?.clearFiles();
|
|
2004
|
-
}, 300);
|
|
2005
|
-
});
|
|
2006
|
-
};
|
|
2007
|
-
reader.readAsArrayBuffer(file.raw);
|
|
2008
|
-
return false;
|
|
2009
|
-
};
|
|
2010
|
-
const handleSizeChange = (val) => {
|
|
2011
|
-
pagesize.value = val;
|
|
2012
|
-
};
|
|
2013
|
-
const handleCurrentChange = (val) => {
|
|
2014
|
-
pagecontext.value = val - 1;
|
|
2015
|
-
};
|
|
2016
|
-
const copyHandler = (index) => {
|
|
2017
|
-
props.model[modelName.value].push(cloneDeep(props.model[modelName.value][index]));
|
|
2018
|
-
};
|
|
2019
|
-
const toggleMode = () => {
|
|
2020
|
-
const calcLabelWidth = (label) => {
|
|
2021
|
-
if (!label) return "0px";
|
|
2022
|
-
const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
|
|
2023
|
-
const chLength = label.length - zhLength;
|
|
2024
|
-
return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
|
|
2025
|
-
};
|
|
2026
|
-
props.config.type = "groupList";
|
|
2027
|
-
props.config.enableToggleMode = true;
|
|
2028
|
-
props.config.tableItems = props.config.items;
|
|
2029
|
-
props.config.items = props.config.groupItems || props.config.items.map((item) => {
|
|
2030
|
-
const text = item.text || item.label;
|
|
2031
|
-
const labelWidth = calcLabelWidth(text);
|
|
2032
|
-
return {
|
|
2033
|
-
...item,
|
|
2034
|
-
text,
|
|
2035
|
-
labelWidth,
|
|
2036
|
-
span: item.span || 12
|
|
2037
|
-
};
|
|
2038
|
-
});
|
|
2039
|
-
};
|
|
2040
|
-
const toggleFullscreen = () => {
|
|
2041
|
-
if (!mTable.value) return;
|
|
2042
|
-
if (isFullscreen.value) {
|
|
2043
|
-
mTable.value.classList.remove("fixed");
|
|
2044
|
-
isFullscreen.value = false;
|
|
2045
|
-
} else {
|
|
2046
|
-
mTable.value.classList.add("fixed");
|
|
2047
|
-
mTable.value.style.zIndex = `${nextZIndex()}`;
|
|
2048
|
-
isFullscreen.value = true;
|
|
2049
|
-
}
|
|
2050
|
-
};
|
|
2051
|
-
const getProp = (index) => {
|
|
2052
|
-
const { prop } = toRefs(props);
|
|
2053
|
-
return `${prop.value}${prop.value ? "." : ""}${index + 1 + pagecontext.value * pagesize.value - 1}`;
|
|
2054
|
-
};
|
|
2055
|
-
const onAddDiffCount = () => emit("addDiffCount");
|
|
2056
|
-
const changeHandler = (v, eventData) => {
|
|
2057
|
-
emit("change", props.model, eventData);
|
|
2058
|
-
};
|
|
2059
|
-
__expose({
|
|
2060
|
-
toggleRowSelection
|
|
2061
|
-
});
|
|
2062
|
-
return (_ctx, _cache) => {
|
|
2063
|
-
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
2064
|
-
(openBlock(), createBlock(Teleport, {
|
|
2065
|
-
to: "body",
|
|
2066
|
-
disabled: !isFullscreen.value
|
|
2067
|
-
}, [
|
|
2068
|
-
createElementVNode(
|
|
2069
|
-
"div",
|
|
2070
|
-
{
|
|
2071
|
-
ref_key: "mTable",
|
|
2072
|
-
ref: mTable,
|
|
2073
|
-
class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
|
|
2074
|
-
},
|
|
2075
|
-
[
|
|
2076
|
-
_ctx.config.extra ? (openBlock(), createElementBlock("span", {
|
|
2077
|
-
key: 0,
|
|
2078
|
-
style: { "color": "rgba(0, 0, 0, 0.45)" },
|
|
2079
|
-
innerHTML: _ctx.config.extra
|
|
2080
|
-
}, null, 8, _hoisted_2$2)) : createCommentVNode("v-if", true),
|
|
2081
|
-
createVNode(unref(TMagicTooltip), {
|
|
2082
|
-
content: "拖拽可排序",
|
|
2083
|
-
placement: "left-start",
|
|
2084
|
-
disabled: _ctx.config.dropSort !== true
|
|
2085
|
-
}, {
|
|
2086
|
-
default: withCtx(() => [
|
|
2087
|
-
_ctx.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
|
|
2088
|
-
ref_key: "tMagicTable",
|
|
2089
|
-
ref: tMagicTable,
|
|
2090
|
-
style: { "width": "100%" },
|
|
2091
|
-
"row-key": _ctx.config.rowKey || "id",
|
|
2092
|
-
data: data.value,
|
|
2093
|
-
lastData: lastData.value,
|
|
2094
|
-
border: _ctx.config.border,
|
|
2095
|
-
"max-height": _ctx.config.maxHeight,
|
|
2096
|
-
"default-expand-all": true,
|
|
2097
|
-
key: updateKey.value,
|
|
2098
|
-
onSelect: selectHandle,
|
|
2099
|
-
onSortChange: sortChange
|
|
2100
|
-
}, {
|
|
2101
|
-
default: withCtx(() => [
|
|
2102
|
-
_ctx.config.itemExtra && !_ctx.config.dropSort ? (openBlock(), createBlock(unref(TMagicTableColumn), {
|
|
2103
|
-
key: 0,
|
|
2104
|
-
fixed: "left",
|
|
2105
|
-
width: "30",
|
|
2106
|
-
type: "expand"
|
|
2107
|
-
}, {
|
|
2108
|
-
default: withCtx((scope) => [
|
|
2109
|
-
createElementVNode("span", {
|
|
2110
|
-
innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
|
|
2111
|
-
class: "m-form-tip"
|
|
2112
|
-
}, null, 8, _hoisted_3)
|
|
2113
|
-
]),
|
|
2114
|
-
_: 1
|
|
2115
|
-
/* STABLE */
|
|
2116
|
-
})) : createCommentVNode("v-if", true),
|
|
2117
|
-
createVNode(unref(TMagicTableColumn), {
|
|
2118
|
-
label: "操作",
|
|
2119
|
-
width: _ctx.config.operateColWidth || 100,
|
|
2120
|
-
align: "center",
|
|
2121
|
-
fixed: _ctx.config.fixed === false ? void 0 : "left"
|
|
2122
|
-
}, {
|
|
2123
|
-
default: withCtx((scope) => [
|
|
2124
|
-
renderSlot(_ctx.$slots, "operateCol", { scope }),
|
|
2125
|
-
withDirectives(createVNode(unref(TMagicButton), {
|
|
2126
|
-
size: "small",
|
|
2127
|
-
type: "danger",
|
|
2128
|
-
link: "",
|
|
2129
|
-
title: "删除",
|
|
2130
|
-
icon: unref(Delete),
|
|
2131
|
-
onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
2132
|
-
}, null, 8, ["icon", "onClick"]), [
|
|
2133
|
-
[vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
|
|
2134
|
-
]),
|
|
2135
|
-
copyable(scope.$index + 1 + pagecontext.value * pagesize.value - 1) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
2136
|
-
key: 0,
|
|
2137
|
-
link: "",
|
|
2138
|
-
size: "small",
|
|
2139
|
-
type: "primary",
|
|
2140
|
-
title: "复制",
|
|
2141
|
-
icon: unref(DocumentCopy),
|
|
2142
|
-
disabled: _ctx.disabled,
|
|
2143
|
-
onClick: ($event) => copyHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
2144
|
-
}, null, 8, ["icon", "disabled", "onClick"])) : createCommentVNode("v-if", true)
|
|
2145
|
-
]),
|
|
2146
|
-
_: 3
|
|
2147
|
-
/* FORWARDED */
|
|
2148
|
-
}, 8, ["width", "fixed"]),
|
|
2149
|
-
_ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
|
|
2150
|
-
key: 1,
|
|
2151
|
-
label: "排序",
|
|
2152
|
-
width: "60"
|
|
2153
|
-
}, {
|
|
2154
|
-
default: withCtx((scope) => [
|
|
2155
|
-
scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(
|
|
2156
|
-
unref(TMagicTooltip),
|
|
2157
|
-
{
|
|
2158
|
-
key: 0,
|
|
2159
|
-
content: "点击上移,双击置顶",
|
|
2160
|
-
placement: "top"
|
|
2161
|
-
},
|
|
2162
|
-
{
|
|
2163
|
-
default: withCtx(() => [
|
|
2164
|
-
createVNode(unref(TMagicButton), {
|
|
2165
|
-
plain: "",
|
|
2166
|
-
size: "small",
|
|
2167
|
-
type: "primary",
|
|
2168
|
-
icon: unref(ArrowUp),
|
|
2169
|
-
disabled: _ctx.disabled,
|
|
2170
|
-
link: "",
|
|
2171
|
-
onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
|
|
2172
|
-
onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
2173
|
-
}, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
|
|
2174
|
-
]),
|
|
2175
|
-
_: 2
|
|
2176
|
-
/* DYNAMIC */
|
|
2177
|
-
},
|
|
2178
|
-
1024
|
|
2179
|
-
/* DYNAMIC_SLOTS */
|
|
2180
|
-
)) : createCommentVNode("v-if", true),
|
|
2181
|
-
scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (openBlock(), createBlock(
|
|
2182
|
-
unref(TMagicTooltip),
|
|
2183
|
-
{
|
|
2184
|
-
key: 1,
|
|
2185
|
-
content: "点击下移,双击置底",
|
|
2186
|
-
placement: "top"
|
|
2187
|
-
},
|
|
2188
|
-
{
|
|
2189
|
-
default: withCtx(() => [
|
|
2190
|
-
createVNode(unref(TMagicButton), {
|
|
2191
|
-
plain: "",
|
|
2192
|
-
size: "small",
|
|
2193
|
-
type: "primary",
|
|
2194
|
-
icon: unref(ArrowDown),
|
|
2195
|
-
disabled: _ctx.disabled,
|
|
2196
|
-
link: "",
|
|
2197
|
-
onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
|
|
2198
|
-
onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
2199
|
-
}, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
|
|
2200
|
-
]),
|
|
2201
|
-
_: 2
|
|
2202
|
-
/* DYNAMIC */
|
|
2203
|
-
},
|
|
2204
|
-
1024
|
|
2205
|
-
/* DYNAMIC_SLOTS */
|
|
2206
|
-
)) : createCommentVNode("v-if", true)
|
|
2207
|
-
]),
|
|
2208
|
-
_: 1
|
|
2209
|
-
/* STABLE */
|
|
2210
|
-
})) : createCommentVNode("v-if", true),
|
|
2211
|
-
selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
|
|
2212
|
-
key: 2,
|
|
2213
|
-
align: "center",
|
|
2214
|
-
"header-align": "center",
|
|
2215
|
-
type: "selection",
|
|
2216
|
-
width: "45"
|
|
2217
|
-
})) : createCommentVNode("v-if", true),
|
|
2218
|
-
_ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
|
|
2219
|
-
key: 3,
|
|
2220
|
-
width: "60",
|
|
2221
|
-
label: "序号"
|
|
2222
|
-
}, {
|
|
2223
|
-
default: withCtx((scope) => [
|
|
2224
|
-
createTextVNode(
|
|
2225
|
-
toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value),
|
|
2226
|
-
1
|
|
2227
|
-
/* TEXT */
|
|
2228
|
-
)
|
|
2229
|
-
]),
|
|
2230
|
-
_: 1
|
|
2231
|
-
/* STABLE */
|
|
2232
|
-
})) : createCommentVNode("v-if", true),
|
|
2233
|
-
(openBlock(true), createElementBlock(
|
|
2234
|
-
Fragment,
|
|
2235
|
-
null,
|
|
2236
|
-
renderList(_ctx.config.items, (column, index) => {
|
|
2237
|
-
return openBlock(), createElementBlock(
|
|
2238
|
-
Fragment,
|
|
2239
|
-
null,
|
|
2240
|
-
[
|
|
2241
|
-
column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
|
|
2242
|
-
prop: column.name,
|
|
2243
|
-
width: column.width,
|
|
2244
|
-
label: column.label,
|
|
2245
|
-
sortable: column.sortable,
|
|
2246
|
-
"sort-orders": ["ascending", "descending"],
|
|
2247
|
-
key: column[unref(mForm)?.keyProp || "__key"] ?? index,
|
|
2248
|
-
"class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
|
|
2249
|
-
}, {
|
|
2250
|
-
default: withCtx((scope) => [
|
|
2251
|
-
scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$x, {
|
|
2252
|
-
key: 0,
|
|
2253
|
-
labelWidth: "0",
|
|
2254
|
-
disabled: _ctx.disabled,
|
|
2255
|
-
prop: getProp(scope.$index),
|
|
2256
|
-
rules: column.rules,
|
|
2257
|
-
config: makeConfig(column, scope.row),
|
|
2258
|
-
model: scope.row,
|
|
2259
|
-
lastValues: lastData.value[scope.$index],
|
|
2260
|
-
"is-compare": _ctx.isCompare,
|
|
2261
|
-
size: _ctx.size,
|
|
2262
|
-
onChange: changeHandler,
|
|
2263
|
-
onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
|
|
2264
|
-
}, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("v-if", true)
|
|
2265
|
-
]),
|
|
2266
|
-
_: 2
|
|
2267
|
-
/* DYNAMIC */
|
|
2268
|
-
}, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("v-if", true)
|
|
2269
|
-
],
|
|
2270
|
-
64
|
|
2271
|
-
/* STABLE_FRAGMENT */
|
|
2272
|
-
);
|
|
2273
|
-
}),
|
|
2274
|
-
256
|
|
2275
|
-
/* UNKEYED_FRAGMENT */
|
|
2276
|
-
))
|
|
2277
|
-
]),
|
|
2278
|
-
_: 3
|
|
2279
|
-
/* FORWARDED */
|
|
2280
|
-
}, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("v-if", true)
|
|
2281
|
-
]),
|
|
2282
|
-
_: 3
|
|
2283
|
-
/* FORWARDED */
|
|
2284
|
-
}, 8, ["disabled"]),
|
|
2285
|
-
renderSlot(_ctx.$slots, "default"),
|
|
2286
|
-
createElementVNode("div", _hoisted_4, [
|
|
2287
|
-
addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
2288
|
-
key: 0,
|
|
2289
|
-
size: "small",
|
|
2290
|
-
type: "primary",
|
|
2291
|
-
disabled: _ctx.disabled,
|
|
2292
|
-
plain: "",
|
|
2293
|
-
onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
|
|
2294
|
-
}, {
|
|
2295
|
-
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
2296
|
-
createTextVNode(
|
|
2297
|
-
"新增一行",
|
|
2298
|
-
-1
|
|
2299
|
-
/* CACHED */
|
|
2300
|
-
)
|
|
2301
|
-
])]),
|
|
2302
|
-
_: 1
|
|
2303
|
-
/* STABLE */
|
|
2304
|
-
}, 8, ["disabled"])) : createCommentVNode("v-if", true),
|
|
2305
|
-
createElementVNode("div", _hoisted_5, [
|
|
2306
|
-
_ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
2307
|
-
key: 0,
|
|
2308
|
-
icon: unref(Grid),
|
|
2309
|
-
size: "small",
|
|
2310
|
-
type: "primary",
|
|
2311
|
-
onClick: toggleMode
|
|
2312
|
-
}, {
|
|
2313
|
-
default: withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
2314
|
-
createTextVNode(
|
|
2315
|
-
"展开配置",
|
|
2316
|
-
-1
|
|
2317
|
-
/* CACHED */
|
|
2318
|
-
)
|
|
2319
|
-
])]),
|
|
2320
|
-
_: 1
|
|
2321
|
-
/* STABLE */
|
|
2322
|
-
}, 8, ["icon"])) : createCommentVNode("v-if", true),
|
|
2323
|
-
_ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
2324
|
-
key: 1,
|
|
2325
|
-
icon: unref(FullScreen),
|
|
2326
|
-
size: "small",
|
|
2327
|
-
type: "primary",
|
|
2328
|
-
onClick: toggleFullscreen
|
|
2329
|
-
}, {
|
|
2330
|
-
default: withCtx(() => [
|
|
2331
|
-
createTextVNode(
|
|
2332
|
-
toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"),
|
|
2333
|
-
1
|
|
2334
|
-
/* TEXT */
|
|
2335
|
-
)
|
|
2336
|
-
]),
|
|
2337
|
-
_: 1
|
|
2338
|
-
/* STABLE */
|
|
2339
|
-
}, 8, ["icon"])) : createCommentVNode("v-if", true),
|
|
2340
|
-
importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
|
|
2341
|
-
key: 2,
|
|
2342
|
-
style: { "display": "inline-block" },
|
|
2343
|
-
ref_key: "excelBtn",
|
|
2344
|
-
ref: excelBtn,
|
|
2345
|
-
action: "/noop",
|
|
2346
|
-
disabled: _ctx.disabled,
|
|
2347
|
-
"on-change": excelHandler,
|
|
2348
|
-
"auto-upload": false
|
|
2349
|
-
}, {
|
|
2350
|
-
default: withCtx(() => [
|
|
2351
|
-
createVNode(unref(TMagicButton), {
|
|
2352
|
-
size: "small",
|
|
2353
|
-
type: "success",
|
|
2354
|
-
disabled: _ctx.disabled,
|
|
2355
|
-
plain: ""
|
|
2356
|
-
}, {
|
|
2357
|
-
default: withCtx(() => [..._cache[5] || (_cache[5] = [
|
|
2358
|
-
createTextVNode(
|
|
2359
|
-
"导入EXCEL",
|
|
2360
|
-
-1
|
|
2361
|
-
/* CACHED */
|
|
2362
|
-
)
|
|
2363
|
-
])]),
|
|
2364
|
-
_: 1
|
|
2365
|
-
/* STABLE */
|
|
2366
|
-
}, 8, ["disabled"])
|
|
2367
|
-
]),
|
|
2368
|
-
_: 1
|
|
2369
|
-
/* STABLE */
|
|
2370
|
-
}, 8, ["disabled"])) : createCommentVNode("v-if", true),
|
|
2371
|
-
importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
2372
|
-
key: 3,
|
|
2373
|
-
size: "small",
|
|
2374
|
-
type: "warning",
|
|
2375
|
-
disabled: _ctx.disabled,
|
|
2376
|
-
plain: "",
|
|
2377
|
-
onClick: _cache[2] || (_cache[2] = ($event) => clearHandler())
|
|
2378
|
-
}, {
|
|
2379
|
-
default: withCtx(() => [..._cache[6] || (_cache[6] = [
|
|
2380
|
-
createTextVNode(
|
|
2381
|
-
"清空",
|
|
2382
|
-
-1
|
|
2383
|
-
/* CACHED */
|
|
2384
|
-
)
|
|
2385
|
-
])]),
|
|
2386
|
-
_: 1
|
|
2387
|
-
/* STABLE */
|
|
2388
|
-
}, 8, ["disabled"])) : createCommentVNode("v-if", true)
|
|
2389
|
-
])
|
|
2390
|
-
]),
|
|
2391
|
-
_ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
2392
|
-
createVNode(unref(TMagicPagination), {
|
|
2393
|
-
layout: "total, sizes, prev, pager, next, jumper",
|
|
2394
|
-
"hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
|
|
2395
|
-
"current-page": pagecontext.value + 1,
|
|
2396
|
-
"page-sizes": [pagesize.value, 60, 120, 300],
|
|
2397
|
-
"page-size": pagesize.value,
|
|
2398
|
-
total: _ctx.model[modelName.value].length,
|
|
2399
|
-
onSizeChange: handleSizeChange,
|
|
2400
|
-
onCurrentChange: handleCurrentChange
|
|
2401
|
-
}, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
|
|
2402
|
-
])) : createCommentVNode("v-if", true)
|
|
2403
|
-
],
|
|
2404
|
-
2
|
|
2405
|
-
/* CLASS */
|
|
2406
|
-
)
|
|
2407
|
-
], 8, ["disabled"]))
|
|
2408
|
-
]);
|
|
2409
|
-
};
|
|
2410
|
-
}
|
|
2411
|
-
});
|
|
2412
|
-
|
|
2413
|
-
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
2414
|
-
...{
|
|
2415
|
-
name: "MFormTabs"
|
|
2416
|
-
},
|
|
2417
|
-
__name: "Tabs",
|
|
2418
|
-
props: {
|
|
2419
|
-
model: {},
|
|
2420
|
-
lastValues: { default: () => ({}) },
|
|
2421
|
-
isCompare: { type: Boolean, default: false },
|
|
2422
|
-
config: {},
|
|
2423
|
-
name: {},
|
|
2424
|
-
size: {},
|
|
2425
|
-
labelWidth: {},
|
|
2426
|
-
prop: {},
|
|
2427
|
-
expandMore: { type: Boolean },
|
|
2428
|
-
disabled: { type: Boolean }
|
|
2429
|
-
},
|
|
2430
|
-
emits: ["change", "addDiffCount"],
|
|
2431
|
-
setup(__props, { emit: __emit }) {
|
|
2432
|
-
const tabPaneComponent = getDesignConfig("components")?.tabPane;
|
|
2433
|
-
const tabsComponent = getDesignConfig("components")?.tabs;
|
|
2434
|
-
const getActive = (mForm2, props2, activeTabName2) => {
|
|
2435
|
-
const { config, model, prop } = props2;
|
|
2436
|
-
const { active } = config;
|
|
2437
|
-
if (typeof active === "function") return active(mForm2, { model, formValue: mForm2?.values, prop });
|
|
2438
|
-
if (0 >= props2.config.items.length) return "0";
|
|
2439
|
-
if (typeof active !== "undefined") return active;
|
|
2440
|
-
return "0";
|
|
2441
|
-
};
|
|
2442
|
-
const tabClick = (mForm2, tab, props2) => {
|
|
2443
|
-
const { config, model, prop } = props2;
|
|
2444
|
-
tab.name = tab.paneName;
|
|
2445
|
-
if (typeof config.onTabClick === "function") {
|
|
2446
|
-
config.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
|
|
2447
|
-
}
|
|
2448
|
-
const tabConfig = config.items.find((item) => tab.name === item.status);
|
|
2449
|
-
if (tabConfig && typeof tabConfig.onTabClick === "function") {
|
|
2450
|
-
tabConfig.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
|
|
2451
|
-
}
|
|
2452
|
-
};
|
|
2453
|
-
const props = __props;
|
|
2454
|
-
const emit = __emit;
|
|
2455
|
-
const mForm = inject("mForm");
|
|
2456
|
-
const activeTabName = ref(getActive(mForm, props));
|
|
2457
|
-
const diffCount = ref({});
|
|
2458
|
-
const tabs = computed(() => {
|
|
2459
|
-
if (props.config.dynamic) {
|
|
2460
|
-
if (!props.config.name) throw new Error("dynamic tab 必须配置name");
|
|
2461
|
-
return props.model[props.config.name] || [];
|
|
2462
|
-
}
|
|
2463
|
-
return props.config.items.filter((item) => display(mForm, item.display, props));
|
|
2464
|
-
});
|
|
2465
|
-
const filter = (config) => filterFunction(mForm, config, props);
|
|
2466
|
-
watchEffect(() => {
|
|
2467
|
-
if (typeof props.config.activeChange === "function") {
|
|
2468
|
-
props.config.activeChange(mForm, activeTabName.value, {
|
|
2469
|
-
model: props.model,
|
|
2470
|
-
prop: props.prop
|
|
2471
|
-
});
|
|
2472
|
-
}
|
|
2473
|
-
});
|
|
2474
|
-
const tabItems = (tab) => props.config.dynamic ? props.config.items : tab.items;
|
|
2475
|
-
const tabClickHandler = (tab) => tabClick(mForm, tab, props);
|
|
2476
|
-
const onTabAdd = async () => {
|
|
2477
|
-
if (!props.name) throw new Error("dynamic tab 必须配置name");
|
|
2478
|
-
if (typeof props.config.onTabAdd === "function") {
|
|
2479
|
-
props.config.onTabAdd(mForm, {
|
|
2480
|
-
model: props.model,
|
|
2481
|
-
prop: props.prop,
|
|
2482
|
-
config: props.config
|
|
1850
|
+
config: props.config
|
|
2483
1851
|
});
|
|
2484
1852
|
emit("change", props.model);
|
|
2485
1853
|
} else {
|
|
@@ -2536,12 +1904,12 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2536
1904
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event)
|
|
2537
1905
|
},
|
|
2538
1906
|
unref(tabsComponent)?.props({
|
|
2539
|
-
type:
|
|
2540
|
-
editable:
|
|
2541
|
-
tabPosition:
|
|
1907
|
+
type: __props.config.tabType,
|
|
1908
|
+
editable: __props.config.editable || false,
|
|
1909
|
+
tabPosition: __props.config.tabPosition || "top"
|
|
2542
1910
|
}) || {},
|
|
2543
1911
|
{
|
|
2544
|
-
class: `tmagic-design-tabs ${
|
|
1912
|
+
class: `tmagic-design-tabs ${__props.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
|
|
2545
1913
|
onTabClick: tabClickHandler,
|
|
2546
1914
|
onTabAdd,
|
|
2547
1915
|
onTabRemove
|
|
@@ -2581,17 +1949,17 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
2581
1949
|
Fragment,
|
|
2582
1950
|
null,
|
|
2583
1951
|
renderList(tabItems(tab), (item) => {
|
|
2584
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1952
|
+
return openBlock(), createBlock(_sfc_main$A, {
|
|
2585
1953
|
key: item[unref(mForm)?.keyProp || "__key"],
|
|
2586
1954
|
config: item,
|
|
2587
|
-
disabled:
|
|
2588
|
-
model:
|
|
2589
|
-
"last-values": unref(isEmpty)(
|
|
2590
|
-
"is-compare":
|
|
2591
|
-
prop:
|
|
2592
|
-
size:
|
|
2593
|
-
"label-width": tab.labelWidth ||
|
|
2594
|
-
"expand-more":
|
|
1955
|
+
disabled: __props.disabled,
|
|
1956
|
+
model: __props.config.dynamic ? (__props.name ? __props.model[__props.name] : __props.model)[tabIndex] : tab.name ? (__props.name ? __props.model[__props.name] : __props.model)[tab.name] : __props.name ? __props.model[__props.name] : __props.model,
|
|
1957
|
+
"last-values": unref(isEmpty)(__props.lastValues) ? {} : __props.config.dynamic ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tabIndex] : tab.name ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tab.name] : __props.name ? __props.lastValues[__props.name] : __props.lastValues,
|
|
1958
|
+
"is-compare": __props.isCompare,
|
|
1959
|
+
prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
|
|
1960
|
+
size: __props.size,
|
|
1961
|
+
"label-width": tab.labelWidth || __props.labelWidth,
|
|
1962
|
+
"expand-more": __props.expandMore,
|
|
2595
1963
|
onChange: changeHandler,
|
|
2596
1964
|
onAddDiffCount: ($event) => onAddDiffCount(tabIndex)
|
|
2597
1965
|
}, null, 8, ["config", "disabled", "model", "last-values", "is-compare", "prop", "size", "label-width", "expand-more", "onAddDiffCount"]);
|
|
@@ -2643,7 +2011,7 @@ const useAddField = (prop) => {
|
|
|
2643
2011
|
);
|
|
2644
2012
|
};
|
|
2645
2013
|
|
|
2646
|
-
const _sfc_main$
|
|
2014
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
2647
2015
|
...{
|
|
2648
2016
|
name: "MFormCascader"
|
|
2649
2017
|
},
|
|
@@ -2671,21 +2039,28 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2671
2039
|
const remoteData = ref(null);
|
|
2672
2040
|
const checkStrictly = computed(() => filterFunction(mForm, props.config.checkStrictly, props));
|
|
2673
2041
|
const valueSeparator = computed(() => filterFunction(mForm, props.config.valueSeparator, props));
|
|
2674
|
-
const value = computed({
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
return props.model[props.name].split(valueSeparator.value);
|
|
2678
|
-
}
|
|
2679
|
-
return props.model[props.name];
|
|
2680
|
-
},
|
|
2681
|
-
set(value2) {
|
|
2682
|
-
let result = value2;
|
|
2683
|
-
if (valueSeparator.value) {
|
|
2684
|
-
result = value2.join(valueSeparator.value);
|
|
2685
|
-
}
|
|
2686
|
-
props.model[props.name] = result;
|
|
2042
|
+
const value = computed(() => {
|
|
2043
|
+
if (typeof props.model[props.name] === "string" && valueSeparator.value) {
|
|
2044
|
+
return props.model[props.name].split(valueSeparator.value);
|
|
2687
2045
|
}
|
|
2046
|
+
return props.model[props.name];
|
|
2688
2047
|
});
|
|
2048
|
+
const updateModelValueHandler = (value2) => {
|
|
2049
|
+
let result = value2;
|
|
2050
|
+
if (valueSeparator.value) {
|
|
2051
|
+
result = value2.join(valueSeparator.value);
|
|
2052
|
+
}
|
|
2053
|
+
if (typeof result === "undefined") {
|
|
2054
|
+
if (Array.isArray(props.model[props.name])) {
|
|
2055
|
+
emit("change", []);
|
|
2056
|
+
} else if (typeof props.model[props.name] === "string") {
|
|
2057
|
+
emit("change", "");
|
|
2058
|
+
} else if (typeof props.model[props.name] === "object") {
|
|
2059
|
+
emit("change", null);
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
emit("change", result);
|
|
2063
|
+
};
|
|
2689
2064
|
const setRemoteOptions = async function() {
|
|
2690
2065
|
const { config } = props;
|
|
2691
2066
|
const { option } = config;
|
|
@@ -2737,34 +2112,33 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2737
2112
|
if (!tMagicCascader.value) return;
|
|
2738
2113
|
tMagicCascader.value.setQuery("");
|
|
2739
2114
|
tMagicCascader.value.setPreviousQuery(null);
|
|
2740
|
-
emit("change", props.model[props.name]);
|
|
2741
2115
|
};
|
|
2742
2116
|
return (_ctx, _cache) => {
|
|
2743
2117
|
return openBlock(), createBlock(unref(TMagicCascader), {
|
|
2744
|
-
|
|
2745
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
2118
|
+
"model-value": value.value,
|
|
2746
2119
|
ref_key: "tMagicCascader",
|
|
2747
2120
|
ref: tMagicCascader,
|
|
2748
2121
|
style: { "width": "100%" },
|
|
2749
2122
|
clearable: "",
|
|
2750
2123
|
filterable: "",
|
|
2751
|
-
size:
|
|
2752
|
-
placeholder:
|
|
2753
|
-
disabled:
|
|
2124
|
+
size: __props.size,
|
|
2125
|
+
placeholder: __props.config.placeholder,
|
|
2126
|
+
disabled: __props.disabled,
|
|
2754
2127
|
options: options.value,
|
|
2755
|
-
"popper-class":
|
|
2128
|
+
"popper-class": __props.config.popperClass,
|
|
2756
2129
|
props: {
|
|
2757
|
-
multiple:
|
|
2758
|
-
emitPath:
|
|
2130
|
+
multiple: __props.config.multiple ?? false,
|
|
2131
|
+
emitPath: __props.config.emitPath ?? true,
|
|
2759
2132
|
checkStrictly: checkStrictly.value ?? false
|
|
2760
2133
|
},
|
|
2134
|
+
"onUpdate:modelValue": updateModelValueHandler,
|
|
2761
2135
|
onChange: changeHandler
|
|
2762
|
-
}, null, 8, ["
|
|
2136
|
+
}, null, 8, ["model-value", "size", "placeholder", "disabled", "options", "popper-class", "props"]);
|
|
2763
2137
|
};
|
|
2764
2138
|
}
|
|
2765
2139
|
});
|
|
2766
2140
|
|
|
2767
|
-
const _sfc_main$
|
|
2141
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
2768
2142
|
...{
|
|
2769
2143
|
name: "MFormCheckbox"
|
|
2770
2144
|
},
|
|
@@ -2810,29 +2184,33 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2810
2184
|
};
|
|
2811
2185
|
return (_ctx, _cache) => {
|
|
2812
2186
|
return openBlock(), createBlock(unref(TMagicCheckbox), {
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
size: _ctx.size,
|
|
2187
|
+
"model-value": __props.model[__props.name],
|
|
2188
|
+
size: __props.size,
|
|
2816
2189
|
trueValue: activeValue.value,
|
|
2817
2190
|
falseValue: inactiveValue.value,
|
|
2818
|
-
disabled:
|
|
2819
|
-
|
|
2820
|
-
}, {
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
)
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2191
|
+
disabled: __props.disabled,
|
|
2192
|
+
"onUpdate:modelValue": changeHandler
|
|
2193
|
+
}, createSlots({
|
|
2194
|
+
_: 2
|
|
2195
|
+
/* DYNAMIC */
|
|
2196
|
+
}, [
|
|
2197
|
+
!__props.config.useLabel ? {
|
|
2198
|
+
name: "default",
|
|
2199
|
+
fn: withCtx(() => [
|
|
2200
|
+
createTextVNode(
|
|
2201
|
+
toDisplayString(__props.config.text),
|
|
2202
|
+
1
|
|
2203
|
+
/* TEXT */
|
|
2204
|
+
)
|
|
2205
|
+
]),
|
|
2206
|
+
key: "0"
|
|
2207
|
+
} : void 0
|
|
2208
|
+
]), 1032, ["model-value", "size", "trueValue", "falseValue", "disabled"]);
|
|
2831
2209
|
};
|
|
2832
2210
|
}
|
|
2833
2211
|
});
|
|
2834
2212
|
|
|
2835
|
-
const _sfc_main$
|
|
2213
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
2836
2214
|
...{
|
|
2837
2215
|
name: "MFormCheckGroup"
|
|
2838
2216
|
},
|
|
@@ -2868,11 +2246,10 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2868
2246
|
});
|
|
2869
2247
|
return (_ctx, _cache) => {
|
|
2870
2248
|
return openBlock(), createBlock(unref(TMagicCheckboxGroup), {
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
onChange: changeHandler
|
|
2249
|
+
"model-value": __props.model[__props.name],
|
|
2250
|
+
size: __props.size,
|
|
2251
|
+
disabled: __props.disabled,
|
|
2252
|
+
"onUpdate:modelValue": changeHandler
|
|
2876
2253
|
}, {
|
|
2877
2254
|
default: withCtx(() => [
|
|
2878
2255
|
(openBlock(true), createElementBlock(
|
|
@@ -2901,12 +2278,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2901
2278
|
]),
|
|
2902
2279
|
_: 1
|
|
2903
2280
|
/* STABLE */
|
|
2904
|
-
}, 8, ["
|
|
2281
|
+
}, 8, ["model-value", "size", "disabled"]);
|
|
2905
2282
|
};
|
|
2906
2283
|
}
|
|
2907
2284
|
});
|
|
2908
2285
|
|
|
2909
|
-
const _sfc_main$
|
|
2286
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
2910
2287
|
...{
|
|
2911
2288
|
name: "MFormColorPicker"
|
|
2912
2289
|
},
|
|
@@ -2930,18 +2307,17 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2930
2307
|
const changeHandler = (value) => emit("change", value);
|
|
2931
2308
|
return (_ctx, _cache) => {
|
|
2932
2309
|
return openBlock(), createBlock(unref(TMagicColorPicker), {
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
disabled: _ctx.disabled,
|
|
2310
|
+
"model-value": __props.model[__props.name],
|
|
2311
|
+
size: __props.size,
|
|
2312
|
+
disabled: __props.disabled,
|
|
2937
2313
|
showAlpha: true,
|
|
2938
|
-
|
|
2939
|
-
}, null, 8, ["
|
|
2314
|
+
"onUpdate:modelValue": changeHandler
|
|
2315
|
+
}, null, 8, ["model-value", "size", "disabled"]);
|
|
2940
2316
|
};
|
|
2941
2317
|
}
|
|
2942
2318
|
});
|
|
2943
2319
|
|
|
2944
|
-
const _sfc_main$
|
|
2320
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
2945
2321
|
...{
|
|
2946
2322
|
name: "MFormDate"
|
|
2947
2323
|
},
|
|
@@ -2968,21 +2344,20 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2968
2344
|
};
|
|
2969
2345
|
return (_ctx, _cache) => {
|
|
2970
2346
|
return openBlock(), createBlock(unref(TMagicDatePicker), {
|
|
2971
|
-
|
|
2972
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
|
|
2347
|
+
"model-value": __props.model[__props.name],
|
|
2973
2348
|
type: "date",
|
|
2974
|
-
size:
|
|
2975
|
-
placeholder:
|
|
2976
|
-
disabled:
|
|
2977
|
-
format:
|
|
2978
|
-
"value-format":
|
|
2979
|
-
|
|
2980
|
-
}, null, 8, ["
|
|
2349
|
+
size: __props.size,
|
|
2350
|
+
placeholder: __props.config.placeholder,
|
|
2351
|
+
disabled: __props.disabled,
|
|
2352
|
+
format: __props.config.format || "YYYY/MM/DD",
|
|
2353
|
+
"value-format": __props.config.valueFormat || "YYYY/MM/DD",
|
|
2354
|
+
"onUpdate:modelValue": changeHandler
|
|
2355
|
+
}, null, 8, ["model-value", "size", "placeholder", "disabled", "format", "value-format"]);
|
|
2981
2356
|
};
|
|
2982
2357
|
}
|
|
2983
2358
|
});
|
|
2984
2359
|
|
|
2985
|
-
const _sfc_main$
|
|
2360
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
2986
2361
|
...{
|
|
2987
2362
|
name: "MFormDateRange"
|
|
2988
2363
|
},
|
|
@@ -3063,26 +2438,25 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
3063
2438
|
};
|
|
3064
2439
|
return (_ctx, _cache) => {
|
|
3065
2440
|
return openBlock(), createBlock(unref(TMagicDatePicker), {
|
|
3066
|
-
|
|
3067
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
2441
|
+
"model-value": value.value,
|
|
3068
2442
|
type: "datetimerange",
|
|
3069
2443
|
"range-separator": "-",
|
|
3070
2444
|
"start-placeholder": "开始日期",
|
|
3071
2445
|
"end-placeholder": "结束日期",
|
|
3072
|
-
size:
|
|
2446
|
+
size: __props.size,
|
|
3073
2447
|
"unlink-panels": true,
|
|
3074
|
-
disabled:
|
|
3075
|
-
"default-time":
|
|
3076
|
-
"value-format":
|
|
3077
|
-
"date-format":
|
|
3078
|
-
"time-format":
|
|
3079
|
-
|
|
3080
|
-
}, null, 8, ["
|
|
2448
|
+
disabled: __props.disabled,
|
|
2449
|
+
"default-time": __props.config.defaultTime,
|
|
2450
|
+
"value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
|
|
2451
|
+
"date-format": __props.config.dateFormat || "YYYY/MM/DD",
|
|
2452
|
+
"time-format": __props.config.timeFormat || "HH:mm:ss",
|
|
2453
|
+
"onUpdate:modelValue": changeHandler
|
|
2454
|
+
}, null, 8, ["model-value", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
|
|
3081
2455
|
};
|
|
3082
2456
|
}
|
|
3083
2457
|
});
|
|
3084
2458
|
|
|
3085
|
-
const _sfc_main$
|
|
2459
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
3086
2460
|
...{
|
|
3087
2461
|
name: "MFormDateTime"
|
|
3088
2462
|
},
|
|
@@ -3120,24 +2494,23 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3120
2494
|
};
|
|
3121
2495
|
return (_ctx, _cache) => {
|
|
3122
2496
|
return openBlock(), createBlock(unref(TMagicDatePicker), {
|
|
3123
|
-
|
|
3124
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
|
|
2497
|
+
"model-value": __props.model[__props.name],
|
|
3125
2498
|
"popper-class": "magic-datetime-picker-popper",
|
|
3126
2499
|
type: "datetime",
|
|
3127
|
-
size:
|
|
3128
|
-
placeholder:
|
|
3129
|
-
disabled:
|
|
3130
|
-
format:
|
|
3131
|
-
"value-format":
|
|
3132
|
-
"default-time":
|
|
3133
|
-
|
|
3134
|
-
}, null, 8, ["
|
|
2500
|
+
size: __props.size,
|
|
2501
|
+
placeholder: __props.config.placeholder,
|
|
2502
|
+
disabled: __props.disabled,
|
|
2503
|
+
format: __props.config.format || "YYYY/MM/DD HH:mm:ss",
|
|
2504
|
+
"value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
|
|
2505
|
+
"default-time": __props.config.defaultTime,
|
|
2506
|
+
"onUpdate:modelValue": changeHandler
|
|
2507
|
+
}, null, 8, ["model-value", "size", "placeholder", "disabled", "format", "value-format", "default-time"]);
|
|
3135
2508
|
};
|
|
3136
2509
|
}
|
|
3137
2510
|
});
|
|
3138
2511
|
|
|
3139
2512
|
const _hoisted_1$8 = { key: 0 };
|
|
3140
|
-
const _sfc_main$
|
|
2513
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
3141
2514
|
...{
|
|
3142
2515
|
name: "MFormDisplay"
|
|
3143
2516
|
},
|
|
@@ -3160,10 +2533,10 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3160
2533
|
}
|
|
3161
2534
|
useAddField(props.prop);
|
|
3162
2535
|
return (_ctx, _cache) => {
|
|
3163
|
-
return
|
|
2536
|
+
return __props.model ? (openBlock(), createElementBlock(
|
|
3164
2537
|
"span",
|
|
3165
2538
|
_hoisted_1$8,
|
|
3166
|
-
toDisplayString(
|
|
2539
|
+
toDisplayString(__props.model[__props.name]),
|
|
3167
2540
|
1
|
|
3168
2541
|
/* TEXT */
|
|
3169
2542
|
)) : createCommentVNode("v-if", true);
|
|
@@ -3172,7 +2545,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3172
2545
|
});
|
|
3173
2546
|
|
|
3174
2547
|
const _hoisted_1$7 = { class: "m-fields-dynamic-field" };
|
|
3175
|
-
const _sfc_main$
|
|
2548
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
3176
2549
|
...{
|
|
3177
2550
|
name: "MFormDynamicField"
|
|
3178
2551
|
},
|
|
@@ -3273,7 +2646,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3273
2646
|
}
|
|
3274
2647
|
});
|
|
3275
2648
|
|
|
3276
|
-
const _sfc_main$
|
|
2649
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
3277
2650
|
...{
|
|
3278
2651
|
name: "MFormHidden"
|
|
3279
2652
|
},
|
|
@@ -3293,24 +2666,24 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3293
2666
|
const props = __props;
|
|
3294
2667
|
useAddField(props.prop);
|
|
3295
2668
|
return (_ctx, _cache) => {
|
|
3296
|
-
return
|
|
2669
|
+
return __props.model ? withDirectives((openBlock(), createElementBlock(
|
|
3297
2670
|
"input",
|
|
3298
2671
|
{
|
|
3299
2672
|
key: 0,
|
|
3300
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
2673
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
|
|
3301
2674
|
type: "hidden"
|
|
3302
2675
|
},
|
|
3303
2676
|
null,
|
|
3304
2677
|
512
|
|
3305
2678
|
/* NEED_PATCH */
|
|
3306
2679
|
)), [
|
|
3307
|
-
[vModelText,
|
|
2680
|
+
[vModelText, __props.model[__props.name]]
|
|
3308
2681
|
]) : createCommentVNode("v-if", true);
|
|
3309
2682
|
};
|
|
3310
2683
|
}
|
|
3311
2684
|
});
|
|
3312
2685
|
|
|
3313
|
-
const _sfc_main$
|
|
2686
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
3314
2687
|
...{
|
|
3315
2688
|
name: "MForm"
|
|
3316
2689
|
},
|
|
@@ -3337,7 +2710,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3337
2710
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3338
2711
|
const props = __props;
|
|
3339
2712
|
const emit = __emit;
|
|
3340
|
-
const
|
|
2713
|
+
const tMagicFormRef = useTemplateRef("tMagicForm");
|
|
3341
2714
|
const initialized = ref(false);
|
|
3342
2715
|
const values = ref({});
|
|
3343
2716
|
const lastValuesProcessed = ref({});
|
|
@@ -3414,7 +2787,17 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3414
2787
|
);
|
|
3415
2788
|
const changeHandler = (v, eventData) => {
|
|
3416
2789
|
if (eventData.changeRecords?.length) {
|
|
3417
|
-
|
|
2790
|
+
for (const record of eventData.changeRecords) {
|
|
2791
|
+
if (record.propPath) {
|
|
2792
|
+
const index = changeRecords.value.findIndex((item) => item.propPath === record.propPath);
|
|
2793
|
+
if (index > -1) {
|
|
2794
|
+
changeRecords.value[index] = record;
|
|
2795
|
+
} else {
|
|
2796
|
+
changeRecords.value.push(record);
|
|
2797
|
+
}
|
|
2798
|
+
setValueByKeyPath(record.propPath, record.value, values.value);
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
3418
2801
|
}
|
|
3419
2802
|
emit("change", values.value, eventData);
|
|
3420
2803
|
};
|
|
@@ -3431,12 +2814,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3431
2814
|
changeRecords,
|
|
3432
2815
|
changeHandler,
|
|
3433
2816
|
resetForm: () => {
|
|
3434
|
-
|
|
2817
|
+
tMagicFormRef.value?.resetFields();
|
|
3435
2818
|
changeRecords.value = [];
|
|
3436
2819
|
},
|
|
3437
2820
|
submitForm: async (native) => {
|
|
3438
2821
|
try {
|
|
3439
|
-
await
|
|
2822
|
+
await tMagicFormRef.value?.validate();
|
|
2823
|
+
changeRecords.value = [];
|
|
3440
2824
|
return native ? values.value : cloneDeep(toRaw(values.value));
|
|
3441
2825
|
} catch (invalidFields) {
|
|
3442
2826
|
emit("error", invalidFields);
|
|
@@ -3455,30 +2839,29 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3455
2839
|
return (_ctx, _cache) => {
|
|
3456
2840
|
return openBlock(), createBlock(unref(TMagicForm), {
|
|
3457
2841
|
class: "m-form",
|
|
3458
|
-
|
|
3459
|
-
ref: tMagicForm,
|
|
2842
|
+
ref: "tMagicForm",
|
|
3460
2843
|
model: values.value,
|
|
3461
|
-
"label-width":
|
|
3462
|
-
style: normalizeStyle(`height: ${
|
|
3463
|
-
inline:
|
|
3464
|
-
"label-position":
|
|
2844
|
+
"label-width": __props.labelWidth,
|
|
2845
|
+
style: normalizeStyle(`height: ${__props.height}`),
|
|
2846
|
+
inline: __props.inline,
|
|
2847
|
+
"label-position": __props.labelPosition,
|
|
3465
2848
|
onSubmit: submitHandler
|
|
3466
2849
|
}, {
|
|
3467
2850
|
default: withCtx(() => [
|
|
3468
|
-
initialized.value && Array.isArray(
|
|
2851
|
+
initialized.value && Array.isArray(__props.config) ? (openBlock(true), createElementBlock(
|
|
3469
2852
|
Fragment,
|
|
3470
2853
|
{ key: 0 },
|
|
3471
|
-
renderList(
|
|
3472
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3473
|
-
disabled:
|
|
3474
|
-
key: item[
|
|
2854
|
+
renderList(__props.config, (item, index) => {
|
|
2855
|
+
return openBlock(), createBlock(_sfc_main$A, {
|
|
2856
|
+
disabled: __props.disabled,
|
|
2857
|
+
key: item[__props.keyProp] ?? index,
|
|
3475
2858
|
config: item,
|
|
3476
2859
|
model: values.value,
|
|
3477
2860
|
"last-values": lastValuesProcessed.value,
|
|
3478
|
-
"is-compare":
|
|
3479
|
-
"label-width": item.labelWidth ||
|
|
3480
|
-
"step-active":
|
|
3481
|
-
size:
|
|
2861
|
+
"is-compare": __props.isCompare,
|
|
2862
|
+
"label-width": item.labelWidth || __props.labelWidth,
|
|
2863
|
+
"step-active": __props.stepActive,
|
|
2864
|
+
size: __props.size,
|
|
3482
2865
|
onChange: changeHandler
|
|
3483
2866
|
}, null, 8, ["disabled", "config", "model", "last-values", "is-compare", "label-width", "step-active", "size"]);
|
|
3484
2867
|
}),
|
|
@@ -3494,7 +2877,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3494
2877
|
});
|
|
3495
2878
|
|
|
3496
2879
|
const _hoisted_1$6 = { style: { "min-height": "1px" } };
|
|
3497
|
-
const _sfc_main$
|
|
2880
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
3498
2881
|
...{
|
|
3499
2882
|
name: "MFormDialog"
|
|
3500
2883
|
},
|
|
@@ -3588,10 +2971,10 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3588
2971
|
class: "m-form-dialog",
|
|
3589
2972
|
top: "20px",
|
|
3590
2973
|
"append-to-body": "",
|
|
3591
|
-
title:
|
|
3592
|
-
width:
|
|
3593
|
-
zIndex:
|
|
3594
|
-
fullscreen:
|
|
2974
|
+
title: __props.title,
|
|
2975
|
+
width: __props.width,
|
|
2976
|
+
zIndex: __props.zIndex,
|
|
2977
|
+
fullscreen: __props.fullscreen,
|
|
3595
2978
|
"close-on-click-modal": false,
|
|
3596
2979
|
onClose: closeHandler
|
|
3597
2980
|
}, {
|
|
@@ -3662,13 +3045,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3662
3045
|
key: 2,
|
|
3663
3046
|
type: "primary",
|
|
3664
3047
|
size: "small",
|
|
3665
|
-
disabled:
|
|
3048
|
+
disabled: __props.disabled,
|
|
3666
3049
|
loading: saveFetch.value,
|
|
3667
3050
|
onClick: save
|
|
3668
3051
|
}, {
|
|
3669
3052
|
default: withCtx(() => [
|
|
3670
3053
|
createTextVNode(
|
|
3671
|
-
toDisplayString(
|
|
3054
|
+
toDisplayString(__props.confirmText),
|
|
3672
3055
|
1
|
|
3673
3056
|
/* TEXT */
|
|
3674
3057
|
)
|
|
@@ -3695,20 +3078,20 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3695
3078
|
style: normalizeStyle(`max-height: ${bodyHeight.value}; overflow-y: auto; overflow-x: hidden;`)
|
|
3696
3079
|
},
|
|
3697
3080
|
[
|
|
3698
|
-
createVNode(_sfc_main$
|
|
3081
|
+
createVNode(_sfc_main$g, {
|
|
3699
3082
|
modelValue: stepActive.value,
|
|
3700
3083
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => stepActive.value = $event),
|
|
3701
3084
|
ref_key: "form",
|
|
3702
3085
|
ref: form,
|
|
3703
|
-
size:
|
|
3704
|
-
disabled:
|
|
3705
|
-
config:
|
|
3706
|
-
"init-values":
|
|
3707
|
-
"parent-values":
|
|
3708
|
-
"label-width":
|
|
3709
|
-
"label-position":
|
|
3710
|
-
inline:
|
|
3711
|
-
"prevent-submit-default":
|
|
3086
|
+
size: __props.size,
|
|
3087
|
+
disabled: __props.disabled,
|
|
3088
|
+
config: __props.config,
|
|
3089
|
+
"init-values": __props.values,
|
|
3090
|
+
"parent-values": __props.parentValues,
|
|
3091
|
+
"label-width": __props.labelWidth,
|
|
3092
|
+
"label-position": __props.labelPosition,
|
|
3093
|
+
inline: __props.inline,
|
|
3094
|
+
"prevent-submit-default": __props.preventSubmitDefault,
|
|
3712
3095
|
onChange: changeHandler
|
|
3713
3096
|
}, null, 8, ["modelValue", "size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline", "prevent-submit-default"]),
|
|
3714
3097
|
renderSlot(_ctx.$slots, "default")
|
|
@@ -3725,11 +3108,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3725
3108
|
});
|
|
3726
3109
|
|
|
3727
3110
|
const _hoisted_1$5 = ["href"];
|
|
3728
|
-
const _hoisted_2$
|
|
3111
|
+
const _hoisted_2$2 = {
|
|
3729
3112
|
key: 2,
|
|
3730
3113
|
class: "m-fields-link"
|
|
3731
3114
|
};
|
|
3732
|
-
const _sfc_main$
|
|
3115
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
3733
3116
|
...{
|
|
3734
3117
|
name: "MFormLink"
|
|
3735
3118
|
},
|
|
@@ -3793,21 +3176,21 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
3793
3176
|
editor.value && (editor.value.dialogVisible = false);
|
|
3794
3177
|
};
|
|
3795
3178
|
return (_ctx, _cache) => {
|
|
3796
|
-
return
|
|
3179
|
+
return __props.config.href && !__props.disabled ? (openBlock(), createElementBlock("a", {
|
|
3797
3180
|
key: 0,
|
|
3798
3181
|
target: "_blank",
|
|
3799
3182
|
href: href.value,
|
|
3800
|
-
style: normalizeStyle(
|
|
3801
|
-
}, toDisplayString(displayText.value), 13, _hoisted_1$5)) :
|
|
3183
|
+
style: normalizeStyle(__props.config.css || {})
|
|
3184
|
+
}, toDisplayString(displayText.value), 13, _hoisted_1$5)) : __props.config.href && __props.disabled ? (openBlock(), createElementBlock(
|
|
3802
3185
|
"span",
|
|
3803
3186
|
{
|
|
3804
3187
|
key: 1,
|
|
3805
|
-
style: normalizeStyle(
|
|
3188
|
+
style: normalizeStyle(__props.config.disabledCss || {})
|
|
3806
3189
|
},
|
|
3807
3190
|
toDisplayString(displayText.value),
|
|
3808
3191
|
5
|
|
3809
3192
|
/* TEXT, STYLE */
|
|
3810
|
-
)) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
3193
|
+
)) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
3811
3194
|
createVNode(unref(TMagicButton), {
|
|
3812
3195
|
link: "",
|
|
3813
3196
|
type: "primary",
|
|
@@ -3823,15 +3206,15 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
3823
3206
|
_: 1
|
|
3824
3207
|
/* STABLE */
|
|
3825
3208
|
}),
|
|
3826
|
-
createVNode(_sfc_main$
|
|
3209
|
+
createVNode(_sfc_main$f, {
|
|
3827
3210
|
ref_key: "editor",
|
|
3828
3211
|
ref: editor,
|
|
3829
|
-
title:
|
|
3830
|
-
width:
|
|
3212
|
+
title: __props.config.formTitle || "编辑扩展配置",
|
|
3213
|
+
width: __props.config.formWidth,
|
|
3831
3214
|
values: formValue.value,
|
|
3832
3215
|
config: formConfig.value,
|
|
3833
|
-
parentValues:
|
|
3834
|
-
fullscreen:
|
|
3216
|
+
parentValues: __props.values,
|
|
3217
|
+
fullscreen: __props.config.fullscreen,
|
|
3835
3218
|
onSubmit: action
|
|
3836
3219
|
}, null, 8, ["title", "width", "values", "config", "parentValues", "fullscreen"])
|
|
3837
3220
|
]));
|
|
@@ -3839,7 +3222,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
3839
3222
|
}
|
|
3840
3223
|
});
|
|
3841
3224
|
|
|
3842
|
-
const _sfc_main$
|
|
3225
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
3843
3226
|
...{
|
|
3844
3227
|
name: "MFormNumber"
|
|
3845
3228
|
},
|
|
@@ -3869,27 +3252,26 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3869
3252
|
mForm?.$emit("field-input", props.prop, v);
|
|
3870
3253
|
};
|
|
3871
3254
|
return (_ctx, _cache) => {
|
|
3872
|
-
return
|
|
3255
|
+
return __props.model ? (openBlock(), createBlock(unref(TMagicInputNumber), {
|
|
3873
3256
|
key: 0,
|
|
3874
|
-
|
|
3875
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
|
|
3257
|
+
"model-value": __props.model[__props.name],
|
|
3876
3258
|
clearable: "",
|
|
3877
3259
|
"controls-position": "right",
|
|
3878
|
-
size:
|
|
3879
|
-
max:
|
|
3880
|
-
min:
|
|
3881
|
-
step:
|
|
3882
|
-
placeholder:
|
|
3883
|
-
disabled:
|
|
3884
|
-
|
|
3260
|
+
size: __props.size,
|
|
3261
|
+
max: __props.config.max,
|
|
3262
|
+
min: __props.config.min,
|
|
3263
|
+
step: __props.config.step,
|
|
3264
|
+
placeholder: __props.config.placeholder,
|
|
3265
|
+
disabled: __props.disabled,
|
|
3266
|
+
"onUpdate:modelValue": changeHandler,
|
|
3885
3267
|
onInput: inputHandler
|
|
3886
|
-
}, null, 8, ["
|
|
3268
|
+
}, null, 8, ["model-value", "size", "max", "min", "step", "placeholder", "disabled"])) : createCommentVNode("v-if", true);
|
|
3887
3269
|
};
|
|
3888
3270
|
}
|
|
3889
3271
|
});
|
|
3890
3272
|
|
|
3891
3273
|
const _hoisted_1$4 = { class: "m-fields-number-range" };
|
|
3892
|
-
const _sfc_main$
|
|
3274
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
3893
3275
|
...{
|
|
3894
3276
|
name: "MFormNumberRange"
|
|
3895
3277
|
},
|
|
@@ -3922,14 +3304,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3922
3304
|
return (_ctx, _cache) => {
|
|
3923
3305
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
3924
3306
|
createVNode(unref(TMagicInput), {
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
_cache[2] || (_cache[2] = createElementVNode(
|
|
3307
|
+
"model-value": __props.model[__props.name][0],
|
|
3308
|
+
clearable: __props.config.clearable ?? true,
|
|
3309
|
+
size: __props.size,
|
|
3310
|
+
disabled: __props.disabled,
|
|
3311
|
+
"onUpdate:modelValue": minChangeHandler
|
|
3312
|
+
}, null, 8, ["model-value", "clearable", "size", "disabled"]),
|
|
3313
|
+
_cache[0] || (_cache[0] = createElementVNode(
|
|
3933
3314
|
"span",
|
|
3934
3315
|
{ class: "split-tag" },
|
|
3935
3316
|
"-",
|
|
@@ -3937,20 +3318,18 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3937
3318
|
/* CACHED */
|
|
3938
3319
|
)),
|
|
3939
3320
|
createVNode(unref(TMagicInput), {
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
}, null, 8, ["modelValue", "size", "disabled"])
|
|
3321
|
+
"model-value": __props.model[__props.name][1],
|
|
3322
|
+
clearable: __props.config.clearable ?? true,
|
|
3323
|
+
size: __props.size,
|
|
3324
|
+
disabled: __props.disabled,
|
|
3325
|
+
"onUpdate:modelValue": maxChangeHandler
|
|
3326
|
+
}, null, 8, ["model-value", "clearable", "size", "disabled"])
|
|
3947
3327
|
]);
|
|
3948
3328
|
};
|
|
3949
3329
|
}
|
|
3950
3330
|
});
|
|
3951
3331
|
|
|
3952
|
-
const
|
|
3953
|
-
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
3332
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
3954
3333
|
...{
|
|
3955
3334
|
name: "MFormRadioGroup"
|
|
3956
3335
|
},
|
|
@@ -3971,56 +3350,54 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3971
3350
|
const props = __props;
|
|
3972
3351
|
const itemComponent = computed(() => props.config.childType === "button" ? TMagicRadioButton : TMagicRadio);
|
|
3973
3352
|
const emit = __emit;
|
|
3974
|
-
const changeHandler = (value) => {
|
|
3975
|
-
emit("change", value);
|
|
3976
|
-
};
|
|
3977
3353
|
const clickHandler = (item) => {
|
|
3978
|
-
|
|
3979
|
-
changeHandler(props.model[props.name]);
|
|
3354
|
+
emit("change", props.model[props.name] === item ? "" : item);
|
|
3980
3355
|
};
|
|
3981
3356
|
useAddField(props.prop);
|
|
3357
|
+
const iconSize = computed(() => {
|
|
3358
|
+
if (props.size === "small") {
|
|
3359
|
+
return "12";
|
|
3360
|
+
}
|
|
3361
|
+
if (props.size === "large") {
|
|
3362
|
+
return "16";
|
|
3363
|
+
}
|
|
3364
|
+
return "14";
|
|
3365
|
+
});
|
|
3982
3366
|
return (_ctx, _cache) => {
|
|
3983
|
-
return
|
|
3367
|
+
return __props.model ? (openBlock(), createBlock(unref(TMagicRadioGroup), {
|
|
3984
3368
|
key: 0,
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
disabled: _ctx.disabled
|
|
3369
|
+
"model-value": __props.model[__props.name],
|
|
3370
|
+
size: __props.size,
|
|
3371
|
+
disabled: __props.disabled
|
|
3989
3372
|
}, {
|
|
3990
3373
|
default: withCtx(() => [
|
|
3991
3374
|
(openBlock(true), createElementBlock(
|
|
3992
3375
|
Fragment,
|
|
3993
3376
|
null,
|
|
3994
|
-
renderList(
|
|
3377
|
+
renderList(__props.config.options, (option) => {
|
|
3995
3378
|
return openBlock(), createBlock(resolveDynamicComponent(itemComponent.value), {
|
|
3996
3379
|
value: option.value,
|
|
3997
3380
|
key: `${option.value}`,
|
|
3998
|
-
onClick:
|
|
3381
|
+
onClick: ($event) => clickHandler(option.value)
|
|
3999
3382
|
}, {
|
|
4000
3383
|
default: withCtx(() => [
|
|
4001
|
-
|
|
4002
|
-
|
|
3384
|
+
createVNode(unref(TMagicTooltip), {
|
|
3385
|
+
disabled: !Boolean(option.tooltip),
|
|
4003
3386
|
placement: "top-start",
|
|
4004
3387
|
content: option.tooltip
|
|
4005
3388
|
}, {
|
|
4006
3389
|
default: withCtx(() => [
|
|
4007
3390
|
createElementVNode("div", null, [
|
|
4008
|
-
option.icon ? (openBlock(), createBlock(
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
_: 2
|
|
4019
|
-
/* DYNAMIC */
|
|
4020
|
-
},
|
|
4021
|
-
1024
|
|
4022
|
-
/* DYNAMIC_SLOTS */
|
|
4023
|
-
)) : createCommentVNode("v-if", true),
|
|
3391
|
+
option.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
3392
|
+
key: 0,
|
|
3393
|
+
size: iconSize.value
|
|
3394
|
+
}, {
|
|
3395
|
+
default: withCtx(() => [
|
|
3396
|
+
(openBlock(), createBlock(resolveDynamicComponent(option.icon)))
|
|
3397
|
+
]),
|
|
3398
|
+
_: 2
|
|
3399
|
+
/* DYNAMIC */
|
|
3400
|
+
}, 1032, ["size"])) : createCommentVNode("v-if", true),
|
|
4024
3401
|
createElementVNode(
|
|
4025
3402
|
"span",
|
|
4026
3403
|
null,
|
|
@@ -4032,31 +3409,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4032
3409
|
]),
|
|
4033
3410
|
_: 2
|
|
4034
3411
|
/* DYNAMIC */
|
|
4035
|
-
}, 1032, ["
|
|
4036
|
-
option.icon ? (openBlock(), createBlock(
|
|
4037
|
-
unref(TMagicIcon),
|
|
4038
|
-
{
|
|
4039
|
-
key: 0,
|
|
4040
|
-
size: "16"
|
|
4041
|
-
},
|
|
4042
|
-
{
|
|
4043
|
-
default: withCtx(() => [
|
|
4044
|
-
(openBlock(), createBlock(resolveDynamicComponent(option.icon)))
|
|
4045
|
-
]),
|
|
4046
|
-
_: 2
|
|
4047
|
-
/* DYNAMIC */
|
|
4048
|
-
},
|
|
4049
|
-
1024
|
|
4050
|
-
/* DYNAMIC_SLOTS */
|
|
4051
|
-
)) : createCommentVNode("v-if", true),
|
|
4052
|
-
createElementVNode(
|
|
4053
|
-
"span",
|
|
4054
|
-
null,
|
|
4055
|
-
toDisplayString(option.text),
|
|
4056
|
-
1
|
|
4057
|
-
/* TEXT */
|
|
4058
|
-
)
|
|
4059
|
-
]))
|
|
3412
|
+
}, 1032, ["disabled", "content"])
|
|
4060
3413
|
]),
|
|
4061
3414
|
_: 2
|
|
4062
3415
|
/* DYNAMIC */
|
|
@@ -4068,13 +3421,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4068
3421
|
]),
|
|
4069
3422
|
_: 1
|
|
4070
3423
|
/* STABLE */
|
|
4071
|
-
}, 8, ["
|
|
3424
|
+
}, 8, ["model-value", "size", "disabled"])) : createCommentVNode("v-if", true);
|
|
4072
3425
|
};
|
|
4073
3426
|
}
|
|
4074
3427
|
});
|
|
4075
3428
|
|
|
4076
|
-
const _hoisted_1$
|
|
4077
|
-
const _sfc_main$
|
|
3429
|
+
const _hoisted_1$3 = { key: 2 };
|
|
3430
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
4078
3431
|
...{
|
|
4079
3432
|
name: "MFormSelect"
|
|
4080
3433
|
},
|
|
@@ -4399,29 +3752,28 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4399
3752
|
});
|
|
4400
3753
|
return (_ctx, _cache) => {
|
|
4401
3754
|
const _directive_loading = resolveDirective("loading");
|
|
4402
|
-
return
|
|
3755
|
+
return __props.model ? withDirectives((openBlock(), createBlock(unref(TMagicSelect), {
|
|
4403
3756
|
key: 0,
|
|
4404
|
-
|
|
4405
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
|
|
3757
|
+
"model-value": __props.model[__props.name],
|
|
4406
3758
|
class: "m-select",
|
|
4407
3759
|
ref_key: "tMagicSelect",
|
|
4408
3760
|
ref: tMagicSelect,
|
|
4409
|
-
clearable: typeof
|
|
4410
|
-
filterable: typeof
|
|
3761
|
+
clearable: typeof __props.config.clearable !== "undefined" ? __props.config.clearable : true,
|
|
3762
|
+
filterable: typeof __props.config.filterable !== "undefined" ? __props.config.filterable : true,
|
|
4411
3763
|
"popper-class": `m-select-popper ${unref(popperClass)}`,
|
|
4412
|
-
size:
|
|
3764
|
+
size: __props.size,
|
|
4413
3765
|
remote: remote.value,
|
|
4414
|
-
placeholder:
|
|
4415
|
-
multiple:
|
|
4416
|
-
"value-key":
|
|
4417
|
-
"allow-create":
|
|
4418
|
-
disabled:
|
|
4419
|
-
"remote-method":
|
|
4420
|
-
|
|
3766
|
+
placeholder: __props.config.placeholder,
|
|
3767
|
+
multiple: __props.config.multiple,
|
|
3768
|
+
"value-key": __props.config.valueKey || "value",
|
|
3769
|
+
"allow-create": __props.config.allowCreate,
|
|
3770
|
+
disabled: __props.disabled,
|
|
3771
|
+
"remote-method": __props.config.remote && remoteMethod,
|
|
3772
|
+
"onUpdate:modelValue": changeHandler,
|
|
4421
3773
|
onVisibleChange: visibleHandler
|
|
4422
3774
|
}, {
|
|
4423
3775
|
default: withCtx(() => [
|
|
4424
|
-
|
|
3776
|
+
__props.config.group ? (openBlock(true), createElementBlock(
|
|
4425
3777
|
Fragment,
|
|
4426
3778
|
{ key: 0 },
|
|
4427
3779
|
renderList(options.value, (group, index) => {
|
|
@@ -4486,7 +3838,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4486
3838
|
mergeProps(
|
|
4487
3839
|
{
|
|
4488
3840
|
class: "tmagic-design-option",
|
|
4489
|
-
key:
|
|
3841
|
+
key: __props.config.valueKey ? option.value[__props.config.valueKey] : option.value
|
|
4490
3842
|
},
|
|
4491
3843
|
{ ref_for: true },
|
|
4492
3844
|
unref(optionComponent)?.props({
|
|
@@ -4509,7 +3861,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4509
3861
|
)),
|
|
4510
3862
|
moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock(
|
|
4511
3863
|
"div",
|
|
4512
|
-
_hoisted_1$
|
|
3864
|
+
_hoisted_1$3,
|
|
4513
3865
|
null,
|
|
4514
3866
|
512
|
|
4515
3867
|
/* NEED_PATCH */
|
|
@@ -4519,14 +3871,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4519
3871
|
]),
|
|
4520
3872
|
_: 1
|
|
4521
3873
|
/* STABLE */
|
|
4522
|
-
}, 8, ["
|
|
3874
|
+
}, 8, ["model-value", "clearable", "filterable", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method"])), [
|
|
4523
3875
|
[_directive_loading, loading.value]
|
|
4524
3876
|
]) : createCommentVNode("v-if", true);
|
|
4525
3877
|
};
|
|
4526
3878
|
}
|
|
4527
3879
|
});
|
|
4528
3880
|
|
|
4529
|
-
const _sfc_main$
|
|
3881
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
4530
3882
|
...{
|
|
4531
3883
|
name: "MFormSwitch"
|
|
4532
3884
|
},
|
|
@@ -4572,21 +3924,21 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4572
3924
|
});
|
|
4573
3925
|
return (_ctx, _cache) => {
|
|
4574
3926
|
return openBlock(), createBlock(unref(TMagicSwitch), {
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
size: _ctx.size,
|
|
3927
|
+
"model-value": __props.model[__props.name],
|
|
3928
|
+
size: __props.size,
|
|
4578
3929
|
activeValue: activeValue.value,
|
|
4579
3930
|
inactiveValue: inactiveValue.value,
|
|
4580
|
-
disabled:
|
|
4581
|
-
|
|
4582
|
-
}, null, 8, ["
|
|
3931
|
+
disabled: __props.disabled,
|
|
3932
|
+
"onUpdate:modelValue": changeHandler
|
|
3933
|
+
}, null, 8, ["model-value", "size", "activeValue", "inactiveValue", "disabled"]);
|
|
4583
3934
|
};
|
|
4584
3935
|
}
|
|
4585
3936
|
});
|
|
4586
3937
|
|
|
4587
|
-
const _hoisted_1$
|
|
4588
|
-
const _hoisted_2 = {
|
|
4589
|
-
const
|
|
3938
|
+
const _hoisted_1$2 = { class: "m-fields-text" };
|
|
3939
|
+
const _hoisted_2$1 = { key: 1 };
|
|
3940
|
+
const _hoisted_3$1 = { style: { "display": "flex", "justify-content": "flex-end" } };
|
|
3941
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
4590
3942
|
...{
|
|
4591
3943
|
name: "MFormText"
|
|
4592
3944
|
},
|
|
@@ -4611,16 +3963,25 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4611
3963
|
const appendConfig = computed(() => {
|
|
4612
3964
|
if (typeof props.config.append === "string") {
|
|
4613
3965
|
return {
|
|
3966
|
+
type: "text",
|
|
4614
3967
|
text: props.config.append,
|
|
4615
|
-
type: "button",
|
|
4616
3968
|
handler: void 0
|
|
4617
3969
|
};
|
|
4618
3970
|
}
|
|
4619
|
-
if (
|
|
4620
|
-
if (props.config.append
|
|
4621
|
-
return
|
|
3971
|
+
if (typeof props.config.append === "object") {
|
|
3972
|
+
if (typeof props.config.append?.handler === "function") {
|
|
3973
|
+
return {
|
|
3974
|
+
type: "button",
|
|
3975
|
+
text: props.config.append.text,
|
|
3976
|
+
handler: props.config.append.handler
|
|
3977
|
+
};
|
|
3978
|
+
}
|
|
3979
|
+
if (props.config.append) {
|
|
3980
|
+
if (props.config.append.value === 0) {
|
|
3981
|
+
return false;
|
|
3982
|
+
}
|
|
3983
|
+
return props.config.append;
|
|
4622
3984
|
}
|
|
4623
|
-
return props.config.append;
|
|
4624
3985
|
}
|
|
4625
3986
|
return false;
|
|
4626
3987
|
});
|
|
@@ -4725,30 +4086,42 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4725
4086
|
instanceRef.value = void 0;
|
|
4726
4087
|
};
|
|
4727
4088
|
return (_ctx, _cache) => {
|
|
4728
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
4089
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
4729
4090
|
createVNode(unref(TMagicInput), {
|
|
4730
|
-
|
|
4731
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
|
|
4091
|
+
"model-value": __props.model[__props.name],
|
|
4732
4092
|
ref_key: "input",
|
|
4733
4093
|
ref: input,
|
|
4734
4094
|
clearable: "",
|
|
4735
|
-
size:
|
|
4736
|
-
placeholder:
|
|
4737
|
-
disabled:
|
|
4738
|
-
|
|
4095
|
+
size: __props.size,
|
|
4096
|
+
placeholder: __props.config.placeholder,
|
|
4097
|
+
disabled: __props.disabled,
|
|
4098
|
+
"onUpdate:modelValue": changeHandler,
|
|
4739
4099
|
onInput: inputHandler,
|
|
4740
|
-
onKeyup: _cache[
|
|
4100
|
+
onKeyup: _cache[0] || (_cache[0] = ($event) => keyUpHandler($event))
|
|
4741
4101
|
}, createSlots({
|
|
4742
4102
|
_: 2
|
|
4743
4103
|
/* DYNAMIC */
|
|
4744
4104
|
}, [
|
|
4105
|
+
__props.config.prepend ? {
|
|
4106
|
+
name: "prepend",
|
|
4107
|
+
fn: withCtx(() => [
|
|
4108
|
+
createElementVNode(
|
|
4109
|
+
"span",
|
|
4110
|
+
null,
|
|
4111
|
+
toDisplayString(__props.config.prepend),
|
|
4112
|
+
1
|
|
4113
|
+
/* TEXT */
|
|
4114
|
+
)
|
|
4115
|
+
]),
|
|
4116
|
+
key: "0"
|
|
4117
|
+
} : void 0,
|
|
4745
4118
|
appendConfig.value ? {
|
|
4746
4119
|
name: "append",
|
|
4747
4120
|
fn: withCtx(() => [
|
|
4748
4121
|
appendConfig.value.type === "button" ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4749
4122
|
key: 0,
|
|
4750
4123
|
style: { "color": "#409eff" },
|
|
4751
|
-
size:
|
|
4124
|
+
size: __props.size,
|
|
4752
4125
|
onClick: withModifiers(buttonClickHandler, ["prevent"])
|
|
4753
4126
|
}, {
|
|
4754
4127
|
default: withCtx(() => [
|
|
@@ -4760,11 +4133,17 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4760
4133
|
]),
|
|
4761
4134
|
_: 1
|
|
4762
4135
|
/* STABLE */
|
|
4763
|
-
}, 8, ["size"])) :
|
|
4136
|
+
}, 8, ["size"])) : (openBlock(), createElementBlock(
|
|
4137
|
+
"span",
|
|
4138
|
+
_hoisted_2$1,
|
|
4139
|
+
toDisplayString(appendConfig.value.text),
|
|
4140
|
+
1
|
|
4141
|
+
/* TEXT */
|
|
4142
|
+
))
|
|
4764
4143
|
]),
|
|
4765
|
-
key: "
|
|
4144
|
+
key: "1"
|
|
4766
4145
|
} : void 0
|
|
4767
|
-
]), 1032, ["
|
|
4146
|
+
]), 1032, ["model-value", "size", "placeholder", "disabled"]),
|
|
4768
4147
|
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4769
4148
|
popoverVisible.value ? (openBlock(), createElementBlock(
|
|
4770
4149
|
"div",
|
|
@@ -4775,20 +4154,20 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4775
4154
|
ref: popoverEl
|
|
4776
4155
|
},
|
|
4777
4156
|
[
|
|
4778
|
-
_cache[
|
|
4157
|
+
_cache[4] || (_cache[4] = createElementVNode(
|
|
4779
4158
|
"div",
|
|
4780
4159
|
{ class: "m-form-validate__warning" },
|
|
4781
4160
|
"输入内容前后有空格,是否移除空格?",
|
|
4782
4161
|
-1
|
|
4783
4162
|
/* CACHED */
|
|
4784
4163
|
)),
|
|
4785
|
-
createElementVNode("div",
|
|
4164
|
+
createElementVNode("div", _hoisted_3$1, [
|
|
4786
4165
|
createVNode(unref(TMagicButton), {
|
|
4787
4166
|
link: "",
|
|
4788
4167
|
size: "small",
|
|
4789
|
-
onClick: _cache[
|
|
4168
|
+
onClick: _cache[1] || (_cache[1] = ($event) => popoverVisible.value = false)
|
|
4790
4169
|
}, {
|
|
4791
|
-
default: withCtx(() => [..._cache[
|
|
4170
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
4792
4171
|
createTextVNode(
|
|
4793
4172
|
"保持原样",
|
|
4794
4173
|
-1
|
|
@@ -4803,7 +4182,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4803
4182
|
size: "small",
|
|
4804
4183
|
onClick: confirmTrimHandler
|
|
4805
4184
|
}, {
|
|
4806
|
-
default: withCtx(() => [..._cache[
|
|
4185
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
4807
4186
|
createTextVNode(
|
|
4808
4187
|
"移除空格",
|
|
4809
4188
|
-1
|
|
@@ -4814,7 +4193,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4814
4193
|
/* STABLE */
|
|
4815
4194
|
})
|
|
4816
4195
|
]),
|
|
4817
|
-
_cache[
|
|
4196
|
+
_cache[5] || (_cache[5] = createElementVNode(
|
|
4818
4197
|
"span",
|
|
4819
4198
|
{
|
|
4820
4199
|
class: "tmagic-form-text-popper-arrow",
|
|
@@ -4834,11 +4213,93 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4834
4213
|
}
|
|
4835
4214
|
});
|
|
4836
4215
|
|
|
4837
|
-
const _sfc_main$
|
|
4216
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
4217
|
+
...{
|
|
4218
|
+
name: "MFormTextarea"
|
|
4219
|
+
},
|
|
4220
|
+
__name: "Textarea",
|
|
4221
|
+
props: {
|
|
4222
|
+
config: {},
|
|
4223
|
+
model: {},
|
|
4224
|
+
initValues: {},
|
|
4225
|
+
values: {},
|
|
4226
|
+
name: {},
|
|
4227
|
+
prop: {},
|
|
4228
|
+
disabled: { type: Boolean },
|
|
4229
|
+
size: {},
|
|
4230
|
+
lastValues: {}
|
|
4231
|
+
},
|
|
4232
|
+
emits: ["change", "input"],
|
|
4233
|
+
setup(__props, { emit: __emit }) {
|
|
4234
|
+
const props = __props;
|
|
4235
|
+
const emit = __emit;
|
|
4236
|
+
useAddField(props.prop);
|
|
4237
|
+
const mForm = inject("mForm");
|
|
4238
|
+
const changeHandler = (value) => {
|
|
4239
|
+
emit("change", value);
|
|
4240
|
+
};
|
|
4241
|
+
const inputHandler = (v) => {
|
|
4242
|
+
emit("input", v);
|
|
4243
|
+
mForm?.$emit("field-input", props.prop, v);
|
|
4244
|
+
};
|
|
4245
|
+
return (_ctx, _cache) => {
|
|
4246
|
+
return openBlock(), createBlock(unref(TMagicInput), {
|
|
4247
|
+
"model-value": __props.model[__props.name],
|
|
4248
|
+
type: "textarea",
|
|
4249
|
+
size: __props.size,
|
|
4250
|
+
clearable: "",
|
|
4251
|
+
placeholder: __props.config.placeholder,
|
|
4252
|
+
disabled: __props.disabled,
|
|
4253
|
+
"onUpdate:modelValue": changeHandler,
|
|
4254
|
+
onInput: inputHandler
|
|
4255
|
+
}, null, 8, ["model-value", "size", "placeholder", "disabled"]);
|
|
4256
|
+
};
|
|
4257
|
+
}
|
|
4258
|
+
});
|
|
4259
|
+
|
|
4260
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
4261
|
+
...{
|
|
4262
|
+
name: "MFormTime"
|
|
4263
|
+
},
|
|
4264
|
+
__name: "Time",
|
|
4265
|
+
props: {
|
|
4266
|
+
config: {},
|
|
4267
|
+
model: {},
|
|
4268
|
+
initValues: {},
|
|
4269
|
+
values: {},
|
|
4270
|
+
name: {},
|
|
4271
|
+
prop: {},
|
|
4272
|
+
disabled: { type: Boolean },
|
|
4273
|
+
size: {},
|
|
4274
|
+
lastValues: {}
|
|
4275
|
+
},
|
|
4276
|
+
emits: ["change"],
|
|
4277
|
+
setup(__props, { emit: __emit }) {
|
|
4278
|
+
const props = __props;
|
|
4279
|
+
const emit = __emit;
|
|
4280
|
+
useAddField(props.prop);
|
|
4281
|
+
const changeHandler = (v) => {
|
|
4282
|
+
emit("change", v);
|
|
4283
|
+
};
|
|
4284
|
+
return (_ctx, _cache) => {
|
|
4285
|
+
return openBlock(), createBlock(unref(TMagicTimePicker), {
|
|
4286
|
+
"model-value": __props.model[__props.name],
|
|
4287
|
+
"value-format": __props.config.valueFormat || "HH:mm:ss",
|
|
4288
|
+
format: __props.config.format || "HH:mm:ss",
|
|
4289
|
+
size: __props.size,
|
|
4290
|
+
placeholder: __props.config.placeholder,
|
|
4291
|
+
disabled: __props.disabled,
|
|
4292
|
+
"onUpdate:modelValue": changeHandler
|
|
4293
|
+
}, null, 8, ["model-value", "value-format", "format", "size", "placeholder", "disabled"]);
|
|
4294
|
+
};
|
|
4295
|
+
}
|
|
4296
|
+
});
|
|
4297
|
+
|
|
4298
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
4838
4299
|
...{
|
|
4839
|
-
name: "
|
|
4300
|
+
name: "MFormTimeRange"
|
|
4840
4301
|
},
|
|
4841
|
-
__name: "
|
|
4302
|
+
__name: "Timerange",
|
|
4842
4303
|
props: {
|
|
4843
4304
|
config: {},
|
|
4844
4305
|
model: {},
|
|
@@ -4850,146 +4311,891 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
4850
4311
|
size: {},
|
|
4851
4312
|
lastValues: {}
|
|
4852
4313
|
},
|
|
4853
|
-
emits: ["change"
|
|
4314
|
+
emits: ["change"],
|
|
4854
4315
|
setup(__props, { emit: __emit }) {
|
|
4855
4316
|
const props = __props;
|
|
4856
4317
|
const emit = __emit;
|
|
4857
4318
|
useAddField(props.prop);
|
|
4858
|
-
const
|
|
4859
|
-
const
|
|
4860
|
-
|
|
4319
|
+
const { names } = props.config;
|
|
4320
|
+
const value = ref([]);
|
|
4321
|
+
if (props.model !== void 0 && names?.length) {
|
|
4322
|
+
watch(
|
|
4323
|
+
[() => props.model[names[0]], () => props.model[names[1]]],
|
|
4324
|
+
([start, end], [preStart, preEnd]) => {
|
|
4325
|
+
if (!value.value) {
|
|
4326
|
+
value.value = [];
|
|
4327
|
+
}
|
|
4328
|
+
if (!start || !end) value.value = [];
|
|
4329
|
+
if (start !== preStart) value.value[0] = start;
|
|
4330
|
+
if (end !== preEnd) value.value[1] = end;
|
|
4331
|
+
},
|
|
4332
|
+
{
|
|
4333
|
+
immediate: true
|
|
4334
|
+
}
|
|
4335
|
+
);
|
|
4336
|
+
}
|
|
4337
|
+
const setValue = (v) => {
|
|
4338
|
+
names?.forEach((item, index) => {
|
|
4339
|
+
if (!props.model) {
|
|
4340
|
+
return;
|
|
4341
|
+
}
|
|
4342
|
+
if (Array.isArray(v)) {
|
|
4343
|
+
props.model[item] = v[index];
|
|
4344
|
+
} else {
|
|
4345
|
+
props.model[item] = void 0;
|
|
4346
|
+
}
|
|
4347
|
+
});
|
|
4861
4348
|
};
|
|
4862
|
-
const
|
|
4863
|
-
|
|
4864
|
-
|
|
4349
|
+
const changeHandler = (v) => {
|
|
4350
|
+
const value2 = v || [];
|
|
4351
|
+
if (names?.length) {
|
|
4352
|
+
setValue(value2);
|
|
4353
|
+
}
|
|
4354
|
+
emit("change", value2);
|
|
4865
4355
|
};
|
|
4866
4356
|
return (_ctx, _cache) => {
|
|
4867
|
-
return openBlock(), createBlock(unref(
|
|
4868
|
-
|
|
4869
|
-
"
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4357
|
+
return openBlock(), createBlock(unref(TMagicTimePicker), {
|
|
4358
|
+
"model-value": value.value,
|
|
4359
|
+
"is-range": "",
|
|
4360
|
+
"range-separator": "-",
|
|
4361
|
+
"start-placeholder": "开始时间",
|
|
4362
|
+
"end-placeholder": "结束时间",
|
|
4363
|
+
size: __props.size,
|
|
4364
|
+
"unlink-panels": true,
|
|
4365
|
+
disabled: __props.disabled,
|
|
4366
|
+
"default-time": __props.config.defaultTime,
|
|
4367
|
+
"onUpdate:modelValue": changeHandler
|
|
4368
|
+
}, null, 8, ["model-value", "size", "disabled", "default-time"]);
|
|
4878
4369
|
};
|
|
4879
4370
|
}
|
|
4880
4371
|
});
|
|
4881
4372
|
|
|
4882
|
-
const
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4373
|
+
const useAdd = (props, emit) => {
|
|
4374
|
+
const mForm = inject("mForm");
|
|
4375
|
+
const addable = computed(() => {
|
|
4376
|
+
const modelName = props.name || props.config.name || "";
|
|
4377
|
+
if (!props.model[modelName].length) {
|
|
4378
|
+
return true;
|
|
4379
|
+
}
|
|
4380
|
+
if (typeof props.config.addable === "function") {
|
|
4381
|
+
return props.config.addable(mForm, {
|
|
4382
|
+
model: props.model[modelName],
|
|
4383
|
+
formValue: mForm?.values,
|
|
4384
|
+
prop: props.prop
|
|
4385
|
+
});
|
|
4386
|
+
}
|
|
4387
|
+
return typeof props.config.addable === "undefined" ? true : props.config.addable;
|
|
4388
|
+
});
|
|
4389
|
+
const newHandler = async (row) => {
|
|
4390
|
+
const modelName = props.name || props.config.name || "";
|
|
4391
|
+
if (props.config.max && props.model[modelName].length >= props.config.max) {
|
|
4392
|
+
tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
|
|
4393
|
+
return;
|
|
4394
|
+
}
|
|
4395
|
+
if (typeof props.config.beforeAddRow === "function") {
|
|
4396
|
+
const beforeCheckRes = props.config.beforeAddRow(mForm, {
|
|
4397
|
+
model: props.model[modelName],
|
|
4398
|
+
formValue: mForm?.values,
|
|
4399
|
+
prop: props.prop
|
|
4400
|
+
});
|
|
4401
|
+
if (!beforeCheckRes) return;
|
|
4402
|
+
}
|
|
4403
|
+
const columns = props.config.items;
|
|
4404
|
+
const enumValues = props.config.enum || [];
|
|
4405
|
+
let enumV = [];
|
|
4406
|
+
const { length } = props.model[modelName];
|
|
4407
|
+
const key = props.config.key || "id";
|
|
4408
|
+
let inputs = {};
|
|
4409
|
+
if (enumValues.length) {
|
|
4410
|
+
if (length >= enumValues.length) {
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
enumV = enumValues.filter((item) => {
|
|
4414
|
+
let i = 0;
|
|
4415
|
+
for (; i < length; i++) {
|
|
4416
|
+
if (item[key] === props.model[modelName][i][key]) {
|
|
4417
|
+
break;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
return i === length;
|
|
4421
|
+
});
|
|
4422
|
+
if (enumV.length > 0) {
|
|
4423
|
+
inputs = enumV[0];
|
|
4424
|
+
}
|
|
4425
|
+
} else if (Array.isArray(row)) {
|
|
4426
|
+
columns.forEach((column, index) => {
|
|
4427
|
+
column.name && (inputs[column.name] = row[index]);
|
|
4428
|
+
});
|
|
4429
|
+
} else {
|
|
4430
|
+
if (typeof props.config.defaultAdd === "function") {
|
|
4431
|
+
inputs = await props.config.defaultAdd(mForm, {
|
|
4432
|
+
model: props.model[modelName],
|
|
4433
|
+
formValue: mForm?.values
|
|
4434
|
+
});
|
|
4435
|
+
} else if (props.config.defaultAdd) {
|
|
4436
|
+
inputs = props.config.defaultAdd;
|
|
4437
|
+
}
|
|
4438
|
+
inputs = await initValue(mForm, {
|
|
4439
|
+
config: columns,
|
|
4440
|
+
initValues: inputs
|
|
4441
|
+
});
|
|
4442
|
+
}
|
|
4443
|
+
if (props.sortKey && length) {
|
|
4444
|
+
inputs[props.sortKey] = props.model[modelName][length - 1][props.sortKey] - 1;
|
|
4445
|
+
}
|
|
4446
|
+
emit("change", [...props.model[modelName], inputs], {
|
|
4447
|
+
changeRecords: [
|
|
4448
|
+
{
|
|
4449
|
+
propPath: `${props.prop}.${props.model[modelName].length}`,
|
|
4450
|
+
value: inputs
|
|
4451
|
+
}
|
|
4452
|
+
]
|
|
4453
|
+
});
|
|
4454
|
+
};
|
|
4455
|
+
return {
|
|
4456
|
+
addable,
|
|
4457
|
+
newHandler
|
|
4458
|
+
};
|
|
4459
|
+
};
|
|
4460
|
+
|
|
4461
|
+
const useFullscreen = () => {
|
|
4462
|
+
const isFullscreen = ref(false);
|
|
4463
|
+
const mTableEl = useTemplateRef("mTable");
|
|
4464
|
+
const { nextZIndex } = useZIndex();
|
|
4465
|
+
const toggleFullscreen = () => {
|
|
4466
|
+
if (!mTableEl.value) return;
|
|
4467
|
+
if (isFullscreen.value) {
|
|
4468
|
+
mTableEl.value.classList.remove("fixed");
|
|
4469
|
+
isFullscreen.value = false;
|
|
4470
|
+
} else {
|
|
4471
|
+
mTableEl.value.classList.add("fixed");
|
|
4472
|
+
mTableEl.value.style.zIndex = `${nextZIndex()}`;
|
|
4473
|
+
isFullscreen.value = true;
|
|
4474
|
+
}
|
|
4475
|
+
};
|
|
4476
|
+
return {
|
|
4477
|
+
isFullscreen,
|
|
4478
|
+
toggleFullscreen
|
|
4479
|
+
};
|
|
4480
|
+
};
|
|
4481
|
+
|
|
4482
|
+
const useImport = (props, emit, newHandler) => {
|
|
4483
|
+
const mForm = inject("mForm");
|
|
4484
|
+
const modelName = computed(() => props.name || props.config.name || "");
|
|
4485
|
+
const importable = computed(() => {
|
|
4486
|
+
if (typeof props.config.importable === "function") {
|
|
4487
|
+
return props.config.importable(mForm, {
|
|
4488
|
+
formValue: mForm?.values,
|
|
4489
|
+
model: props.model[modelName.value]
|
|
4490
|
+
});
|
|
4491
|
+
}
|
|
4492
|
+
return typeof props.config.importable === "undefined" ? false : props.config.importable;
|
|
4493
|
+
});
|
|
4494
|
+
const excelBtn = useTemplateRef("excelBtn");
|
|
4495
|
+
const excelHandler = async (file) => {
|
|
4496
|
+
if (!file?.raw) {
|
|
4497
|
+
return false;
|
|
4498
|
+
}
|
|
4499
|
+
if (!globalThis.XLSX) {
|
|
4500
|
+
await asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
|
|
4501
|
+
}
|
|
4502
|
+
const reader = new FileReader();
|
|
4503
|
+
reader.onload = () => {
|
|
4504
|
+
const data = reader.result;
|
|
4505
|
+
const pdata = globalThis.XLSX.read(data, { type: "array" });
|
|
4506
|
+
pdata.SheetNames.forEach((sheetName) => {
|
|
4507
|
+
const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
|
|
4508
|
+
if (arr?.[0]) {
|
|
4509
|
+
arr.forEach((row) => {
|
|
4510
|
+
newHandler(row);
|
|
4511
|
+
});
|
|
4512
|
+
}
|
|
4513
|
+
setTimeout(() => {
|
|
4514
|
+
excelBtn.value?.clearFiles();
|
|
4515
|
+
}, 300);
|
|
4516
|
+
});
|
|
4517
|
+
};
|
|
4518
|
+
reader.readAsArrayBuffer(file.raw);
|
|
4519
|
+
return false;
|
|
4520
|
+
};
|
|
4521
|
+
const clearHandler = () => {
|
|
4522
|
+
emit("change", []);
|
|
4523
|
+
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
4524
|
+
};
|
|
4525
|
+
return {
|
|
4526
|
+
importable,
|
|
4527
|
+
excelHandler,
|
|
4528
|
+
clearHandler
|
|
4529
|
+
};
|
|
4530
|
+
};
|
|
4531
|
+
|
|
4532
|
+
const usePagination = (props, modelName) => {
|
|
4533
|
+
const pageSize = ref(10);
|
|
4534
|
+
const currentPage = ref(0);
|
|
4535
|
+
const paginationData = computed(() => getDataByPage(props.model[modelName.value], currentPage.value, pageSize.value));
|
|
4536
|
+
const handleSizeChange = (val) => {
|
|
4537
|
+
pageSize.value = val;
|
|
4538
|
+
};
|
|
4539
|
+
const handleCurrentChange = (val) => {
|
|
4540
|
+
currentPage.value = val - 1;
|
|
4541
|
+
};
|
|
4542
|
+
return {
|
|
4543
|
+
pageSize,
|
|
4544
|
+
currentPage,
|
|
4545
|
+
paginationData,
|
|
4546
|
+
handleSizeChange,
|
|
4547
|
+
handleCurrentChange
|
|
4548
|
+
};
|
|
4549
|
+
};
|
|
4550
|
+
|
|
4551
|
+
const useSelection = (props, emit, tMagicTableRef) => {
|
|
4552
|
+
const mForm = inject("mForm");
|
|
4553
|
+
const selectHandle = (selection, row) => {
|
|
4554
|
+
if (typeof props.config.selection === "string" && props.config.selection === "single") {
|
|
4555
|
+
tMagicTableRef.value?.clearSelection();
|
|
4556
|
+
tMagicTableRef.value?.toggleRowSelection(row, true);
|
|
4557
|
+
}
|
|
4558
|
+
emit("select", selection, row);
|
|
4559
|
+
if (typeof props.config.onSelect === "function") {
|
|
4560
|
+
props.config.onSelect(mForm, { selection, row, config: props.config });
|
|
4561
|
+
}
|
|
4562
|
+
};
|
|
4563
|
+
const toggleRowSelection = (row, selected) => {
|
|
4564
|
+
tMagicTableRef.value?.toggleRowSelection.call(tMagicTableRef.value?.getTableRef(), row, selected);
|
|
4565
|
+
};
|
|
4566
|
+
return {
|
|
4567
|
+
selectHandle,
|
|
4568
|
+
toggleRowSelection
|
|
4569
|
+
};
|
|
4570
|
+
};
|
|
4571
|
+
|
|
4572
|
+
const useSortable = (props, emit, tMagicTableRef, modelName) => {
|
|
4573
|
+
const mForm = inject("mForm");
|
|
4574
|
+
let sortable;
|
|
4575
|
+
const rowDrop = () => {
|
|
4576
|
+
sortable?.destroy();
|
|
4577
|
+
const tableEl = tMagicTableRef.value?.getEl();
|
|
4578
|
+
const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
|
|
4579
|
+
if (!tBodyEl) {
|
|
4580
|
+
return;
|
|
4581
|
+
}
|
|
4582
|
+
sortable = Sortable.create(tBodyEl, {
|
|
4583
|
+
draggable: ".tmagic-design-table-row",
|
|
4584
|
+
filter: "input",
|
|
4585
|
+
// 表单组件选字操作和触发拖拽会冲突,优先保证选字操作
|
|
4586
|
+
preventOnFilter: false,
|
|
4587
|
+
// 允许选字
|
|
4588
|
+
direction: "vertical",
|
|
4589
|
+
onEnd: ({ newIndex, oldIndex }) => {
|
|
4590
|
+
if (typeof newIndex === "undefined") return;
|
|
4591
|
+
if (typeof oldIndex === "undefined") return;
|
|
4592
|
+
const newData = sortArray(props.model[modelName.value], newIndex, oldIndex, props.sortKey);
|
|
4593
|
+
emit("change", newData);
|
|
4594
|
+
mForm?.$emit("field-change", newData);
|
|
4595
|
+
}
|
|
4596
|
+
});
|
|
4597
|
+
};
|
|
4598
|
+
watchEffect(() => {
|
|
4599
|
+
if (props.config.dropSort) {
|
|
4600
|
+
rowDrop();
|
|
4601
|
+
}
|
|
4602
|
+
});
|
|
4603
|
+
};
|
|
4604
|
+
|
|
4605
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
4606
|
+
__name: "ActionsColumn",
|
|
4887
4607
|
props: {
|
|
4888
4608
|
config: {},
|
|
4889
4609
|
model: {},
|
|
4890
|
-
initValues: {},
|
|
4891
|
-
values: {},
|
|
4892
4610
|
name: {},
|
|
4893
|
-
prop: {},
|
|
4894
4611
|
disabled: { type: Boolean },
|
|
4895
|
-
|
|
4896
|
-
|
|
4612
|
+
currentPage: {},
|
|
4613
|
+
pageSize: {},
|
|
4614
|
+
index: {},
|
|
4615
|
+
row: {},
|
|
4616
|
+
prop: {},
|
|
4617
|
+
sortKey: {}
|
|
4897
4618
|
},
|
|
4898
4619
|
emits: ["change"],
|
|
4620
|
+
setup(__props, { emit: __emit }) {
|
|
4621
|
+
const emit = __emit;
|
|
4622
|
+
const props = __props;
|
|
4623
|
+
const mForm = inject("mForm");
|
|
4624
|
+
const removeHandler = (index) => {
|
|
4625
|
+
if (props.disabled) return;
|
|
4626
|
+
emit("change", props.model[props.name].toSpliced(index, 1));
|
|
4627
|
+
};
|
|
4628
|
+
const copyHandler = (index) => {
|
|
4629
|
+
const inputs = cloneDeep(props.model[props.name][index]);
|
|
4630
|
+
const { length } = props.model[props.name];
|
|
4631
|
+
if (props.sortKey && length) {
|
|
4632
|
+
inputs[props.sortKey] = props.model[props.name][length - 1][props.sortKey] - 1;
|
|
4633
|
+
}
|
|
4634
|
+
emit("change", [...props.model[props.name], inputs], {
|
|
4635
|
+
changeRecords: [
|
|
4636
|
+
{
|
|
4637
|
+
propPath: `${props.prop}.${props.model[props.name].length}`,
|
|
4638
|
+
value: inputs
|
|
4639
|
+
}
|
|
4640
|
+
]
|
|
4641
|
+
});
|
|
4642
|
+
};
|
|
4643
|
+
const showDelete = (index) => {
|
|
4644
|
+
const deleteFunc = props.config.delete;
|
|
4645
|
+
if (deleteFunc && typeof deleteFunc === "function") {
|
|
4646
|
+
return deleteFunc(props.model[props.name], index, mForm?.values);
|
|
4647
|
+
}
|
|
4648
|
+
return props.config.delete ?? true;
|
|
4649
|
+
};
|
|
4650
|
+
const copyable = (index) => {
|
|
4651
|
+
const copyableFunc = props.config.copyable;
|
|
4652
|
+
if (copyableFunc && typeof copyableFunc === "function") {
|
|
4653
|
+
return copyableFunc(mForm, {
|
|
4654
|
+
values: mForm?.initValues || {},
|
|
4655
|
+
model: props.model,
|
|
4656
|
+
parent: mForm?.parentValues || {},
|
|
4657
|
+
formValue: mForm?.values || props.model,
|
|
4658
|
+
prop: props.prop,
|
|
4659
|
+
config: props.config,
|
|
4660
|
+
index
|
|
4661
|
+
});
|
|
4662
|
+
}
|
|
4663
|
+
return props.config.copyable ?? true;
|
|
4664
|
+
};
|
|
4665
|
+
return (_ctx, _cache) => {
|
|
4666
|
+
return openBlock(), createElementBlock(
|
|
4667
|
+
Fragment,
|
|
4668
|
+
null,
|
|
4669
|
+
[
|
|
4670
|
+
renderSlot(_ctx.$slots, "operateCol", {
|
|
4671
|
+
scope: { $index: __props.index, row: __props.row }
|
|
4672
|
+
}),
|
|
4673
|
+
withDirectives(createVNode(unref(TMagicButton), {
|
|
4674
|
+
size: "small",
|
|
4675
|
+
type: "danger",
|
|
4676
|
+
link: "",
|
|
4677
|
+
title: "删除",
|
|
4678
|
+
icon: unref(Delete),
|
|
4679
|
+
onClick: _cache[0] || (_cache[0] = ($event) => removeHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
|
|
4680
|
+
}, null, 8, ["icon"]), [
|
|
4681
|
+
[vShow, showDelete(__props.index + 1 + __props.currentPage * __props.pageSize - 1)]
|
|
4682
|
+
]),
|
|
4683
|
+
copyable(__props.index + 1 + __props.currentPage * __props.pageSize - 1) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4684
|
+
key: 0,
|
|
4685
|
+
link: "",
|
|
4686
|
+
size: "small",
|
|
4687
|
+
type: "primary",
|
|
4688
|
+
title: "复制",
|
|
4689
|
+
icon: unref(DocumentCopy),
|
|
4690
|
+
disabled: __props.disabled,
|
|
4691
|
+
onClick: _cache[1] || (_cache[1] = ($event) => copyHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
|
|
4692
|
+
}, null, 8, ["icon", "disabled"])) : createCommentVNode("v-if", true)
|
|
4693
|
+
],
|
|
4694
|
+
64
|
|
4695
|
+
/* STABLE_FRAGMENT */
|
|
4696
|
+
);
|
|
4697
|
+
};
|
|
4698
|
+
}
|
|
4699
|
+
});
|
|
4700
|
+
|
|
4701
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
4702
|
+
__name: "SortColumn",
|
|
4703
|
+
props: {
|
|
4704
|
+
index: {},
|
|
4705
|
+
disabled: { type: Boolean },
|
|
4706
|
+
currentPage: {},
|
|
4707
|
+
pageSize: {},
|
|
4708
|
+
name: {},
|
|
4709
|
+
model: {}
|
|
4710
|
+
},
|
|
4711
|
+
emits: ["swap"],
|
|
4899
4712
|
setup(__props, { emit: __emit }) {
|
|
4900
4713
|
const props = __props;
|
|
4901
4714
|
const emit = __emit;
|
|
4902
|
-
|
|
4903
|
-
const
|
|
4904
|
-
|
|
4715
|
+
let timer = null;
|
|
4716
|
+
const upHandler = (index) => {
|
|
4717
|
+
if (timer) {
|
|
4718
|
+
clearTimeout(timer);
|
|
4719
|
+
}
|
|
4720
|
+
timer = setTimeout(() => {
|
|
4721
|
+
emit("swap", index, index - 1);
|
|
4722
|
+
timer = null;
|
|
4723
|
+
}, 300);
|
|
4724
|
+
};
|
|
4725
|
+
const topHandler = (index) => {
|
|
4726
|
+
if (timer) {
|
|
4727
|
+
clearTimeout(timer);
|
|
4728
|
+
}
|
|
4729
|
+
const moveNum = index;
|
|
4730
|
+
for (let i = 0; i < moveNum; i++) {
|
|
4731
|
+
emit("swap", index, index - 1);
|
|
4732
|
+
index -= 1;
|
|
4733
|
+
}
|
|
4734
|
+
};
|
|
4735
|
+
const downHandler = (index) => {
|
|
4736
|
+
if (timer) {
|
|
4737
|
+
clearTimeout(timer);
|
|
4738
|
+
}
|
|
4739
|
+
timer = setTimeout(() => {
|
|
4740
|
+
emit("swap", index, index + 1);
|
|
4741
|
+
timer = null;
|
|
4742
|
+
}, 300);
|
|
4743
|
+
};
|
|
4744
|
+
const bottomHandler = (index) => {
|
|
4745
|
+
if (timer) {
|
|
4746
|
+
clearTimeout(timer);
|
|
4747
|
+
}
|
|
4748
|
+
const moveNum = props.model[props.name].length - 1 - index;
|
|
4749
|
+
for (let i = 0; i < moveNum; i++) {
|
|
4750
|
+
emit("swap", index, index + 1);
|
|
4751
|
+
index += 1;
|
|
4752
|
+
}
|
|
4905
4753
|
};
|
|
4906
4754
|
return (_ctx, _cache) => {
|
|
4907
|
-
return openBlock(),
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4755
|
+
return openBlock(), createElementBlock(
|
|
4756
|
+
Fragment,
|
|
4757
|
+
null,
|
|
4758
|
+
[
|
|
4759
|
+
__props.index + 1 + __props.currentPage * __props.pageSize - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
4760
|
+
key: 0,
|
|
4761
|
+
content: "点击上移,双击置顶",
|
|
4762
|
+
placement: "top"
|
|
4763
|
+
}, {
|
|
4764
|
+
default: withCtx(() => [
|
|
4765
|
+
createVNode(unref(TMagicButton), {
|
|
4766
|
+
plain: "",
|
|
4767
|
+
size: "small",
|
|
4768
|
+
type: "primary",
|
|
4769
|
+
icon: unref(ArrowUp),
|
|
4770
|
+
disabled: __props.disabled,
|
|
4771
|
+
link: "",
|
|
4772
|
+
onClick: _cache[0] || (_cache[0] = ($event) => upHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1)),
|
|
4773
|
+
onDblclick: _cache[1] || (_cache[1] = ($event) => topHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
|
|
4774
|
+
}, null, 8, ["icon", "disabled"])
|
|
4775
|
+
]),
|
|
4776
|
+
_: 1
|
|
4777
|
+
/* STABLE */
|
|
4778
|
+
})) : createCommentVNode("v-if", true),
|
|
4779
|
+
__props.index + 1 + __props.currentPage * __props.pageSize - 1 !== __props.model[__props.name].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
4780
|
+
key: 1,
|
|
4781
|
+
content: "点击下移,双击置底",
|
|
4782
|
+
placement: "top"
|
|
4783
|
+
}, {
|
|
4784
|
+
default: withCtx(() => [
|
|
4785
|
+
createVNode(unref(TMagicButton), {
|
|
4786
|
+
plain: "",
|
|
4787
|
+
size: "small",
|
|
4788
|
+
type: "primary",
|
|
4789
|
+
icon: unref(ArrowDown),
|
|
4790
|
+
disabled: __props.disabled,
|
|
4791
|
+
link: "",
|
|
4792
|
+
onClick: _cache[2] || (_cache[2] = ($event) => downHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1)),
|
|
4793
|
+
onDblclick: _cache[3] || (_cache[3] = ($event) => bottomHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
|
|
4794
|
+
}, null, 8, ["icon", "disabled"])
|
|
4795
|
+
]),
|
|
4796
|
+
_: 1
|
|
4797
|
+
/* STABLE */
|
|
4798
|
+
})) : createCommentVNode("v-if", true)
|
|
4799
|
+
],
|
|
4800
|
+
64
|
|
4801
|
+
/* STABLE_FRAGMENT */
|
|
4802
|
+
);
|
|
4917
4803
|
};
|
|
4918
4804
|
}
|
|
4919
4805
|
});
|
|
4920
4806
|
|
|
4807
|
+
const useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
|
|
4808
|
+
const mForm = inject("mForm");
|
|
4809
|
+
const display$1 = (fuc) => display(mForm, fuc, props);
|
|
4810
|
+
const lastData = computed(
|
|
4811
|
+
() => props.config.pagination ? getDataByPage(props.lastValues[modelName.value], currentPage.value, pageSize.value) : props.lastValues[modelName.value] || []
|
|
4812
|
+
);
|
|
4813
|
+
const itemExtra = (fuc, index) => {
|
|
4814
|
+
if (typeof fuc === "function") {
|
|
4815
|
+
return fuc(mForm, {
|
|
4816
|
+
values: mForm?.initValues,
|
|
4817
|
+
model: props.model,
|
|
4818
|
+
formValue: mForm ? mForm.values : props.model,
|
|
4819
|
+
prop: props.prop,
|
|
4820
|
+
index
|
|
4821
|
+
});
|
|
4822
|
+
}
|
|
4823
|
+
return fuc;
|
|
4824
|
+
};
|
|
4825
|
+
const selection = computed(() => {
|
|
4826
|
+
if (typeof props.config.selection === "function") {
|
|
4827
|
+
return props.config.selection(mForm, { model: props.model[modelName.value] });
|
|
4828
|
+
}
|
|
4829
|
+
return props.config.selection;
|
|
4830
|
+
});
|
|
4831
|
+
const getProp = (index) => {
|
|
4832
|
+
return `${props.prop}${props.prop ? "." : ""}${index + 1 + currentPage.value * pageSize.value - 1}`;
|
|
4833
|
+
};
|
|
4834
|
+
const makeConfig = (config, row) => {
|
|
4835
|
+
const newConfig = cloneDeep(config);
|
|
4836
|
+
if (typeof config.itemsFunction === "function") {
|
|
4837
|
+
newConfig.items = config.itemsFunction(row);
|
|
4838
|
+
}
|
|
4839
|
+
delete newConfig.display;
|
|
4840
|
+
return newConfig;
|
|
4841
|
+
};
|
|
4842
|
+
const changeHandler = (v, eventData) => {
|
|
4843
|
+
emit("change", props.model, eventData);
|
|
4844
|
+
};
|
|
4845
|
+
const onAddDiffCount = () => emit("addDiffCount");
|
|
4846
|
+
const columns = computed(() => {
|
|
4847
|
+
const columns2 = [];
|
|
4848
|
+
if (props.config.itemExtra && !props.config.dropSort) {
|
|
4849
|
+
columns2.push({
|
|
4850
|
+
props: {
|
|
4851
|
+
fixed: "left",
|
|
4852
|
+
width: 30,
|
|
4853
|
+
type: "expand"
|
|
4854
|
+
},
|
|
4855
|
+
cell: ({ $index }) => h("span", {
|
|
4856
|
+
innerHTML: itemExtra(props.config.itemExtra, $index),
|
|
4857
|
+
class: "m-form-tip"
|
|
4858
|
+
})
|
|
4859
|
+
});
|
|
4860
|
+
}
|
|
4861
|
+
columns2.push({
|
|
4862
|
+
props: {
|
|
4863
|
+
label: "操作",
|
|
4864
|
+
fixed: props.config.fixed === false ? void 0 : "left",
|
|
4865
|
+
width: props.config.operateColWidth || 112,
|
|
4866
|
+
align: "center"
|
|
4867
|
+
},
|
|
4868
|
+
cell: ({ row, $index }) => h(_sfc_main$4, {
|
|
4869
|
+
row,
|
|
4870
|
+
index: $index,
|
|
4871
|
+
model: props.model,
|
|
4872
|
+
config: props.config,
|
|
4873
|
+
prop: props.prop,
|
|
4874
|
+
disabled: props.disabled,
|
|
4875
|
+
sortKey: props.sortKey,
|
|
4876
|
+
name: modelName.value,
|
|
4877
|
+
currentPage: currentPage.value,
|
|
4878
|
+
pageSize: pageSize.value,
|
|
4879
|
+
onChange: (v) => {
|
|
4880
|
+
emit("change", v);
|
|
4881
|
+
}
|
|
4882
|
+
})
|
|
4883
|
+
});
|
|
4884
|
+
if (props.sort && props.model[modelName.value] && props.model[modelName.value].length > 1) {
|
|
4885
|
+
columns2.push({
|
|
4886
|
+
props: {
|
|
4887
|
+
label: "排序",
|
|
4888
|
+
width: 80
|
|
4889
|
+
},
|
|
4890
|
+
cell: ({ $index }) => h(_sfc_main$3, {
|
|
4891
|
+
index: $index,
|
|
4892
|
+
model: props.model,
|
|
4893
|
+
disabled: props.disabled,
|
|
4894
|
+
name: modelName.value,
|
|
4895
|
+
currentPage: currentPage.value,
|
|
4896
|
+
pageSize: pageSize.value,
|
|
4897
|
+
onSwap: (index1, index2) => {
|
|
4898
|
+
const newData = sortArray(props.model[modelName.value], index1, index2, props.sortKey);
|
|
4899
|
+
emit("change", newData);
|
|
4900
|
+
mForm?.$emit("field-change", newData);
|
|
4901
|
+
}
|
|
4902
|
+
})
|
|
4903
|
+
});
|
|
4904
|
+
}
|
|
4905
|
+
if (selection.value) {
|
|
4906
|
+
columns2.push({
|
|
4907
|
+
props: {
|
|
4908
|
+
align: "center",
|
|
4909
|
+
headerAlign: "center",
|
|
4910
|
+
type: "selection",
|
|
4911
|
+
width: 45
|
|
4912
|
+
}
|
|
4913
|
+
});
|
|
4914
|
+
}
|
|
4915
|
+
if (props.showIndex && props.config.showIndex) {
|
|
4916
|
+
columns2.push({
|
|
4917
|
+
props: {
|
|
4918
|
+
label: "序号",
|
|
4919
|
+
width: 60
|
|
4920
|
+
},
|
|
4921
|
+
cell: ({ $index }) => h("span", $index + 1 + currentPage.value * pageSize.value)
|
|
4922
|
+
});
|
|
4923
|
+
}
|
|
4924
|
+
for (const column of props.config.items) {
|
|
4925
|
+
if (column.type !== "hidden" && display$1(column.display)) {
|
|
4926
|
+
columns2.push({
|
|
4927
|
+
props: {
|
|
4928
|
+
prop: column.name,
|
|
4929
|
+
label: column.label,
|
|
4930
|
+
width: column.width,
|
|
4931
|
+
sortable: column.sortable,
|
|
4932
|
+
sortOrders: ["ascending", "descending"],
|
|
4933
|
+
class: props.config.dropSort === true ? "el-table__column--dropable" : ""
|
|
4934
|
+
},
|
|
4935
|
+
cell: ({ row, $index }) => h(_sfc_main$A, {
|
|
4936
|
+
labelWidth: "0",
|
|
4937
|
+
disabled: props.disabled,
|
|
4938
|
+
prop: getProp($index),
|
|
4939
|
+
rules: column.rules,
|
|
4940
|
+
config: makeConfig(column, row),
|
|
4941
|
+
model: row,
|
|
4942
|
+
lastValues: lastData.value[$index],
|
|
4943
|
+
isCompare: props.isCompare,
|
|
4944
|
+
size: props.size,
|
|
4945
|
+
onChange: changeHandler,
|
|
4946
|
+
onAddDiffCount
|
|
4947
|
+
})
|
|
4948
|
+
});
|
|
4949
|
+
}
|
|
4950
|
+
}
|
|
4951
|
+
return columns2;
|
|
4952
|
+
});
|
|
4953
|
+
return {
|
|
4954
|
+
columns
|
|
4955
|
+
};
|
|
4956
|
+
};
|
|
4957
|
+
|
|
4958
|
+
const _hoisted_1$1 = { class: "m-fields-table-wrap" };
|
|
4959
|
+
const _hoisted_2 = ["innerHTML"];
|
|
4960
|
+
const _hoisted_3 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
|
|
4961
|
+
const _hoisted_4 = { style: { "display": "flex" } };
|
|
4962
|
+
const _hoisted_5 = {
|
|
4963
|
+
key: 1,
|
|
4964
|
+
class: "bottom",
|
|
4965
|
+
style: { "text-align": "right" }
|
|
4966
|
+
};
|
|
4921
4967
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
4922
4968
|
...{
|
|
4923
|
-
name: "
|
|
4969
|
+
name: "MFormTable"
|
|
4924
4970
|
},
|
|
4925
|
-
__name: "
|
|
4971
|
+
__name: "Table",
|
|
4926
4972
|
props: {
|
|
4927
|
-
config: {},
|
|
4928
4973
|
model: {},
|
|
4929
|
-
|
|
4930
|
-
|
|
4974
|
+
lastValues: { default: () => ({}) },
|
|
4975
|
+
isCompare: { type: Boolean, default: false },
|
|
4976
|
+
config: {},
|
|
4931
4977
|
name: {},
|
|
4932
|
-
prop: {},
|
|
4978
|
+
prop: { default: "" },
|
|
4979
|
+
labelWidth: {},
|
|
4980
|
+
sort: { type: Boolean },
|
|
4933
4981
|
disabled: { type: Boolean },
|
|
4982
|
+
sortKey: { default: "" },
|
|
4983
|
+
text: {},
|
|
4934
4984
|
size: {},
|
|
4935
|
-
|
|
4985
|
+
enableToggleMode: { type: Boolean, default: true },
|
|
4986
|
+
showIndex: { type: Boolean, default: true }
|
|
4936
4987
|
},
|
|
4937
|
-
emits: ["change"],
|
|
4938
|
-
setup(__props, { emit: __emit }) {
|
|
4988
|
+
emits: ["change", "select", "addDiffCount"],
|
|
4989
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4939
4990
|
const props = __props;
|
|
4940
4991
|
const emit = __emit;
|
|
4941
|
-
|
|
4942
|
-
const
|
|
4943
|
-
const
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4992
|
+
const modelName = computed(() => props.name || props.config.name || "");
|
|
4993
|
+
const tMagicTableRef = useTemplateRef("tMagicTable");
|
|
4994
|
+
const { pageSize, currentPage, paginationData, handleSizeChange, handleCurrentChange } = usePagination(
|
|
4995
|
+
props,
|
|
4996
|
+
modelName
|
|
4997
|
+
);
|
|
4998
|
+
const { addable, newHandler } = useAdd(props, emit);
|
|
4999
|
+
const { columns } = useTableColumns(props, emit, currentPage, pageSize, modelName);
|
|
5000
|
+
useSortable(props, emit, tMagicTableRef, modelName);
|
|
5001
|
+
const { isFullscreen, toggleFullscreen } = useFullscreen();
|
|
5002
|
+
const { importable, excelHandler, clearHandler } = useImport(props, emit, newHandler);
|
|
5003
|
+
const { selectHandle, toggleRowSelection } = useSelection(props, emit, tMagicTableRef);
|
|
5004
|
+
const updateKey = ref(1);
|
|
5005
|
+
const data = computed(() => props.config.pagination ? paginationData.value : props.model[modelName.value]);
|
|
5006
|
+
const toggleMode = () => {
|
|
5007
|
+
const calcLabelWidth = (label) => {
|
|
5008
|
+
if (!label) return "0px";
|
|
5009
|
+
const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
|
|
5010
|
+
const chLength = label.length - zhLength;
|
|
5011
|
+
return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
|
|
5012
|
+
};
|
|
5013
|
+
props.config.type = "groupList";
|
|
5014
|
+
props.config.enableToggleMode = true;
|
|
5015
|
+
props.config.tableItems = props.config.items;
|
|
5016
|
+
props.config.items = props.config.groupItems || props.config.items.map((item) => {
|
|
5017
|
+
const text = item.text || item.label;
|
|
5018
|
+
const labelWidth = calcLabelWidth(text);
|
|
5019
|
+
return {
|
|
5020
|
+
...item,
|
|
5021
|
+
text,
|
|
5022
|
+
labelWidth,
|
|
5023
|
+
span: item.span || 12
|
|
5024
|
+
};
|
|
4970
5025
|
});
|
|
4971
5026
|
};
|
|
4972
|
-
const
|
|
4973
|
-
const
|
|
4974
|
-
|
|
4975
|
-
setValue(value2);
|
|
4976
|
-
}
|
|
4977
|
-
emit("change", value2);
|
|
5027
|
+
const sortChangeHandler = (sortOptions) => {
|
|
5028
|
+
const modelName2 = props.name || props.config.name || "";
|
|
5029
|
+
sortChange(props.model[modelName2], sortOptions);
|
|
4978
5030
|
};
|
|
5031
|
+
__expose({
|
|
5032
|
+
toggleRowSelection
|
|
5033
|
+
});
|
|
4979
5034
|
return (_ctx, _cache) => {
|
|
4980
|
-
return openBlock(),
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
5035
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
5036
|
+
(openBlock(), createBlock(Teleport, {
|
|
5037
|
+
to: "body",
|
|
5038
|
+
disabled: !unref(isFullscreen)
|
|
5039
|
+
}, [
|
|
5040
|
+
createElementVNode(
|
|
5041
|
+
"div",
|
|
5042
|
+
{
|
|
5043
|
+
ref: "mTable",
|
|
5044
|
+
class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }])
|
|
5045
|
+
},
|
|
5046
|
+
[
|
|
5047
|
+
__props.config.extra ? (openBlock(), createElementBlock("span", {
|
|
5048
|
+
key: 0,
|
|
5049
|
+
style: { "color": "rgba(0, 0, 0, 0.45)" },
|
|
5050
|
+
innerHTML: __props.config.extra
|
|
5051
|
+
}, null, 8, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
5052
|
+
createVNode(unref(TMagicTooltip), {
|
|
5053
|
+
content: "拖拽可排序",
|
|
5054
|
+
placement: "left-start",
|
|
5055
|
+
disabled: __props.config.dropSort !== true
|
|
5056
|
+
}, {
|
|
5057
|
+
default: withCtx(() => [
|
|
5058
|
+
__props.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
|
|
5059
|
+
ref: "tMagicTable",
|
|
5060
|
+
style: { "width": "100%" },
|
|
5061
|
+
"show-header": "",
|
|
5062
|
+
"row-key": __props.config.rowKey || "id",
|
|
5063
|
+
columns: unref(columns),
|
|
5064
|
+
data: data.value,
|
|
5065
|
+
border: __props.config.border,
|
|
5066
|
+
"max-height": __props.config.maxHeight,
|
|
5067
|
+
"default-expand-all": true,
|
|
5068
|
+
key: updateKey.value,
|
|
5069
|
+
onSelect: unref(selectHandle),
|
|
5070
|
+
onSortChange: sortChangeHandler
|
|
5071
|
+
}, null, 8, ["row-key", "columns", "data", "border", "max-height", "onSelect"])) : createCommentVNode("v-if", true)
|
|
5072
|
+
]),
|
|
5073
|
+
_: 1
|
|
5074
|
+
/* STABLE */
|
|
5075
|
+
}, 8, ["disabled"]),
|
|
5076
|
+
renderSlot(_ctx.$slots, "default"),
|
|
5077
|
+
createElementVNode("div", _hoisted_3, [
|
|
5078
|
+
unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
5079
|
+
key: 0,
|
|
5080
|
+
size: "small",
|
|
5081
|
+
type: "primary",
|
|
5082
|
+
disabled: __props.disabled,
|
|
5083
|
+
plain: "",
|
|
5084
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(newHandler)())
|
|
5085
|
+
}, {
|
|
5086
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
5087
|
+
createTextVNode(
|
|
5088
|
+
"新增一行",
|
|
5089
|
+
-1
|
|
5090
|
+
/* CACHED */
|
|
5091
|
+
)
|
|
5092
|
+
])]),
|
|
5093
|
+
_: 1
|
|
5094
|
+
/* STABLE */
|
|
5095
|
+
}, 8, ["disabled"])) : createCommentVNode("v-if", true),
|
|
5096
|
+
createElementVNode("div", _hoisted_4, [
|
|
5097
|
+
__props.enableToggleMode && __props.config.enableToggleMode !== false && !unref(isFullscreen) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
5098
|
+
key: 0,
|
|
5099
|
+
icon: unref(Grid),
|
|
5100
|
+
size: "small",
|
|
5101
|
+
type: "primary",
|
|
5102
|
+
onClick: toggleMode
|
|
5103
|
+
}, {
|
|
5104
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
5105
|
+
createTextVNode(
|
|
5106
|
+
"展开配置",
|
|
5107
|
+
-1
|
|
5108
|
+
/* CACHED */
|
|
5109
|
+
)
|
|
5110
|
+
])]),
|
|
5111
|
+
_: 1
|
|
5112
|
+
/* STABLE */
|
|
5113
|
+
}, 8, ["icon"])) : createCommentVNode("v-if", true),
|
|
5114
|
+
__props.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
5115
|
+
key: 1,
|
|
5116
|
+
icon: unref(FullScreen),
|
|
5117
|
+
size: "small",
|
|
5118
|
+
type: "primary",
|
|
5119
|
+
onClick: unref(toggleFullscreen)
|
|
5120
|
+
}, {
|
|
5121
|
+
default: withCtx(() => [
|
|
5122
|
+
createTextVNode(
|
|
5123
|
+
toDisplayString(unref(isFullscreen) ? "退出全屏" : "全屏编辑"),
|
|
5124
|
+
1
|
|
5125
|
+
/* TEXT */
|
|
5126
|
+
)
|
|
5127
|
+
]),
|
|
5128
|
+
_: 1
|
|
5129
|
+
/* STABLE */
|
|
5130
|
+
}, 8, ["icon", "onClick"])) : createCommentVNode("v-if", true),
|
|
5131
|
+
unref(importable) ? (openBlock(), createBlock(unref(TMagicUpload), {
|
|
5132
|
+
key: 2,
|
|
5133
|
+
style: { "display": "inline-block" },
|
|
5134
|
+
ref: "excelBtn",
|
|
5135
|
+
action: "/noop",
|
|
5136
|
+
disabled: __props.disabled,
|
|
5137
|
+
"on-change": unref(excelHandler),
|
|
5138
|
+
"auto-upload": false
|
|
5139
|
+
}, {
|
|
5140
|
+
default: withCtx(() => [
|
|
5141
|
+
createVNode(unref(TMagicButton), {
|
|
5142
|
+
size: "small",
|
|
5143
|
+
type: "success",
|
|
5144
|
+
disabled: __props.disabled,
|
|
5145
|
+
plain: ""
|
|
5146
|
+
}, {
|
|
5147
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
5148
|
+
createTextVNode(
|
|
5149
|
+
"导入EXCEL",
|
|
5150
|
+
-1
|
|
5151
|
+
/* CACHED */
|
|
5152
|
+
)
|
|
5153
|
+
])]),
|
|
5154
|
+
_: 1
|
|
5155
|
+
/* STABLE */
|
|
5156
|
+
}, 8, ["disabled"])
|
|
5157
|
+
]),
|
|
5158
|
+
_: 1
|
|
5159
|
+
/* STABLE */
|
|
5160
|
+
}, 8, ["disabled", "on-change"])) : createCommentVNode("v-if", true),
|
|
5161
|
+
unref(importable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
5162
|
+
key: 3,
|
|
5163
|
+
size: "small",
|
|
5164
|
+
type: "warning",
|
|
5165
|
+
disabled: __props.disabled,
|
|
5166
|
+
plain: "",
|
|
5167
|
+
onClick: unref(clearHandler)
|
|
5168
|
+
}, {
|
|
5169
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
5170
|
+
createTextVNode(
|
|
5171
|
+
"清空",
|
|
5172
|
+
-1
|
|
5173
|
+
/* CACHED */
|
|
5174
|
+
)
|
|
5175
|
+
])]),
|
|
5176
|
+
_: 1
|
|
5177
|
+
/* STABLE */
|
|
5178
|
+
}, 8, ["disabled", "onClick"])) : createCommentVNode("v-if", true)
|
|
5179
|
+
])
|
|
5180
|
+
]),
|
|
5181
|
+
__props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
5182
|
+
createVNode(unref(TMagicPagination), {
|
|
5183
|
+
layout: "total, sizes, prev, pager, next, jumper",
|
|
5184
|
+
"hide-on-single-page": __props.model[modelName.value].length < unref(pageSize),
|
|
5185
|
+
"current-page": unref(currentPage) + 1,
|
|
5186
|
+
"page-sizes": [unref(pageSize), 60, 120, 300],
|
|
5187
|
+
"page-size": unref(pageSize),
|
|
5188
|
+
total: __props.model[modelName.value].length,
|
|
5189
|
+
onSizeChange: unref(handleSizeChange),
|
|
5190
|
+
onCurrentChange: unref(handleCurrentChange)
|
|
5191
|
+
}, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total", "onSizeChange", "onCurrentChange"])
|
|
5192
|
+
])) : createCommentVNode("v-if", true)
|
|
5193
|
+
],
|
|
5194
|
+
2
|
|
5195
|
+
/* CLASS */
|
|
5196
|
+
)
|
|
5197
|
+
], 8, ["disabled"]))
|
|
5198
|
+
]);
|
|
4993
5199
|
};
|
|
4994
5200
|
}
|
|
4995
5201
|
});
|
|
@@ -5078,14 +5284,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5078
5284
|
ref: drawer,
|
|
5079
5285
|
modelValue: visible.value,
|
|
5080
5286
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
|
|
5081
|
-
title:
|
|
5082
|
-
"close-on-press-escape":
|
|
5287
|
+
title: __props.title,
|
|
5288
|
+
"close-on-press-escape": __props.closeOnPressEscape,
|
|
5083
5289
|
"append-to-body": true,
|
|
5084
5290
|
"show-close": true,
|
|
5085
5291
|
"close-on-click-modal": true,
|
|
5086
|
-
size:
|
|
5087
|
-
zIndex:
|
|
5088
|
-
"before-close":
|
|
5292
|
+
size: __props.width,
|
|
5293
|
+
zIndex: __props.zIndex,
|
|
5294
|
+
"before-close": __props.beforeClose,
|
|
5089
5295
|
onOpen: openHandler,
|
|
5090
5296
|
onOpened: openedHandler,
|
|
5091
5297
|
onClose: closeHandler,
|
|
@@ -5122,13 +5328,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5122
5328
|
}),
|
|
5123
5329
|
createVNode(unref(TMagicButton), {
|
|
5124
5330
|
type: "primary",
|
|
5125
|
-
disabled:
|
|
5331
|
+
disabled: __props.disabled,
|
|
5126
5332
|
loading: saveFetch.value,
|
|
5127
5333
|
onClick: submitHandler
|
|
5128
5334
|
}, {
|
|
5129
5335
|
default: withCtx(() => [
|
|
5130
5336
|
createTextVNode(
|
|
5131
|
-
toDisplayString(
|
|
5337
|
+
toDisplayString(__props.confirmText),
|
|
5132
5338
|
1
|
|
5133
5339
|
/* TEXT */
|
|
5134
5340
|
)
|
|
@@ -5156,18 +5362,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5156
5362
|
class: "m-drawer-body"
|
|
5157
5363
|
},
|
|
5158
5364
|
[
|
|
5159
|
-
createVNode(_sfc_main$
|
|
5365
|
+
createVNode(_sfc_main$g, {
|
|
5160
5366
|
ref_key: "form",
|
|
5161
5367
|
ref: form,
|
|
5162
|
-
size:
|
|
5163
|
-
disabled:
|
|
5164
|
-
config:
|
|
5165
|
-
"init-values":
|
|
5166
|
-
"parent-values":
|
|
5167
|
-
"label-width":
|
|
5168
|
-
"label-position":
|
|
5169
|
-
inline:
|
|
5170
|
-
"prevent-submit-default":
|
|
5368
|
+
size: __props.size,
|
|
5369
|
+
disabled: __props.disabled,
|
|
5370
|
+
config: __props.config,
|
|
5371
|
+
"init-values": __props.values,
|
|
5372
|
+
"parent-values": __props.parentValues,
|
|
5373
|
+
"label-width": __props.labelWidth,
|
|
5374
|
+
"label-position": __props.labelPosition,
|
|
5375
|
+
inline: __props.inline,
|
|
5376
|
+
"prevent-submit-default": __props.preventSubmitDefault,
|
|
5171
5377
|
onChange: changeHandler
|
|
5172
5378
|
}, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline", "prevent-submit-default"]),
|
|
5173
5379
|
renderSlot(_ctx.$slots, "default")
|
|
@@ -5264,18 +5470,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
5264
5470
|
[
|
|
5265
5471
|
createVNode(unref(TMagicScrollbar), null, {
|
|
5266
5472
|
default: withCtx(() => [
|
|
5267
|
-
createVNode(_sfc_main$
|
|
5473
|
+
createVNode(_sfc_main$g, {
|
|
5268
5474
|
ref_key: "form",
|
|
5269
5475
|
ref: form,
|
|
5270
|
-
size:
|
|
5271
|
-
disabled:
|
|
5272
|
-
config:
|
|
5273
|
-
"init-values":
|
|
5274
|
-
"parent-values":
|
|
5275
|
-
"label-width":
|
|
5276
|
-
"label-position":
|
|
5277
|
-
inline:
|
|
5278
|
-
"prevent-submit-default":
|
|
5476
|
+
size: __props.size,
|
|
5477
|
+
disabled: __props.disabled,
|
|
5478
|
+
config: __props.config,
|
|
5479
|
+
"init-values": __props.values,
|
|
5480
|
+
"parent-values": __props.parentValues,
|
|
5481
|
+
"label-width": __props.labelWidth,
|
|
5482
|
+
"label-position": __props.labelPosition,
|
|
5483
|
+
inline: __props.inline,
|
|
5484
|
+
"prevent-submit-default": __props.preventSubmitDefault,
|
|
5279
5485
|
onChange: changeHandler
|
|
5280
5486
|
}, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline", "prevent-submit-default"]),
|
|
5281
5487
|
renderSlot(_ctx.$slots, "default")
|
|
@@ -5301,14 +5507,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
5301
5507
|
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
5302
5508
|
createVNode(unref(TMagicButton), {
|
|
5303
5509
|
type: "primary",
|
|
5304
|
-
size:
|
|
5305
|
-
disabled:
|
|
5510
|
+
size: __props.size,
|
|
5511
|
+
disabled: __props.disabled,
|
|
5306
5512
|
loading: saveFetch.value,
|
|
5307
5513
|
onClick: submitHandler
|
|
5308
5514
|
}, {
|
|
5309
5515
|
default: withCtx(() => [
|
|
5310
5516
|
createTextVNode(
|
|
5311
|
-
toDisplayString(
|
|
5517
|
+
toDisplayString(__props.confirmText),
|
|
5312
5518
|
1
|
|
5313
5519
|
/* TEXT */
|
|
5314
5520
|
)
|
|
@@ -5337,38 +5543,39 @@ const index = {
|
|
|
5337
5543
|
const option = Object.assign(defaultInstallOpt, opt);
|
|
5338
5544
|
app.config.globalProperties.$MAGIC_FORM = option;
|
|
5339
5545
|
setConfig(option);
|
|
5340
|
-
app.component("m-form", _sfc_main$
|
|
5341
|
-
app.component("m-form-dialog", _sfc_main$
|
|
5342
|
-
app.component("m-form-container", _sfc_main$
|
|
5343
|
-
app.component("m-form-fieldset", _sfc_main$
|
|
5344
|
-
app.component("m-form-group-list", _sfc_main$
|
|
5345
|
-
app.component("m-form-panel", _sfc_main$
|
|
5346
|
-
app.component("m-form-row", _sfc_main$
|
|
5347
|
-
app.component("m-form-step", _sfc_main$
|
|
5348
|
-
app.component("m-form-table", _sfc_main$
|
|
5349
|
-
app.component("m-form-tab", _sfc_main$
|
|
5350
|
-
app.component("m-
|
|
5351
|
-
app.component("m-fields-
|
|
5352
|
-
app.component("m-fields-
|
|
5353
|
-
app.component("m-fields-number
|
|
5354
|
-
app.component("m-fields-
|
|
5355
|
-
app.component("m-fields-
|
|
5356
|
-
app.component("m-fields-
|
|
5357
|
-
app.component("m-fields-
|
|
5358
|
-
app.component("m-fields-
|
|
5359
|
-
app.component("m-fields-
|
|
5360
|
-
app.component("m-fields-
|
|
5361
|
-
app.component("m-fields-
|
|
5362
|
-
app.component("m-fields-
|
|
5363
|
-
app.component("m-fields-
|
|
5364
|
-
app.component("m-fields-
|
|
5365
|
-
app.component("m-fields-
|
|
5366
|
-
app.component("m-fields-
|
|
5367
|
-
app.component("m-fields-
|
|
5368
|
-
app.component("m-fields-
|
|
5369
|
-
app.component("m-fields-
|
|
5370
|
-
app.component("m-fields-
|
|
5546
|
+
app.component("m-form", _sfc_main$g);
|
|
5547
|
+
app.component("m-form-dialog", _sfc_main$f);
|
|
5548
|
+
app.component("m-form-container", _sfc_main$A);
|
|
5549
|
+
app.component("m-form-fieldset", _sfc_main$z);
|
|
5550
|
+
app.component("m-form-group-list", _sfc_main$w);
|
|
5551
|
+
app.component("m-form-panel", _sfc_main$v);
|
|
5552
|
+
app.component("m-form-row", _sfc_main$t);
|
|
5553
|
+
app.component("m-form-step", _sfc_main$s);
|
|
5554
|
+
app.component("m-form-table", _sfc_main$2);
|
|
5555
|
+
app.component("m-form-tab", _sfc_main$r);
|
|
5556
|
+
app.component("m-form-flex-layout", _sfc_main$y);
|
|
5557
|
+
app.component("m-fields-text", _sfc_main$8);
|
|
5558
|
+
app.component("m-fields-img-upload", _sfc_main$8);
|
|
5559
|
+
app.component("m-fields-number", _sfc_main$d);
|
|
5560
|
+
app.component("m-fields-number-range", _sfc_main$c);
|
|
5561
|
+
app.component("m-fields-textarea", _sfc_main$7);
|
|
5562
|
+
app.component("m-fields-hidden", _sfc_main$h);
|
|
5563
|
+
app.component("m-fields-date", _sfc_main$m);
|
|
5564
|
+
app.component("m-fields-datetime", _sfc_main$k);
|
|
5565
|
+
app.component("m-fields-daterange", _sfc_main$l);
|
|
5566
|
+
app.component("m-fields-timerange", _sfc_main$5);
|
|
5567
|
+
app.component("m-fields-time", _sfc_main$6);
|
|
5568
|
+
app.component("m-fields-checkbox", _sfc_main$p);
|
|
5569
|
+
app.component("m-fields-switch", _sfc_main$9);
|
|
5570
|
+
app.component("m-fields-color-picker", _sfc_main$n);
|
|
5571
|
+
app.component("m-fields-checkbox-group", _sfc_main$o);
|
|
5572
|
+
app.component("m-fields-radio-group", _sfc_main$b);
|
|
5573
|
+
app.component("m-fields-display", _sfc_main$j);
|
|
5574
|
+
app.component("m-fields-link", _sfc_main$e);
|
|
5575
|
+
app.component("m-fields-select", _sfc_main$a);
|
|
5576
|
+
app.component("m-fields-cascader", _sfc_main$q);
|
|
5577
|
+
app.component("m-fields-dynamic-field", _sfc_main$i);
|
|
5371
5578
|
}
|
|
5372
5579
|
};
|
|
5373
5580
|
|
|
5374
|
-
export { _sfc_main$
|
|
5581
|
+
export { _sfc_main$q as MCascader, _sfc_main$p as MCheckbox, _sfc_main$o as MCheckboxGroup, _sfc_main$n as MColorPicker, _sfc_main$A as MContainer, _sfc_main$m as MDate, _sfc_main$k as MDateTime, _sfc_main$l as MDaterange, _sfc_main$j as MDisplay, _sfc_main$i as MDynamicField, _sfc_main$z as MFieldset, _sfc_main$y as MFlexLayout, _sfc_main$g as MForm, _sfc_main as MFormBox, _sfc_main$f as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$w as MGroupList, _sfc_main$h as MHidden, _sfc_main$e as MLink, _sfc_main$d as MNumber, _sfc_main$c as MNumberRange, _sfc_main$v as MPanel, _sfc_main$b as MRadioGroup, _sfc_main$t as MRow, _sfc_main$a as MSelect, _sfc_main$9 as MSwitch, _sfc_main$2 as MTable, _sfc_main$r as MTabs, _sfc_main$8 as MText, _sfc_main$7 as MTextarea, _sfc_main$6 as MTime, _sfc_main$5 as MTimerange, createForm, createValues, datetimeFormatter, index as default, display, filterFunction, getDataByPage, getRules, initValue, sortArray, sortChange, useAddField };
|