@hbdlzy/ui-core 0.1.2 → 0.1.4

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/components.manifest.json +40 -1
  2. package/dist/components/BaseCard/BaseCard.types.d.ts +36 -0
  3. package/dist/components/BaseCard/BaseCard.vue.d.ts +122 -0
  4. package/dist/components/BaseCard/index.d.ts +3 -0
  5. package/dist/components/BaseDialog/BaseDialog.types.d.ts +25 -0
  6. package/dist/components/BaseDialog/BaseDialog.vue.d.ts +100 -0
  7. package/dist/components/BaseDialog/index.d.ts +3 -0
  8. package/dist/components/BaseEChart/BaseEChart.types.d.ts +26 -0
  9. package/dist/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
  10. package/dist/components/BaseEChart/index.d.ts +3 -0
  11. package/dist/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
  12. package/dist/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
  13. package/dist/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
  14. package/dist/components/BaseExportButton/index.d.ts +5 -0
  15. package/dist/components/BaseSearchForm/BaseSearchForm.types.d.ts +42 -0
  16. package/dist/components/BaseSearchForm/BaseSearchForm.utils.d.ts +5 -0
  17. package/dist/components/BaseSearchForm/BaseSearchForm.vue.d.ts +88 -0
  18. package/dist/components/BaseSearchForm/index.d.ts +4 -0
  19. package/dist/components/BaseTable/BaseTable.types.d.ts +163 -0
  20. package/dist/components/BaseTable/BaseTable.vue.d.ts +157 -0
  21. package/dist/components/BaseTable/index.d.ts +3 -0
  22. package/dist/components/OutlinedCascader/OutlinedCascader.types.d.ts +25 -0
  23. package/dist/components/OutlinedCascader/OutlinedCascader.vue.d.ts +85 -0
  24. package/dist/components/OutlinedCascader/index.d.ts +3 -0
  25. package/dist/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +27 -0
  26. package/dist/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +88 -0
  27. package/dist/components/OutlinedDatePicker/index.d.ts +3 -0
  28. package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +26 -0
  29. package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +97 -0
  30. package/dist/components/OutlinedDateTimePicker/index.d.ts +3 -0
  31. package/dist/components/OutlinedInput/OutlinedInput.types.d.ts +29 -0
  32. package/dist/components/OutlinedInput/OutlinedInput.vue.d.ts +97 -0
  33. package/dist/components/OutlinedInput/index.d.ts +3 -0
  34. package/dist/components/OutlinedSelect/OutlinedSelect.types.d.ts +38 -0
  35. package/dist/components/OutlinedSelect/OutlinedSelect.vue.d.ts +116 -0
  36. package/dist/components/OutlinedSelect/index.d.ts +3 -0
  37. package/dist/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +28 -0
  38. package/dist/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +94 -0
  39. package/dist/components/OutlinedTimePicker/index.d.ts +3 -0
  40. package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +46 -0
  41. package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +137 -0
  42. package/dist/components/OutlinedTreeSelect/index.d.ts +3 -0
  43. package/dist/echarts/index.d.ts +9 -0
  44. package/dist/excel/exportExcel.d.ts +18 -0
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.d.ts +30 -0
  47. package/dist/index.js +832 -169
  48. package/dist/style.css +1 -1
  49. package/package.json +7 -4
  50. package/src/components/BaseDialog/BaseDialog.types.ts +28 -0
  51. package/src/components/BaseDialog/BaseDialog.vue +158 -0
  52. package/src/components/BaseDialog/README.md +69 -0
  53. package/src/components/BaseDialog/index.ts +10 -0
  54. package/src/components/BaseExportButton/BaseExportButton.vue +3 -1
  55. package/src/components/BaseSearchForm/BaseSearchForm.types.ts +46 -0
  56. package/src/components/BaseSearchForm/BaseSearchForm.utils.ts +41 -0
  57. package/src/components/BaseSearchForm/BaseSearchForm.vue +267 -0
  58. package/src/components/BaseSearchForm/README.md +66 -0
  59. package/src/components/BaseSearchForm/index.ts +20 -0
  60. package/src/components/BaseTable/BaseTable.types.ts +13 -1
  61. package/src/components/BaseTable/BaseTable.vue +412 -13
  62. package/src/components/BaseTable/README.md +106 -120
  63. package/src/echarts/index.ts +13 -8
  64. package/src/index.ts +4 -0
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as echarts from "echarts";
2
2
  export { echarts };
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, shallowRef, nextTick, onUnmounted, useAttrs, normalizeClass, normalizeProps, guardReactiveProps } from "vue";
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";
4
4
  import { ElMessage } from "element-plus";
5
- import ExcelJS from "exceljs";
6
5
  import { saveAs } from "file-saver";
6
+ import ExcelJS from "exceljs";
7
7
  var BaseCard_vue_vue_type_style_index_0_scoped_true_lang = "";
8
8
  var _export_sfc = (sfc, props) => {
9
9
  const target = sfc.__vccOpts || sfc;
@@ -12,11 +12,11 @@ var _export_sfc = (sfc, props) => {
12
12
  }
13
13
  return target;
14
14
  };
15
- const _hoisted_1$3 = {
15
+ const _hoisted_1$5 = {
16
16
  key: 0,
17
17
  class: "base-card__header"
18
18
  };
19
- const _hoisted_2$1 = { class: "base-card__header-left" };
19
+ const _hoisted_2$3 = { class: "base-card__header-left" };
20
20
  const _hoisted_3$1 = {
21
21
  key: 0,
22
22
  class: "base-card__title-wrap"
@@ -43,8 +43,8 @@ const _hoisted_10$1 = {
43
43
  key: 0,
44
44
  class: "base-card__tip"
45
45
  };
46
- const _hoisted_11 = { class: "base-card__content" };
47
- const _sfc_main$a = defineComponent({
46
+ const _hoisted_11$1 = { class: "base-card__content" };
47
+ const _sfc_main$c = defineComponent({
48
48
  ...{
49
49
  name: "BaseCard"
50
50
  },
@@ -140,8 +140,8 @@ const _sfc_main$a = defineComponent({
140
140
  class: "base-card",
141
141
  style: normalizeStyle(cardStyles.value)
142
142
  }, [
143
- shouldRenderHeader.value ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
144
- createElementVNode("div", _hoisted_2$1, [
143
+ shouldRenderHeader.value ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
144
+ createElementVNode("div", _hoisted_2$3, [
145
145
  hasTitleBlock.value ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
146
146
  __props.showTitleMarker ? (openBlock(), createElementBlock("span", _hoisted_4$1)) : createCommentVNode("", true),
147
147
  _ctx.$slots["title-label"] ? renderSlot(_ctx.$slots, "title-label", { key: 1 }, void 0, true) : (openBlock(), createElementBlock("h4", _hoisted_5$1, toDisplayString(__props.title), 1))
@@ -164,7 +164,7 @@ const _sfc_main$a = defineComponent({
164
164
  _ctx.$slots.tip ? (openBlock(), createElementBlock("div", _hoisted_10$1, [
165
165
  renderSlot(_ctx.$slots, "tip", {}, void 0, true)
166
166
  ])) : createCommentVNode("", true),
167
- createElementVNode("div", _hoisted_11, [
167
+ createElementVNode("div", _hoisted_11$1, [
168
168
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
169
169
  ])
170
170
  ])
@@ -172,7 +172,386 @@ const _sfc_main$a = defineComponent({
172
172
  };
173
173
  }
174
174
  });
175
- var BaseCard = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-6bfddf1c"]]);
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"]]);
176
555
  var BaseTable_vue_vue_type_style_index_0_scoped_true_lang = "";
177
556
  const _hoisted_1$2 = { class: "base-table" };
178
557
  const _hoisted_2 = {
@@ -184,18 +563,22 @@ const _hoisted_4 = {
184
563
  key: 0,
185
564
  class: "base-table__toolbar-right"
186
565
  };
187
- const _hoisted_5 = {
566
+ const _hoisted_5 = { class: "base-table__header" };
567
+ const _hoisted_6 = { class: "base-table__header-label" };
568
+ const _hoisted_7 = { class: "base-table__header-actions" };
569
+ const _hoisted_8 = { class: "base-table__header-search-footer" };
570
+ const _hoisted_9 = {
188
571
  key: 0,
189
572
  class: "base-table__actions"
190
573
  };
191
- const _hoisted_6 = {
574
+ const _hoisted_10 = {
192
575
  key: 2,
193
576
  class: "base-table__tags"
194
577
  };
195
- const _hoisted_7 = { key: 1 };
196
- const _hoisted_8 = ["innerHTML"];
197
- const _hoisted_9 = ["onClick"];
198
- const _hoisted_10 = {
578
+ const _hoisted_11 = { key: 1 };
579
+ const _hoisted_12 = ["innerHTML"];
580
+ const _hoisted_13 = ["onClick"];
581
+ const _hoisted_14 = {
199
582
  key: 6,
200
583
  class: "base-table__text"
201
584
  };
@@ -250,8 +633,11 @@ const _sfc_main$9 = defineComponent({
250
633
  const slots = useSlots();
251
634
  const tableRef = ref();
252
635
  const loading = ref(false);
636
+ const sourceRows = ref(normalizeRows(props.data));
253
637
  const rows = ref(normalizeRows(props.data));
254
638
  const selectionRows = ref([]);
639
+ const headerSearchValues = reactive({});
640
+ const headerSearchDropdownRefs = ref({});
255
641
  const sortState = reactive({
256
642
  prop: (_a = props.defaultSort) == null ? void 0 : _a.prop,
257
643
  order: ((_b = props.defaultSort) == null ? void 0 : _b.order) || null
@@ -309,24 +695,20 @@ const _sfc_main$9 = defineComponent({
309
695
  { deep: true }
310
696
  );
311
697
  onMounted(() => {
312
- var _a2;
313
698
  if (props.request && props.autoLoad) {
314
699
  void load();
315
700
  return;
316
701
  }
317
702
  if (!props.request) {
318
- rows.value = normalizeRows(props.data);
319
- if (!((_a2 = props.pagination) == null ? void 0 : _a2.total)) {
320
- paginationState.total = rows.value.length;
321
- emitPagination();
322
- }
703
+ setData(props.data || []);
323
704
  }
324
705
  });
325
706
  function syncPagination(value) {
707
+ const nextPageSizes = value == null ? void 0 : value.pageSizes;
326
708
  paginationState.currentPage = Number((value == null ? void 0 : value.currentPage) || paginationState.currentPage || 1);
327
709
  paginationState.pageSize = Number((value == null ? void 0 : value.pageSize) || paginationState.pageSize || 20);
328
710
  paginationState.total = Number((value == null ? void 0 : value.total) || (value == null ? void 0 : value.total) === 0 ? value.total : paginationState.total || rows.value.length);
329
- paginationState.pageSizes = Array.isArray(value == null ? void 0 : value.pageSizes) && value.pageSizes.length ? [...value.pageSizes] : [...paginationState.pageSizes.length ? paginationState.pageSizes : [10, 20, 50, 100]];
711
+ paginationState.pageSizes = Array.isArray(nextPageSizes) && nextPageSizes.length ? [...nextPageSizes] : [...paginationState.pageSizes.length ? paginationState.pageSizes : [10, 20, 50, 100]];
330
712
  }
331
713
  function emitPagination() {
332
714
  emit("update:pagination", {
@@ -342,7 +724,7 @@ const _sfc_main$9 = defineComponent({
342
724
  return;
343
725
  }
344
726
  if (!props.request) {
345
- setData(props.data || []);
727
+ applyLocalRows();
346
728
  return;
347
729
  }
348
730
  loading.value = true;
@@ -368,6 +750,10 @@ const _sfc_main$9 = defineComponent({
368
750
  }
369
751
  }
370
752
  async function refresh() {
753
+ if (!props.request) {
754
+ applyLocalRows();
755
+ return;
756
+ }
371
757
  await load();
372
758
  }
373
759
  async function resetPage() {
@@ -376,12 +762,8 @@ const _sfc_main$9 = defineComponent({
376
762
  await load();
377
763
  }
378
764
  function setData(data) {
379
- var _a2, _b2;
380
- rows.value = normalizeRows(data);
381
- if (!props.request) {
382
- paginationState.total = Number((_b2 = (_a2 = props.pagination) == null ? void 0 : _a2.total) != null ? _b2 : rows.value.length);
383
- emitPagination();
384
- }
765
+ sourceRows.value = normalizeRows(data);
766
+ applyLocalRows();
385
767
  }
386
768
  function clearSelection() {
387
769
  var _a2;
@@ -460,6 +842,146 @@ const _sfc_main$9 = defineComponent({
460
842
  value
461
843
  });
462
844
  }
845
+ function shouldRenderBuiltInHeader(column) {
846
+ return hasHeaderSearch(column);
847
+ }
848
+ function hasHeaderSearch(column) {
849
+ return Boolean(getHeaderSearchConfig(column));
850
+ }
851
+ function getHeaderSearchConfig(column) {
852
+ if (!column.headerSearch) {
853
+ return null;
854
+ }
855
+ if (column.headerSearch === true) {
856
+ return {};
857
+ }
858
+ return column.headerSearch;
859
+ }
860
+ function getHeaderSearchStateKey(column) {
861
+ return resolveHeaderSearchParamKey(column) || getColumnProp(column) || getColumnKey(column);
862
+ }
863
+ function setHeaderSearchDropdownRef(instance, column) {
864
+ const stateKey = getHeaderSearchStateKey(column);
865
+ if (!instance) {
866
+ delete headerSearchDropdownRefs.value[stateKey];
867
+ return;
868
+ }
869
+ headerSearchDropdownRefs.value[stateKey] = instance;
870
+ }
871
+ function bindHeaderSearchDropdown(column) {
872
+ return (instance) => {
873
+ setHeaderSearchDropdownRef(instance, column);
874
+ };
875
+ }
876
+ function resolveHeaderSearchParamKey(column) {
877
+ const config = getHeaderSearchConfig(column);
878
+ const legacyParamKey = column.otherProps;
879
+ return (config == null ? void 0 : config.paramKey) || legacyParamKey || getColumnProp(column) || "";
880
+ }
881
+ function getHeaderSearchValue(column) {
882
+ return headerSearchValues[getHeaderSearchStateKey(column)] || "";
883
+ }
884
+ function hasHeaderSearchValue(column) {
885
+ return Boolean(getHeaderSearchValue(column).trim());
886
+ }
887
+ function updateHeaderSearchValue(column, value) {
888
+ headerSearchValues[getHeaderSearchStateKey(column)] = normalizeHeaderSearchValue(value);
889
+ }
890
+ function getHeaderSearchPlaceholder(column) {
891
+ var _a2;
892
+ return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.placeholder) || "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9";
893
+ }
894
+ function getHeaderSearchWidth(column) {
895
+ var _a2;
896
+ return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.width) || 280;
897
+ }
898
+ function getHeaderSearchSearchText(column) {
899
+ var _a2;
900
+ return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.searchText) || "\u641C\u7D22";
901
+ }
902
+ function getHeaderSearchResetText(column) {
903
+ var _a2;
904
+ return ((_a2 = getHeaderSearchConfig(column)) == null ? void 0 : _a2.resetText) || "\u91CD\u7F6E";
905
+ }
906
+ async function handleHeaderSearch(column) {
907
+ closeHeaderSearch(column);
908
+ paginationState.currentPage = 1;
909
+ emitPagination();
910
+ if (props.request) {
911
+ await load();
912
+ return;
913
+ }
914
+ applyLocalRows();
915
+ }
916
+ async function handleHeaderSearchReset(column) {
917
+ updateHeaderSearchValue(column, "");
918
+ closeHeaderSearch(column);
919
+ paginationState.currentPage = 1;
920
+ emitPagination();
921
+ if (props.request) {
922
+ await load();
923
+ return;
924
+ }
925
+ applyLocalRows();
926
+ }
927
+ function closeHeaderSearch(column) {
928
+ var _a2, _b2;
929
+ (_b2 = (_a2 = headerSearchDropdownRefs.value[getHeaderSearchStateKey(column)]) == null ? void 0 : _a2.handleClose) == null ? void 0 : _b2.call(_a2);
930
+ }
931
+ function buildHeaderSearchParams() {
932
+ return props.columns.reduce((result, column) => {
933
+ if (!hasHeaderSearch(column)) {
934
+ return result;
935
+ }
936
+ const paramKey = resolveHeaderSearchParamKey(column);
937
+ const value = getHeaderSearchValue(column).trim();
938
+ if (!paramKey || !value) {
939
+ return result;
940
+ }
941
+ result[paramKey] = value;
942
+ return result;
943
+ }, {});
944
+ }
945
+ function applyLocalRows() {
946
+ const filteredRows = filterLocalRows(sourceRows.value);
947
+ rows.value = filteredRows;
948
+ paginationState.total = filteredRows.length;
949
+ emitPagination();
950
+ }
951
+ function filterLocalRows(data) {
952
+ const activeColumns = props.columns.filter((column) => hasHeaderSearch(column) && hasHeaderSearchValue(column)).map((column) => ({
953
+ column,
954
+ keyword: getHeaderSearchValue(column).trim().toLowerCase()
955
+ }));
956
+ if (!activeColumns.length) {
957
+ return normalizeRows(data);
958
+ }
959
+ return normalizeRows(data).filter((row) => {
960
+ return activeColumns.every(({ column, keyword }) => {
961
+ const columnProp = getColumnProp(column);
962
+ if (!columnProp) {
963
+ return true;
964
+ }
965
+ const value = getCellValue2(row, column);
966
+ return toSearchableText(value).includes(keyword);
967
+ });
968
+ });
969
+ }
970
+ function normalizeHeaderSearchValue(value) {
971
+ if (value === void 0 || value === null) {
972
+ return "";
973
+ }
974
+ return String(value);
975
+ }
976
+ function toSearchableText(value) {
977
+ if (value === void 0 || value === null) {
978
+ return "";
979
+ }
980
+ if (Array.isArray(value)) {
981
+ return value.map((item) => toSearchableText(item)).join(" ").toLowerCase();
982
+ }
983
+ return String(value).toLowerCase();
984
+ }
463
985
  function buildRequestParams() {
464
986
  const params = {
465
987
  ...props.requestParams,
@@ -470,9 +992,11 @@ const _sfc_main$9 = defineComponent({
470
992
  };
471
993
  const currentColumn = props.columns.find((item) => String(item.prop || "") === String(sortState.prop || ""));
472
994
  const sortPayload = buildSortPayload(currentColumn, sortState.prop, sortState.order);
995
+ const headerSearchParams = buildHeaderSearchParams();
473
996
  const sortParams = buildSortParams(sortPayload);
474
997
  return {
475
998
  ...params,
999
+ ...headerSearchParams,
476
1000
  ...sortParams
477
1001
  };
478
1002
  }
@@ -669,11 +1193,66 @@ const _sfc_main$9 = defineComponent({
669
1193
  }
670
1194
  return typeof value === "number" ? `${value}px` : value;
671
1195
  }
1196
+ function findHeaderSearchColumn(key) {
1197
+ return props.columns.find((column) => {
1198
+ return getHeaderSearchStateKey(column) === key || getColumnProp(column) === key;
1199
+ });
1200
+ }
1201
+ async function setHeaderSearchValue(key, value, shouldReload = true) {
1202
+ const matchedColumn = findHeaderSearchColumn(key);
1203
+ const stateKey = matchedColumn ? getHeaderSearchStateKey(matchedColumn) : key;
1204
+ headerSearchValues[stateKey] = normalizeHeaderSearchValue(value);
1205
+ if (!shouldReload) {
1206
+ return;
1207
+ }
1208
+ if (matchedColumn) {
1209
+ await handleHeaderSearch(matchedColumn);
1210
+ return;
1211
+ }
1212
+ paginationState.currentPage = 1;
1213
+ emitPagination();
1214
+ if (props.request) {
1215
+ await load();
1216
+ return;
1217
+ }
1218
+ applyLocalRows();
1219
+ }
1220
+ async function resetHeaderSearch(key) {
1221
+ if (key) {
1222
+ const matchedColumn = findHeaderSearchColumn(key);
1223
+ if (matchedColumn) {
1224
+ await handleHeaderSearchReset(matchedColumn);
1225
+ return;
1226
+ }
1227
+ delete headerSearchValues[key];
1228
+ } else {
1229
+ Object.keys(headerSearchValues).forEach((stateKey) => {
1230
+ delete headerSearchValues[stateKey];
1231
+ });
1232
+ Object.keys(headerSearchDropdownRefs.value).forEach((stateKey) => {
1233
+ var _a2, _b2;
1234
+ (_b2 = (_a2 = headerSearchDropdownRefs.value[stateKey]) == null ? void 0 : _a2.handleClose) == null ? void 0 : _b2.call(_a2);
1235
+ });
1236
+ }
1237
+ paginationState.currentPage = 1;
1238
+ emitPagination();
1239
+ if (props.request) {
1240
+ await load();
1241
+ return;
1242
+ }
1243
+ applyLocalRows();
1244
+ }
1245
+ function getHeaderSearchValues() {
1246
+ return { ...headerSearchValues };
1247
+ }
672
1248
  __expose({
673
1249
  load,
674
1250
  refresh,
675
1251
  setData,
676
1252
  resetPage,
1253
+ setHeaderSearchValue,
1254
+ resetHeaderSearch,
1255
+ getHeaderSearchValues,
677
1256
  clearSelection,
678
1257
  toggleRowSelection,
679
1258
  getSelectionRows,
@@ -683,10 +1262,12 @@ const _sfc_main$9 = defineComponent({
683
1262
  const _component_el_pagination = resolveComponent("el-pagination");
684
1263
  const _component_el_empty = resolveComponent("el-empty");
685
1264
  const _component_el_table_column = resolveComponent("el-table-column");
1265
+ const _component_el_input = resolveComponent("el-input");
686
1266
  const _component_el_button = resolveComponent("el-button");
1267
+ const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
1268
+ const _component_el_dropdown = resolveComponent("el-dropdown");
687
1269
  const _component_el_image = resolveComponent("el-image");
688
1270
  const _component_el_tag = resolveComponent("el-tag");
689
- const _component_el_input = resolveComponent("el-input");
690
1271
  const _component_el_table = resolveComponent("el-table");
691
1272
  const _directive_loading = resolveDirective("loading");
692
1273
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
@@ -766,7 +1347,7 @@ const _sfc_main$9 = defineComponent({
766
1347
  columnIndex: scope.$index,
767
1348
  value: getCellValue2(scope.row, column)
768
1349
  }, void 0, true) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
769
- isActionColumn(column) ? (openBlock(), createElementBlock("div", _hoisted_5, [
1350
+ isActionColumn(column) ? (openBlock(), createElementBlock("div", _hoisted_9, [
770
1351
  (openBlock(true), createElementBlock(Fragment, null, renderList(getVisibleActions(column, scope.row), (action) => {
771
1352
  return openBlock(), createBlock(_component_el_button, {
772
1353
  key: `${action.type}-${action.label}`,
@@ -788,7 +1369,7 @@ const _sfc_main$9 = defineComponent({
788
1369
  src: toImageSrc(getCellValue2(scope.row, column)),
789
1370
  "preview-src-list": getPreviewSrcList(scope.row, column),
790
1371
  fit: column.imageFit || "cover"
791
- }, null, 8, ["style", "src", "preview-src-list", "fit"])) : column.kind === "tag" ? (openBlock(), createElementBlock("div", _hoisted_6, [
1372
+ }, null, 8, ["style", "src", "preview-src-list", "fit"])) : column.kind === "tag" ? (openBlock(), createElementBlock("div", _hoisted_10, [
792
1373
  getMatchedOptions(scope.row, column).length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(getMatchedOptions(scope.row, column), (option) => {
793
1374
  return openBlock(), createBlock(_component_el_tag, {
794
1375
  key: String(option.value),
@@ -801,11 +1382,11 @@ const _sfc_main$9 = defineComponent({
801
1382
  ]),
802
1383
  _: 2
803
1384
  }, 1032, ["type", "style"]);
804
- }), 128)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(resolveEmptyText(column)), 1))
1385
+ }), 128)) : (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(resolveEmptyText(column)), 1))
805
1386
  ])) : column.kind === "html" ? (openBlock(), createElementBlock("div", {
806
1387
  key: 3,
807
1388
  innerHTML: getHtmlContent(scope.row, column)
808
- }, null, 8, _hoisted_8)) : column.kind === "input" ? (openBlock(), createBlock(_component_el_input, {
1389
+ }, null, 8, _hoisted_12)) : column.kind === "input" ? (openBlock(), createBlock(_component_el_input, {
809
1390
  key: 4,
810
1391
  "model-value": toDisplayValue(getCellValue2(scope.row, column), ""),
811
1392
  type: column.inputType || "text",
@@ -815,7 +1396,7 @@ const _sfc_main$9 = defineComponent({
815
1396
  class: "base-table__link",
816
1397
  type: "button",
817
1398
  onClick: ($event) => handleCellClick(scope.row, column)
818
- }, toDisplayString(formatCellDisplay(scope.row, column)), 9, _hoisted_9)) : (openBlock(), createElementBlock("div", _hoisted_10, toDisplayString(formatCellDisplay(scope.row, column)), 1))
1399
+ }, toDisplayString(formatCellDisplay(scope.row, column)), 9, _hoisted_13)) : (openBlock(), createElementBlock("div", _hoisted_14, toDisplayString(formatCellDisplay(scope.row, column)), 1))
819
1400
  ], 64))
820
1401
  ]),
821
1402
  _: 2
@@ -826,6 +1407,80 @@ const _sfc_main$9 = defineComponent({
826
1407
  renderSlot(_ctx.$slots, resolveHeaderSlotName(column), mergeProps({ ref_for: true }, headerScope, { columnConfig: column }), void 0, true)
827
1408
  ]),
828
1409
  key: "0"
1410
+ } : shouldRenderBuiltInHeader(column) ? {
1411
+ name: "header",
1412
+ fn: withCtx(() => [
1413
+ createElementVNode("div", _hoisted_5, [
1414
+ createElementVNode("span", _hoisted_6, toDisplayString(column.label), 1),
1415
+ createElementVNode("div", _hoisted_7, [
1416
+ createVNode(_component_el_dropdown, {
1417
+ ref_for: true,
1418
+ ref: bindHeaderSearchDropdown(column),
1419
+ class: "base-table__header-dropdown",
1420
+ trigger: "click",
1421
+ "hide-on-click": false,
1422
+ placement: "bottom",
1423
+ "popper-class": "base-table__header-search-dropdown"
1424
+ }, {
1425
+ dropdown: withCtx(() => [
1426
+ createVNode(_component_el_dropdown_menu, { class: "base-table__header-search-menu" }, {
1427
+ default: withCtx(() => [
1428
+ createElementVNode("div", {
1429
+ class: "base-table__header-search-panel",
1430
+ style: normalizeStyle({ width: toCssValue(getHeaderSearchWidth(column)) || "280px" }),
1431
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {
1432
+ }, ["stop"]))
1433
+ }, [
1434
+ createVNode(_component_el_input, {
1435
+ "model-value": getHeaderSearchValue(column),
1436
+ placeholder: getHeaderSearchPlaceholder(column),
1437
+ clearable: "",
1438
+ "onUpdate:modelValue": ($event) => updateHeaderSearchValue(column, $event),
1439
+ onKeyup: withKeys(($event) => handleHeaderSearch(column), ["enter"])
1440
+ }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue", "onKeyup"]),
1441
+ createElementVNode("div", _hoisted_8, [
1442
+ createVNode(_component_el_button, {
1443
+ link: "",
1444
+ type: "primary",
1445
+ onClick: ($event) => handleHeaderSearch(column)
1446
+ }, {
1447
+ default: withCtx(() => [
1448
+ createTextVNode(toDisplayString(getHeaderSearchSearchText(column)), 1)
1449
+ ]),
1450
+ _: 2
1451
+ }, 1032, ["onClick"]),
1452
+ createVNode(_component_el_button, {
1453
+ link: "",
1454
+ onClick: ($event) => handleHeaderSearchReset(column)
1455
+ }, {
1456
+ default: withCtx(() => [
1457
+ createTextVNode(toDisplayString(getHeaderSearchResetText(column)), 1)
1458
+ ]),
1459
+ _: 2
1460
+ }, 1032, ["onClick"])
1461
+ ])
1462
+ ], 4)
1463
+ ]),
1464
+ _: 2
1465
+ }, 1024)
1466
+ ]),
1467
+ default: withCtx(() => [
1468
+ createElementVNode("button", {
1469
+ class: normalizeClass(["base-table__header-icon", { "is-active": hasHeaderSearchValue(column) }]),
1470
+ type: "button"
1471
+ }, [..._cache[1] || (_cache[1] = [
1472
+ createElementVNode("span", {
1473
+ class: "base-table__header-icon-mark",
1474
+ "aria-hidden": "true"
1475
+ }, null, -1)
1476
+ ])], 2)
1477
+ ]),
1478
+ _: 2
1479
+ }, 1536)
1480
+ ])
1481
+ ])
1482
+ ]),
1483
+ key: "1"
829
1484
  } : void 0
830
1485
  ]), 1032, ["prop", "label", "type", "width", "min-width", "fixed", "align", "header-align", "sortable", "show-overflow-tooltip", "class-name", "label-class-name"]);
831
1486
  }), 128))
@@ -838,7 +1493,7 @@ const _sfc_main$9 = defineComponent({
838
1493
  };
839
1494
  }
840
1495
  });
841
- var BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-429ba785"]]);
1496
+ var BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-7ae8d382"]]);
842
1497
  var BaseEChart_vue_vue_type_style_index_0_scoped_true_lang = "";
843
1498
  const _sfc_main$8 = defineComponent({
844
1499
  __name: "BaseEChart",
@@ -1114,136 +1769,6 @@ const _sfc_main$8 = defineComponent({
1114
1769
  }
1115
1770
  });
1116
1771
  var BaseEChart = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-51bc4772"]]);
1117
- const DEFAULT_SHEET_NAME = "Sheet1";
1118
- const DEFAULT_COLUMN_WIDTH = 16;
1119
- const EXCEL_MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1120
- function getLeafCount(column) {
1121
- var _a;
1122
- if (!((_a = column.children) == null ? void 0 : _a.length)) {
1123
- return 1;
1124
- }
1125
- return column.children.reduce((count, child) => count + getLeafCount(child), 0);
1126
- }
1127
- function getMaxDepth(columns, depth = 1) {
1128
- return columns.reduce((maxDepth, column) => {
1129
- var _a;
1130
- if (!((_a = column.children) == null ? void 0 : _a.length)) {
1131
- return Math.max(maxDepth, depth);
1132
- }
1133
- return Math.max(maxDepth, getMaxDepth(column.children, depth + 1));
1134
- }, depth);
1135
- }
1136
- function getDisplayLength(value) {
1137
- const text = `${value != null ? value : ""}`;
1138
- return Array.from(text).reduce((length, char) => {
1139
- return length + (char.charCodeAt(0) > 255 ? 2 : 1);
1140
- }, 0);
1141
- }
1142
- function getValueByPath(source, path) {
1143
- if (!path) {
1144
- return "";
1145
- }
1146
- return path.split(".").reduce((current, key) => {
1147
- if (current === null || current === void 0) {
1148
- return void 0;
1149
- }
1150
- return current[key];
1151
- }, source);
1152
- }
1153
- function getCellValue(row, rowIndex, column) {
1154
- if (typeof column.formatter === "function") {
1155
- return column.formatter(row, rowIndex, column);
1156
- }
1157
- return getValueByPath(row, column.key);
1158
- }
1159
- function buildHeaderMatrix(columns) {
1160
- const maxDepth = getMaxDepth(columns);
1161
- const totalLeafCount = columns.reduce((count, column) => count + getLeafCount(column), 0);
1162
- const headerRows = Array.from({ length: maxDepth }, () => Array.from({ length: totalLeafCount }).fill(""));
1163
- const merges = [];
1164
- const leafColumns = [];
1165
- let currentColumnIndex = 0;
1166
- const fillHeaders = (column, depth) => {
1167
- var _a;
1168
- const startColumnIndex = currentColumnIndex;
1169
- const leafCount = getLeafCount(column);
1170
- headerRows[depth][startColumnIndex] = column.label;
1171
- if ((_a = column.children) == null ? void 0 : _a.length) {
1172
- column.children.forEach((child) => fillHeaders(child, depth + 1));
1173
- if (leafCount > 1) {
1174
- merges.push({
1175
- s: { r: depth, c: startColumnIndex },
1176
- e: { r: depth, c: startColumnIndex + leafCount - 1 }
1177
- });
1178
- }
1179
- return;
1180
- }
1181
- leafColumns.push(column);
1182
- currentColumnIndex += 1;
1183
- if (depth < maxDepth - 1) {
1184
- merges.push({
1185
- s: { r: depth, c: startColumnIndex },
1186
- e: { r: maxDepth - 1, c: startColumnIndex }
1187
- });
1188
- }
1189
- };
1190
- columns.forEach((column) => fillHeaders(column, 0));
1191
- return {
1192
- headerRows,
1193
- leafColumns,
1194
- merges
1195
- };
1196
- }
1197
- function buildColumnWidths(leafColumns, dataRows, defaultColumnWidth, autoWidth) {
1198
- return leafColumns.map((column, columnIndex) => {
1199
- var _a;
1200
- const headerWidth = getDisplayLength(column.label);
1201
- const dataWidth = dataRows.reduce((maxWidth, row) => {
1202
- return Math.max(maxWidth, getDisplayLength(row[columnIndex]));
1203
- }, 0);
1204
- const targetWidth = (_a = column.width) != null ? _a : autoWidth ? Math.max(defaultColumnWidth, headerWidth, dataWidth) : defaultColumnWidth;
1205
- return targetWidth;
1206
- });
1207
- }
1208
- function normalizeFileName(fileName) {
1209
- return fileName.endsWith(".xlsx") ? fileName : `${fileName}.xlsx`;
1210
- }
1211
- function applyColumnWidths(worksheet, columnWidths) {
1212
- columnWidths.forEach((width, index) => {
1213
- worksheet.getColumn(index + 1).width = width;
1214
- });
1215
- }
1216
- function applyMerges(worksheet, merges) {
1217
- merges.forEach((range) => {
1218
- worksheet.mergeCells(range.s.r + 1, range.s.c + 1, range.e.r + 1, range.e.c + 1);
1219
- });
1220
- }
1221
- async function exportExcel(options) {
1222
- const {
1223
- fileName,
1224
- sheetName = DEFAULT_SHEET_NAME,
1225
- data,
1226
- autoWidth = true,
1227
- defaultColumnWidth = DEFAULT_COLUMN_WIDTH
1228
- } = options;
1229
- const columns = options.columns.filter((column) => !!column);
1230
- if (!columns.length) {
1231
- throw new Error("Excel export columns can not be empty.");
1232
- }
1233
- const { headerRows, leafColumns, merges } = buildHeaderMatrix(columns);
1234
- const dataRows = data.map((row, rowIndex) => leafColumns.map((column) => getCellValue(row, rowIndex, column)));
1235
- const columnWidths = buildColumnWidths(leafColumns, dataRows, defaultColumnWidth, autoWidth);
1236
- const workbook = new ExcelJS.Workbook();
1237
- const worksheet = workbook.addWorksheet(sheetName);
1238
- [...headerRows, ...dataRows].forEach((row) => {
1239
- worksheet.addRow(row);
1240
- });
1241
- applyMerges(worksheet, merges);
1242
- applyColumnWidths(worksheet, columnWidths);
1243
- const buffer = await workbook.xlsx.writeBuffer();
1244
- const blob = new Blob([buffer], { type: EXCEL_MIME_TYPE });
1245
- saveAs(blob, normalizeFileName(fileName));
1246
- }
1247
1772
  const DEFAULT_EXPORT_FILE_NAME = "export-file";
1248
1773
  function getHeaderValue(headers, headerName) {
1249
1774
  var _a;
@@ -1379,7 +1904,10 @@ const _sfc_main$7 = defineComponent({
1379
1904
  emit("start");
1380
1905
  try {
1381
1906
  if (exportMode.value === "excel" && props.excelOptions) {
1382
- await exportExcel(props.excelOptions);
1907
+ const { exportExcel: exportExcel2 } = await Promise.resolve().then(function() {
1908
+ return exportExcel$1;
1909
+ });
1910
+ await exportExcel2(props.excelOptions);
1383
1911
  if (props.autoMessage) {
1384
1912
  ElMessage.success(props.successMessage);
1385
1913
  }
@@ -3297,4 +3825,139 @@ const _sfc_main = defineComponent({
3297
3825
  }
3298
3826
  });
3299
3827
  var OutlinedTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8403e6ea"]]);
3300
- export { BaseCard, BaseEChart, _sfc_main$7 as BaseExportButton, BaseTable, OutlinedCascader, OutlinedDatePicker, OutlinedDateTimePicker, OutlinedInput, OutlinedSelect, OutlinedTimePicker, OutlinedTreeSelect, downloadExportResponse, exportExcel, extractFileNameFromDisposition, normalizeExportFileName };
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 };