@hbdlzy/ui-core 0.1.4 → 0.1.5

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.
Files changed (64) hide show
  1. package/README.md +7 -0
  2. package/components.manifest.json +11 -35
  3. package/dist/components/BaseCard/BaseCard.types.d.ts +36 -36
  4. package/dist/components/BaseCard/BaseCard.vue.d.ts +122 -122
  5. package/dist/components/BaseCard/index.d.ts +3 -3
  6. package/dist/components/BaseEChart/BaseEChart.types.d.ts +26 -26
  7. package/dist/components/BaseEChart/BaseEChart.vue.d.ts +66 -66
  8. package/dist/components/BaseEChart/index.d.ts +3 -3
  9. package/dist/components/BaseExportButton/BaseExportButton.types.d.ts +21 -21
  10. package/dist/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -4
  11. package/dist/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -128
  12. package/dist/components/BaseExportButton/index.d.ts +5 -5
  13. package/dist/components/BaseTable/BaseTable.types.d.ts +163 -163
  14. package/dist/components/BaseTable/BaseTable.vue.d.ts +157 -157
  15. package/dist/components/BaseTable/index.d.ts +3 -3
  16. package/dist/components/OutlinedCascader/OutlinedCascader.types.d.ts +25 -25
  17. package/dist/components/OutlinedCascader/OutlinedCascader.vue.d.ts +85 -85
  18. package/dist/components/OutlinedCascader/index.d.ts +3 -3
  19. package/dist/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +27 -27
  20. package/dist/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +88 -88
  21. package/dist/components/OutlinedDatePicker/index.d.ts +3 -3
  22. package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +26 -26
  23. package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +97 -97
  24. package/dist/components/OutlinedDateTimePicker/index.d.ts +3 -3
  25. package/dist/components/OutlinedInput/OutlinedInput.types.d.ts +29 -29
  26. package/dist/components/OutlinedInput/OutlinedInput.vue.d.ts +97 -97
  27. package/dist/components/OutlinedInput/index.d.ts +3 -3
  28. package/dist/components/OutlinedSelect/OutlinedSelect.types.d.ts +38 -38
  29. package/dist/components/OutlinedSelect/OutlinedSelect.vue.d.ts +116 -116
  30. package/dist/components/OutlinedSelect/index.d.ts +3 -3
  31. package/dist/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +28 -28
  32. package/dist/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +94 -94
  33. package/dist/components/OutlinedTimePicker/index.d.ts +3 -3
  34. package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +46 -46
  35. package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +137 -137
  36. package/dist/components/OutlinedTreeSelect/index.d.ts +3 -3
  37. package/dist/echarts/index.d.ts +9 -9
  38. package/dist/excel/exportExcel.d.ts +18 -18
  39. package/dist/index.cjs +42 -1
  40. package/dist/index.d.ts +27 -30
  41. package/dist/index.js +308 -527
  42. package/dist/ripple/index.d.ts +2 -0
  43. package/dist/style.css +1 -1
  44. package/package.json +6 -4
  45. package/src/components/BaseExportButton/BaseExportButton.vue +1 -3
  46. package/src/components/BaseTable/BaseTable.types.ts +1 -1
  47. package/src/index.ts +5 -4
  48. package/src/ripple/index.ts +213 -0
  49. package/dist/components/BaseDialog/BaseDialog.types.d.ts +0 -25
  50. package/dist/components/BaseDialog/BaseDialog.vue.d.ts +0 -100
  51. package/dist/components/BaseDialog/index.d.ts +0 -3
  52. package/dist/components/BaseSearchForm/BaseSearchForm.types.d.ts +0 -42
  53. package/dist/components/BaseSearchForm/BaseSearchForm.utils.d.ts +0 -5
  54. package/dist/components/BaseSearchForm/BaseSearchForm.vue.d.ts +0 -88
  55. package/dist/components/BaseSearchForm/index.d.ts +0 -4
  56. package/src/components/BaseDialog/BaseDialog.types.ts +0 -28
  57. package/src/components/BaseDialog/BaseDialog.vue +0 -158
  58. package/src/components/BaseDialog/README.md +0 -69
  59. package/src/components/BaseDialog/index.ts +0 -10
  60. package/src/components/BaseSearchForm/BaseSearchForm.types.ts +0 -46
  61. package/src/components/BaseSearchForm/BaseSearchForm.utils.ts +0 -41
  62. package/src/components/BaseSearchForm/BaseSearchForm.vue +0 -267
  63. package/src/components/BaseSearchForm/README.md +0 -66
  64. 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, watch, resolveComponent, createVNode, withModifiers, withCtx, Fragment, renderList, createBlock, mergeProps, withKeys, createTextVNode, createSlots, reactive, onMounted, resolveDirective, withDirectives, normalizeClass, shallowRef, nextTick, onUnmounted, useAttrs, normalizeProps, guardReactiveProps } from "vue";
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,11 +179,11 @@ var _export_sfc = (sfc, props) => {
12
179
  }
13
180
  return target;
14
181
  };
15
- const _hoisted_1$5 = {
182
+ const _hoisted_1$3 = {
16
183
  key: 0,
17
184
  class: "base-card__header"
18
185
  };
19
- const _hoisted_2$3 = { class: "base-card__header-left" };
186
+ const _hoisted_2$1 = { class: "base-card__header-left" };
20
187
  const _hoisted_3$1 = {
21
188
  key: 0,
22
189
  class: "base-card__title-wrap"
@@ -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$c = defineComponent({
214
+ const _sfc_main$a = defineComponent({
48
215
  ...{
49
216
  name: "BaseCard"
50
217
  },
@@ -140,8 +307,8 @@ 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$5, [
144
- createElementVNode("div", _hoisted_2$3, [
310
+ shouldRenderHeader.value ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
311
+ createElementVNode("div", _hoisted_2$1, [
145
312
  hasTitleBlock.value ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
146
313
  __props.showTitleMarker ? (openBlock(), createElementBlock("span", _hoisted_4$1)) : createCommentVNode("", true),
147
314
  _ctx.$slots["title-label"] ? renderSlot(_ctx.$slots, "title-label", { key: 1 }, void 0, true) : (openBlock(), createElementBlock("h4", _hoisted_5$1, toDisplayString(__props.title), 1))
@@ -172,386 +339,7 @@ const _sfc_main$c = defineComponent({
172
339
  };
173
340
  }
174
341
  });
175
- var BaseCard = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-6bfddf1c"]]);
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
344
  const _hoisted_1$2 = { class: "base-table" };
557
345
  const _hoisted_2 = {
@@ -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
- const { exportExcel: exportExcel2 } = await Promise.resolve().then(function() {
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
  }
@@ -3825,139 +3740,5 @@ const _sfc_main = defineComponent({
3825
3740
  }
3826
3741
  });
3827
3742
  var OutlinedTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8403e6ea"]]);
3828
- const DEFAULT_SHEET_NAME = "Sheet1";
3829
- const DEFAULT_COLUMN_WIDTH = 16;
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 };
3743
+ installRipple();
3744
+ export { BaseCard, BaseEChart, _sfc_main$7 as BaseExportButton, BaseTable, OutlinedCascader, OutlinedDatePicker, OutlinedDateTimePicker, OutlinedInput, OutlinedSelect, OutlinedTimePicker, OutlinedTreeSelect, downloadExportResponse, exportExcel, extractFileNameFromDisposition, installRipple, normalizeExportFileName, uninstallRipple };