yxuse 3.0.60 → 3.0.62
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 +152 -76
- 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 +8 -2
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,110 @@ 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 renderForm(prop, $index, component);
|
|
20510
|
+
};
|
|
20511
|
+
const renderForm = (prop, index2, component) => {
|
|
20512
|
+
return createVNode(resolveComponent("el-form-item"), {
|
|
20513
|
+
"prop": "tableData." + index2 + "." + prop,
|
|
20514
|
+
"label": " ",
|
|
20515
|
+
"rules": formTableRules.value[prop]
|
|
20516
|
+
}, _isSlot$1(component) ? component : {
|
|
20517
|
+
default: () => [component]
|
|
20518
|
+
});
|
|
20519
|
+
};
|
|
20520
|
+
const getRules = () => {
|
|
20521
|
+
const rules = {};
|
|
20522
|
+
if (!isFormTable.value) return;
|
|
20523
|
+
const handleRule = (item) => {
|
|
20524
|
+
if (!item.prop) return;
|
|
20525
|
+
const isSelect = (item == null ? void 0 : item.renderType) && ["select", "cascader"].includes(item == null ? void 0 : item.renderType);
|
|
20526
|
+
const defaultRule = {
|
|
20527
|
+
required: true,
|
|
20528
|
+
message: `${item.label ?? "该字段"}不能为空`,
|
|
20529
|
+
trigger: isSelect ? "change" : "blur"
|
|
20530
|
+
};
|
|
20531
|
+
if (item.required) {
|
|
20532
|
+
rules[item.prop] = [defaultRule];
|
|
20533
|
+
}
|
|
20534
|
+
if (item.rules && item.rules.length > 0) {
|
|
20535
|
+
rules[item.prop] = [...rules[item == null ? void 0 : item.prop] || [], ...item.rules];
|
|
20536
|
+
}
|
|
20537
|
+
};
|
|
20538
|
+
columns.value.filter((cell) => ((cell == null ? void 0 : cell.renderType) || (cell == null ? void 0 : cell.render)) && ((cell == null ? void 0 : cell.required) || (cell == null ? void 0 : cell.rules))).forEach((form) => {
|
|
20539
|
+
var _a;
|
|
20540
|
+
(_a = form.children) == null ? void 0 : _a.forEach(handleRule);
|
|
20541
|
+
handleRule(form);
|
|
20542
|
+
});
|
|
20543
|
+
formTableRules.value = rules;
|
|
20544
|
+
};
|
|
20545
|
+
const tableFormValidate = async () => {
|
|
20546
|
+
if (!isFormTable.value) return Promise.resolve(true);
|
|
20547
|
+
if (!tableFormRef.value) return Promise.resolve(false);
|
|
20548
|
+
return await tableFormRef.value.validate(() => Promise.resolve());
|
|
20549
|
+
};
|
|
20550
|
+
const render2 = (props2) => {
|
|
20551
|
+
let _slot2;
|
|
20485
20552
|
const {
|
|
20486
20553
|
rowKey,
|
|
20487
20554
|
tableData,
|
|
@@ -20501,18 +20568,17 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20501
20568
|
default: (scope) => {
|
|
20502
20569
|
if ((cell == null ? void 0 : cell.renderType) === "operate") return renderOperate(cell, scope);
|
|
20503
20570
|
if ((cell == null ? void 0 : cell.renderType) && (cell == null ? void 0 : cell.renderType) !== "operate") {
|
|
20504
|
-
|
|
20505
|
-
|
|
20506
|
-
|
|
20507
|
-
|
|
20508
|
-
|
|
20509
|
-
|
|
20510
|
-
|
|
20511
|
-
|
|
20512
|
-
|
|
20513
|
-
|
|
20571
|
+
return dynamicComponent(cell, scope);
|
|
20572
|
+
}
|
|
20573
|
+
if (cell == null ? void 0 : cell.render) {
|
|
20574
|
+
const renderResult = cell.render(scope.row, scope.$index, cell);
|
|
20575
|
+
const needsValidation = cell.required || cell.rules;
|
|
20576
|
+
const isFragment = typeof (renderResult == null ? void 0 : renderResult.type) === "symbol";
|
|
20577
|
+
if (needsValidation && isFragment) {
|
|
20578
|
+
return renderForm(cell.prop, scope.$index, renderResult);
|
|
20579
|
+
}
|
|
20580
|
+
return renderResult;
|
|
20514
20581
|
}
|
|
20515
|
-
if (cell == null ? void 0 : cell.render) return cell == null ? void 0 : cell.render(scope.row);
|
|
20516
20582
|
if (children && (children == null ? void 0 : children.length) > 0) return renderColumn(children);
|
|
20517
20583
|
return (cell == null ? void 0 : cell.slotName) && columnSlots(cell, scope);
|
|
20518
20584
|
},
|
|
@@ -20565,14 +20631,23 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20565
20631
|
}, null)]);
|
|
20566
20632
|
};
|
|
20567
20633
|
if (!columns.value) return;
|
|
20568
|
-
return createVNode(Fragment, null, [createVNode(resolveComponent("el-
|
|
20569
|
-
"
|
|
20570
|
-
|
|
20571
|
-
|
|
20572
|
-
|
|
20573
|
-
})
|
|
20574
|
-
|
|
20575
|
-
|
|
20634
|
+
return createVNode(Fragment, null, [isFormTable.value ? createVNode(resolveComponent("el-form"), {
|
|
20635
|
+
"model": props2,
|
|
20636
|
+
"ref": tableFormRef
|
|
20637
|
+
}, _isSlot$1(_slot2 = renderTable()) ? _slot2 : {
|
|
20638
|
+
default: () => [_slot2]
|
|
20639
|
+
}) : renderTable(), pagination()]);
|
|
20640
|
+
function renderTable() {
|
|
20641
|
+
let _slot3;
|
|
20642
|
+
return createVNode(resolveComponent("el-table"), mergeProps({
|
|
20643
|
+
"ref": tableRef
|
|
20644
|
+
}, attrs, {
|
|
20645
|
+
"row-key": rowKey,
|
|
20646
|
+
"data": tableData
|
|
20647
|
+
}), _isSlot$1(_slot3 = renderColumn(columns.value)) ? _slot3 : {
|
|
20648
|
+
default: () => [_slot3]
|
|
20649
|
+
});
|
|
20650
|
+
}
|
|
20576
20651
|
};
|
|
20577
20652
|
const exportDataToExcel = (fileName) => {
|
|
20578
20653
|
const header = columns.value.filter((cell) => cell.prop);
|
|
@@ -20590,7 +20665,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
20590
20665
|
__expose({
|
|
20591
20666
|
tableRef,
|
|
20592
20667
|
exportDataToExcel,
|
|
20593
|
-
updateColumns
|
|
20668
|
+
updateColumns,
|
|
20669
|
+
tableFormValidate
|
|
20594
20670
|
});
|
|
20595
20671
|
return (_ctx, _cache) => {
|
|
20596
20672
|
return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
|
|
@@ -20952,7 +21028,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
20952
21028
|
};
|
|
20953
21029
|
}
|
|
20954
21030
|
});
|
|
20955
|
-
const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
21031
|
+
const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-8f175b2c"]]);
|
|
20956
21032
|
let versionKey, curVersion, updateApp;
|
|
20957
21033
|
const updateSysVersion = () => {
|
|
20958
21034
|
localStorage.setItem(versionKey, curVersion);
|
|
@@ -21222,8 +21298,8 @@ const components2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
21222
21298
|
LogoTitleRender,
|
|
21223
21299
|
Toolbar,
|
|
21224
21300
|
Update,
|
|
21225
|
-
YxDialog: _sfc_main$
|
|
21226
|
-
YxDrawer: _sfc_main$
|
|
21301
|
+
YxDialog: _sfc_main$7,
|
|
21302
|
+
YxDrawer: _sfc_main$6,
|
|
21227
21303
|
YxForm: index$1,
|
|
21228
21304
|
YxIcon: index,
|
|
21229
21305
|
YxTable: _sfc_main$5,
|
|
@@ -21232,8 +21308,8 @@ const components2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
21232
21308
|
export {
|
|
21233
21309
|
LogoTitleRender as L,
|
|
21234
21310
|
Update as U,
|
|
21235
|
-
_sfc_main$
|
|
21236
|
-
_sfc_main$
|
|
21311
|
+
_sfc_main$7 as _,
|
|
21312
|
+
_sfc_main$6 as a,
|
|
21237
21313
|
_sfc_main$5 as b,
|
|
21238
21314
|
components2 as c,
|
|
21239
21315
|
index as d,
|
package/lib/index.es6.js.gz
CHANGED
|
Binary file
|