@xjw_/vue3-npm-system 1.0.10 → 1.2.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/index.es.js +177 -68
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +175 -66
- package/dist/index.umd.js.map +1 -1
- package/dist/types/components/XDatePicker.vue.d.ts +1 -1
- package/dist/types/components/XElSelect.vue.d.ts +3 -3
- package/dist/types/components/XReportTable.vue.d.ts +2 -2
- package/dist/types/components/XSearchBar.vue.d.ts +36 -2
- package/dist/types/components/XVxeColumn.vue.d.ts +1 -1
- package/dist/types/components/XVxeTable.vue.d.ts +4 -4
- package/dist/vue3-npm-system.css +33 -33
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Cookies from "js-cookie";
|
|
2
2
|
import axios from "axios";
|
|
3
|
-
import { ElMessage } from "element-plus";
|
|
4
|
-
import { defineComponent, computed, openBlock, createElementBlock, mergeProps, createElementVNode, ref, watch, resolveComponent, createBlock, provide, withCtx, createVNode, normalizeStyle, renderSlot, inject, normalizeClass, createCommentVNode, Fragment, renderList, createSlots, getCurrentInstance, toDisplayString, useSlots,
|
|
3
|
+
import { ElMessage, ElInput, ElOption, ElCascader, ElDatePicker, ElSelect } from "element-plus";
|
|
4
|
+
import { defineComponent, computed, openBlock, createElementBlock, mergeProps, createElementVNode, ref, watch, resolveComponent, createBlock, provide, withCtx, createVNode, normalizeStyle, renderSlot, inject, normalizeClass, createCommentVNode, Fragment, renderList, createSlots, getCurrentInstance, toDisplayString, useSlots, onMounted, unref, withKeys, createTextVNode, withDirectives, resolveDynamicComponent, vShow, nextTick, normalizeProps, guardReactiveProps } from "vue";
|
|
5
5
|
function debounce$1(func, wait) {
|
|
6
6
|
let timeout = null;
|
|
7
7
|
return function(...args) {
|
|
@@ -1309,7 +1309,7 @@ const _hoisted_13$1 = { class: "" };
|
|
|
1309
1309
|
const _hoisted_14$1 = { class: "" };
|
|
1310
1310
|
const _hoisted_15$1 = { key: 1 };
|
|
1311
1311
|
const _hoisted_16$1 = { class: "" };
|
|
1312
|
-
const _hoisted_17 = { class: "" };
|
|
1312
|
+
const _hoisted_17$1 = { class: "" };
|
|
1313
1313
|
const _hoisted_18 = { class: "" };
|
|
1314
1314
|
const _hoisted_19 = { class: "" };
|
|
1315
1315
|
const _hoisted_20 = { class: "report-body" };
|
|
@@ -1579,7 +1579,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
1579
1579
|
])) : createCommentVNode("", true),
|
|
1580
1580
|
__props.customHeader2Label ? (openBlock(), createElementBlock("div", _hoisted_15$1, [
|
|
1581
1581
|
createElementVNode("span", _hoisted_16$1, toDisplayString(__props.customHeader2Label) + ":", 1),
|
|
1582
|
-
createElementVNode("span", _hoisted_17, toDisplayString(__props.customHeader2 || ""), 1)
|
|
1582
|
+
createElementVNode("span", _hoisted_17$1, toDisplayString(__props.customHeader2 || ""), 1)
|
|
1583
1583
|
])) : createCommentVNode("", true),
|
|
1584
1584
|
createElementVNode("div", null, [
|
|
1585
1585
|
createElementVNode("span", _hoisted_18, toDisplayString(__props.customHeader3Label) + toDisplayString(__props.customHeader3Label ? ":" : ""), 1),
|
|
@@ -1686,6 +1686,7 @@ const _hoisted_13 = {
|
|
|
1686
1686
|
const _hoisted_14 = { class: "search-top-extra-content" };
|
|
1687
1687
|
const _hoisted_15 = { class: "search-top__actions" };
|
|
1688
1688
|
const _hoisted_16 = { class: "search-form__buttons" };
|
|
1689
|
+
const _hoisted_17 = { class: "search-form__buttons" };
|
|
1689
1690
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1690
1691
|
__name: "XSearchBar",
|
|
1691
1692
|
props: {
|
|
@@ -1741,6 +1742,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1741
1742
|
text3: {
|
|
1742
1743
|
type: String,
|
|
1743
1744
|
default: ""
|
|
1745
|
+
},
|
|
1746
|
+
searchList: {
|
|
1747
|
+
type: Array,
|
|
1748
|
+
default: () => []
|
|
1749
|
+
},
|
|
1750
|
+
selectOptions: {
|
|
1751
|
+
type: Object,
|
|
1752
|
+
default: () => ({})
|
|
1744
1753
|
}
|
|
1745
1754
|
},
|
|
1746
1755
|
emits: ["update:modelValue", "update:queryForm", "list-update", "data-reset"],
|
|
@@ -1750,7 +1759,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1750
1759
|
const slots = useSlots();
|
|
1751
1760
|
const showMore = ref(false);
|
|
1752
1761
|
const queryFormRef = ref();
|
|
1753
|
-
const
|
|
1762
|
+
const dynamicFormRef = ref();
|
|
1763
|
+
const componentMap = {
|
|
1764
|
+
"el-input": ElInput,
|
|
1765
|
+
"el-select": ElSelect,
|
|
1766
|
+
"el-date-picker": ElDatePicker,
|
|
1767
|
+
"el-cascader": ElCascader
|
|
1768
|
+
};
|
|
1754
1769
|
const combinedQueries = computed({
|
|
1755
1770
|
get() {
|
|
1756
1771
|
if (props.modelValue !== void 0 && props.modelValue !== null) {
|
|
@@ -1767,7 +1782,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1767
1782
|
}
|
|
1768
1783
|
});
|
|
1769
1784
|
const hasFormSlot = computed(() => !!slots.form);
|
|
1770
|
-
const
|
|
1785
|
+
const hasDynamicFields = computed(() => parsedSearchList.value.length > 0);
|
|
1771
1786
|
const vxeFormSpan = computed(() => Math.floor(24 / props.columns));
|
|
1772
1787
|
const formContainerStyle = computed(() => ({
|
|
1773
1788
|
"--form-columns": props.columns
|
|
@@ -1775,6 +1790,73 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1775
1790
|
const buttonItemSpan = computed(() => {
|
|
1776
1791
|
return 24;
|
|
1777
1792
|
});
|
|
1793
|
+
const parsedSearchList = computed(() => {
|
|
1794
|
+
return (props.searchList || []).map((item) => {
|
|
1795
|
+
let attribute = {};
|
|
1796
|
+
if (typeof item.attribute === "string") {
|
|
1797
|
+
try {
|
|
1798
|
+
attribute = JSON.parse(item.attribute);
|
|
1799
|
+
} catch {
|
|
1800
|
+
attribute = {};
|
|
1801
|
+
}
|
|
1802
|
+
} else if (item.attribute && typeof item.attribute === "object") {
|
|
1803
|
+
attribute = item.attribute;
|
|
1804
|
+
}
|
|
1805
|
+
let dictKey = {};
|
|
1806
|
+
if (typeof item.dictKey === "string") {
|
|
1807
|
+
try {
|
|
1808
|
+
dictKey = JSON.parse(item.dictKey);
|
|
1809
|
+
} catch {
|
|
1810
|
+
dictKey = {};
|
|
1811
|
+
}
|
|
1812
|
+
} else if (item.dictKey && typeof item.dictKey === "object") {
|
|
1813
|
+
dictKey = item.dictKey;
|
|
1814
|
+
}
|
|
1815
|
+
return { ...item, attribute, dictKey };
|
|
1816
|
+
});
|
|
1817
|
+
});
|
|
1818
|
+
const dynamicRules = computed(() => {
|
|
1819
|
+
const result = {};
|
|
1820
|
+
parsedSearchList.value.forEach((item) => {
|
|
1821
|
+
var _a;
|
|
1822
|
+
if ((_a = item.attribute) == null ? void 0 : _a.required) {
|
|
1823
|
+
result[item.fieldJavaName] = [
|
|
1824
|
+
{ required: true, message: `请输入${item.fieldName}`, trigger: "blur" }
|
|
1825
|
+
];
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1828
|
+
return result;
|
|
1829
|
+
});
|
|
1830
|
+
function resolveComponent$1(fieldType) {
|
|
1831
|
+
return componentMap[fieldType] || ElInput;
|
|
1832
|
+
}
|
|
1833
|
+
function shouldBindOptions(item) {
|
|
1834
|
+
return item.fieldType === "el-cascader";
|
|
1835
|
+
}
|
|
1836
|
+
function initDefaultValues() {
|
|
1837
|
+
if (!parsedSearchList.value.length) return;
|
|
1838
|
+
parsedSearchList.value.forEach((item) => {
|
|
1839
|
+
const dk = item.dictKey;
|
|
1840
|
+
if (!dk || !dk.default) return;
|
|
1841
|
+
if (dk.default === "1") {
|
|
1842
|
+
props.queryForm[item.fieldJavaName] = dk.defaultValue;
|
|
1843
|
+
} else if (dk.default === "2") {
|
|
1844
|
+
const now = /* @__PURE__ */ new Date();
|
|
1845
|
+
if (dk.defaultValue === 1) {
|
|
1846
|
+
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
1847
|
+
props.queryForm[item.fieldJavaName] = formatDate2(firstDay);
|
|
1848
|
+
} else {
|
|
1849
|
+
props.queryForm[item.fieldJavaName] = formatDate2(now);
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
function formatDate2(date) {
|
|
1855
|
+
const y = date.getFullYear();
|
|
1856
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
1857
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
1858
|
+
return `${y}-${m}-${d}`;
|
|
1859
|
+
}
|
|
1778
1860
|
function reset() {
|
|
1779
1861
|
combinedQueries.value = "";
|
|
1780
1862
|
if (props.modelValue !== void 0 && props.modelValue !== null) {
|
|
@@ -1785,8 +1867,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1785
1867
|
queryFormRef.value.resetFields();
|
|
1786
1868
|
});
|
|
1787
1869
|
}
|
|
1788
|
-
if (
|
|
1789
|
-
|
|
1870
|
+
if (hasDynamicFields.value && dynamicFormRef.value && typeof dynamicFormRef.value.resetFields === "function") {
|
|
1871
|
+
nextTick(() => {
|
|
1872
|
+
dynamicFormRef.value.resetFields();
|
|
1873
|
+
});
|
|
1790
1874
|
}
|
|
1791
1875
|
if (props.queryForm && Object.keys(props.queryForm).length > 0) {
|
|
1792
1876
|
const emptyForm = {};
|
|
@@ -1807,28 +1891,23 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1807
1891
|
}
|
|
1808
1892
|
function searchParentList() {
|
|
1809
1893
|
if (props.rules && Object.keys(props.rules).length > 0) {
|
|
1810
|
-
if (
|
|
1894
|
+
if (hasFormSlot.value && queryFormRef.value && typeof queryFormRef.value.validate === "function") {
|
|
1811
1895
|
return new Promise((resolve, reject) => {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
});
|
|
1823
|
-
} else {
|
|
1824
|
-
emit("list-update", 1);
|
|
1825
|
-
resolve(true);
|
|
1826
|
-
}
|
|
1896
|
+
queryFormRef.value.validate((valid) => {
|
|
1897
|
+
if (valid) {
|
|
1898
|
+
showMore.value = false;
|
|
1899
|
+
emit("list-update", 1);
|
|
1900
|
+
resolve(true);
|
|
1901
|
+
} else {
|
|
1902
|
+
showMore.value = true;
|
|
1903
|
+
reject(false);
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1827
1906
|
});
|
|
1828
1907
|
}
|
|
1829
|
-
if (
|
|
1908
|
+
if (hasDynamicFields.value && dynamicFormRef.value && typeof dynamicFormRef.value.validate === "function") {
|
|
1830
1909
|
return new Promise((resolve, reject) => {
|
|
1831
|
-
|
|
1910
|
+
dynamicFormRef.value.validate((valid) => {
|
|
1832
1911
|
if (valid) {
|
|
1833
1912
|
showMore.value = false;
|
|
1834
1913
|
emit("list-update", 1);
|
|
@@ -1846,15 +1925,18 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1846
1925
|
return Promise.resolve(true);
|
|
1847
1926
|
}
|
|
1848
1927
|
}
|
|
1928
|
+
onMounted(() => {
|
|
1929
|
+
initDefaultValues();
|
|
1930
|
+
});
|
|
1931
|
+
watch(() => props.searchList, () => {
|
|
1932
|
+
initDefaultValues();
|
|
1933
|
+
}, { deep: true });
|
|
1849
1934
|
__expose({
|
|
1850
1935
|
queryFormRef,
|
|
1851
|
-
|
|
1936
|
+
dynamicFormRef
|
|
1852
1937
|
});
|
|
1853
1938
|
return (_ctx, _cache) => {
|
|
1854
|
-
const _component_el_input = resolveComponent("el-input");
|
|
1855
1939
|
const _component_el_button = resolveComponent("el-button");
|
|
1856
|
-
const _component_vxe_form_item = resolveComponent("vxe-form-item");
|
|
1857
|
-
const _component_vxe_form = resolveComponent("vxe-form");
|
|
1858
1940
|
return openBlock(), createElementBlock("div", {
|
|
1859
1941
|
class: "search",
|
|
1860
1942
|
style: normalizeStyle({ paddingBottom: __props.paddingBottom })
|
|
@@ -1864,7 +1946,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1864
1946
|
createElementVNode("div", _hoisted_3$1, [
|
|
1865
1947
|
__props.showInput ? (openBlock(), createElementBlock("span", _hoisted_4$1, "快捷搜索 ")) : createCommentVNode("", true),
|
|
1866
1948
|
__props.showInput ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
|
1867
|
-
createVNode(
|
|
1949
|
+
createVNode(unref(ElInput), {
|
|
1868
1950
|
type: "text",
|
|
1869
1951
|
onKeyup: withKeys(searchParentList, ["enter"]),
|
|
1870
1952
|
modelValue: combinedQueries.value,
|
|
@@ -1992,53 +2074,80 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1992
2074
|
]),
|
|
1993
2075
|
_: 3
|
|
1994
2076
|
}, 8, ["rules", "model", "span", "label-width"])) : createCommentVNode("", true),
|
|
1995
|
-
|
|
2077
|
+
hasDynamicFields.value ? (openBlock(), createBlock(XElForm, {
|
|
1996
2078
|
key: 1,
|
|
1997
|
-
|
|
1998
|
-
|
|
2079
|
+
rules: dynamicRules.value,
|
|
2080
|
+
model: __props.queryForm,
|
|
2081
|
+
ref_key: "dynamicFormRef",
|
|
2082
|
+
ref: dynamicFormRef,
|
|
1999
2083
|
span: vxeFormSpan.value,
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
"title-align": "right",
|
|
2003
|
-
"title-width": __props.titleWidth,
|
|
2004
|
-
size: "medium",
|
|
2005
|
-
ref_key: "vxeFormRef",
|
|
2006
|
-
ref: vxeFormRef
|
|
2084
|
+
"label-width": __props.titleWidth,
|
|
2085
|
+
"label-position": "top"
|
|
2007
2086
|
}, {
|
|
2008
2087
|
default: withCtx(() => [
|
|
2009
|
-
|
|
2010
|
-
|
|
2088
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(parsedSearchList.value, (item) => {
|
|
2089
|
+
return openBlock(), createBlock(XElFormItem, {
|
|
2090
|
+
key: item.fieldJavaName,
|
|
2091
|
+
label: item.fieldName,
|
|
2092
|
+
prop: item.fieldJavaName
|
|
2093
|
+
}, {
|
|
2094
|
+
default: withCtx(() => [
|
|
2095
|
+
(openBlock(), createBlock(resolveDynamicComponent(resolveComponent$1(item.fieldType)), mergeProps({
|
|
2096
|
+
modelValue: __props.queryForm[item.fieldJavaName],
|
|
2097
|
+
"onUpdate:modelValue": ($event) => __props.queryForm[item.fieldJavaName] = $event
|
|
2098
|
+
}, { ref_for: true }, item.attribute, {
|
|
2099
|
+
options: shouldBindOptions(item) ? __props.selectOptions[item.fieldJavaName] || [] : void 0
|
|
2100
|
+
}), {
|
|
2101
|
+
default: withCtx(() => [
|
|
2102
|
+
item.fieldType === "el-select" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.selectOptions[item.fieldJavaName] || [], (option, idx) => {
|
|
2103
|
+
var _a, _b;
|
|
2104
|
+
return openBlock(), createBlock(unref(ElOption), {
|
|
2105
|
+
key: idx,
|
|
2106
|
+
label: option[((_a = item.dictKey) == null ? void 0 : _a.label) || "label"],
|
|
2107
|
+
value: option[((_b = item.dictKey) == null ? void 0 : _b.value) || "value"]
|
|
2108
|
+
}, null, 8, ["label", "value"]);
|
|
2109
|
+
}), 128)) : createCommentVNode("", true)
|
|
2110
|
+
]),
|
|
2111
|
+
_: 2
|
|
2112
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "options"]))
|
|
2113
|
+
]),
|
|
2114
|
+
_: 2
|
|
2115
|
+
}, 1032, ["label", "prop"]);
|
|
2116
|
+
}), 128)),
|
|
2117
|
+
!__props.showSearch ? (openBlock(), createBlock(XElFormItem, {
|
|
2011
2118
|
key: 0,
|
|
2012
|
-
|
|
2013
|
-
|
|
2119
|
+
label: "",
|
|
2120
|
+
span: buttonItemSpan.value
|
|
2014
2121
|
}, {
|
|
2015
2122
|
default: withCtx(() => [
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2123
|
+
createElementVNode("div", _hoisted_17, [
|
|
2124
|
+
createVNode(_component_el_button, {
|
|
2125
|
+
plain: "",
|
|
2126
|
+
onClick: reset
|
|
2127
|
+
}, {
|
|
2128
|
+
default: withCtx(() => _cache[7] || (_cache[7] = [
|
|
2129
|
+
createTextVNode("重 置")
|
|
2130
|
+
])),
|
|
2131
|
+
_: 1,
|
|
2132
|
+
__: [7]
|
|
2133
|
+
}),
|
|
2134
|
+
createVNode(_component_el_button, {
|
|
2135
|
+
type: "primary",
|
|
2136
|
+
onClick: searchParentList
|
|
2137
|
+
}, {
|
|
2138
|
+
default: withCtx(() => _cache[8] || (_cache[8] = [
|
|
2139
|
+
createTextVNode("查 询")
|
|
2140
|
+
])),
|
|
2141
|
+
_: 1,
|
|
2142
|
+
__: [8]
|
|
2143
|
+
})
|
|
2144
|
+
])
|
|
2036
2145
|
]),
|
|
2037
2146
|
_: 1
|
|
2038
2147
|
}, 8, ["span"])) : createCommentVNode("", true)
|
|
2039
2148
|
]),
|
|
2040
|
-
_:
|
|
2041
|
-
}, 8, ["
|
|
2149
|
+
_: 1
|
|
2150
|
+
}, 8, ["rules", "model", "span", "label-width"])) : createCommentVNode("", true)
|
|
2042
2151
|
], 4)
|
|
2043
2152
|
], 2), [
|
|
2044
2153
|
[vShow, showMore.value || !__props.showSearch]
|
|
@@ -2047,7 +2156,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2047
2156
|
};
|
|
2048
2157
|
}
|
|
2049
2158
|
});
|
|
2050
|
-
const XSearchBar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
2159
|
+
const XSearchBar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-0c479461"]]);
|
|
2051
2160
|
const _hoisted_1 = { class: "x-split-layout__sidebar-menu" };
|
|
2052
2161
|
const _hoisted_2 = ["onClick"];
|
|
2053
2162
|
const _hoisted_3 = { class: "x-split-layout__menu-icon" };
|