yxuse 3.0.60 → 3.0.61
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/lib/index.cjs6.js +3 -3
- package/lib/index.cjs6.js.gz +0 -0
- package/lib/index.cjs6.js.map +1 -1
- package/lib/index.es6.js +140 -75
- package/lib/index.es6.js.gz +0 -0
- package/lib/index.es6.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/types/components/YxTable/index.vue.d.ts +1 -0
- package/types/components/YxTable/type.d.ts +7 -1
package/lib/index.es6.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent, reactive, resolveComponent, createBlock, openBlock, createSlots, withCtx, renderSlot, createElementVNode, createVNode, createTextVNode,
|
|
1
|
+
import { defineComponent, reactive, resolveComponent, createBlock, openBlock, createSlots, withCtx, renderSlot, createElementVNode, createVNode, createTextVNode, useSlots, useAttrs, ref, onMounted, nextTick, watch, onBeforeMount, resolveDynamicComponent, Fragment, mergeProps, withModifiers, isVNode, createElementBlock, onUnmounted, toDisplayString, renderList, unref, normalizeStyle, normalizeClass, createCommentVNode, version, createApp } from "vue";
|
|
2
2
|
import { S as Sortable, _ as _export_sfc, T as Toolbar } from "./index.es5.js";
|
|
3
3
|
import { genFileId } from "element-plus";
|
|
4
4
|
import { j as jumpToHome, b as getUserConfig } from "./index.es12.js";
|
|
5
5
|
import "element-plus/es/components/message/style/index";
|
|
6
6
|
import { u as uploadResourceApi } from "./index.es13.js";
|
|
7
7
|
const _hoisted_1$4 = { class: "dialog-footer flex justify-end" };
|
|
8
|
-
const _sfc_main$
|
|
8
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
9
9
|
__name: "index",
|
|
10
10
|
setup(__props, { expose: __expose }) {
|
|
11
11
|
const dialogOptions = reactive({
|
|
@@ -98,7 +98,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
const _hoisted_1$3 = { class: "dialog-footer flex justify-end" };
|
|
101
|
-
const _sfc_main$
|
|
101
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
102
102
|
__name: "index",
|
|
103
103
|
setup(__props, { expose: __expose }) {
|
|
104
104
|
const drawerOptions = reactive({
|
|
@@ -190,51 +190,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
194
|
-
__name: "index",
|
|
195
|
-
props: {
|
|
196
|
-
conf: {},
|
|
197
|
-
model: {}
|
|
198
|
-
},
|
|
199
|
-
emits: ["change"],
|
|
200
|
-
setup(__props, { emit: __emit }) {
|
|
201
|
-
const props = __props;
|
|
202
|
-
const emit = __emit;
|
|
203
|
-
watch(
|
|
204
|
-
() => {
|
|
205
|
-
var _a;
|
|
206
|
-
return props.model[(_a = props.conf) == null ? void 0 : _a.prop];
|
|
207
|
-
},
|
|
208
|
-
() => {
|
|
209
|
-
emit("change", props.model);
|
|
210
|
-
}
|
|
211
|
-
);
|
|
212
|
-
return (_ctx, _cache) => {
|
|
213
|
-
var _a, _b, _c;
|
|
214
|
-
return openBlock(), createBlock(resolveDynamicComponent(`el-${(_a = _ctx.conf) == null ? void 0 : _a.renderType}`), mergeProps({
|
|
215
|
-
modelValue: _ctx.model[(_b = _ctx.conf) == null ? void 0 : _b.prop],
|
|
216
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => {
|
|
217
|
-
var _a2;
|
|
218
|
-
return _ctx.model[(_a2 = _ctx.conf) == null ? void 0 : _a2.prop] = $event;
|
|
219
|
-
})
|
|
220
|
-
}, (_c = _ctx.conf) == null ? void 0 : _c.config), {
|
|
221
|
-
default: withCtx(() => {
|
|
222
|
-
var _a2, _b2;
|
|
223
|
-
return [
|
|
224
|
-
_ctx.conf.renderType === "select" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(((_b2 = (_a2 = _ctx.conf) == null ? void 0 : _a2.config) == null ? void 0 : _b2.options) ?? [], (op) => {
|
|
225
|
-
return openBlock(), createBlock(resolveDynamicComponent(`el-option`), {
|
|
226
|
-
key: op.value,
|
|
227
|
-
label: op.label,
|
|
228
|
-
value: op.value
|
|
229
|
-
}, null, 8, ["label", "value"]);
|
|
230
|
-
}), 128)) : createCommentVNode("", true)
|
|
231
|
-
];
|
|
232
|
-
}),
|
|
233
|
-
_: 1
|
|
234
|
-
}, 16, ["modelValue"]);
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
193
|
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
239
194
|
var XLSX = {};
|
|
240
195
|
XLSX.version = "0.18.5";
|
|
@@ -20411,7 +20366,8 @@ function _isSlot$1(s) {
|
|
|
20411
20366
|
}
|
|
20412
20367
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
20413
20368
|
...{
|
|
20414
|
-
name: "YxTable"
|
|
20369
|
+
name: "YxTable",
|
|
20370
|
+
inheritAttrs: false
|
|
20415
20371
|
},
|
|
20416
20372
|
__name: "index",
|
|
20417
20373
|
props: {
|
|
@@ -20435,7 +20391,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20435
20391
|
const slots = useSlots();
|
|
20436
20392
|
const attrs = useAttrs();
|
|
20437
20393
|
const tableRef = ref();
|
|
20394
|
+
const tableFormRef = ref();
|
|
20438
20395
|
const columns = ref([]);
|
|
20396
|
+
const isFormTable = ref(false);
|
|
20397
|
+
const formTableRules = ref({});
|
|
20439
20398
|
const emit = __emit;
|
|
20440
20399
|
onMounted(() => {
|
|
20441
20400
|
nextTick(() => {
|
|
@@ -20451,12 +20410,18 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20451
20410
|
const initTable = async () => {
|
|
20452
20411
|
columns.value = typeof props.columns === "function" ? await props.columns() : props.columns;
|
|
20453
20412
|
columns.value.forEach((col) => {
|
|
20454
|
-
var _a;
|
|
20413
|
+
var _a, _b;
|
|
20455
20414
|
if (!col.renderType) return;
|
|
20456
20415
|
if (["select", "cascader"].includes(col.renderType) && ((_a = col == null ? void 0 : col.config) == null ? void 0 : _a.loadOptions)) {
|
|
20457
20416
|
loadOptions(col.config);
|
|
20458
20417
|
}
|
|
20418
|
+
if (col.required || ((_b = col.rules) == null ? void 0 : _b.length)) {
|
|
20419
|
+
isFormTable.value = true;
|
|
20420
|
+
}
|
|
20459
20421
|
});
|
|
20422
|
+
if (isFormTable.value) {
|
|
20423
|
+
getRules();
|
|
20424
|
+
}
|
|
20460
20425
|
};
|
|
20461
20426
|
const loadOptions = async (config) => {
|
|
20462
20427
|
if ((config == null ? void 0 : config.options) && (config == null ? void 0 : config.options.length) === 0 && (config == null ? void 0 : config.loadOptions) && typeof (config == null ? void 0 : config.loadOptions) === "function") {
|
|
@@ -20480,8 +20445,107 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20480
20445
|
}
|
|
20481
20446
|
});
|
|
20482
20447
|
};
|
|
20483
|
-
const
|
|
20448
|
+
const dynamicComponent = (column, {
|
|
20449
|
+
$index,
|
|
20450
|
+
row
|
|
20451
|
+
}) => {
|
|
20484
20452
|
let _slot;
|
|
20453
|
+
const {
|
|
20454
|
+
renderType,
|
|
20455
|
+
event = {},
|
|
20456
|
+
prop,
|
|
20457
|
+
label,
|
|
20458
|
+
config = {},
|
|
20459
|
+
required,
|
|
20460
|
+
rules
|
|
20461
|
+
} = column;
|
|
20462
|
+
if (!prop || !renderType) return null;
|
|
20463
|
+
const Component = resolveComponent("el-" + renderType);
|
|
20464
|
+
const {
|
|
20465
|
+
options = [],
|
|
20466
|
+
...restConfig
|
|
20467
|
+
} = config;
|
|
20468
|
+
const renderChildComponent = () => {
|
|
20469
|
+
if (!options || options.length === 0) return null;
|
|
20470
|
+
if (renderType === "select") {
|
|
20471
|
+
return options.map((item) => createVNode(resolveComponent("el-option"), {
|
|
20472
|
+
"label": item.label,
|
|
20473
|
+
"value": item.value,
|
|
20474
|
+
"key": item.value
|
|
20475
|
+
}, null));
|
|
20476
|
+
}
|
|
20477
|
+
if (renderType === "radio-group") {
|
|
20478
|
+
return options.map((item) => createVNode(resolveComponent("el-radio"), {
|
|
20479
|
+
"label": item.value,
|
|
20480
|
+
"key": item.value
|
|
20481
|
+
}, {
|
|
20482
|
+
default: () => [item.label]
|
|
20483
|
+
}));
|
|
20484
|
+
}
|
|
20485
|
+
return null;
|
|
20486
|
+
};
|
|
20487
|
+
if (renderType === "cascader") {
|
|
20488
|
+
return createVNode(resolveComponent("el-cascader"), mergeProps({
|
|
20489
|
+
"modelValue": row[prop],
|
|
20490
|
+
"onUpdate:modelValue": ($event) => row[prop] = $event,
|
|
20491
|
+
"placeholder": `请选择${label}`,
|
|
20492
|
+
"options": options
|
|
20493
|
+
}, event, restConfig), null);
|
|
20494
|
+
}
|
|
20495
|
+
const isSelect = ["select", "cascader"].includes(renderType);
|
|
20496
|
+
const isFormCell = required || (rules == null ? void 0 : rules.length);
|
|
20497
|
+
const modelValue = row[prop];
|
|
20498
|
+
const updateModelValue = (val) => {
|
|
20499
|
+
row[prop] = (config == null ? void 0 : config.type) === "number" ? Number(val) : val;
|
|
20500
|
+
};
|
|
20501
|
+
const component = createVNode(Component, mergeProps({
|
|
20502
|
+
"modelValue": modelValue,
|
|
20503
|
+
"onUpdate:modelValue": updateModelValue,
|
|
20504
|
+
"placeholder": `请${isSelect ? "选择" : "输入"}${label}`
|
|
20505
|
+
}, event, restConfig), _isSlot$1(_slot = renderChildComponent()) ? _slot : {
|
|
20506
|
+
default: () => [_slot]
|
|
20507
|
+
});
|
|
20508
|
+
if (!isFormCell) return component;
|
|
20509
|
+
return createVNode(resolveComponent("el-form-item"), {
|
|
20510
|
+
"prop": "tableData." + $index + "." + prop,
|
|
20511
|
+
"label": " ",
|
|
20512
|
+
"rules": formTableRules.value[prop]
|
|
20513
|
+
}, _isSlot$1(component) ? component : {
|
|
20514
|
+
default: () => [component]
|
|
20515
|
+
});
|
|
20516
|
+
};
|
|
20517
|
+
const getRules = () => {
|
|
20518
|
+
const rules = {};
|
|
20519
|
+
if (!isFormTable.value) return;
|
|
20520
|
+
const handleRule = (item) => {
|
|
20521
|
+
if (!item.prop) return;
|
|
20522
|
+
const isSelect = (item == null ? void 0 : item.renderType) && ["select", "cascader"].includes(item == null ? void 0 : item.renderType);
|
|
20523
|
+
const defaultRule = {
|
|
20524
|
+
required: true,
|
|
20525
|
+
message: `${item.label ?? "该字段"}不能为空`,
|
|
20526
|
+
trigger: isSelect ? "change" : "blur"
|
|
20527
|
+
};
|
|
20528
|
+
if (item.required) {
|
|
20529
|
+
rules[item.prop] = [defaultRule];
|
|
20530
|
+
}
|
|
20531
|
+
if (item.rules && item.rules.length > 0) {
|
|
20532
|
+
rules[item.prop] = [...rules[item == null ? void 0 : item.prop] || [], ...item.rules];
|
|
20533
|
+
}
|
|
20534
|
+
};
|
|
20535
|
+
columns.value.filter((cell) => (cell == null ? void 0 : cell.renderType) && ((cell == null ? void 0 : cell.required) || (cell == null ? void 0 : cell.rules))).forEach((form) => {
|
|
20536
|
+
var _a;
|
|
20537
|
+
(_a = form.children) == null ? void 0 : _a.forEach(handleRule);
|
|
20538
|
+
handleRule(form);
|
|
20539
|
+
});
|
|
20540
|
+
formTableRules.value = rules;
|
|
20541
|
+
};
|
|
20542
|
+
const tableFormValidate = async () => {
|
|
20543
|
+
if (!isFormTable.value) return Promise.resolve(true);
|
|
20544
|
+
if (!tableFormRef.value) return Promise.resolve(false);
|
|
20545
|
+
return await tableFormRef.value.validate(() => Promise.resolve());
|
|
20546
|
+
};
|
|
20547
|
+
const render2 = (props2) => {
|
|
20548
|
+
let _slot2;
|
|
20485
20549
|
const {
|
|
20486
20550
|
rowKey,
|
|
20487
20551
|
tableData,
|
|
@@ -20501,16 +20565,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20501
20565
|
default: (scope) => {
|
|
20502
20566
|
if ((cell == null ? void 0 : cell.renderType) === "operate") return renderOperate(cell, scope);
|
|
20503
20567
|
if ((cell == null ? void 0 : cell.renderType) && (cell == null ? void 0 : cell.renderType) !== "operate") {
|
|
20504
|
-
|
|
20505
|
-
renderType: cell.renderType,
|
|
20506
|
-
prop: cell.prop,
|
|
20507
|
-
config: cell.config
|
|
20508
|
-
};
|
|
20509
|
-
return createVNode(_sfc_main$6, {
|
|
20510
|
-
"conf": conf,
|
|
20511
|
-
"model": scope.row,
|
|
20512
|
-
"onChange": cell == null ? void 0 : cell.change
|
|
20513
|
-
}, null);
|
|
20568
|
+
return dynamicComponent(cell, scope);
|
|
20514
20569
|
}
|
|
20515
20570
|
if (cell == null ? void 0 : cell.render) return cell == null ? void 0 : cell.render(scope.row);
|
|
20516
20571
|
if (children && (children == null ? void 0 : children.length) > 0) return renderColumn(children);
|
|
@@ -20565,14 +20620,23 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20565
20620
|
}, null)]);
|
|
20566
20621
|
};
|
|
20567
20622
|
if (!columns.value) return;
|
|
20568
|
-
return createVNode(Fragment, null, [createVNode(resolveComponent("el-
|
|
20569
|
-
"
|
|
20570
|
-
|
|
20571
|
-
|
|
20572
|
-
|
|
20573
|
-
})
|
|
20574
|
-
|
|
20575
|
-
|
|
20623
|
+
return createVNode(Fragment, null, [isFormTable.value ? createVNode(resolveComponent("el-form"), {
|
|
20624
|
+
"model": props2,
|
|
20625
|
+
"ref": tableFormRef
|
|
20626
|
+
}, _isSlot$1(_slot2 = renderTable()) ? _slot2 : {
|
|
20627
|
+
default: () => [_slot2]
|
|
20628
|
+
}) : renderTable(), pagination()]);
|
|
20629
|
+
function renderTable() {
|
|
20630
|
+
let _slot3;
|
|
20631
|
+
return createVNode(resolveComponent("el-table"), mergeProps({
|
|
20632
|
+
"ref": tableRef
|
|
20633
|
+
}, attrs, {
|
|
20634
|
+
"row-key": rowKey,
|
|
20635
|
+
"data": tableData
|
|
20636
|
+
}), _isSlot$1(_slot3 = renderColumn(columns.value)) ? _slot3 : {
|
|
20637
|
+
default: () => [_slot3]
|
|
20638
|
+
});
|
|
20639
|
+
}
|
|
20576
20640
|
};
|
|
20577
20641
|
const exportDataToExcel = (fileName) => {
|
|
20578
20642
|
const header = columns.value.filter((cell) => cell.prop);
|
|
@@ -20590,7 +20654,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20590
20654
|
__expose({
|
|
20591
20655
|
tableRef,
|
|
20592
20656
|
exportDataToExcel,
|
|
20593
|
-
updateColumns
|
|
20657
|
+
updateColumns,
|
|
20658
|
+
tableFormValidate
|
|
20594
20659
|
});
|
|
20595
20660
|
return (_ctx, _cache) => {
|
|
20596
20661
|
return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
|
|
@@ -20952,7 +21017,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
20952
21017
|
};
|
|
20953
21018
|
}
|
|
20954
21019
|
});
|
|
20955
|
-
const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
21020
|
+
const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-8f175b2c"]]);
|
|
20956
21021
|
let versionKey, curVersion, updateApp;
|
|
20957
21022
|
const updateSysVersion = () => {
|
|
20958
21023
|
localStorage.setItem(versionKey, curVersion);
|
|
@@ -21222,8 +21287,8 @@ const components2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
21222
21287
|
LogoTitleRender,
|
|
21223
21288
|
Toolbar,
|
|
21224
21289
|
Update,
|
|
21225
|
-
YxDialog: _sfc_main$
|
|
21226
|
-
YxDrawer: _sfc_main$
|
|
21290
|
+
YxDialog: _sfc_main$7,
|
|
21291
|
+
YxDrawer: _sfc_main$6,
|
|
21227
21292
|
YxForm: index$1,
|
|
21228
21293
|
YxIcon: index,
|
|
21229
21294
|
YxTable: _sfc_main$5,
|
|
@@ -21232,8 +21297,8 @@ const components2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
21232
21297
|
export {
|
|
21233
21298
|
LogoTitleRender as L,
|
|
21234
21299
|
Update as U,
|
|
21235
|
-
_sfc_main$
|
|
21236
|
-
_sfc_main$
|
|
21300
|
+
_sfc_main$7 as _,
|
|
21301
|
+
_sfc_main$6 as a,
|
|
21237
21302
|
_sfc_main$5 as b,
|
|
21238
21303
|
components2 as c,
|
|
21239
21304
|
index as d,
|
package/lib/index.es6.js.gz
CHANGED
|
Binary file
|