@hbdlzy/ui-core 0.1.4 → 0.1.6
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/README.md +7 -0
- package/components.manifest.json +32 -35
- package/dist/components/BaseCard/BaseCard.types.d.ts +36 -36
- package/dist/components/BaseCard/BaseCard.vue.d.ts +122 -122
- package/dist/components/BaseCard/index.d.ts +3 -3
- package/dist/components/BaseEChart/BaseEChart.types.d.ts +26 -26
- package/dist/components/BaseEChart/BaseEChart.vue.d.ts +66 -66
- package/dist/components/BaseEChart/index.d.ts +3 -3
- package/dist/components/BaseExportButton/BaseExportButton.types.d.ts +21 -21
- package/dist/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -4
- package/dist/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -128
- package/dist/components/BaseExportButton/index.d.ts +5 -5
- package/dist/components/BaseTable/BaseTable.types.d.ts +163 -163
- package/dist/components/BaseTable/BaseTable.vue.d.ts +157 -157
- package/dist/components/BaseTable/index.d.ts +3 -3
- package/dist/components/OutlinedCascader/OutlinedCascader.types.d.ts +28 -25
- package/dist/components/OutlinedCascader/OutlinedCascader.vue.d.ts +94 -85
- package/dist/components/OutlinedCascader/index.d.ts +3 -3
- package/dist/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +30 -27
- package/dist/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +97 -88
- package/dist/components/OutlinedDatePicker/index.d.ts +3 -3
- package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +29 -26
- package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +106 -97
- package/dist/components/OutlinedDateTimePicker/index.d.ts +3 -3
- package/dist/components/OutlinedInput/OutlinedInput.types.d.ts +32 -29
- package/dist/components/OutlinedInput/OutlinedInput.vue.d.ts +106 -97
- package/dist/components/OutlinedInput/index.d.ts +3 -3
- package/dist/components/OutlinedSelect/OutlinedSelect.types.d.ts +41 -38
- package/dist/components/OutlinedSelect/OutlinedSelect.vue.d.ts +125 -116
- package/dist/components/OutlinedSelect/index.d.ts +3 -3
- package/dist/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +31 -28
- package/dist/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +103 -94
- package/dist/components/OutlinedTimePicker/index.d.ts +3 -3
- package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +49 -46
- package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +146 -137
- package/dist/components/OutlinedTreeSelect/index.d.ts +3 -3
- package/dist/echarts/index.d.ts +9 -9
- package/dist/excel/exportExcel.d.ts +18 -18
- package/dist/index.cjs +42 -1
- package/dist/index.d.ts +27 -30
- package/dist/index.js +643 -644
- package/dist/ripple/index.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +6 -4
- package/src/components/BaseExportButton/BaseExportButton.vue +1 -3
- package/src/components/BaseTable/BaseTable.types.ts +1 -1
- package/src/components/OutlinedCascader/OutlinedCascader.types.ts +3 -0
- package/src/components/OutlinedCascader/OutlinedCascader.vue +71 -6
- package/src/components/OutlinedCascader/README.md +3 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.ts +3 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue +71 -6
- package/src/components/OutlinedDatePicker/README.md +3 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.ts +3 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue +144 -64
- package/src/components/OutlinedDateTimePicker/README.md +3 -0
- package/src/components/OutlinedInput/OutlinedInput.types.ts +3 -0
- package/src/components/OutlinedInput/OutlinedInput.vue +87 -8
- package/src/components/OutlinedInput/README.md +3 -0
- package/src/components/OutlinedSelect/OutlinedSelect.types.ts +3 -0
- package/src/components/OutlinedSelect/OutlinedSelect.vue +72 -6
- package/src/components/OutlinedSelect/README.md +3 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.ts +3 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue +75 -8
- package/src/components/OutlinedTimePicker/README.md +3 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.ts +3 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue +72 -6
- package/src/components/OutlinedTreeSelect/README.md +3 -0
- package/src/index.ts +5 -4
- package/src/ripple/index.ts +213 -0
- package/dist/components/BaseDialog/BaseDialog.types.d.ts +0 -25
- package/dist/components/BaseDialog/BaseDialog.vue.d.ts +0 -100
- package/dist/components/BaseDialog/index.d.ts +0 -3
- package/dist/components/BaseSearchForm/BaseSearchForm.types.d.ts +0 -42
- package/dist/components/BaseSearchForm/BaseSearchForm.utils.d.ts +0 -5
- package/dist/components/BaseSearchForm/BaseSearchForm.vue.d.ts +0 -88
- package/dist/components/BaseSearchForm/index.d.ts +0 -4
- package/src/components/BaseDialog/BaseDialog.types.ts +0 -28
- package/src/components/BaseDialog/BaseDialog.vue +0 -158
- package/src/components/BaseDialog/README.md +0 -69
- package/src/components/BaseDialog/index.ts +0 -10
- package/src/components/BaseSearchForm/BaseSearchForm.types.ts +0 -46
- package/src/components/BaseSearchForm/BaseSearchForm.utils.ts +0 -41
- package/src/components/BaseSearchForm/BaseSearchForm.vue +0 -267
- package/src/components/BaseSearchForm/README.md +0 -66
- package/src/components/BaseSearchForm/index.ts +0 -20
package/dist/index.js
CHANGED
|
@@ -1,9 +1,176 @@
|
|
|
1
1
|
import * as echarts from "echarts";
|
|
2
2
|
export { echarts };
|
|
3
|
-
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, renderSlot, toDisplayString, ref,
|
|
3
|
+
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, renderSlot, toDisplayString, ref, reactive, watch, onMounted, resolveComponent, resolveDirective, createVNode, withDirectives, createBlock, withCtx, Fragment, renderList, createSlots, createTextVNode, mergeProps, withModifiers, withKeys, normalizeClass, shallowRef, nextTick, onUnmounted, useAttrs, normalizeProps, guardReactiveProps } from "vue";
|
|
4
4
|
import { ElMessage } from "element-plus";
|
|
5
|
-
import { saveAs } from "file-saver";
|
|
6
5
|
import ExcelJS from "exceljs";
|
|
6
|
+
import { saveAs } from "file-saver";
|
|
7
|
+
const HBDL_RIPPLE_KEY = "__HBDL_UI_RIPPLE__";
|
|
8
|
+
const RIPPLE_STYLE_ID = "hbdl-ui-ripple-style";
|
|
9
|
+
const RIPPLE_HOST_CLASS = "hbdl-ripple-host";
|
|
10
|
+
const RIPPLE_WAVE_CLASS = "hbdl-ripple__wave";
|
|
11
|
+
const RIPPLE_TARGET_SELECTOR = [
|
|
12
|
+
"button",
|
|
13
|
+
'[role="button"]',
|
|
14
|
+
".el-button",
|
|
15
|
+
".el-radio-button__inner",
|
|
16
|
+
".el-checkbox-button__inner"
|
|
17
|
+
].join(",");
|
|
18
|
+
const RIPPLE_DISABLED_SELECTOR = [
|
|
19
|
+
":disabled",
|
|
20
|
+
"[disabled]",
|
|
21
|
+
'[aria-disabled="true"]',
|
|
22
|
+
".is-disabled",
|
|
23
|
+
".is-loading"
|
|
24
|
+
].join(",");
|
|
25
|
+
const RIPPLE_SKIP_SELECTOR = '[data-hbdl-ripple="false"]';
|
|
26
|
+
const RIPPLE_STYLE = `
|
|
27
|
+
.${RIPPLE_HOST_CLASS} {
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
-webkit-tap-highlight-color: transparent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.${RIPPLE_HOST_CLASS} > .${RIPPLE_WAVE_CLASS} {
|
|
33
|
+
position: absolute;
|
|
34
|
+
left: var(--hbdl-ripple-x);
|
|
35
|
+
top: var(--hbdl-ripple-y);
|
|
36
|
+
width: var(--hbdl-ripple-size);
|
|
37
|
+
height: var(--hbdl-ripple-size);
|
|
38
|
+
border-radius: 999px;
|
|
39
|
+
background: var(--hbdl-ripple-color, currentColor);
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
opacity: 0;
|
|
42
|
+
transform: scale(0);
|
|
43
|
+
animation: hbdl-ripple-wave 560ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes hbdl-ripple-wave {
|
|
47
|
+
0% {
|
|
48
|
+
opacity: 0.22;
|
|
49
|
+
transform: scale(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
55% {
|
|
53
|
+
opacity: 0.18;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
100% {
|
|
57
|
+
opacity: 0;
|
|
58
|
+
transform: scale(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
.${RIPPLE_HOST_CLASS} > .${RIPPLE_WAVE_CLASS} {
|
|
64
|
+
animation-duration: 1ms;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
const noop = () => void 0;
|
|
69
|
+
function installRipple() {
|
|
70
|
+
if (!canUseDOM()) {
|
|
71
|
+
return noop;
|
|
72
|
+
}
|
|
73
|
+
const rippleWindow = window;
|
|
74
|
+
if (rippleWindow[HBDL_RIPPLE_KEY]) {
|
|
75
|
+
return rippleWindow[HBDL_RIPPLE_KEY].teardown;
|
|
76
|
+
}
|
|
77
|
+
injectRippleStyle();
|
|
78
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
79
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
80
|
+
const teardown = () => {
|
|
81
|
+
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
82
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
83
|
+
delete rippleWindow[HBDL_RIPPLE_KEY];
|
|
84
|
+
};
|
|
85
|
+
rippleWindow[HBDL_RIPPLE_KEY] = {
|
|
86
|
+
teardown
|
|
87
|
+
};
|
|
88
|
+
return teardown;
|
|
89
|
+
}
|
|
90
|
+
function uninstallRipple() {
|
|
91
|
+
var _a;
|
|
92
|
+
if (!canUseDOM()) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const rippleWindow = window;
|
|
96
|
+
(_a = rippleWindow[HBDL_RIPPLE_KEY]) == null ? void 0 : _a.teardown();
|
|
97
|
+
}
|
|
98
|
+
function canUseDOM() {
|
|
99
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
100
|
+
}
|
|
101
|
+
function injectRippleStyle() {
|
|
102
|
+
if (document.getElementById(RIPPLE_STYLE_ID)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const style = document.createElement("style");
|
|
106
|
+
style.id = RIPPLE_STYLE_ID;
|
|
107
|
+
style.textContent = RIPPLE_STYLE;
|
|
108
|
+
document.head.appendChild(style);
|
|
109
|
+
}
|
|
110
|
+
function handlePointerDown(event) {
|
|
111
|
+
if (event.defaultPrevented || event.button !== 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const target = findRippleTarget(event.target);
|
|
115
|
+
if (!target) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
createRipple(target, event.clientX, event.clientY);
|
|
119
|
+
}
|
|
120
|
+
function handleKeyDown(event) {
|
|
121
|
+
if (event.defaultPrevented || event.repeat || !isActivationKey(event.key)) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const target = findRippleTarget(event.target);
|
|
125
|
+
if (!target) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const rect = target.getBoundingClientRect();
|
|
129
|
+
createRipple(target, rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
130
|
+
}
|
|
131
|
+
function findRippleTarget(target) {
|
|
132
|
+
if (!(target instanceof Element)) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const rippleTarget = target.closest(RIPPLE_TARGET_SELECTOR);
|
|
136
|
+
if (!(rippleTarget instanceof HTMLElement)) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if (rippleTarget.closest(RIPPLE_SKIP_SELECTOR) || rippleTarget.closest(RIPPLE_DISABLED_SELECTOR)) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return rippleTarget;
|
|
143
|
+
}
|
|
144
|
+
function createRipple(target, clientX, clientY) {
|
|
145
|
+
const rect = target.getBoundingClientRect();
|
|
146
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const offsetX = clientX - rect.left;
|
|
150
|
+
const offsetY = clientY - rect.top;
|
|
151
|
+
const maxX = Math.max(offsetX, rect.width - offsetX);
|
|
152
|
+
const maxY = Math.max(offsetY, rect.height - offsetY);
|
|
153
|
+
const size = Math.ceil(Math.sqrt(maxX * maxX + maxY * maxY) * 2);
|
|
154
|
+
const ripple = document.createElement("span");
|
|
155
|
+
prepareRippleHost(target);
|
|
156
|
+
ripple.className = RIPPLE_WAVE_CLASS;
|
|
157
|
+
ripple.setAttribute("aria-hidden", "true");
|
|
158
|
+
ripple.style.setProperty("--hbdl-ripple-size", `${size}px`);
|
|
159
|
+
ripple.style.setProperty("--hbdl-ripple-x", `${offsetX - size / 2}px`);
|
|
160
|
+
ripple.style.setProperty("--hbdl-ripple-y", `${offsetY - size / 2}px`);
|
|
161
|
+
target.insertBefore(ripple, target.firstChild);
|
|
162
|
+
ripple.addEventListener("animationend", () => ripple.remove(), { once: true });
|
|
163
|
+
window.setTimeout(() => ripple.remove(), 700);
|
|
164
|
+
}
|
|
165
|
+
function prepareRippleHost(target) {
|
|
166
|
+
target.classList.add(RIPPLE_HOST_CLASS);
|
|
167
|
+
if (getComputedStyle(target).position === "static") {
|
|
168
|
+
target.style.position = "relative";
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function isActivationKey(key) {
|
|
172
|
+
return key === "Enter" || key === " " || key === "Spacebar";
|
|
173
|
+
}
|
|
7
174
|
var BaseCard_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
8
175
|
var _export_sfc = (sfc, props) => {
|
|
9
176
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -12,20 +179,20 @@ var _export_sfc = (sfc, props) => {
|
|
|
12
179
|
}
|
|
13
180
|
return target;
|
|
14
181
|
};
|
|
15
|
-
const _hoisted_1$
|
|
182
|
+
const _hoisted_1$8 = {
|
|
16
183
|
key: 0,
|
|
17
184
|
class: "base-card__header"
|
|
18
185
|
};
|
|
19
|
-
const _hoisted_2$
|
|
20
|
-
const _hoisted_3$
|
|
186
|
+
const _hoisted_2$8 = { class: "base-card__header-left" };
|
|
187
|
+
const _hoisted_3$3 = {
|
|
21
188
|
key: 0,
|
|
22
189
|
class: "base-card__title-wrap"
|
|
23
190
|
};
|
|
24
|
-
const _hoisted_4$
|
|
191
|
+
const _hoisted_4$2 = {
|
|
25
192
|
key: 0,
|
|
26
193
|
class: "base-card__title-marker"
|
|
27
194
|
};
|
|
28
|
-
const _hoisted_5$
|
|
195
|
+
const _hoisted_5$2 = {
|
|
29
196
|
key: 2,
|
|
30
197
|
class: "base-card__title"
|
|
31
198
|
};
|
|
@@ -44,7 +211,7 @@ const _hoisted_10$1 = {
|
|
|
44
211
|
class: "base-card__tip"
|
|
45
212
|
};
|
|
46
213
|
const _hoisted_11$1 = { class: "base-card__content" };
|
|
47
|
-
const _sfc_main$
|
|
214
|
+
const _sfc_main$a = defineComponent({
|
|
48
215
|
...{
|
|
49
216
|
name: "BaseCard"
|
|
50
217
|
},
|
|
@@ -140,11 +307,11 @@ const _sfc_main$c = defineComponent({
|
|
|
140
307
|
class: "base-card",
|
|
141
308
|
style: normalizeStyle(cardStyles.value)
|
|
142
309
|
}, [
|
|
143
|
-
shouldRenderHeader.value ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
144
|
-
createElementVNode("div", _hoisted_2$
|
|
145
|
-
hasTitleBlock.value ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
146
|
-
__props.showTitleMarker ? (openBlock(), createElementBlock("span", _hoisted_4$
|
|
147
|
-
_ctx.$slots["title-label"] ? renderSlot(_ctx.$slots, "title-label", { key: 1 }, void 0, true) : (openBlock(), createElementBlock("h4", _hoisted_5$
|
|
310
|
+
shouldRenderHeader.value ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
311
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
312
|
+
hasTitleBlock.value ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
|
|
313
|
+
__props.showTitleMarker ? (openBlock(), createElementBlock("span", _hoisted_4$2)) : createCommentVNode("", true),
|
|
314
|
+
_ctx.$slots["title-label"] ? renderSlot(_ctx.$slots, "title-label", { key: 1 }, void 0, true) : (openBlock(), createElementBlock("h4", _hoisted_5$2, toDisplayString(__props.title), 1))
|
|
148
315
|
])) : createCommentVNode("", true),
|
|
149
316
|
renderSlot(_ctx.$slots, "title", {}, void 0, true)
|
|
150
317
|
]),
|
|
@@ -172,398 +339,19 @@ const _sfc_main$c = defineComponent({
|
|
|
172
339
|
};
|
|
173
340
|
}
|
|
174
341
|
});
|
|
175
|
-
var BaseCard = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
176
|
-
function cloneSearchFormModel(model) {
|
|
177
|
-
return { ...model || {} };
|
|
178
|
-
}
|
|
179
|
-
function getVisibleSearchFields(fields, collapsed) {
|
|
180
|
-
return fields.filter((field) => {
|
|
181
|
-
if (field.hidden) {
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
return !collapsed || !field.collapsed;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function resetSearchFormModel(fields) {
|
|
188
|
-
return fields.reduce((model, field) => {
|
|
189
|
-
if (field.type === "dateRange") {
|
|
190
|
-
model[field.key] = [];
|
|
191
|
-
return model;
|
|
192
|
-
}
|
|
193
|
-
model[field.key] = "";
|
|
194
|
-
return model;
|
|
195
|
-
}, {});
|
|
196
|
-
}
|
|
197
|
-
function toSearchFormCssValue(value) {
|
|
198
|
-
if (value === void 0 || value === null || value === "") {
|
|
199
|
-
return void 0;
|
|
200
|
-
}
|
|
201
|
-
return typeof value === "number" ? `${value}px` : value;
|
|
202
|
-
}
|
|
203
|
-
var BaseSearchForm_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
204
|
-
const _hoisted_1$4 = { class: "base-search-form" };
|
|
205
|
-
const _hoisted_2$2 = { class: "base-search-form__actions" };
|
|
206
|
-
const _sfc_main$b = defineComponent({
|
|
207
|
-
...{
|
|
208
|
-
name: "BaseSearchForm"
|
|
209
|
-
},
|
|
210
|
-
__name: "BaseSearchForm",
|
|
211
|
-
props: {
|
|
212
|
-
modelValue: { default: () => ({}) },
|
|
213
|
-
fields: {},
|
|
214
|
-
collapsed: { type: Boolean, default: true },
|
|
215
|
-
showCollapse: { type: Boolean, default: true },
|
|
216
|
-
columns: { default: 4 },
|
|
217
|
-
labelWidth: { default: 80 },
|
|
218
|
-
fieldWidth: { default: void 0 },
|
|
219
|
-
gutter: { default: 16 },
|
|
220
|
-
submitText: { default: "\u67E5\u8BE2" },
|
|
221
|
-
resetText: { default: "\u91CD\u7F6E" },
|
|
222
|
-
expandText: { default: "\u5C55\u5F00" },
|
|
223
|
-
collapseText: { default: "\u6536\u8D77" }
|
|
224
|
-
},
|
|
225
|
-
emits: ["update:modelValue", "search", "reset", "field-change"],
|
|
226
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
227
|
-
const props = __props;
|
|
228
|
-
const emit = __emit;
|
|
229
|
-
const innerModel = ref(cloneSearchFormModel(props.modelValue));
|
|
230
|
-
const isCollapsed = ref(props.collapsed);
|
|
231
|
-
watch(
|
|
232
|
-
() => props.modelValue,
|
|
233
|
-
(value) => {
|
|
234
|
-
innerModel.value = cloneSearchFormModel(value);
|
|
235
|
-
},
|
|
236
|
-
{ deep: true }
|
|
237
|
-
);
|
|
238
|
-
watch(
|
|
239
|
-
() => props.collapsed,
|
|
240
|
-
(value) => {
|
|
241
|
-
isCollapsed.value = value;
|
|
242
|
-
}
|
|
243
|
-
);
|
|
244
|
-
const visibleFields = computed(() => getVisibleSearchFields(props.fields, isCollapsed.value));
|
|
245
|
-
const hasCollapsedFields = computed(() => props.fields.some((field) => field.collapsed && !field.hidden));
|
|
246
|
-
const normalizedLabelWidth = computed(() => toSearchFormCssValue(props.labelWidth));
|
|
247
|
-
const gridStyle = computed(() => ({
|
|
248
|
-
gridTemplateColumns: `repeat(${Math.max(1, props.columns)}, minmax(0, 1fr))`,
|
|
249
|
-
gap: `${props.gutter}px`
|
|
250
|
-
}));
|
|
251
|
-
function getFieldStyle(field) {
|
|
252
|
-
return {
|
|
253
|
-
gridColumn: field.span ? `span ${Math.max(1, field.span)}` : void 0,
|
|
254
|
-
"--base-search-form-field-width": toSearchFormCssValue(props.fieldWidth)
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
function emitModelUpdate() {
|
|
258
|
-
emit("update:modelValue", cloneSearchFormModel(innerModel.value));
|
|
259
|
-
}
|
|
260
|
-
function handleFieldChange(key, value) {
|
|
261
|
-
setFieldValue(key, value);
|
|
262
|
-
emit("field-change", key, value, cloneSearchFormModel(innerModel.value));
|
|
263
|
-
}
|
|
264
|
-
function setFieldValue(key, value) {
|
|
265
|
-
innerModel.value = {
|
|
266
|
-
...innerModel.value,
|
|
267
|
-
[key]: value
|
|
268
|
-
};
|
|
269
|
-
emitModelUpdate();
|
|
270
|
-
}
|
|
271
|
-
function submit() {
|
|
272
|
-
emit("search", cloneSearchFormModel(innerModel.value));
|
|
273
|
-
}
|
|
274
|
-
function reset() {
|
|
275
|
-
innerModel.value = resetSearchFormModel(props.fields);
|
|
276
|
-
emitModelUpdate();
|
|
277
|
-
emit("reset", cloneSearchFormModel(innerModel.value));
|
|
278
|
-
}
|
|
279
|
-
function toggleCollapsed() {
|
|
280
|
-
isCollapsed.value = !isCollapsed.value;
|
|
281
|
-
}
|
|
282
|
-
function getModel() {
|
|
283
|
-
return cloneSearchFormModel(innerModel.value);
|
|
284
|
-
}
|
|
285
|
-
__expose({
|
|
286
|
-
submit,
|
|
287
|
-
reset,
|
|
288
|
-
setFieldValue,
|
|
289
|
-
getModel
|
|
290
|
-
});
|
|
291
|
-
return (_ctx, _cache) => {
|
|
292
|
-
const _component_el_option = resolveComponent("el-option");
|
|
293
|
-
const _component_el_select = resolveComponent("el-select");
|
|
294
|
-
const _component_el_date_picker = resolveComponent("el-date-picker");
|
|
295
|
-
const _component_el_input = resolveComponent("el-input");
|
|
296
|
-
const _component_el_form_item = resolveComponent("el-form-item");
|
|
297
|
-
const _component_el_button = resolveComponent("el-button");
|
|
298
|
-
const _component_el_form = resolveComponent("el-form");
|
|
299
|
-
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
300
|
-
createVNode(_component_el_form, {
|
|
301
|
-
class: "base-search-form__form",
|
|
302
|
-
model: innerModel.value,
|
|
303
|
-
"label-width": normalizedLabelWidth.value,
|
|
304
|
-
onSubmit: withModifiers(submit, ["prevent"])
|
|
305
|
-
}, {
|
|
306
|
-
default: withCtx(() => [
|
|
307
|
-
createElementVNode("div", {
|
|
308
|
-
class: "base-search-form__grid",
|
|
309
|
-
style: normalizeStyle(gridStyle.value)
|
|
310
|
-
}, [
|
|
311
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleFields.value, (field) => {
|
|
312
|
-
return openBlock(), createBlock(_component_el_form_item, {
|
|
313
|
-
key: field.key,
|
|
314
|
-
class: "base-search-form__item",
|
|
315
|
-
label: field.label,
|
|
316
|
-
style: normalizeStyle(getFieldStyle(field))
|
|
317
|
-
}, {
|
|
318
|
-
default: withCtx(() => {
|
|
319
|
-
var _a, _b;
|
|
320
|
-
return [
|
|
321
|
-
field.type === "slot" ? renderSlot(_ctx.$slots, field.key, {
|
|
322
|
-
key: 0,
|
|
323
|
-
field,
|
|
324
|
-
model: innerModel.value,
|
|
325
|
-
value: innerModel.value[field.key],
|
|
326
|
-
setValue: (value) => setFieldValue(field.key, value)
|
|
327
|
-
}, void 0, true) : field.type === "select" ? (openBlock(), createBlock(_component_el_select, mergeProps({
|
|
328
|
-
key: 1,
|
|
329
|
-
class: "base-search-form__control",
|
|
330
|
-
"model-value": innerModel.value[field.key],
|
|
331
|
-
placeholder: field.placeholder || field.label,
|
|
332
|
-
clearable: field.clearable !== false,
|
|
333
|
-
disabled: field.disabled
|
|
334
|
-
}, { ref_for: true }, field.props, {
|
|
335
|
-
"onUpdate:modelValue": (value) => handleFieldChange(field.key, value)
|
|
336
|
-
}), {
|
|
337
|
-
default: withCtx(() => [
|
|
338
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(field.options || [], (option) => {
|
|
339
|
-
return openBlock(), createBlock(_component_el_option, {
|
|
340
|
-
key: String(option.value),
|
|
341
|
-
label: option.label,
|
|
342
|
-
value: option.value,
|
|
343
|
-
disabled: option.disabled
|
|
344
|
-
}, null, 8, ["label", "value", "disabled"]);
|
|
345
|
-
}), 128))
|
|
346
|
-
]),
|
|
347
|
-
_: 2
|
|
348
|
-
}, 1040, ["model-value", "placeholder", "clearable", "disabled", "onUpdate:modelValue"])) : field.type === "date" || field.type === "dateRange" ? (openBlock(), createBlock(_component_el_date_picker, mergeProps({
|
|
349
|
-
key: 2,
|
|
350
|
-
class: "base-search-form__control",
|
|
351
|
-
"model-value": innerModel.value[field.key],
|
|
352
|
-
type: field.type === "dateRange" ? "daterange" : "date",
|
|
353
|
-
placeholder: field.placeholder || field.label,
|
|
354
|
-
"start-placeholder": ((_a = field.props) == null ? void 0 : _a.startPlaceholder) || "\u5F00\u59CB\u65E5\u671F",
|
|
355
|
-
"end-placeholder": ((_b = field.props) == null ? void 0 : _b.endPlaceholder) || "\u7ED3\u675F\u65E5\u671F",
|
|
356
|
-
clearable: field.clearable !== false,
|
|
357
|
-
disabled: field.disabled
|
|
358
|
-
}, { ref_for: true }, field.props, {
|
|
359
|
-
"onUpdate:modelValue": (value) => handleFieldChange(field.key, value)
|
|
360
|
-
}), null, 16, ["model-value", "type", "placeholder", "start-placeholder", "end-placeholder", "clearable", "disabled", "onUpdate:modelValue"])) : (openBlock(), createBlock(_component_el_input, mergeProps({
|
|
361
|
-
key: 3,
|
|
362
|
-
class: "base-search-form__control",
|
|
363
|
-
"model-value": innerModel.value[field.key],
|
|
364
|
-
placeholder: field.placeholder || field.label,
|
|
365
|
-
clearable: field.clearable !== false,
|
|
366
|
-
disabled: field.disabled
|
|
367
|
-
}, { ref_for: true }, field.props, {
|
|
368
|
-
"onUpdate:modelValue": (value) => handleFieldChange(field.key, value),
|
|
369
|
-
onKeyup: withKeys(submit, ["enter"])
|
|
370
|
-
}), null, 16, ["model-value", "placeholder", "clearable", "disabled", "onUpdate:modelValue"]))
|
|
371
|
-
];
|
|
372
|
-
}),
|
|
373
|
-
_: 2
|
|
374
|
-
}, 1032, ["label", "style"]);
|
|
375
|
-
}), 128)),
|
|
376
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
377
|
-
renderSlot(_ctx.$slots, "actions-before", { model: innerModel.value }, void 0, true),
|
|
378
|
-
createVNode(_component_el_button, {
|
|
379
|
-
type: "primary",
|
|
380
|
-
onClick: submit
|
|
381
|
-
}, {
|
|
382
|
-
default: withCtx(() => [
|
|
383
|
-
createTextVNode(toDisplayString(__props.submitText), 1)
|
|
384
|
-
]),
|
|
385
|
-
_: 1
|
|
386
|
-
}),
|
|
387
|
-
createVNode(_component_el_button, { onClick: reset }, {
|
|
388
|
-
default: withCtx(() => [
|
|
389
|
-
createTextVNode(toDisplayString(__props.resetText), 1)
|
|
390
|
-
]),
|
|
391
|
-
_: 1
|
|
392
|
-
}),
|
|
393
|
-
__props.showCollapse && hasCollapsedFields.value ? (openBlock(), createBlock(_component_el_button, {
|
|
394
|
-
key: 0,
|
|
395
|
-
link: "",
|
|
396
|
-
type: "primary",
|
|
397
|
-
onClick: toggleCollapsed
|
|
398
|
-
}, {
|
|
399
|
-
default: withCtx(() => [
|
|
400
|
-
createTextVNode(toDisplayString(isCollapsed.value ? __props.expandText : __props.collapseText), 1)
|
|
401
|
-
]),
|
|
402
|
-
_: 1
|
|
403
|
-
})) : createCommentVNode("", true),
|
|
404
|
-
renderSlot(_ctx.$slots, "actions-after", { model: innerModel.value }, void 0, true)
|
|
405
|
-
])
|
|
406
|
-
], 4)
|
|
407
|
-
]),
|
|
408
|
-
_: 3
|
|
409
|
-
}, 8, ["model", "label-width"])
|
|
410
|
-
]);
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
var BaseSearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-52b1fbc7"]]);
|
|
415
|
-
var BaseDialog_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
416
|
-
const _hoisted_1$3 = { class: "base-dialog__body" };
|
|
417
|
-
const _hoisted_2$1 = { class: "base-dialog__footer" };
|
|
418
|
-
const _sfc_main$a = defineComponent({
|
|
419
|
-
...{
|
|
420
|
-
name: "BaseDialog"
|
|
421
|
-
},
|
|
422
|
-
__name: "BaseDialog",
|
|
423
|
-
props: {
|
|
424
|
-
modelValue: { type: Boolean, default: false },
|
|
425
|
-
title: { default: "" },
|
|
426
|
-
width: { default: "560px" },
|
|
427
|
-
top: { default: "12vh" },
|
|
428
|
-
fullscreen: { type: Boolean, default: false },
|
|
429
|
-
appendToBody: { type: Boolean, default: false },
|
|
430
|
-
destroyOnClose: { type: Boolean, default: false },
|
|
431
|
-
closeOnClickModal: { type: Boolean, default: false },
|
|
432
|
-
closeOnPressEscape: { type: Boolean, default: true },
|
|
433
|
-
showClose: { type: Boolean, default: true },
|
|
434
|
-
showFooter: { type: Boolean, default: true },
|
|
435
|
-
confirmText: { default: "\u786E\u5B9A" },
|
|
436
|
-
cancelText: { default: "\u53D6\u6D88" },
|
|
437
|
-
confirmLoading: { type: Boolean, default: false },
|
|
438
|
-
confirmDisabled: { type: Boolean, default: false },
|
|
439
|
-
beforeConfirm: { type: Function, default: void 0 }
|
|
440
|
-
},
|
|
441
|
-
emits: ["update:modelValue", "open", "opened", "close", "closed", "cancel", "confirm"],
|
|
442
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
443
|
-
const props = __props;
|
|
444
|
-
const emit = __emit;
|
|
445
|
-
const innerConfirmLoading = ref(false);
|
|
446
|
-
const normalizedWidth = computed(() => toCssValue(props.width));
|
|
447
|
-
const mergedConfirmLoading = computed(() => props.confirmLoading || innerConfirmLoading.value);
|
|
448
|
-
function toCssValue(value) {
|
|
449
|
-
if (value === void 0 || value === null || value === "") {
|
|
450
|
-
return void 0;
|
|
451
|
-
}
|
|
452
|
-
return typeof value === "number" ? `${value}px` : value;
|
|
453
|
-
}
|
|
454
|
-
function handleModelValueUpdate(value) {
|
|
455
|
-
emit("update:modelValue", value);
|
|
456
|
-
}
|
|
457
|
-
function open() {
|
|
458
|
-
emit("update:modelValue", true);
|
|
459
|
-
}
|
|
460
|
-
function close() {
|
|
461
|
-
emit("update:modelValue", false);
|
|
462
|
-
}
|
|
463
|
-
function cancel() {
|
|
464
|
-
emit("cancel");
|
|
465
|
-
close();
|
|
466
|
-
}
|
|
467
|
-
async function confirm() {
|
|
468
|
-
var _a;
|
|
469
|
-
if (mergedConfirmLoading.value || props.confirmDisabled) {
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
innerConfirmLoading.value = true;
|
|
473
|
-
try {
|
|
474
|
-
const result = await ((_a = props.beforeConfirm) == null ? void 0 : _a.call(props));
|
|
475
|
-
if (result === false) {
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
emit("confirm");
|
|
479
|
-
} finally {
|
|
480
|
-
innerConfirmLoading.value = false;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
__expose({
|
|
484
|
-
open,
|
|
485
|
-
close,
|
|
486
|
-
confirm
|
|
487
|
-
});
|
|
488
|
-
return (_ctx, _cache) => {
|
|
489
|
-
const _component_el_button = resolveComponent("el-button");
|
|
490
|
-
const _component_el_dialog = resolveComponent("el-dialog");
|
|
491
|
-
return openBlock(), createBlock(_component_el_dialog, {
|
|
492
|
-
class: "base-dialog",
|
|
493
|
-
"model-value": __props.modelValue,
|
|
494
|
-
title: __props.title,
|
|
495
|
-
width: normalizedWidth.value,
|
|
496
|
-
top: __props.top,
|
|
497
|
-
fullscreen: __props.fullscreen,
|
|
498
|
-
"append-to-body": __props.appendToBody,
|
|
499
|
-
"destroy-on-close": __props.destroyOnClose,
|
|
500
|
-
"close-on-click-modal": __props.closeOnClickModal,
|
|
501
|
-
"close-on-press-escape": __props.closeOnPressEscape,
|
|
502
|
-
"show-close": __props.showClose,
|
|
503
|
-
"onUpdate:modelValue": handleModelValueUpdate,
|
|
504
|
-
onOpen: _cache[0] || (_cache[0] = ($event) => emit("open")),
|
|
505
|
-
onOpened: _cache[1] || (_cache[1] = ($event) => emit("opened")),
|
|
506
|
-
onClose: _cache[2] || (_cache[2] = ($event) => emit("close")),
|
|
507
|
-
onClosed: _cache[3] || (_cache[3] = ($event) => emit("closed"))
|
|
508
|
-
}, createSlots({
|
|
509
|
-
default: withCtx(() => [
|
|
510
|
-
createElementVNode("div", _hoisted_1$3, [
|
|
511
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
512
|
-
])
|
|
513
|
-
]),
|
|
514
|
-
_: 2
|
|
515
|
-
}, [
|
|
516
|
-
_ctx.$slots.header ? {
|
|
517
|
-
name: "header",
|
|
518
|
-
fn: withCtx(() => [
|
|
519
|
-
renderSlot(_ctx.$slots, "header", {}, void 0, true)
|
|
520
|
-
]),
|
|
521
|
-
key: "0"
|
|
522
|
-
} : void 0,
|
|
523
|
-
__props.showFooter ? {
|
|
524
|
-
name: "footer",
|
|
525
|
-
fn: withCtx(() => [
|
|
526
|
-
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
527
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
528
|
-
createVNode(_component_el_button, { onClick: cancel }, {
|
|
529
|
-
default: withCtx(() => [
|
|
530
|
-
createTextVNode(toDisplayString(__props.cancelText), 1)
|
|
531
|
-
]),
|
|
532
|
-
_: 1
|
|
533
|
-
}),
|
|
534
|
-
createVNode(_component_el_button, {
|
|
535
|
-
type: "primary",
|
|
536
|
-
loading: mergedConfirmLoading.value,
|
|
537
|
-
disabled: __props.confirmDisabled,
|
|
538
|
-
onClick: confirm
|
|
539
|
-
}, {
|
|
540
|
-
default: withCtx(() => [
|
|
541
|
-
createTextVNode(toDisplayString(__props.confirmText), 1)
|
|
542
|
-
]),
|
|
543
|
-
_: 1
|
|
544
|
-
}, 8, ["loading", "disabled"])
|
|
545
|
-
])
|
|
546
|
-
], true)
|
|
547
|
-
]),
|
|
548
|
-
key: "1"
|
|
549
|
-
} : void 0
|
|
550
|
-
]), 1032, ["model-value", "title", "width", "top", "fullscreen", "append-to-body", "destroy-on-close", "close-on-click-modal", "close-on-press-escape", "show-close"]);
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
var BaseDialog = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-37bcb779"]]);
|
|
342
|
+
var BaseCard = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-6bfddf1c"]]);
|
|
555
343
|
var BaseTable_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
556
|
-
const _hoisted_1$
|
|
557
|
-
const _hoisted_2 = {
|
|
344
|
+
const _hoisted_1$7 = { class: "base-table" };
|
|
345
|
+
const _hoisted_2$7 = {
|
|
558
346
|
key: 0,
|
|
559
347
|
class: "base-table__toolbar"
|
|
560
348
|
};
|
|
561
|
-
const _hoisted_3 = { class: "base-table__toolbar-left" };
|
|
562
|
-
const _hoisted_4 = {
|
|
349
|
+
const _hoisted_3$2 = { class: "base-table__toolbar-left" };
|
|
350
|
+
const _hoisted_4$1 = {
|
|
563
351
|
key: 0,
|
|
564
352
|
class: "base-table__toolbar-right"
|
|
565
353
|
};
|
|
566
|
-
const _hoisted_5 = { class: "base-table__header" };
|
|
354
|
+
const _hoisted_5$1 = { class: "base-table__header" };
|
|
567
355
|
const _hoisted_6 = { class: "base-table__header-label" };
|
|
568
356
|
const _hoisted_7 = { class: "base-table__header-actions" };
|
|
569
357
|
const _hoisted_8 = { class: "base-table__header-search-footer" };
|
|
@@ -1270,12 +1058,12 @@ const _sfc_main$9 = defineComponent({
|
|
|
1270
1058
|
const _component_el_tag = resolveComponent("el-tag");
|
|
1271
1059
|
const _component_el_table = resolveComponent("el-table");
|
|
1272
1060
|
const _directive_loading = resolveDirective("loading");
|
|
1273
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1274
|
-
shouldRenderToolbar.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
1275
|
-
createElementVNode("div", _hoisted_3, [
|
|
1061
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
1062
|
+
shouldRenderToolbar.value ? (openBlock(), createElementBlock("div", _hoisted_2$7, [
|
|
1063
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
1276
1064
|
renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)
|
|
1277
1065
|
]),
|
|
1278
|
-
__props.showPagination ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
1066
|
+
__props.showPagination ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
|
|
1279
1067
|
createVNode(_component_el_pagination, {
|
|
1280
1068
|
small: "",
|
|
1281
1069
|
background: "",
|
|
@@ -1410,7 +1198,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
1410
1198
|
} : shouldRenderBuiltInHeader(column) ? {
|
|
1411
1199
|
name: "header",
|
|
1412
1200
|
fn: withCtx(() => [
|
|
1413
|
-
createElementVNode("div", _hoisted_5, [
|
|
1201
|
+
createElementVNode("div", _hoisted_5$1, [
|
|
1414
1202
|
createElementVNode("span", _hoisted_6, toDisplayString(column.label), 1),
|
|
1415
1203
|
createElementVNode("div", _hoisted_7, [
|
|
1416
1204
|
createVNode(_component_el_dropdown, {
|
|
@@ -1769,6 +1557,136 @@ const _sfc_main$8 = defineComponent({
|
|
|
1769
1557
|
}
|
|
1770
1558
|
});
|
|
1771
1559
|
var BaseEChart = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-51bc4772"]]);
|
|
1560
|
+
const DEFAULT_SHEET_NAME = "Sheet1";
|
|
1561
|
+
const DEFAULT_COLUMN_WIDTH = 16;
|
|
1562
|
+
const EXCEL_MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
1563
|
+
function getLeafCount(column) {
|
|
1564
|
+
var _a;
|
|
1565
|
+
if (!((_a = column.children) == null ? void 0 : _a.length)) {
|
|
1566
|
+
return 1;
|
|
1567
|
+
}
|
|
1568
|
+
return column.children.reduce((count, child) => count + getLeafCount(child), 0);
|
|
1569
|
+
}
|
|
1570
|
+
function getMaxDepth(columns, depth = 1) {
|
|
1571
|
+
return columns.reduce((maxDepth, column) => {
|
|
1572
|
+
var _a;
|
|
1573
|
+
if (!((_a = column.children) == null ? void 0 : _a.length)) {
|
|
1574
|
+
return Math.max(maxDepth, depth);
|
|
1575
|
+
}
|
|
1576
|
+
return Math.max(maxDepth, getMaxDepth(column.children, depth + 1));
|
|
1577
|
+
}, depth);
|
|
1578
|
+
}
|
|
1579
|
+
function getDisplayLength(value) {
|
|
1580
|
+
const text = `${value != null ? value : ""}`;
|
|
1581
|
+
return Array.from(text).reduce((length, char) => {
|
|
1582
|
+
return length + (char.charCodeAt(0) > 255 ? 2 : 1);
|
|
1583
|
+
}, 0);
|
|
1584
|
+
}
|
|
1585
|
+
function getValueByPath(source, path) {
|
|
1586
|
+
if (!path) {
|
|
1587
|
+
return "";
|
|
1588
|
+
}
|
|
1589
|
+
return path.split(".").reduce((current, key) => {
|
|
1590
|
+
if (current === null || current === void 0) {
|
|
1591
|
+
return void 0;
|
|
1592
|
+
}
|
|
1593
|
+
return current[key];
|
|
1594
|
+
}, source);
|
|
1595
|
+
}
|
|
1596
|
+
function getCellValue(row, rowIndex, column) {
|
|
1597
|
+
if (typeof column.formatter === "function") {
|
|
1598
|
+
return column.formatter(row, rowIndex, column);
|
|
1599
|
+
}
|
|
1600
|
+
return getValueByPath(row, column.key);
|
|
1601
|
+
}
|
|
1602
|
+
function buildHeaderMatrix(columns) {
|
|
1603
|
+
const maxDepth = getMaxDepth(columns);
|
|
1604
|
+
const totalLeafCount = columns.reduce((count, column) => count + getLeafCount(column), 0);
|
|
1605
|
+
const headerRows = Array.from({ length: maxDepth }, () => Array.from({ length: totalLeafCount }).fill(""));
|
|
1606
|
+
const merges = [];
|
|
1607
|
+
const leafColumns = [];
|
|
1608
|
+
let currentColumnIndex = 0;
|
|
1609
|
+
const fillHeaders = (column, depth) => {
|
|
1610
|
+
var _a;
|
|
1611
|
+
const startColumnIndex = currentColumnIndex;
|
|
1612
|
+
const leafCount = getLeafCount(column);
|
|
1613
|
+
headerRows[depth][startColumnIndex] = column.label;
|
|
1614
|
+
if ((_a = column.children) == null ? void 0 : _a.length) {
|
|
1615
|
+
column.children.forEach((child) => fillHeaders(child, depth + 1));
|
|
1616
|
+
if (leafCount > 1) {
|
|
1617
|
+
merges.push({
|
|
1618
|
+
s: { r: depth, c: startColumnIndex },
|
|
1619
|
+
e: { r: depth, c: startColumnIndex + leafCount - 1 }
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
leafColumns.push(column);
|
|
1625
|
+
currentColumnIndex += 1;
|
|
1626
|
+
if (depth < maxDepth - 1) {
|
|
1627
|
+
merges.push({
|
|
1628
|
+
s: { r: depth, c: startColumnIndex },
|
|
1629
|
+
e: { r: maxDepth - 1, c: startColumnIndex }
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
};
|
|
1633
|
+
columns.forEach((column) => fillHeaders(column, 0));
|
|
1634
|
+
return {
|
|
1635
|
+
headerRows,
|
|
1636
|
+
leafColumns,
|
|
1637
|
+
merges
|
|
1638
|
+
};
|
|
1639
|
+
}
|
|
1640
|
+
function buildColumnWidths(leafColumns, dataRows, defaultColumnWidth, autoWidth) {
|
|
1641
|
+
return leafColumns.map((column, columnIndex) => {
|
|
1642
|
+
var _a;
|
|
1643
|
+
const headerWidth = getDisplayLength(column.label);
|
|
1644
|
+
const dataWidth = dataRows.reduce((maxWidth, row) => {
|
|
1645
|
+
return Math.max(maxWidth, getDisplayLength(row[columnIndex]));
|
|
1646
|
+
}, 0);
|
|
1647
|
+
const targetWidth = (_a = column.width) != null ? _a : autoWidth ? Math.max(defaultColumnWidth, headerWidth, dataWidth) : defaultColumnWidth;
|
|
1648
|
+
return targetWidth;
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
function normalizeFileName(fileName) {
|
|
1652
|
+
return fileName.endsWith(".xlsx") ? fileName : `${fileName}.xlsx`;
|
|
1653
|
+
}
|
|
1654
|
+
function applyColumnWidths(worksheet, columnWidths) {
|
|
1655
|
+
columnWidths.forEach((width, index) => {
|
|
1656
|
+
worksheet.getColumn(index + 1).width = width;
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
function applyMerges(worksheet, merges) {
|
|
1660
|
+
merges.forEach((range) => {
|
|
1661
|
+
worksheet.mergeCells(range.s.r + 1, range.s.c + 1, range.e.r + 1, range.e.c + 1);
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
async function exportExcel(options) {
|
|
1665
|
+
const {
|
|
1666
|
+
fileName,
|
|
1667
|
+
sheetName = DEFAULT_SHEET_NAME,
|
|
1668
|
+
data,
|
|
1669
|
+
autoWidth = true,
|
|
1670
|
+
defaultColumnWidth = DEFAULT_COLUMN_WIDTH
|
|
1671
|
+
} = options;
|
|
1672
|
+
const columns = options.columns.filter((column) => !!column);
|
|
1673
|
+
if (!columns.length) {
|
|
1674
|
+
throw new Error("Excel export columns can not be empty.");
|
|
1675
|
+
}
|
|
1676
|
+
const { headerRows, leafColumns, merges } = buildHeaderMatrix(columns);
|
|
1677
|
+
const dataRows = data.map((row, rowIndex) => leafColumns.map((column) => getCellValue(row, rowIndex, column)));
|
|
1678
|
+
const columnWidths = buildColumnWidths(leafColumns, dataRows, defaultColumnWidth, autoWidth);
|
|
1679
|
+
const workbook = new ExcelJS.Workbook();
|
|
1680
|
+
const worksheet = workbook.addWorksheet(sheetName);
|
|
1681
|
+
[...headerRows, ...dataRows].forEach((row) => {
|
|
1682
|
+
worksheet.addRow(row);
|
|
1683
|
+
});
|
|
1684
|
+
applyMerges(worksheet, merges);
|
|
1685
|
+
applyColumnWidths(worksheet, columnWidths);
|
|
1686
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
1687
|
+
const blob = new Blob([buffer], { type: EXCEL_MIME_TYPE });
|
|
1688
|
+
saveAs(blob, normalizeFileName(fileName));
|
|
1689
|
+
}
|
|
1772
1690
|
const DEFAULT_EXPORT_FILE_NAME = "export-file";
|
|
1773
1691
|
function getHeaderValue(headers, headerName) {
|
|
1774
1692
|
var _a;
|
|
@@ -1904,10 +1822,7 @@ const _sfc_main$7 = defineComponent({
|
|
|
1904
1822
|
emit("start");
|
|
1905
1823
|
try {
|
|
1906
1824
|
if (exportMode.value === "excel" && props.excelOptions) {
|
|
1907
|
-
|
|
1908
|
-
return exportExcel$1;
|
|
1909
|
-
});
|
|
1910
|
-
await exportExcel2(props.excelOptions);
|
|
1825
|
+
await exportExcel(props.excelOptions);
|
|
1911
1826
|
if (props.autoMessage) {
|
|
1912
1827
|
ElMessage.success(props.successMessage);
|
|
1913
1828
|
}
|
|
@@ -1962,7 +1877,15 @@ const _sfc_main$7 = defineComponent({
|
|
|
1962
1877
|
}
|
|
1963
1878
|
});
|
|
1964
1879
|
var OutlinedInput_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
1965
|
-
const _hoisted_1$
|
|
1880
|
+
const _hoisted_1$6 = { class: "outlined-input__suffix-text" };
|
|
1881
|
+
const _hoisted_2$6 = {
|
|
1882
|
+
key: 0,
|
|
1883
|
+
class: "outlined-input__required"
|
|
1884
|
+
};
|
|
1885
|
+
const _hoisted_3$1 = {
|
|
1886
|
+
key: 1,
|
|
1887
|
+
class: "outlined-input__error"
|
|
1888
|
+
};
|
|
1966
1889
|
const _sfc_main$6 = defineComponent({
|
|
1967
1890
|
...{
|
|
1968
1891
|
name: "OutlinedInput",
|
|
@@ -1987,7 +1910,10 @@ const _sfc_main$6 = defineComponent({
|
|
|
1987
1910
|
clearable: { type: Boolean, default: false },
|
|
1988
1911
|
showWordLimit: { type: Boolean, default: true },
|
|
1989
1912
|
marginBottom: { default: 20 },
|
|
1990
|
-
paddingTop: { default: 20 }
|
|
1913
|
+
paddingTop: { default: 20 },
|
|
1914
|
+
required: { type: Boolean, default: false },
|
|
1915
|
+
error: { type: Boolean, default: false },
|
|
1916
|
+
errorMessage: { default: "" }
|
|
1991
1917
|
},
|
|
1992
1918
|
emits: ["input", "update:value", "warning", "focus", "blur", "change", "clear"],
|
|
1993
1919
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -2019,6 +1945,7 @@ const _sfc_main$6 = defineComponent({
|
|
|
2019
1945
|
});
|
|
2020
1946
|
const containerClasses = computed(() => ({
|
|
2021
1947
|
"outlined-input--bordered": props.isBorder,
|
|
1948
|
+
"outlined-input--error": hasError.value,
|
|
2022
1949
|
"outlined-input--textarea-default": resolvedType.value === "textarea" && !hasTextareaAutosize.value
|
|
2023
1950
|
}));
|
|
2024
1951
|
const containerStyle = computed(() => ({
|
|
@@ -2034,6 +1961,9 @@ const _sfc_main$6 = defineComponent({
|
|
|
2034
1961
|
};
|
|
2035
1962
|
});
|
|
2036
1963
|
const floatingLabel = computed(() => props.label || props.placeholder || "");
|
|
1964
|
+
const controlPlaceholder = computed(() => addRequiredMark(props.placeholder));
|
|
1965
|
+
const hasError = computed(() => Boolean(props.error));
|
|
1966
|
+
const resolvedErrorMessage = computed(() => props.errorMessage || createRequiredMessage(floatingLabel.value));
|
|
2037
1967
|
const hasContent = computed(() => hasFilledValue(inputValue.value));
|
|
2038
1968
|
const labelClasses = computed(() => ({
|
|
2039
1969
|
"outlined-input__label--floating": focused.value || hasContent.value,
|
|
@@ -2091,6 +2021,15 @@ const _sfc_main$6 = defineComponent({
|
|
|
2091
2021
|
}
|
|
2092
2022
|
return value;
|
|
2093
2023
|
}
|
|
2024
|
+
function addRequiredMark(value) {
|
|
2025
|
+
if (!props.required || !value || value.startsWith("*")) {
|
|
2026
|
+
return value;
|
|
2027
|
+
}
|
|
2028
|
+
return `*${value}`;
|
|
2029
|
+
}
|
|
2030
|
+
function createRequiredMessage(label) {
|
|
2031
|
+
return label ? `${label}\u4E3A\u5FC5\u586B\u9879` : "\u8BE5\u9879\u4E3A\u5FC5\u586B\u9879";
|
|
2032
|
+
}
|
|
2094
2033
|
__expose({
|
|
2095
2034
|
focus: () => {
|
|
2096
2035
|
var _a2;
|
|
@@ -2122,7 +2061,7 @@ const _sfc_main$6 = defineComponent({
|
|
|
2122
2061
|
}, inputAttrs.value, {
|
|
2123
2062
|
"model-value": inputValue.value,
|
|
2124
2063
|
type: resolvedType.value,
|
|
2125
|
-
placeholder:
|
|
2064
|
+
placeholder: controlPlaceholder.value,
|
|
2126
2065
|
disabled: __props.disabled,
|
|
2127
2066
|
maxlength: __props.maxlength,
|
|
2128
2067
|
max: __props.max,
|
|
@@ -2131,6 +2070,7 @@ const _sfc_main$6 = defineComponent({
|
|
|
2131
2070
|
"show-word-limit": __props.showWordLimit,
|
|
2132
2071
|
clearable: __props.clearable,
|
|
2133
2072
|
style: inputStyle.value,
|
|
2073
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
2134
2074
|
"onUpdate:modelValue": handleModelValueUpdate,
|
|
2135
2075
|
onFocus: handleFocus,
|
|
2136
2076
|
onBlur: handleBlur,
|
|
@@ -2162,22 +2102,34 @@ const _sfc_main$6 = defineComponent({
|
|
|
2162
2102
|
name: "suffix",
|
|
2163
2103
|
fn: withCtx(() => [
|
|
2164
2104
|
renderSlot(_ctx.$slots, "suffix", {}, () => [
|
|
2165
|
-
createElementVNode("span", _hoisted_1$
|
|
2105
|
+
createElementVNode("span", _hoisted_1$6, toDisplayString(__props.suffixText), 1)
|
|
2166
2106
|
], true)
|
|
2167
2107
|
]),
|
|
2168
2108
|
key: "3"
|
|
2169
2109
|
} : void 0
|
|
2170
|
-
]), 1040, ["model-value", "type", "placeholder", "disabled", "maxlength", "max", "min", "show-password", "show-word-limit", "clearable", "style"]),
|
|
2110
|
+
]), 1040, ["model-value", "type", "placeholder", "disabled", "maxlength", "max", "min", "show-password", "show-word-limit", "clearable", "style", "aria-invalid"]),
|
|
2171
2111
|
floatingLabel.value ? (openBlock(), createElementBlock("div", {
|
|
2172
2112
|
key: 0,
|
|
2173
2113
|
class: normalizeClass(["outlined-input__label", labelClasses.value])
|
|
2174
|
-
},
|
|
2114
|
+
}, [
|
|
2115
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_2$6, "*")) : createCommentVNode("", true),
|
|
2116
|
+
createElementVNode("span", null, toDisplayString(floatingLabel.value), 1)
|
|
2117
|
+
], 2)) : createCommentVNode("", true),
|
|
2118
|
+
hasError.value ? (openBlock(), createElementBlock("p", _hoisted_3$1, toDisplayString(resolvedErrorMessage.value), 1)) : createCommentVNode("", true)
|
|
2175
2119
|
], 6);
|
|
2176
2120
|
};
|
|
2177
2121
|
}
|
|
2178
2122
|
});
|
|
2179
|
-
var OutlinedInput = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-
|
|
2123
|
+
var OutlinedInput = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-3c232c9a"]]);
|
|
2180
2124
|
var OutlinedSelect_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
2125
|
+
const _hoisted_1$5 = {
|
|
2126
|
+
key: 0,
|
|
2127
|
+
class: "outlined-select__required"
|
|
2128
|
+
};
|
|
2129
|
+
const _hoisted_2$5 = {
|
|
2130
|
+
key: 1,
|
|
2131
|
+
class: "outlined-select__error"
|
|
2132
|
+
};
|
|
2181
2133
|
const _sfc_main$5 = defineComponent({
|
|
2182
2134
|
...{
|
|
2183
2135
|
name: "OutlinedSelect",
|
|
@@ -2204,7 +2156,10 @@ const _sfc_main$5 = defineComponent({
|
|
|
2204
2156
|
noCheck: { type: Boolean, default: false },
|
|
2205
2157
|
maxCollapseTags: { default: 5 },
|
|
2206
2158
|
marginBottom: { default: 20 },
|
|
2207
|
-
paddingTop: { default: 20 }
|
|
2159
|
+
paddingTop: { default: 20 },
|
|
2160
|
+
required: { type: Boolean, default: false },
|
|
2161
|
+
error: { type: Boolean, default: false },
|
|
2162
|
+
errorMessage: { default: "" }
|
|
2208
2163
|
},
|
|
2209
2164
|
emits: ["input", "update:value", "change", "focus", "blur", "visible-change", "clear"],
|
|
2210
2165
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -2231,7 +2186,8 @@ const _sfc_main$5 = defineComponent({
|
|
|
2231
2186
|
return rest;
|
|
2232
2187
|
});
|
|
2233
2188
|
const containerClasses = computed(() => ({
|
|
2234
|
-
"outlined-select--bordered": props.isBorder
|
|
2189
|
+
"outlined-select--bordered": props.isBorder,
|
|
2190
|
+
"outlined-select--error": hasError.value
|
|
2235
2191
|
}));
|
|
2236
2192
|
const containerStyle = computed(() => ({
|
|
2237
2193
|
marginBottom: toCssValue(props.marginBottom),
|
|
@@ -2242,6 +2198,9 @@ const _sfc_main$5 = defineComponent({
|
|
|
2242
2198
|
height: props.multiple ? "auto" : `${props.inputHeight}px`
|
|
2243
2199
|
}));
|
|
2244
2200
|
const floatingLabel = computed(() => props.label || props.placeholder || "");
|
|
2201
|
+
const controlPlaceholder = computed(() => addRequiredMark(props.placeholder));
|
|
2202
|
+
const hasError = computed(() => Boolean(props.error));
|
|
2203
|
+
const resolvedErrorMessage = computed(() => props.errorMessage || createRequiredMessage(floatingLabel.value));
|
|
2245
2204
|
const hasCustomOptionsSlot = computed(() => Boolean(slots.default));
|
|
2246
2205
|
const hasContent = computed(() => {
|
|
2247
2206
|
if (props.multiple) {
|
|
@@ -2325,6 +2284,15 @@ const _sfc_main$5 = defineComponent({
|
|
|
2325
2284
|
}
|
|
2326
2285
|
return value;
|
|
2327
2286
|
}
|
|
2287
|
+
function addRequiredMark(value) {
|
|
2288
|
+
if (!props.required || !value || value.startsWith("*")) {
|
|
2289
|
+
return value;
|
|
2290
|
+
}
|
|
2291
|
+
return `*${value}`;
|
|
2292
|
+
}
|
|
2293
|
+
function createRequiredMessage(label) {
|
|
2294
|
+
return label ? `${label}\u4E3A\u5FC5\u586B\u9879` : "\u8BE5\u9879\u4E3A\u5FC5\u586B\u9879";
|
|
2295
|
+
}
|
|
2328
2296
|
__expose({
|
|
2329
2297
|
focus: () => {
|
|
2330
2298
|
var _a, _b;
|
|
@@ -2368,7 +2336,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
2368
2336
|
}, selectAttrs.value, {
|
|
2369
2337
|
class: "outlined-select__control",
|
|
2370
2338
|
"model-value": selectValue.value,
|
|
2371
|
-
placeholder:
|
|
2339
|
+
placeholder: controlPlaceholder.value,
|
|
2372
2340
|
disabled: __props.disabled,
|
|
2373
2341
|
multiple: __props.multiple,
|
|
2374
2342
|
filterable: __props.filterable,
|
|
@@ -2377,6 +2345,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
2377
2345
|
"collapse-tags-tooltip": __props.collapseTagsTooltip,
|
|
2378
2346
|
"max-collapse-tags": __props.maxCollapseTags,
|
|
2379
2347
|
style: selectStyle.value,
|
|
2348
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
2380
2349
|
"onUpdate:modelValue": handleModelValueUpdate,
|
|
2381
2350
|
onFocus: handleFocus,
|
|
2382
2351
|
onBlur: handleBlur,
|
|
@@ -2407,17 +2376,29 @@ const _sfc_main$5 = defineComponent({
|
|
|
2407
2376
|
}), 128))
|
|
2408
2377
|
]),
|
|
2409
2378
|
_: 3
|
|
2410
|
-
}, 16, ["model-value", "placeholder", "disabled", "multiple", "filterable", "clearable", "collapse-tags", "collapse-tags-tooltip", "max-collapse-tags", "style"]),
|
|
2379
|
+
}, 16, ["model-value", "placeholder", "disabled", "multiple", "filterable", "clearable", "collapse-tags", "collapse-tags-tooltip", "max-collapse-tags", "style", "aria-invalid"]),
|
|
2411
2380
|
floatingLabel.value ? (openBlock(), createElementBlock("div", {
|
|
2412
2381
|
key: 0,
|
|
2413
2382
|
class: normalizeClass(["outlined-select__label", labelClasses.value])
|
|
2414
|
-
},
|
|
2383
|
+
}, [
|
|
2384
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_1$5, "*")) : createCommentVNode("", true),
|
|
2385
|
+
createElementVNode("span", null, toDisplayString(floatingLabel.value), 1)
|
|
2386
|
+
], 2)) : createCommentVNode("", true),
|
|
2387
|
+
hasError.value ? (openBlock(), createElementBlock("p", _hoisted_2$5, toDisplayString(resolvedErrorMessage.value), 1)) : createCommentVNode("", true)
|
|
2415
2388
|
], 6);
|
|
2416
2389
|
};
|
|
2417
2390
|
}
|
|
2418
2391
|
});
|
|
2419
|
-
var OutlinedSelect = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
2392
|
+
var OutlinedSelect = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-2a354461"]]);
|
|
2420
2393
|
var OutlinedDatePicker_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
2394
|
+
const _hoisted_1$4 = {
|
|
2395
|
+
key: 0,
|
|
2396
|
+
class: "outlined-date-picker__required"
|
|
2397
|
+
};
|
|
2398
|
+
const _hoisted_2$4 = {
|
|
2399
|
+
key: 1,
|
|
2400
|
+
class: "outlined-date-picker__error"
|
|
2401
|
+
};
|
|
2421
2402
|
const _sfc_main$4 = defineComponent({
|
|
2422
2403
|
...{
|
|
2423
2404
|
name: "OutlinedDatePicker",
|
|
@@ -2439,7 +2420,10 @@ const _sfc_main$4 = defineComponent({
|
|
|
2439
2420
|
isBorder: { type: Boolean, default: false },
|
|
2440
2421
|
disabledDate: { type: [String, Number, Date, Function], default: void 0 },
|
|
2441
2422
|
marginBottom: { default: 20 },
|
|
2442
|
-
paddingTop: { default: 20 }
|
|
2423
|
+
paddingTop: { default: 20 },
|
|
2424
|
+
required: { type: Boolean, default: false },
|
|
2425
|
+
error: { type: Boolean, default: false },
|
|
2426
|
+
errorMessage: { default: "" }
|
|
2443
2427
|
},
|
|
2444
2428
|
emits: ["input", "update:value", "change", "focus", "blur", "visible-change"],
|
|
2445
2429
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -2513,7 +2497,8 @@ const _sfc_main$4 = defineComponent({
|
|
|
2513
2497
|
};
|
|
2514
2498
|
});
|
|
2515
2499
|
const containerClasses = computed(() => ({
|
|
2516
|
-
"outlined-date-picker--bordered": props.isBorder
|
|
2500
|
+
"outlined-date-picker--bordered": props.isBorder,
|
|
2501
|
+
"outlined-date-picker--error": hasError.value
|
|
2517
2502
|
}));
|
|
2518
2503
|
const containerStyle = computed(() => ({
|
|
2519
2504
|
marginBottom: toCssValue(props.marginBottom),
|
|
@@ -2523,6 +2508,9 @@ const _sfc_main$4 = defineComponent({
|
|
|
2523
2508
|
height: `${props.inputHeight}px`
|
|
2524
2509
|
}));
|
|
2525
2510
|
const floatingLabel = computed(() => props.label || props.placeholder || "");
|
|
2511
|
+
const controlPlaceholder = computed(() => addRequiredMark(props.placeholder));
|
|
2512
|
+
const hasError = computed(() => Boolean(props.error));
|
|
2513
|
+
const resolvedErrorMessage = computed(() => props.errorMessage || createRequiredMessage(floatingLabel.value));
|
|
2526
2514
|
const hasContent = computed(() => hasFilledValue(pickerValue.value));
|
|
2527
2515
|
const labelClasses = computed(() => ({
|
|
2528
2516
|
"outlined-date-picker__label--floating": focused.value || hasContent.value,
|
|
@@ -2603,6 +2591,15 @@ const _sfc_main$4 = defineComponent({
|
|
|
2603
2591
|
}
|
|
2604
2592
|
return value;
|
|
2605
2593
|
}
|
|
2594
|
+
function addRequiredMark(value) {
|
|
2595
|
+
if (!props.required || !value || value.startsWith("*")) {
|
|
2596
|
+
return value;
|
|
2597
|
+
}
|
|
2598
|
+
return `*${value}`;
|
|
2599
|
+
}
|
|
2600
|
+
function createRequiredMessage(label) {
|
|
2601
|
+
return label ? `${label}\u4E3A\u5FC5\u586B\u9879` : "\u8BE5\u9879\u4E3A\u5FC5\u586B\u9879";
|
|
2602
|
+
}
|
|
2606
2603
|
__expose({
|
|
2607
2604
|
focus: () => {
|
|
2608
2605
|
var _a2, _b;
|
|
@@ -2637,24 +2634,29 @@ const _sfc_main$4 = defineComponent({
|
|
|
2637
2634
|
type: __props.typeDate,
|
|
2638
2635
|
format: __props.format,
|
|
2639
2636
|
"value-format": resolvedValueFormat.value,
|
|
2640
|
-
placeholder:
|
|
2637
|
+
placeholder: controlPlaceholder.value,
|
|
2641
2638
|
disabled: __props.disabled,
|
|
2642
2639
|
style: pickerStyle.value,
|
|
2640
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
2643
2641
|
"onUpdate:modelValue": handleModelValueUpdate,
|
|
2644
2642
|
onFocus: handleFocus,
|
|
2645
2643
|
onBlur: handleBlur,
|
|
2646
2644
|
onChange: handleChange,
|
|
2647
2645
|
onVisibleChange: handleVisibleChange
|
|
2648
|
-
}), null, 16, ["model-value", "type", "format", "value-format", "placeholder", "disabled", "style"]),
|
|
2646
|
+
}), null, 16, ["model-value", "type", "format", "value-format", "placeholder", "disabled", "style", "aria-invalid"]),
|
|
2649
2647
|
floatingLabel.value ? (openBlock(), createElementBlock("div", {
|
|
2650
2648
|
key: 0,
|
|
2651
2649
|
class: normalizeClass(["outlined-date-picker__label", labelClasses.value])
|
|
2652
|
-
},
|
|
2650
|
+
}, [
|
|
2651
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_1$4, "*")) : createCommentVNode("", true),
|
|
2652
|
+
createElementVNode("span", null, toDisplayString(floatingLabel.value), 1)
|
|
2653
|
+
], 2)) : createCommentVNode("", true),
|
|
2654
|
+
hasError.value ? (openBlock(), createElementBlock("p", _hoisted_2$4, toDisplayString(resolvedErrorMessage.value), 1)) : createCommentVNode("", true)
|
|
2653
2655
|
], 6);
|
|
2654
2656
|
};
|
|
2655
2657
|
}
|
|
2656
2658
|
});
|
|
2657
|
-
var OutlinedDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
2659
|
+
var OutlinedDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-47219caf"]]);
|
|
2658
2660
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2659
2661
|
var dayjs_min = { exports: {} };
|
|
2660
2662
|
(function(module, exports) {
|
|
@@ -2948,7 +2950,20 @@ var dayjs_min = { exports: {} };
|
|
|
2948
2950
|
})(dayjs_min);
|
|
2949
2951
|
var dayjs = dayjs_min.exports;
|
|
2950
2952
|
var OutlinedDateTimePicker_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
2951
|
-
const _hoisted_1 = { class: "outlined-date-time-
|
|
2953
|
+
const _hoisted_1$3 = { class: "outlined-date-time-picker__inner" };
|
|
2954
|
+
const _hoisted_2$3 = {
|
|
2955
|
+
key: 0,
|
|
2956
|
+
class: "outlined-date-time-picker__required"
|
|
2957
|
+
};
|
|
2958
|
+
const _hoisted_3 = { class: "outlined-date-time-picker__separator" };
|
|
2959
|
+
const _hoisted_4 = {
|
|
2960
|
+
key: 0,
|
|
2961
|
+
class: "outlined-date-time-picker__required"
|
|
2962
|
+
};
|
|
2963
|
+
const _hoisted_5 = {
|
|
2964
|
+
key: 0,
|
|
2965
|
+
class: "outlined-date-time-picker__error"
|
|
2966
|
+
};
|
|
2952
2967
|
const _sfc_main$3 = defineComponent({
|
|
2953
2968
|
...{
|
|
2954
2969
|
name: "OutlinedDateTimePicker",
|
|
@@ -2966,7 +2981,10 @@ const _sfc_main$3 = defineComponent({
|
|
|
2966
2981
|
timePlaceholder: { default: "\u65F6\u95F4" },
|
|
2967
2982
|
clearable: { type: Boolean, default: false },
|
|
2968
2983
|
marginBottom: { default: 20 },
|
|
2969
|
-
paddingTop: { default: 20 }
|
|
2984
|
+
paddingTop: { default: 20 },
|
|
2985
|
+
required: { type: Boolean, default: false },
|
|
2986
|
+
error: { type: Boolean, default: false },
|
|
2987
|
+
errorMessage: { default: "" }
|
|
2970
2988
|
},
|
|
2971
2989
|
emits: ["input", "update:value", "change", "focus", "blur", "visible-change"],
|
|
2972
2990
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -2993,16 +3011,24 @@ const _sfc_main$3 = defineComponent({
|
|
|
2993
3011
|
const rootClass = computed(() => attrs.class);
|
|
2994
3012
|
const rootStyle = computed(() => attrs.style);
|
|
2995
3013
|
const floatingLabel = computed(() => props.label || props.placeholder || "");
|
|
2996
|
-
const
|
|
2997
|
-
"outlined-date-time-
|
|
3014
|
+
const containerClasses = computed(() => ({
|
|
3015
|
+
"outlined-date-time-picker--error": hasError.value
|
|
2998
3016
|
}));
|
|
2999
|
-
const
|
|
3017
|
+
const containerStyle = computed(() => ({
|
|
3000
3018
|
marginBottom: toCssValue(props.marginBottom),
|
|
3001
3019
|
paddingTop: toCssValue(props.paddingTop)
|
|
3002
3020
|
}));
|
|
3021
|
+
const fieldClasses = computed(() => ({
|
|
3022
|
+
"outlined-date-time-picker__field--bordered": props.isBorder,
|
|
3023
|
+
"outlined-date-time-picker__field--error": hasError.value
|
|
3024
|
+
}));
|
|
3003
3025
|
const controlStyle = computed(() => ({
|
|
3004
3026
|
height: `${props.inputHeight}px`
|
|
3005
3027
|
}));
|
|
3028
|
+
const datePlaceholder = computed(() => addRequiredMark(props.placeholder));
|
|
3029
|
+
const timeControlPlaceholder = computed(() => addRequiredMark(props.timePlaceholder));
|
|
3030
|
+
const hasError = computed(() => Boolean(props.error));
|
|
3031
|
+
const resolvedErrorMessage = computed(() => props.errorMessage || createRequiredMessage(floatingLabel.value));
|
|
3006
3032
|
const resolvedDisabledDate = computed(() => createDisabledDateHandler(props.disabledDate));
|
|
3007
3033
|
const resolvedDisabledHours = computed(() => {
|
|
3008
3034
|
if (!shouldLimitCurrentTime()) {
|
|
@@ -3136,6 +3162,15 @@ const _sfc_main$3 = defineComponent({
|
|
|
3136
3162
|
}
|
|
3137
3163
|
return value;
|
|
3138
3164
|
}
|
|
3165
|
+
function addRequiredMark(value) {
|
|
3166
|
+
if (!props.required || !value || value.startsWith("*")) {
|
|
3167
|
+
return value;
|
|
3168
|
+
}
|
|
3169
|
+
return `*${value}`;
|
|
3170
|
+
}
|
|
3171
|
+
function createRequiredMessage(label) {
|
|
3172
|
+
return label ? `${label}\u4E3A\u5FC5\u586B\u9879` : "\u8BE5\u9879\u4E3A\u5FC5\u586B\u9879";
|
|
3173
|
+
}
|
|
3139
3174
|
__expose({
|
|
3140
3175
|
focusDate: () => {
|
|
3141
3176
|
var _a, _b;
|
|
@@ -3168,70 +3203,87 @@ const _sfc_main$3 = defineComponent({
|
|
|
3168
3203
|
const _component_el_date_picker = resolveComponent("el-date-picker");
|
|
3169
3204
|
const _component_el_time_picker = resolveComponent("el-time-picker");
|
|
3170
3205
|
return openBlock(), createElementBlock("div", {
|
|
3171
|
-
class: normalizeClass(["outlined-date-time-picker", [rootClass.value]]),
|
|
3172
|
-
style: normalizeStyle(rootStyle.value)
|
|
3206
|
+
class: normalizeClass(["outlined-date-time-picker", [containerClasses.value, rootClass.value]]),
|
|
3207
|
+
style: normalizeStyle([containerStyle.value, rootStyle.value])
|
|
3173
3208
|
}, [
|
|
3174
|
-
createElementVNode("div",
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
createVNode(_component_el_time_picker, {
|
|
3207
|
-
ref_key: "timePickerRef",
|
|
3208
|
-
ref: timePickerRef,
|
|
3209
|
-
class: "outlined-date-time-picker__control",
|
|
3210
|
-
"model-value": timeValue.value,
|
|
3211
|
-
format: "HH:mm",
|
|
3212
|
-
"value-format": "HH:mm",
|
|
3213
|
-
placeholder: __props.timePlaceholder,
|
|
3214
|
-
clearable: __props.clearable,
|
|
3215
|
-
disabled: !dateValue.value,
|
|
3216
|
-
"disabled-hours": resolvedDisabledHours.value,
|
|
3217
|
-
"disabled-minutes": resolvedDisabledMinutes.value,
|
|
3218
|
-
style: normalizeStyle(controlStyle.value),
|
|
3219
|
-
"onUpdate:modelValue": handleTimeUpdate,
|
|
3220
|
-
onFocus: _cache[3] || (_cache[3] = ($event) => handleFocus("time")),
|
|
3221
|
-
onBlur: _cache[4] || (_cache[4] = ($event) => handleBlur("time", $event)),
|
|
3222
|
-
onChange: handleTimeChange,
|
|
3223
|
-
onVisibleChange: _cache[5] || (_cache[5] = ($event) => handleVisibleChange("time", $event))
|
|
3224
|
-
}, null, 8, ["model-value", "placeholder", "clearable", "disabled", "disabled-hours", "disabled-minutes", "style"]),
|
|
3209
|
+
createElementVNode("div", _hoisted_1$3, [
|
|
3210
|
+
createElementVNode("div", {
|
|
3211
|
+
class: normalizeClass(["outlined-date-time-picker__field", fieldClasses.value])
|
|
3212
|
+
}, [
|
|
3213
|
+
createVNode(_component_el_date_picker, {
|
|
3214
|
+
ref_key: "datePickerRef",
|
|
3215
|
+
ref: datePickerRef,
|
|
3216
|
+
class: "outlined-date-time-picker__control",
|
|
3217
|
+
"model-value": dateValue.value,
|
|
3218
|
+
type: "date",
|
|
3219
|
+
format: "YYYY-MM-DD",
|
|
3220
|
+
"value-format": "YYYY-MM-DD",
|
|
3221
|
+
placeholder: datePlaceholder.value,
|
|
3222
|
+
clearable: __props.clearable,
|
|
3223
|
+
"disabled-date": resolvedDisabledDate.value,
|
|
3224
|
+
style: normalizeStyle(controlStyle.value),
|
|
3225
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
3226
|
+
"onUpdate:modelValue": handleDateUpdate,
|
|
3227
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => handleFocus("date")),
|
|
3228
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => handleBlur("date", $event)),
|
|
3229
|
+
onChange: handleDateChange,
|
|
3230
|
+
onVisibleChange: _cache[2] || (_cache[2] = ($event) => handleVisibleChange("date", $event))
|
|
3231
|
+
}, null, 8, ["model-value", "placeholder", "clearable", "disabled-date", "style", "aria-invalid"]),
|
|
3232
|
+
floatingLabel.value ? (openBlock(), createElementBlock("div", {
|
|
3233
|
+
key: 0,
|
|
3234
|
+
class: normalizeClass(["outlined-date-time-picker__label", dateLabelClasses.value])
|
|
3235
|
+
}, [
|
|
3236
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_2$3, "*")) : createCommentVNode("", true),
|
|
3237
|
+
createElementVNode("span", null, toDisplayString(floatingLabel.value), 1)
|
|
3238
|
+
], 2)) : createCommentVNode("", true)
|
|
3239
|
+
], 2),
|
|
3240
|
+
createElementVNode("span", _hoisted_3, toDisplayString(__props.separatorText), 1),
|
|
3225
3241
|
createElementVNode("div", {
|
|
3226
|
-
class: normalizeClass(["outlined-date-time-
|
|
3227
|
-
},
|
|
3228
|
-
|
|
3242
|
+
class: normalizeClass(["outlined-date-time-picker__field", fieldClasses.value])
|
|
3243
|
+
}, [
|
|
3244
|
+
createVNode(_component_el_time_picker, {
|
|
3245
|
+
ref_key: "timePickerRef",
|
|
3246
|
+
ref: timePickerRef,
|
|
3247
|
+
class: "outlined-date-time-picker__control",
|
|
3248
|
+
"model-value": timeValue.value,
|
|
3249
|
+
format: "HH:mm",
|
|
3250
|
+
"value-format": "HH:mm",
|
|
3251
|
+
placeholder: timeControlPlaceholder.value,
|
|
3252
|
+
clearable: __props.clearable,
|
|
3253
|
+
disabled: !dateValue.value,
|
|
3254
|
+
"disabled-hours": resolvedDisabledHours.value,
|
|
3255
|
+
"disabled-minutes": resolvedDisabledMinutes.value,
|
|
3256
|
+
style: normalizeStyle(controlStyle.value),
|
|
3257
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
3258
|
+
"onUpdate:modelValue": handleTimeUpdate,
|
|
3259
|
+
onFocus: _cache[3] || (_cache[3] = ($event) => handleFocus("time")),
|
|
3260
|
+
onBlur: _cache[4] || (_cache[4] = ($event) => handleBlur("time", $event)),
|
|
3261
|
+
onChange: handleTimeChange,
|
|
3262
|
+
onVisibleChange: _cache[5] || (_cache[5] = ($event) => handleVisibleChange("time", $event))
|
|
3263
|
+
}, null, 8, ["model-value", "placeholder", "clearable", "disabled", "disabled-hours", "disabled-minutes", "style", "aria-invalid"]),
|
|
3264
|
+
createElementVNode("div", {
|
|
3265
|
+
class: normalizeClass(["outlined-date-time-picker__label", timeLabelClasses.value])
|
|
3266
|
+
}, [
|
|
3267
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_4, "*")) : createCommentVNode("", true),
|
|
3268
|
+
createElementVNode("span", null, toDisplayString(__props.timePlaceholder), 1)
|
|
3269
|
+
], 2)
|
|
3270
|
+
], 2)
|
|
3271
|
+
]),
|
|
3272
|
+
hasError.value ? (openBlock(), createElementBlock("p", _hoisted_5, toDisplayString(resolvedErrorMessage.value), 1)) : createCommentVNode("", true)
|
|
3229
3273
|
], 6);
|
|
3230
3274
|
};
|
|
3231
3275
|
}
|
|
3232
3276
|
});
|
|
3233
|
-
var OutlinedDateTimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
3277
|
+
var OutlinedDateTimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-ee2ef524"]]);
|
|
3234
3278
|
var OutlinedTimePicker_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
3279
|
+
const _hoisted_1$2 = {
|
|
3280
|
+
key: 0,
|
|
3281
|
+
class: "outlined-time-picker__required"
|
|
3282
|
+
};
|
|
3283
|
+
const _hoisted_2$2 = {
|
|
3284
|
+
key: 1,
|
|
3285
|
+
class: "outlined-time-picker__error"
|
|
3286
|
+
};
|
|
3235
3287
|
const _sfc_main$2 = defineComponent({
|
|
3236
3288
|
...{
|
|
3237
3289
|
name: "OutlinedTimePicker",
|
|
@@ -3254,7 +3306,10 @@ const _sfc_main$2 = defineComponent({
|
|
|
3254
3306
|
inputHeight: { default: 40 },
|
|
3255
3307
|
isBorder: { type: Boolean, default: false },
|
|
3256
3308
|
marginBottom: { default: 20 },
|
|
3257
|
-
paddingTop: { default: 20 }
|
|
3309
|
+
paddingTop: { default: 20 },
|
|
3310
|
+
required: { type: Boolean, default: false },
|
|
3311
|
+
error: { type: Boolean, default: false },
|
|
3312
|
+
errorMessage: { default: "" }
|
|
3258
3313
|
},
|
|
3259
3314
|
emits: ["input", "update:value", "change", "focus", "blur", "visible-change", "clear"],
|
|
3260
3315
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -3281,7 +3336,8 @@ const _sfc_main$2 = defineComponent({
|
|
|
3281
3336
|
return rest;
|
|
3282
3337
|
});
|
|
3283
3338
|
const containerClasses = computed(() => ({
|
|
3284
|
-
"outlined-time-picker--bordered": props.isBorder
|
|
3339
|
+
"outlined-time-picker--bordered": props.isBorder,
|
|
3340
|
+
"outlined-time-picker--error": hasError.value
|
|
3285
3341
|
}));
|
|
3286
3342
|
const containerStyle = computed(() => ({
|
|
3287
3343
|
marginBottom: toCssValue(props.marginBottom),
|
|
@@ -3291,6 +3347,11 @@ const _sfc_main$2 = defineComponent({
|
|
|
3291
3347
|
height: `${props.inputHeight}px`
|
|
3292
3348
|
}));
|
|
3293
3349
|
const floatingLabel = computed(() => props.label || props.placeholder || "");
|
|
3350
|
+
const controlPlaceholder = computed(() => addRequiredMark(props.placeholder));
|
|
3351
|
+
const controlStartPlaceholder = computed(() => addRequiredMark(props.startPlaceholder));
|
|
3352
|
+
const controlEndPlaceholder = computed(() => addRequiredMark(props.endPlaceholder));
|
|
3353
|
+
const hasError = computed(() => Boolean(props.error));
|
|
3354
|
+
const resolvedErrorMessage = computed(() => props.errorMessage || createRequiredMessage(floatingLabel.value));
|
|
3294
3355
|
const hasContent = computed(() => {
|
|
3295
3356
|
if (Array.isArray(pickerValue.value)) {
|
|
3296
3357
|
return pickerValue.value.length > 0;
|
|
@@ -3360,6 +3421,15 @@ const _sfc_main$2 = defineComponent({
|
|
|
3360
3421
|
}
|
|
3361
3422
|
return value;
|
|
3362
3423
|
}
|
|
3424
|
+
function addRequiredMark(value) {
|
|
3425
|
+
if (!props.required || !value || value.startsWith("*")) {
|
|
3426
|
+
return value;
|
|
3427
|
+
}
|
|
3428
|
+
return `*${value}`;
|
|
3429
|
+
}
|
|
3430
|
+
function createRequiredMessage(label) {
|
|
3431
|
+
return label ? `${label}\u4E3A\u5FC5\u586B\u9879` : "\u8BE5\u9879\u4E3A\u5FC5\u586B\u9879";
|
|
3432
|
+
}
|
|
3363
3433
|
__expose({
|
|
3364
3434
|
focus: () => {
|
|
3365
3435
|
var _a, _b;
|
|
@@ -3401,31 +3471,44 @@ const _sfc_main$2 = defineComponent({
|
|
|
3401
3471
|
"is-range": __props.isRange,
|
|
3402
3472
|
format: __props.format,
|
|
3403
3473
|
"value-format": resolvedValueFormat.value,
|
|
3404
|
-
placeholder:
|
|
3405
|
-
"start-placeholder":
|
|
3406
|
-
"end-placeholder":
|
|
3474
|
+
placeholder: controlPlaceholder.value,
|
|
3475
|
+
"start-placeholder": controlStartPlaceholder.value,
|
|
3476
|
+
"end-placeholder": controlEndPlaceholder.value,
|
|
3407
3477
|
"range-separator": __props.rangeSeparator,
|
|
3408
3478
|
disabled: __props.disabled,
|
|
3409
3479
|
clearable: __props.clearable,
|
|
3410
3480
|
"arrow-control": __props.arrowControl,
|
|
3411
3481
|
style: pickerStyle.value,
|
|
3482
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
3412
3483
|
"onUpdate:modelValue": handleModelValueUpdate,
|
|
3413
3484
|
onFocus: handleFocus,
|
|
3414
3485
|
onBlur: handleBlur,
|
|
3415
3486
|
onChange: handleChange,
|
|
3416
3487
|
onVisibleChange: handleVisibleChange,
|
|
3417
3488
|
onClear: handleClear
|
|
3418
|
-
}), null, 16, ["model-value", "is-range", "format", "value-format", "placeholder", "start-placeholder", "end-placeholder", "range-separator", "disabled", "clearable", "arrow-control", "style"]),
|
|
3489
|
+
}), null, 16, ["model-value", "is-range", "format", "value-format", "placeholder", "start-placeholder", "end-placeholder", "range-separator", "disabled", "clearable", "arrow-control", "style", "aria-invalid"]),
|
|
3419
3490
|
floatingLabel.value ? (openBlock(), createElementBlock("div", {
|
|
3420
3491
|
key: 0,
|
|
3421
3492
|
class: normalizeClass(["outlined-time-picker__label", labelClasses.value])
|
|
3422
|
-
},
|
|
3493
|
+
}, [
|
|
3494
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_1$2, "*")) : createCommentVNode("", true),
|
|
3495
|
+
createElementVNode("span", null, toDisplayString(floatingLabel.value), 1)
|
|
3496
|
+
], 2)) : createCommentVNode("", true),
|
|
3497
|
+
hasError.value ? (openBlock(), createElementBlock("p", _hoisted_2$2, toDisplayString(resolvedErrorMessage.value), 1)) : createCommentVNode("", true)
|
|
3423
3498
|
], 6);
|
|
3424
3499
|
};
|
|
3425
3500
|
}
|
|
3426
3501
|
});
|
|
3427
|
-
var OutlinedTimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3502
|
+
var OutlinedTimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-0257087e"]]);
|
|
3428
3503
|
var OutlinedCascader_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
3504
|
+
const _hoisted_1$1 = {
|
|
3505
|
+
key: 0,
|
|
3506
|
+
class: "outlined-cascader__required"
|
|
3507
|
+
};
|
|
3508
|
+
const _hoisted_2$1 = {
|
|
3509
|
+
key: 1,
|
|
3510
|
+
class: "outlined-cascader__error"
|
|
3511
|
+
};
|
|
3429
3512
|
const _sfc_main$1 = defineComponent({
|
|
3430
3513
|
...{
|
|
3431
3514
|
name: "OutlinedCascader",
|
|
@@ -3446,7 +3529,10 @@ const _sfc_main$1 = defineComponent({
|
|
|
3446
3529
|
filterable: { type: Boolean, default: true },
|
|
3447
3530
|
levels: { type: Boolean, default: true },
|
|
3448
3531
|
marginBottom: { default: 20 },
|
|
3449
|
-
paddingTop: { default: 20 }
|
|
3532
|
+
paddingTop: { default: 20 },
|
|
3533
|
+
required: { type: Boolean, default: false },
|
|
3534
|
+
error: { type: Boolean, default: false },
|
|
3535
|
+
errorMessage: { default: "" }
|
|
3450
3536
|
},
|
|
3451
3537
|
emits: ["input", "update:value", "change", "focus", "blur", "visible-change"],
|
|
3452
3538
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -3472,7 +3558,8 @@ const _sfc_main$1 = defineComponent({
|
|
|
3472
3558
|
return rest;
|
|
3473
3559
|
});
|
|
3474
3560
|
const containerClasses = computed(() => ({
|
|
3475
|
-
"outlined-cascader--bordered": props.isBorder
|
|
3561
|
+
"outlined-cascader--bordered": props.isBorder,
|
|
3562
|
+
"outlined-cascader--error": hasError.value
|
|
3476
3563
|
}));
|
|
3477
3564
|
const containerStyle = computed(() => ({
|
|
3478
3565
|
marginBottom: toCssValue(props.marginBottom),
|
|
@@ -3483,6 +3570,9 @@ const _sfc_main$1 = defineComponent({
|
|
|
3483
3570
|
height: `${props.inputHeight}px`
|
|
3484
3571
|
}));
|
|
3485
3572
|
const floatingLabel = computed(() => props.label || props.placeholder || "");
|
|
3573
|
+
const controlPlaceholder = computed(() => addRequiredMark(props.placeholder));
|
|
3574
|
+
const hasError = computed(() => Boolean(props.error));
|
|
3575
|
+
const resolvedErrorMessage = computed(() => props.errorMessage || createRequiredMessage(floatingLabel.value));
|
|
3486
3576
|
const hasContent = computed(() => cascaderValue.value.length > 0);
|
|
3487
3577
|
const labelClasses = computed(() => ({
|
|
3488
3578
|
"outlined-cascader__label--floating": focused.value || hasContent.value,
|
|
@@ -3532,6 +3622,15 @@ const _sfc_main$1 = defineComponent({
|
|
|
3532
3622
|
}
|
|
3533
3623
|
return value;
|
|
3534
3624
|
}
|
|
3625
|
+
function addRequiredMark(value) {
|
|
3626
|
+
if (!props.required || !value || value.startsWith("*")) {
|
|
3627
|
+
return value;
|
|
3628
|
+
}
|
|
3629
|
+
return `*${value}`;
|
|
3630
|
+
}
|
|
3631
|
+
function createRequiredMessage(label) {
|
|
3632
|
+
return label ? `${label}\u4E3A\u5FC5\u586B\u9879` : "\u8BE5\u9879\u4E3A\u5FC5\u586B\u9879";
|
|
3633
|
+
}
|
|
3535
3634
|
__expose({
|
|
3536
3635
|
focus: () => {
|
|
3537
3636
|
var _a, _b;
|
|
@@ -3567,28 +3666,41 @@ const _sfc_main$1 = defineComponent({
|
|
|
3567
3666
|
options: __props.options,
|
|
3568
3667
|
props: __props.propsValue,
|
|
3569
3668
|
clearable: __props.clearable,
|
|
3570
|
-
placeholder:
|
|
3669
|
+
placeholder: controlPlaceholder.value,
|
|
3571
3670
|
filterable: __props.filterable,
|
|
3572
3671
|
"show-all-levels": __props.levels,
|
|
3573
3672
|
disabled: __props.disabled,
|
|
3574
3673
|
"popper-class": __props.popperClass,
|
|
3575
3674
|
style: cascaderStyle.value,
|
|
3675
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
3576
3676
|
"onUpdate:modelValue": handleModelValueUpdate,
|
|
3577
3677
|
onFocus: handleFocus,
|
|
3578
3678
|
onBlur: handleBlur,
|
|
3579
3679
|
onChange: handleChange,
|
|
3580
3680
|
onVisibleChange: handleVisibleChange
|
|
3581
|
-
}), null, 16, ["model-value", "options", "props", "clearable", "placeholder", "filterable", "show-all-levels", "disabled", "popper-class", "style"]),
|
|
3681
|
+
}), null, 16, ["model-value", "options", "props", "clearable", "placeholder", "filterable", "show-all-levels", "disabled", "popper-class", "style", "aria-invalid"]),
|
|
3582
3682
|
floatingLabel.value ? (openBlock(), createElementBlock("div", {
|
|
3583
3683
|
key: 0,
|
|
3584
3684
|
class: normalizeClass(["outlined-cascader__label", labelClasses.value])
|
|
3585
|
-
},
|
|
3685
|
+
}, [
|
|
3686
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_1$1, "*")) : createCommentVNode("", true),
|
|
3687
|
+
createElementVNode("span", null, toDisplayString(floatingLabel.value), 1)
|
|
3688
|
+
], 2)) : createCommentVNode("", true),
|
|
3689
|
+
hasError.value ? (openBlock(), createElementBlock("p", _hoisted_2$1, toDisplayString(resolvedErrorMessage.value), 1)) : createCommentVNode("", true)
|
|
3586
3690
|
], 6);
|
|
3587
3691
|
};
|
|
3588
3692
|
}
|
|
3589
3693
|
});
|
|
3590
|
-
var OutlinedCascader = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
3694
|
+
var OutlinedCascader = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-033e3fab"]]);
|
|
3591
3695
|
var OutlinedTreeSelect_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
3696
|
+
const _hoisted_1 = {
|
|
3697
|
+
key: 0,
|
|
3698
|
+
class: "outlined-tree-select__required"
|
|
3699
|
+
};
|
|
3700
|
+
const _hoisted_2 = {
|
|
3701
|
+
key: 1,
|
|
3702
|
+
class: "outlined-tree-select__error"
|
|
3703
|
+
};
|
|
3592
3704
|
const _sfc_main = defineComponent({
|
|
3593
3705
|
...{
|
|
3594
3706
|
name: "OutlinedTreeSelect",
|
|
@@ -3623,7 +3735,10 @@ const _sfc_main = defineComponent({
|
|
|
3623
3735
|
inputHeight: { default: 40 },
|
|
3624
3736
|
isBorder: { type: Boolean, default: false },
|
|
3625
3737
|
marginBottom: { default: 20 },
|
|
3626
|
-
paddingTop: { default: 20 }
|
|
3738
|
+
paddingTop: { default: 20 },
|
|
3739
|
+
required: { type: Boolean, default: false },
|
|
3740
|
+
error: { type: Boolean, default: false },
|
|
3741
|
+
errorMessage: { default: "" }
|
|
3627
3742
|
},
|
|
3628
3743
|
emits: ["input", "update:value", "change", "focus", "blur", "visible-change", "clear"],
|
|
3629
3744
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -3649,7 +3764,8 @@ const _sfc_main = defineComponent({
|
|
|
3649
3764
|
return rest;
|
|
3650
3765
|
});
|
|
3651
3766
|
const containerClasses = computed(() => ({
|
|
3652
|
-
"outlined-tree-select--bordered": props.isBorder
|
|
3767
|
+
"outlined-tree-select--bordered": props.isBorder,
|
|
3768
|
+
"outlined-tree-select--error": hasError.value
|
|
3653
3769
|
}));
|
|
3654
3770
|
const containerStyle = computed(() => ({
|
|
3655
3771
|
marginBottom: toCssValue(props.marginBottom),
|
|
@@ -3671,6 +3787,9 @@ const _sfc_main = defineComponent({
|
|
|
3671
3787
|
};
|
|
3672
3788
|
});
|
|
3673
3789
|
const floatingLabel = computed(() => props.label || props.placeholder || "");
|
|
3790
|
+
const controlPlaceholder = computed(() => addRequiredMark(props.placeholder));
|
|
3791
|
+
const hasError = computed(() => Boolean(props.error));
|
|
3792
|
+
const resolvedErrorMessage = computed(() => props.errorMessage || createRequiredMessage(floatingLabel.value));
|
|
3674
3793
|
const hasContent = computed(() => {
|
|
3675
3794
|
if (isArrayMode()) {
|
|
3676
3795
|
return Array.isArray(treeSelectValue.value) && treeSelectValue.value.length > 0;
|
|
@@ -3743,6 +3862,15 @@ const _sfc_main = defineComponent({
|
|
|
3743
3862
|
}
|
|
3744
3863
|
return value;
|
|
3745
3864
|
}
|
|
3865
|
+
function addRequiredMark(value) {
|
|
3866
|
+
if (!props.required || !value || value.startsWith("*")) {
|
|
3867
|
+
return value;
|
|
3868
|
+
}
|
|
3869
|
+
return `*${value}`;
|
|
3870
|
+
}
|
|
3871
|
+
function createRequiredMessage(label) {
|
|
3872
|
+
return label ? `${label}\u4E3A\u5FC5\u586B\u9879` : "\u8BE5\u9879\u4E3A\u5FC5\u586B\u9879";
|
|
3873
|
+
}
|
|
3746
3874
|
__expose({
|
|
3747
3875
|
focus: () => {
|
|
3748
3876
|
var _a, _b;
|
|
@@ -3781,7 +3909,7 @@ const _sfc_main = defineComponent({
|
|
|
3781
3909
|
"model-value": treeSelectValue.value,
|
|
3782
3910
|
data: __props.data,
|
|
3783
3911
|
props: resolvedTreeProps.value,
|
|
3784
|
-
placeholder:
|
|
3912
|
+
placeholder: controlPlaceholder.value,
|
|
3785
3913
|
disabled: __props.disabled,
|
|
3786
3914
|
clearable: __props.clearable,
|
|
3787
3915
|
filterable: __props.filterable,
|
|
@@ -3798,6 +3926,7 @@ const _sfc_main = defineComponent({
|
|
|
3798
3926
|
"popper-class": __props.popperClass,
|
|
3799
3927
|
"node-key": __props.nodeKey,
|
|
3800
3928
|
style: treeSelectStyle.value,
|
|
3929
|
+
"aria-invalid": hasError.value ? "true" : void 0,
|
|
3801
3930
|
"onUpdate:modelValue": handleModelValueUpdate,
|
|
3802
3931
|
onFocus: handleFocus,
|
|
3803
3932
|
onBlur: handleBlur,
|
|
@@ -3815,149 +3944,19 @@ const _sfc_main = defineComponent({
|
|
|
3815
3944
|
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
3816
3945
|
]),
|
|
3817
3946
|
_: 3
|
|
3818
|
-
}, 16, ["model-value", "data", "props", "placeholder", "disabled", "clearable", "filterable", "multiple", "show-checkbox", "check-strictly", "check-on-click-node", "default-expand-all", "expand-on-click-node", "render-after-expand", "collapse-tags", "collapse-tags-tooltip", "max-collapse-tags", "popper-class", "node-key", "style"]),
|
|
3947
|
+
}, 16, ["model-value", "data", "props", "placeholder", "disabled", "clearable", "filterable", "multiple", "show-checkbox", "check-strictly", "check-on-click-node", "default-expand-all", "expand-on-click-node", "render-after-expand", "collapse-tags", "collapse-tags-tooltip", "max-collapse-tags", "popper-class", "node-key", "style", "aria-invalid"]),
|
|
3819
3948
|
floatingLabel.value ? (openBlock(), createElementBlock("div", {
|
|
3820
3949
|
key: 0,
|
|
3821
3950
|
class: normalizeClass(["outlined-tree-select__label", labelClasses.value])
|
|
3822
|
-
},
|
|
3951
|
+
}, [
|
|
3952
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_1, "*")) : createCommentVNode("", true),
|
|
3953
|
+
createElementVNode("span", null, toDisplayString(floatingLabel.value), 1)
|
|
3954
|
+
], 2)) : createCommentVNode("", true),
|
|
3955
|
+
hasError.value ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(resolvedErrorMessage.value), 1)) : createCommentVNode("", true)
|
|
3823
3956
|
], 6);
|
|
3824
3957
|
};
|
|
3825
3958
|
}
|
|
3826
3959
|
});
|
|
3827
|
-
var OutlinedTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
const EXCEL_MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
3831
|
-
function getLeafCount(column) {
|
|
3832
|
-
var _a;
|
|
3833
|
-
if (!((_a = column.children) == null ? void 0 : _a.length)) {
|
|
3834
|
-
return 1;
|
|
3835
|
-
}
|
|
3836
|
-
return column.children.reduce((count, child) => count + getLeafCount(child), 0);
|
|
3837
|
-
}
|
|
3838
|
-
function getMaxDepth(columns, depth = 1) {
|
|
3839
|
-
return columns.reduce((maxDepth, column) => {
|
|
3840
|
-
var _a;
|
|
3841
|
-
if (!((_a = column.children) == null ? void 0 : _a.length)) {
|
|
3842
|
-
return Math.max(maxDepth, depth);
|
|
3843
|
-
}
|
|
3844
|
-
return Math.max(maxDepth, getMaxDepth(column.children, depth + 1));
|
|
3845
|
-
}, depth);
|
|
3846
|
-
}
|
|
3847
|
-
function getDisplayLength(value) {
|
|
3848
|
-
const text = `${value != null ? value : ""}`;
|
|
3849
|
-
return Array.from(text).reduce((length, char) => {
|
|
3850
|
-
return length + (char.charCodeAt(0) > 255 ? 2 : 1);
|
|
3851
|
-
}, 0);
|
|
3852
|
-
}
|
|
3853
|
-
function getValueByPath(source, path) {
|
|
3854
|
-
if (!path) {
|
|
3855
|
-
return "";
|
|
3856
|
-
}
|
|
3857
|
-
return path.split(".").reduce((current, key) => {
|
|
3858
|
-
if (current === null || current === void 0) {
|
|
3859
|
-
return void 0;
|
|
3860
|
-
}
|
|
3861
|
-
return current[key];
|
|
3862
|
-
}, source);
|
|
3863
|
-
}
|
|
3864
|
-
function getCellValue(row, rowIndex, column) {
|
|
3865
|
-
if (typeof column.formatter === "function") {
|
|
3866
|
-
return column.formatter(row, rowIndex, column);
|
|
3867
|
-
}
|
|
3868
|
-
return getValueByPath(row, column.key);
|
|
3869
|
-
}
|
|
3870
|
-
function buildHeaderMatrix(columns) {
|
|
3871
|
-
const maxDepth = getMaxDepth(columns);
|
|
3872
|
-
const totalLeafCount = columns.reduce((count, column) => count + getLeafCount(column), 0);
|
|
3873
|
-
const headerRows = Array.from({ length: maxDepth }, () => Array.from({ length: totalLeafCount }).fill(""));
|
|
3874
|
-
const merges = [];
|
|
3875
|
-
const leafColumns = [];
|
|
3876
|
-
let currentColumnIndex = 0;
|
|
3877
|
-
const fillHeaders = (column, depth) => {
|
|
3878
|
-
var _a;
|
|
3879
|
-
const startColumnIndex = currentColumnIndex;
|
|
3880
|
-
const leafCount = getLeafCount(column);
|
|
3881
|
-
headerRows[depth][startColumnIndex] = column.label;
|
|
3882
|
-
if ((_a = column.children) == null ? void 0 : _a.length) {
|
|
3883
|
-
column.children.forEach((child) => fillHeaders(child, depth + 1));
|
|
3884
|
-
if (leafCount > 1) {
|
|
3885
|
-
merges.push({
|
|
3886
|
-
s: { r: depth, c: startColumnIndex },
|
|
3887
|
-
e: { r: depth, c: startColumnIndex + leafCount - 1 }
|
|
3888
|
-
});
|
|
3889
|
-
}
|
|
3890
|
-
return;
|
|
3891
|
-
}
|
|
3892
|
-
leafColumns.push(column);
|
|
3893
|
-
currentColumnIndex += 1;
|
|
3894
|
-
if (depth < maxDepth - 1) {
|
|
3895
|
-
merges.push({
|
|
3896
|
-
s: { r: depth, c: startColumnIndex },
|
|
3897
|
-
e: { r: maxDepth - 1, c: startColumnIndex }
|
|
3898
|
-
});
|
|
3899
|
-
}
|
|
3900
|
-
};
|
|
3901
|
-
columns.forEach((column) => fillHeaders(column, 0));
|
|
3902
|
-
return {
|
|
3903
|
-
headerRows,
|
|
3904
|
-
leafColumns,
|
|
3905
|
-
merges
|
|
3906
|
-
};
|
|
3907
|
-
}
|
|
3908
|
-
function buildColumnWidths(leafColumns, dataRows, defaultColumnWidth, autoWidth) {
|
|
3909
|
-
return leafColumns.map((column, columnIndex) => {
|
|
3910
|
-
var _a;
|
|
3911
|
-
const headerWidth = getDisplayLength(column.label);
|
|
3912
|
-
const dataWidth = dataRows.reduce((maxWidth, row) => {
|
|
3913
|
-
return Math.max(maxWidth, getDisplayLength(row[columnIndex]));
|
|
3914
|
-
}, 0);
|
|
3915
|
-
const targetWidth = (_a = column.width) != null ? _a : autoWidth ? Math.max(defaultColumnWidth, headerWidth, dataWidth) : defaultColumnWidth;
|
|
3916
|
-
return targetWidth;
|
|
3917
|
-
});
|
|
3918
|
-
}
|
|
3919
|
-
function normalizeFileName(fileName) {
|
|
3920
|
-
return fileName.endsWith(".xlsx") ? fileName : `${fileName}.xlsx`;
|
|
3921
|
-
}
|
|
3922
|
-
function applyColumnWidths(worksheet, columnWidths) {
|
|
3923
|
-
columnWidths.forEach((width, index) => {
|
|
3924
|
-
worksheet.getColumn(index + 1).width = width;
|
|
3925
|
-
});
|
|
3926
|
-
}
|
|
3927
|
-
function applyMerges(worksheet, merges) {
|
|
3928
|
-
merges.forEach((range) => {
|
|
3929
|
-
worksheet.mergeCells(range.s.r + 1, range.s.c + 1, range.e.r + 1, range.e.c + 1);
|
|
3930
|
-
});
|
|
3931
|
-
}
|
|
3932
|
-
async function exportExcel(options) {
|
|
3933
|
-
const {
|
|
3934
|
-
fileName,
|
|
3935
|
-
sheetName = DEFAULT_SHEET_NAME,
|
|
3936
|
-
data,
|
|
3937
|
-
autoWidth = true,
|
|
3938
|
-
defaultColumnWidth = DEFAULT_COLUMN_WIDTH
|
|
3939
|
-
} = options;
|
|
3940
|
-
const columns = options.columns.filter((column) => !!column);
|
|
3941
|
-
if (!columns.length) {
|
|
3942
|
-
throw new Error("Excel export columns can not be empty.");
|
|
3943
|
-
}
|
|
3944
|
-
const { headerRows, leafColumns, merges } = buildHeaderMatrix(columns);
|
|
3945
|
-
const dataRows = data.map((row, rowIndex) => leafColumns.map((column) => getCellValue(row, rowIndex, column)));
|
|
3946
|
-
const columnWidths = buildColumnWidths(leafColumns, dataRows, defaultColumnWidth, autoWidth);
|
|
3947
|
-
const workbook = new ExcelJS.Workbook();
|
|
3948
|
-
const worksheet = workbook.addWorksheet(sheetName);
|
|
3949
|
-
[...headerRows, ...dataRows].forEach((row) => {
|
|
3950
|
-
worksheet.addRow(row);
|
|
3951
|
-
});
|
|
3952
|
-
applyMerges(worksheet, merges);
|
|
3953
|
-
applyColumnWidths(worksheet, columnWidths);
|
|
3954
|
-
const buffer = await workbook.xlsx.writeBuffer();
|
|
3955
|
-
const blob = new Blob([buffer], { type: EXCEL_MIME_TYPE });
|
|
3956
|
-
saveAs(blob, normalizeFileName(fileName));
|
|
3957
|
-
}
|
|
3958
|
-
var exportExcel$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3959
|
-
__proto__: null,
|
|
3960
|
-
exportExcel,
|
|
3961
|
-
"default": exportExcel
|
|
3962
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
3963
|
-
export { BaseCard, BaseDialog, BaseEChart, _sfc_main$7 as BaseExportButton, BaseSearchForm, BaseTable, OutlinedCascader, OutlinedDatePicker, OutlinedDateTimePicker, OutlinedInput, OutlinedSelect, OutlinedTimePicker, OutlinedTreeSelect, cloneSearchFormModel, downloadExportResponse, exportExcel, extractFileNameFromDisposition, getVisibleSearchFields, normalizeExportFileName, resetSearchFormModel, toSearchFormCssValue };
|
|
3960
|
+
var OutlinedTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-30d7dee0"]]);
|
|
3961
|
+
installRipple();
|
|
3962
|
+
export { BaseCard, BaseEChart, _sfc_main$7 as BaseExportButton, BaseTable, OutlinedCascader, OutlinedDatePicker, OutlinedDateTimePicker, OutlinedInput, OutlinedSelect, OutlinedTimePicker, OutlinedTreeSelect, downloadExportResponse, exportExcel, extractFileNameFromDisposition, installRipple, normalizeExportFileName, uninstallRipple };
|