@dao-style/core 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,9 +17,9 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, unref, resolveComponent, Fragment, createBlock, createTextVNode, toDisplayString, ref, inject, watchEffect, mergeProps, provide, readonly, toRefs, withKeys, normalizeStyle, withDirectives, vShow, watch, getCurrentInstance, onMounted, onBeforeUnmount, Teleport, createVNode, Transition, withCtx, nextTick, resolveDynamicComponent, createSlots, withModifiers, reactive, renderList, getCurrentScope, onScopeDispose, vModelText, onUnmounted, h, toRef } from "vue";
21
- import { isArray as isArray$2, isSet, looseIndexOf, looseEqual, isFunction as isFunction$1, NOOP } from "@vue/shared";
20
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, unref, resolveComponent, Fragment, createBlock, toRef, h, toDisplayString, createVNode, withCtx, createTextVNode, ref, inject, watchEffect, mergeProps, provide, readonly, toRefs, withKeys, normalizeStyle, withDirectives, vShow, watch, getCurrentInstance, onMounted, onBeforeUnmount, Teleport, Transition, nextTick, resolveDynamicComponent, createSlots, withModifiers, reactive, renderList, getCurrentScope, onScopeDispose, vModelText, onUnmounted } from "vue";
22
21
  import { useI18n } from "vue-i18n";
22
+ import { isFunction as isFunction$1, isArray as isArray$2, isSet, looseIndexOf, looseEqual, NOOP } from "@vue/shared";
23
23
  var common = "";
24
24
  var actionIcon_vue_vue_type_style_index_0_lang = "";
25
25
  var _export_sfc = (sfc, props) => {
@@ -28,7 +28,7 @@ var _export_sfc = (sfc, props) => {
28
28
  }
29
29
  return sfc;
30
30
  };
31
- const _sfc_main$Q = defineComponent({
31
+ const _sfc_main$R = defineComponent({
32
32
  name: "DaoActionIcon",
33
33
  props: {
34
34
  name: {
@@ -61,8 +61,8 @@ const _sfc_main$Q = defineComponent({
61
61
  };
62
62
  }
63
63
  });
64
- const _hoisted_1$A = ["disabled"];
65
- function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
64
+ const _hoisted_1$B = ["disabled"];
65
+ function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
66
66
  return openBlock(), createElementBlock("button", {
67
67
  class: normalizeClass([
68
68
  "dao-action-icon",
@@ -78,9 +78,9 @@ function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
78
78
  class: normalizeClass(["dao-action-icon__iconfont", _ctx.name])
79
79
  }, null, 2)) : createCommentVNode("", true)
80
80
  ])
81
- ], 10, _hoisted_1$A);
81
+ ], 10, _hoisted_1$B);
82
82
  }
83
- var DaoActionIcon = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["render", _sfc_render$M]]);
83
+ var DaoActionIcon = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["render", _sfc_render$N]]);
84
84
  const BUTTON_TYPES = ["primary", "secondary", "tertiary", "ghost", "danger"];
85
85
  var buttonProps = {
86
86
  type: {
@@ -119,7 +119,7 @@ var buttonProps = {
119
119
  }
120
120
  };
121
121
  var icon_scss_vue_type_style_index_0_src_lang = "";
122
- const _sfc_main$P = defineComponent({
122
+ const _sfc_main$Q = defineComponent({
123
123
  name: "DaoIcon",
124
124
  props: {
125
125
  name: {
@@ -132,28 +132,28 @@ const _sfc_main$P = defineComponent({
132
132
  }
133
133
  }
134
134
  });
135
- const _hoisted_1$z = {
135
+ const _hoisted_1$A = {
136
136
  key: 1,
137
137
  class: "dao-icon dao-svg-icon"
138
138
  };
139
- const _hoisted_2$p = ["xlink:href"];
140
- function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
139
+ const _hoisted_2$q = ["xlink:href"];
140
+ function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
141
141
  return _ctx.useFont ? (openBlock(), createElementBlock("i", {
142
142
  key: 0,
143
143
  class: normalizeClass(["dao-icon dao-iconfont", _ctx.name])
144
- }, null, 2)) : (openBlock(), createElementBlock("svg", _hoisted_1$z, [
144
+ }, null, 2)) : (openBlock(), createElementBlock("svg", _hoisted_1$A, [
145
145
  createElementVNode("use", {
146
146
  "xlink:href": `#${_ctx.name}`
147
- }, null, 8, _hoisted_2$p)
147
+ }, null, 8, _hoisted_2$q)
148
148
  ]));
149
149
  }
150
- var DaoIcon = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["render", _sfc_render$L]]);
150
+ var DaoIcon = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["render", _sfc_render$M]]);
151
151
  var button_vue_vue_type_style_index_0_lang = "";
152
152
  const NO_ICON = Symbol(0);
153
153
  const RIGHT_ICON = Symbol(1);
154
154
  const LEFT_ICON = Symbol(2);
155
155
  const BOTH_ICON = Symbol(3);
156
- const _sfc_main$O = defineComponent({
156
+ const _sfc_main$P = defineComponent({
157
157
  name: "DaoButton",
158
158
  components: {
159
159
  DaoIcon
@@ -244,12 +244,12 @@ const _sfc_main$O = defineComponent({
244
244
  };
245
245
  }
246
246
  });
247
- const _hoisted_1$y = ["disabled"];
248
- const _hoisted_2$o = {
247
+ const _hoisted_1$z = ["disabled"];
248
+ const _hoisted_2$p = {
249
249
  key: 1,
250
250
  class: "dao-btn__text"
251
251
  };
252
- function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
252
+ function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
253
253
  const _component_dao_icon = resolveComponent("dao-icon");
254
254
  return openBlock(), createElementBlock("button", {
255
255
  class: normalizeClass(_ctx.classList),
@@ -263,7 +263,7 @@ function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
263
263
  "use-font": _ctx.isIconLeftFont,
264
264
  name: _ctx.realIconLeft
265
265
  }, null, 8, ["class", "use-font", "name"])) : createCommentVNode("", true),
266
- _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_2$o, [
266
+ _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_2$p, [
267
267
  renderSlot(_ctx.$slots, "default")
268
268
  ])) : createCommentVNode("", true),
269
269
  _ctx.realIconRight ? (openBlock(), createBlock(_component_dao_icon, {
@@ -273,11 +273,171 @@ function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
273
273
  name: _ctx.realIconRight
274
274
  }, null, 8, ["class", "use-font", "name"])) : createCommentVNode("", true)
275
275
  ], 64))
276
- ], 10, _hoisted_1$y);
276
+ ], 10, _hoisted_1$z);
277
277
  }
278
- var DaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$K]]);
279
- var buttonGroup_vue_vue_type_style_index_0_lang = "";
278
+ var DaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["render", _sfc_render$L]]);
279
+ const textButtonType = ["default", "action", "link", "custom"];
280
+ var TextButtonProps = {
281
+ tag: {
282
+ type: [Object, String],
283
+ default: "button"
284
+ },
285
+ prop: {
286
+ type: Object,
287
+ default: () => ({
288
+ type: "default"
289
+ })
290
+ }
291
+ };
292
+ var textButton_vue_vue_type_style_index_0_lang = "";
293
+ const _sfc_main$O = defineComponent({
294
+ name: "DaoTextButton",
295
+ components: {
296
+ DaoIcon
297
+ },
298
+ props: TextButtonProps,
299
+ setup(props, { slots, attrs }) {
300
+ const prop = toRef(props, "prop");
301
+ const computedType = computed(() => {
302
+ var _a2;
303
+ return ((_a2 = prop.value) == null ? void 0 : _a2.type) && textButtonType.includes(prop.value.type) ? prop.value.type : "custom";
304
+ });
305
+ const componentComputed = computed(() => ({
306
+ class: [
307
+ "dao-text-button",
308
+ `dao-text-button--${computedType.value}`,
309
+ attrs.disabled ? "is-disabled" : ""
310
+ ]
311
+ }));
312
+ const iconTemp = computed(() => {
313
+ var _a2, _b2;
314
+ return ((_a2 = prop.value) == null ? void 0 : _a2.icon) ? h(DaoIcon, {
315
+ name: (_b2 = prop.value) == null ? void 0 : _b2.icon,
316
+ "use-font": true,
317
+ class: "dao-text-button__icon"
318
+ }) : null;
319
+ });
320
+ const slotTemp = computed(() => {
321
+ const _slots = __spreadValues({
322
+ default: () => ""
323
+ }, slots);
324
+ return Object.fromEntries(Object.entries(_slots).map(([key, item]) => {
325
+ const newSlot = isFunction$1(item) ? item : () => item || null;
326
+ if (key === "default") {
327
+ return [
328
+ key,
329
+ (...args) => {
330
+ const defaultSlot = newSlot.call(null, ...args);
331
+ return [
332
+ iconTemp.value,
333
+ defaultSlot ? h("span", { class: "dao-text-button__slot" }, { default: () => defaultSlot }) : ""
334
+ ];
335
+ }
336
+ ];
337
+ }
338
+ return [key, newSlot];
339
+ }));
340
+ });
341
+ return () => h(props.tag, __spreadValues({}, componentComputed.value), slotTemp.value);
342
+ }
343
+ });
344
+ const BatchBarProps = {
345
+ total: {
346
+ type: Number,
347
+ default: 0
348
+ },
349
+ selectedFormat: {
350
+ type: Function,
351
+ default: void 0
352
+ },
353
+ deselectText: {
354
+ type: String,
355
+ default: void 0
356
+ },
357
+ removeText: {
358
+ type: String,
359
+ default: void 0
360
+ }
361
+ };
362
+ var batchBar_vue_vue_type_style_index_0_lang = "";
280
363
  const _sfc_main$N = defineComponent({
364
+ name: "DaoBatchBar",
365
+ components: {
366
+ DaoButton,
367
+ DaoTextButton: _sfc_main$O
368
+ },
369
+ props: BatchBarProps,
370
+ emits: ["delete", "deselect"],
371
+ setup: (props, { emit }) => {
372
+ var _a2;
373
+ const { t } = useI18n();
374
+ const selectedFormatFun = (_a2 = props.selectedFormat) != null ? _a2 : (total) => t("core.batchBar.selectedFormat", {
375
+ n: total
376
+ });
377
+ const text = computed(() => {
378
+ var _a3, _b2;
379
+ return {
380
+ remove: (_a3 = props.removeText) != null ? _a3 : t("core.batchBar.removeText"),
381
+ deselect: (_b2 = props.deselectText) != null ? _b2 : t("core.batchBar.deselectText"),
382
+ selected: selectedFormatFun(props.total)
383
+ };
384
+ });
385
+ const onHandleDeselect = () => {
386
+ emit("deselect");
387
+ };
388
+ const onHandleDelete = () => {
389
+ emit("delete");
390
+ };
391
+ const showSelf = computed(() => props.total > 0);
392
+ return {
393
+ text,
394
+ showSelf,
395
+ onHandleDelete,
396
+ onHandleDeselect
397
+ };
398
+ }
399
+ });
400
+ const _hoisted_1$y = {
401
+ key: 0,
402
+ class: "dao-batch-bar"
403
+ };
404
+ const _hoisted_2$o = { class: "dao-batch-bar__text" };
405
+ const _hoisted_3$f = { class: "dao-batch-bar__text--select" };
406
+ const _hoisted_4$c = { class: "dao-batch-bar__action" };
407
+ function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
408
+ const _component_dao_text_button = resolveComponent("dao-text-button");
409
+ const _component_dao_button = resolveComponent("dao-button");
410
+ return _ctx.showSelf ? (openBlock(), createElementBlock("div", _hoisted_1$y, [
411
+ createElementVNode("div", _hoisted_2$o, [
412
+ createElementVNode("span", _hoisted_3$f, toDisplayString(_ctx.text.selected), 1),
413
+ createVNode(_component_dao_text_button, {
414
+ class: "dao-batch-bar__text--deselect",
415
+ onClick: _ctx.onHandleDeselect
416
+ }, {
417
+ default: withCtx(() => [
418
+ createTextVNode(toDisplayString(_ctx.text.deselect), 1)
419
+ ]),
420
+ _: 1
421
+ }, 8, ["onClick"])
422
+ ]),
423
+ createElementVNode("div", _hoisted_4$c, [
424
+ renderSlot(_ctx.$slots, "default", { onDelete: _ctx.onHandleDelete }, () => [
425
+ createVNode(_component_dao_button, {
426
+ type: "danger",
427
+ onClick: _ctx.onHandleDelete
428
+ }, {
429
+ default: withCtx(() => [
430
+ createTextVNode(toDisplayString(_ctx.text.remove), 1)
431
+ ]),
432
+ _: 1
433
+ }, 8, ["onClick"])
434
+ ])
435
+ ])
436
+ ])) : createCommentVNode("", true);
437
+ }
438
+ var DaoBatchBar = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$K]]);
439
+ var buttonGroup_vue_vue_type_style_index_0_lang = "";
440
+ const _sfc_main$M = defineComponent({
281
441
  name: "DaoButtonGroup"
282
442
  });
283
443
  const _hoisted_1$x = { class: "dao-btn-group" };
@@ -286,9 +446,9 @@ function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
286
446
  renderSlot(_ctx.$slots, "default")
287
447
  ]);
288
448
  }
289
- var buttonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$J]]);
449
+ var buttonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$J]]);
290
450
  var card_scss_vue_type_style_index_0_src_lang = "";
291
- const _sfc_main$M = defineComponent({
451
+ const _sfc_main$L = defineComponent({
292
452
  name: "DaoCard",
293
453
  components: {
294
454
  DaoIcon
@@ -371,9 +531,9 @@ function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
371
531
  ], 2)
372
532
  ], 2);
373
533
  }
374
- var card = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$I]]);
534
+ var card = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$I]]);
375
535
  var cardItem_scss_vue_type_style_index_0_src_lang = "";
376
- const _sfc_main$L = defineComponent({
536
+ const _sfc_main$K = defineComponent({
377
537
  name: "DaoCardItem"
378
538
  });
379
539
  const _hoisted_1$v = { class: "dao-card-item" };
@@ -382,7 +542,7 @@ function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
382
542
  renderSlot(_ctx.$slots, "default")
383
543
  ]);
384
544
  }
385
- var cardItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$H]]);
545
+ var cardItem = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$H]]);
386
546
  function isNullish(val) {
387
547
  return val === null || val === void 0;
388
548
  }
@@ -425,7 +585,7 @@ function getUnrefItem(set, item) {
425
585
  index: index2
426
586
  };
427
587
  }
428
- const _sfc_main$K = defineComponent({
588
+ const _sfc_main$J = defineComponent({
429
589
  name: "DaoCheckbox",
430
590
  props: {
431
591
  modelValue: {
@@ -609,9 +769,9 @@ function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
609
769
  ])) : createCommentVNode("", true)
610
770
  ], 2);
611
771
  }
612
- var DaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$G]]);
772
+ var DaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$G]]);
613
773
  var checkboxGroup_vue_vue_type_style_index_0_lang = "";
614
- const _sfc_main$J = defineComponent({
774
+ const _sfc_main$I = defineComponent({
615
775
  name: "DaoCheckboxGroup",
616
776
  props: {
617
777
  modelValue: {
@@ -652,7 +812,7 @@ function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
652
812
  renderSlot(_ctx.$slots, "default")
653
813
  ], 2);
654
814
  }
655
- var checkboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$F]]);
815
+ var checkboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$F]]);
656
816
  var top = "top";
657
817
  var bottom = "bottom";
658
818
  var right = "right";
@@ -1851,7 +2011,7 @@ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyS
1851
2011
  var createPopper = /* @__PURE__ */ popperGenerator({
1852
2012
  defaultModifiers
1853
2013
  });
1854
- const _sfc_main$I = defineComponent({
2014
+ const _sfc_main$H = defineComponent({
1855
2015
  name: "PopperContent",
1856
2016
  props: {
1857
2017
  popperId: {
@@ -1945,7 +2105,7 @@ function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
1945
2105
  ])
1946
2106
  ], 42, _hoisted_1$t);
1947
2107
  }
1948
- var PopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$E]]);
2108
+ var PopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["render", _sfc_render$E]]);
1949
2109
  var PopperProps = {
1950
2110
  modelValue: {
1951
2111
  type: Boolean,
@@ -2051,7 +2211,7 @@ function getActualRoot(app) {
2051
2211
  }
2052
2212
  return internalRoot;
2053
2213
  }
2054
- const _sfc_main$H = defineComponent({
2214
+ const _sfc_main$G = defineComponent({
2055
2215
  name: "DaoPopper",
2056
2216
  components: {
2057
2217
  PopperContent
@@ -2464,7 +2624,7 @@ function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
2464
2624
  ], 8, ["to", "disabled"]))
2465
2625
  ], 2);
2466
2626
  }
2467
- var DaoPopper = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["render", _sfc_render$D]]);
2627
+ var DaoPopper = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$D]]);
2468
2628
  var tooltipProps = __spreadProps(__spreadValues({}, PopperProps), {
2469
2629
  offset: {
2470
2630
  type: [Number, String],
@@ -2472,13 +2632,13 @@ var tooltipProps = __spreadProps(__spreadValues({}, PopperProps), {
2472
2632
  }
2473
2633
  });
2474
2634
  var tooltip_scss_vue_type_style_index_0_src_lang = "";
2475
- const _sfc_main$G = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
2635
+ const _sfc_main$F = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
2476
2636
  name: "DaoTooltip",
2477
2637
  props: tooltipProps,
2478
2638
  daoPopperTheme: "dao-tooltip"
2479
2639
  }));
2480
2640
  var popover_scss_vue_type_style_index_0_src_lang = "";
2481
- const _sfc_main$F = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
2641
+ const _sfc_main$E = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
2482
2642
  name: "DaoPopover",
2483
2643
  props: PopperProps,
2484
2644
  daoPopperTheme: "dao-popover"
@@ -2548,17 +2708,17 @@ const ellipsisProps = {
2548
2708
  }
2549
2709
  };
2550
2710
  var ellipsis_vue_vue_type_style_index_0_lang = "";
2551
- const _sfc_main$E = defineComponent({
2711
+ const _sfc_main$D = defineComponent({
2552
2712
  name: "DaoEllipsis",
2553
2713
  components: {
2554
- Tooltip: _sfc_main$G,
2555
- Popover: _sfc_main$F
2714
+ Tooltip: _sfc_main$F,
2715
+ Popover: _sfc_main$E
2556
2716
  },
2557
2717
  props: ellipsisProps,
2558
2718
  setup(props) {
2559
2719
  const disabled = ref(true);
2560
2720
  const tooltipRef = ref();
2561
- const ComponentType = computed(() => props.type === "tooltip" ? _sfc_main$G : _sfc_main$F);
2721
+ const ComponentType = computed(() => props.type === "tooltip" ? _sfc_main$F : _sfc_main$E);
2562
2722
  const isOpen = computed(() => {
2563
2723
  var _a2, _b2, _c, _d;
2564
2724
  return (_d = (_c = (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.$) == null ? void 0 : _b2.ctx) == null ? void 0 : _c.isOpen) != null ? _d : false;
@@ -2600,7 +2760,7 @@ const _sfc_main$E = defineComponent({
2600
2760
  tooltipRef,
2601
2761
  isOpen,
2602
2762
  isEllipsis,
2603
- Tooltip: _sfc_main$G,
2763
+ Tooltip: _sfc_main$F,
2604
2764
  ComponentType
2605
2765
  };
2606
2766
  }
@@ -2643,8 +2803,8 @@ function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
2643
2803
  } : void 0
2644
2804
  ]), 1032, ["disabled", "placement", "offset", "class", "append-to", "delay", "popper-class", "width"]);
2645
2805
  }
2646
- var DaoEllipsis = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["render", _sfc_render$C]]);
2647
- const _sfc_main$D = defineComponent({
2806
+ var DaoEllipsis = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$C]]);
2807
+ const _sfc_main$C = defineComponent({
2648
2808
  name: "DaoDialogHeader",
2649
2809
  components: {
2650
2810
  DaoActionIcon,
@@ -2696,8 +2856,8 @@ function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
2696
2856
  ])
2697
2857
  ]);
2698
2858
  }
2699
- var DialogHeader = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$B]]);
2700
- const _sfc_main$C = defineComponent({
2859
+ var DialogHeader = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$B]]);
2860
+ const _sfc_main$B = defineComponent({
2701
2861
  name: "DaoDialogFooter",
2702
2862
  components: {
2703
2863
  DaoButton
@@ -2766,14 +2926,14 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
2766
2926
  ])
2767
2927
  ]);
2768
2928
  }
2769
- var DialogFooter = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$A]]);
2929
+ var DialogFooter = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$A]]);
2770
2930
  var dialog_scss_vue_type_style_index_0_src_lang = "";
2771
2931
  const DIALOG_NUM_ATTR = "dao-dialog__num";
2772
2932
  const DIALOG_MINIMUM_PADDING = "20px";
2773
2933
  const DIALOG_DEFAULT_PADDING_TOP = "100px";
2774
2934
  const DIALOG_DEFAULT_PADDING_BOTTOM = "20px";
2775
2935
  const KEYBOARD_EVENT_NAME$1 = "keydown";
2776
- const _sfc_main$B = defineComponent({
2936
+ const _sfc_main$A = defineComponent({
2777
2937
  name: "DaoDialog",
2778
2938
  components: {
2779
2939
  DialogHeader,
@@ -3037,7 +3197,7 @@ function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
3037
3197
  _: 3
3038
3198
  }, 8, ["onBeforeEnter", "onAfterEnter", "onBeforeLeave", "onAfterLeave"]);
3039
3199
  }
3040
- var dialog = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$z]]);
3200
+ var dialog = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$z]]);
3041
3201
  const drawerProps = {
3042
3202
  modelValue: {
3043
3203
  type: Boolean,
@@ -3108,7 +3268,7 @@ const trapTabKey = (e, firstTab, lastTab) => {
3108
3268
  };
3109
3269
  var drawer_vue_vue_type_style_index_0_lang = "";
3110
3270
  const KEYBOARD_EVENT_NAME = "keydown";
3111
- const _sfc_main$A = defineComponent({
3271
+ const _sfc_main$z = defineComponent({
3112
3272
  name: "DaoDrawer",
3113
3273
  components: {
3114
3274
  DaoButton,
@@ -3321,8 +3481,8 @@ function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
3321
3481
  ], 34)
3322
3482
  ]);
3323
3483
  }
3324
- var drawer = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$y]]);
3325
- const _sfc_main$z = defineComponent({
3484
+ var drawer = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$y]]);
3485
+ const _sfc_main$y = defineComponent({
3326
3486
  name: "DaoDropdown",
3327
3487
  components: {
3328
3488
  DaoPopper
@@ -3403,9 +3563,9 @@ function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
3403
3563
  _: 3
3404
3564
  }, 8, ["placement", "append-to", "trigger", "offset", "model-value"]);
3405
3565
  }
3406
- var DaoDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$x]]);
3566
+ var DaoDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$x]]);
3407
3567
  var dropdownMenu_vue_vue_type_style_index_0_lang = "";
3408
- const _sfc_main$y = defineComponent({
3568
+ const _sfc_main$x = defineComponent({
3409
3569
  name: "DaoDropdownMenu"
3410
3570
  });
3411
3571
  const _hoisted_1$m = { class: "dao-dropdown-menu" };
@@ -3414,9 +3574,9 @@ function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
3414
3574
  renderSlot(_ctx.$slots, "default")
3415
3575
  ]);
3416
3576
  }
3417
- var DaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$w]]);
3577
+ var DaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$w]]);
3418
3578
  var dropdownItem_vue_vue_type_style_index_0_lang = "";
3419
- const _sfc_main$x = defineComponent({
3579
+ const _sfc_main$w = defineComponent({
3420
3580
  name: "DaoDropdownItem",
3421
3581
  props: {
3422
3582
  type: {
@@ -3470,7 +3630,7 @@ function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
3470
3630
  _ctx.type !== "divider" ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
3471
3631
  ], 16);
3472
3632
  }
3473
- var DaoDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$v]]);
3633
+ var DaoDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$v]]);
3474
3634
  const expansionProps = {
3475
3635
  modelValue: {
3476
3636
  type: [String, Symbol, Array]
@@ -3499,7 +3659,7 @@ const expansionItemProps = {
3499
3659
  }
3500
3660
  };
3501
3661
  var expansion_vue_vue_type_style_index_0_lang = "";
3502
- const _sfc_main$w = defineComponent({
3662
+ const _sfc_main$v = defineComponent({
3503
3663
  name: "DaoExpansion",
3504
3664
  props: expansionProps,
3505
3665
  emits: ["update:modelValue", "change"],
@@ -3598,15 +3758,16 @@ function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
3598
3758
  renderSlot(_ctx.$slots, "default")
3599
3759
  ], 2);
3600
3760
  }
3601
- var expansion = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$u]]);
3761
+ var expansion = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$u]]);
3602
3762
  var expansionItem_vue_vue_type_style_index_0_lang = "";
3603
- const _sfc_main$v = defineComponent({
3763
+ const _sfc_main$u = defineComponent({
3604
3764
  name: "DaoExpansionItem",
3605
3765
  components: {
3606
3766
  DaoIcon,
3607
3767
  DaoEllipsis
3608
3768
  },
3609
3769
  props: expansionItemProps,
3770
+ emits: ["close"],
3610
3771
  setup(props) {
3611
3772
  const toggleItem = inject(ToggleItemKey, null);
3612
3773
  const parentState = inject(ExpansionStateKey, null);
@@ -3715,7 +3876,7 @@ function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
3715
3876
  }, [
3716
3877
  createElementVNode("div", {
3717
3878
  class: "dao-expansion-item-header",
3718
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onItemClick && _ctx.onItemClick(...args))
3879
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onItemClick && _ctx.onItemClick(...args))
3719
3880
  }, [
3720
3881
  _ctx.$slots.handler ? (openBlock(), createElementBlock("div", _hoisted_1$l, [
3721
3882
  renderSlot(_ctx.$slots, "handler")
@@ -3745,13 +3906,19 @@ function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
3745
3906
  _ctx.$slots["after-title"] ? (openBlock(), createElementBlock("div", _hoisted_6$4, [
3746
3907
  renderSlot(_ctx.$slots, "after-title")
3747
3908
  ])) : createCommentVNode("", true),
3748
- _ctx.$slots.action ? (openBlock(), createElementBlock("div", {
3909
+ _ctx.$slots.action || _ctx.expansionType === "doc" ? (openBlock(), createElementBlock("div", {
3749
3910
  key: 5,
3750
3911
  class: "dao-expansion-item-action",
3751
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
3912
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
3752
3913
  }, ["stop"]))
3753
3914
  }, [
3754
- renderSlot(_ctx.$slots, "action")
3915
+ _ctx.expansionType === "doc" ? (openBlock(), createBlock(_component_dao_icon, {
3916
+ key: 0,
3917
+ "use-font": "",
3918
+ name: "icon-close",
3919
+ class: "dao-expansion-item__close-icon",
3920
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close", _ctx.name))
3921
+ })) : renderSlot(_ctx.$slots, "action", { key: 1 })
3755
3922
  ])) : createCommentVNode("", true)
3756
3923
  ]),
3757
3924
  createVNode(Transition, {
@@ -3776,7 +3943,7 @@ function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
3776
3943
  }, 8, ["onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])
3777
3944
  ], 2);
3778
3945
  }
3779
- var expansionItem = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$t]]);
3946
+ var expansionItem = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$t]]);
3780
3947
  const formType = ["horizontal", "vertical"];
3781
3948
  const formClassNames = {
3782
3949
  text: {
@@ -3804,7 +3971,7 @@ const formProps = {
3804
3971
  };
3805
3972
  const formKey = Symbol("formKey");
3806
3973
  var form_vue_vue_type_style_index_0_lang = "";
3807
- const _sfc_main$u = defineComponent({
3974
+ const _sfc_main$t = defineComponent({
3808
3975
  name: "DaoForm",
3809
3976
  props: formProps,
3810
3977
  setup(props) {
@@ -3828,12 +3995,12 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
3828
3995
  renderSlot(_ctx.$slots, "default", { classNames: _ctx.formClassNames })
3829
3996
  ], 2);
3830
3997
  }
3831
- var form = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$s]]);
3998
+ var form = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$s]]);
3832
3999
  var formItem_vue_vue_type_style_index_0_lang = "";
3833
- const _sfc_main$t = defineComponent({
4000
+ const _sfc_main$s = defineComponent({
3834
4001
  name: "DaoFormItem",
3835
4002
  components: {
3836
- DaoTooltip: _sfc_main$G,
4003
+ DaoTooltip: _sfc_main$F,
3837
4004
  DaoEllipsis
3838
4005
  },
3839
4006
  props: {
@@ -3933,9 +4100,9 @@ function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
3933
4100
  ], 4)
3934
4101
  ], 2);
3935
4102
  }
3936
- var formItem = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$r]]);
4103
+ var formItem = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$r]]);
3937
4104
  var formGroup_vue_vue_type_style_index_0_lang = "";
3938
- const _sfc_main$s = defineComponent({
4105
+ const _sfc_main$r = defineComponent({
3939
4106
  name: "DaoFormGroup",
3940
4107
  props: {
3941
4108
  title: {
@@ -3956,7 +4123,7 @@ function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
3956
4123
  renderSlot(_ctx.$slots, "default")
3957
4124
  ]);
3958
4125
  }
3959
- var formGroup = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$q]]);
4126
+ var formGroup = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$q]]);
3960
4127
  const headerProps = {
3961
4128
  type: {
3962
4129
  type: String,
@@ -3968,7 +4135,7 @@ const headerProps = {
3968
4135
  }
3969
4136
  };
3970
4137
  var header_vue_vue_type_style_index_0_lang = "";
3971
- const _sfc_main$r = defineComponent({
4138
+ const _sfc_main$q = defineComponent({
3972
4139
  name: "DaoHeader",
3973
4140
  props: headerProps,
3974
4141
  setup(props, { slots }) {
@@ -4014,7 +4181,7 @@ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
4014
4181
  ], 2)) : createCommentVNode("", true)
4015
4182
  ], 2);
4016
4183
  }
4017
- var header = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$p]]);
4184
+ var header = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$p]]);
4018
4185
  const breadcrumbProps = {
4019
4186
  type: {
4020
4187
  type: String,
@@ -4047,7 +4214,7 @@ const breadcrumbItemProps = {
4047
4214
  type: [String, Object]
4048
4215
  }
4049
4216
  };
4050
- const _sfc_main$q = defineComponent({
4217
+ const _sfc_main$p = defineComponent({
4051
4218
  name: "DaoBreadcrumbItem",
4052
4219
  props: breadcrumbItemProps,
4053
4220
  setup(props) {
@@ -4101,9 +4268,9 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
4101
4268
  }, toDisplayString(_ctx.separator), 3)
4102
4269
  ], 2);
4103
4270
  }
4104
- var DaoBreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$o]]);
4271
+ var DaoBreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$o]]);
4105
4272
  var breadcrumb_vue_vue_type_style_index_0_lang = "";
4106
- const _sfc_main$p = defineComponent({
4273
+ const _sfc_main$o = defineComponent({
4107
4274
  name: "DaoBreadcrumb",
4108
4275
  components: {
4109
4276
  DaoIcon,
@@ -4150,7 +4317,7 @@ function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
4150
4317
  renderSlot(_ctx.$slots, "default")
4151
4318
  ], 2);
4152
4319
  }
4153
- var breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$n]]);
4320
+ var breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$n]]);
4154
4321
  if (typeof window !== "undefined") {
4155
4322
  let loadSvg = function() {
4156
4323
  var body = document.body;
@@ -4217,7 +4384,7 @@ var inputProps = {
4217
4384
  }
4218
4385
  };
4219
4386
  var input_vue_vue_type_style_index_0_lang = "";
4220
- const _sfc_main$o = defineComponent({
4387
+ const _sfc_main$n = defineComponent({
4221
4388
  name: "DaoInput",
4222
4389
  components: {
4223
4390
  DaoIcon
@@ -4519,7 +4686,7 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
4519
4686
  ])
4520
4687
  ], 2);
4521
4688
  }
4522
- var DaoInput = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$m]]);
4689
+ var DaoInput = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$m]]);
4523
4690
  var MessageProps = {
4524
4691
  modelValue: {
4525
4692
  type: Boolean,
@@ -4543,7 +4710,7 @@ var MessageProps = {
4543
4710
  }
4544
4711
  };
4545
4712
  var message_vue_vue_type_style_index_0_lang = "";
4546
- const _sfc_main$n = defineComponent({
4713
+ const _sfc_main$m = defineComponent({
4547
4714
  name: "DaoMessage",
4548
4715
  props: MessageProps,
4549
4716
  emits: ["update:modelValue", "change", "beforeClose", "closed", "beforeShow", "show"],
@@ -4642,7 +4809,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
4642
4809
  ])
4643
4810
  ], 34)) : createCommentVNode("", true);
4644
4811
  }
4645
- var message = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$l]]);
4812
+ var message = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$l]]);
4646
4813
  const NAV_TYPES = ["2rd", "3rd"];
4647
4814
  const navProps = {
4648
4815
  accordion: {
@@ -4738,7 +4905,7 @@ const navItemProps = {
4738
4905
  }
4739
4906
  };
4740
4907
  var nav_vue_vue_type_style_index_0_lang = "";
4741
- const _sfc_main$m = defineComponent({
4908
+ const _sfc_main$l = defineComponent({
4742
4909
  name: "DaoNav",
4743
4910
  props: navProps,
4744
4911
  emits: ["back", "select", "toggle"],
@@ -4822,8 +4989,8 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
4822
4989
  ])
4823
4990
  ]);
4824
4991
  }
4825
- var nav = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$k]]);
4826
- const _sfc_main$l = defineComponent({
4992
+ var nav = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$k]]);
4993
+ const _sfc_main$k = defineComponent({
4827
4994
  name: "DaoNavHead",
4828
4995
  components: {
4829
4996
  DaoIcon,
@@ -4887,8 +5054,8 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
4887
5054
  ])
4888
5055
  ], 2);
4889
5056
  }
4890
- var navHead = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$j]]);
4891
- const _sfc_main$k = defineComponent({
5057
+ var navHead = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$j]]);
5058
+ const _sfc_main$j = defineComponent({
4892
5059
  name: "DaoNavItem",
4893
5060
  components: {
4894
5061
  DaoIcon,
@@ -5005,8 +5172,8 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
5005
5172
  ], 34)
5006
5173
  ], 2);
5007
5174
  }
5008
- var navItem = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$i]]);
5009
- const _sfc_main$j = defineComponent({
5175
+ var navItem = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$i]]);
5176
+ const _sfc_main$i = defineComponent({
5010
5177
  name: "DaoNavSub",
5011
5178
  components: {
5012
5179
  DaoIcon,
@@ -5186,7 +5353,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
5186
5353
  })
5187
5354
  ], 2);
5188
5355
  }
5189
- var navSub = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$h]]);
5356
+ var navSub = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$h]]);
5190
5357
  const paginationProps = {
5191
5358
  pageSize: {
5192
5359
  type: Number,
@@ -5403,7 +5570,7 @@ var DaoSelectProps = {
5403
5570
  }
5404
5571
  };
5405
5572
  var select_vue_vue_type_style_index_0_lang = "";
5406
- const _sfc_main$i = defineComponent({
5573
+ const _sfc_main$h = defineComponent({
5407
5574
  name: "DaoSelect",
5408
5575
  components: {
5409
5576
  DaoPopper,
@@ -5851,9 +6018,9 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
5851
6018
  _: 3
5852
6019
  }, 8, ["modelValue", "disabled", "offset", "popper-class", "popper-options", "class", "append-to"]);
5853
6020
  }
5854
- var DaoSelect = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$g]]);
6021
+ var DaoSelect = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$g]]);
5855
6022
  var option_vue_vue_type_style_index_0_lang = "";
5856
- const _sfc_main$h = defineComponent({
6023
+ const _sfc_main$g = defineComponent({
5857
6024
  name: "DaoOption",
5858
6025
  props: {
5859
6026
  value: {
@@ -5965,10 +6132,10 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
5965
6132
  [vShow, _ctx.visible]
5966
6133
  ]);
5967
6134
  }
5968
- var DaoOption = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$f]]);
6135
+ var DaoOption = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$f]]);
5969
6136
  var pagination_vue_vue_type_style_index_0_lang = "";
5970
6137
  const numberAscSort = (a, b) => a - b;
5971
- const _sfc_main$g = defineComponent({
6138
+ const _sfc_main$f = defineComponent({
5972
6139
  name: "DaoPagination",
5973
6140
  components: {
5974
6141
  DaoSelect,
@@ -6147,9 +6314,9 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
6147
6314
  }, 8, ["class", "model-value", "style", "onChange"])
6148
6315
  ], 2)) : createCommentVNode("", true);
6149
6316
  }
6150
- var DaoPagination = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$e]]);
6317
+ var DaoPagination = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$e]]);
6151
6318
  var progress_vue_vue_type_style_index_0_lang = "";
6152
- const _sfc_main$f = defineComponent({
6319
+ const _sfc_main$e = defineComponent({
6153
6320
  name: "DaoProgress",
6154
6321
  props: {
6155
6322
  value: {
@@ -6232,9 +6399,9 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
6232
6399
  ])) : createCommentVNode("", true)
6233
6400
  ]);
6234
6401
  }
6235
- var progress = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$d]]);
6402
+ var progress = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$d]]);
6236
6403
  var radio_vue_vue_type_style_index_0_lang = "";
6237
- const _sfc_main$e = defineComponent({
6404
+ const _sfc_main$d = defineComponent({
6238
6405
  name: "DaoRadio",
6239
6406
  props: {
6240
6407
  modelValue: {
@@ -6347,9 +6514,9 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
6347
6514
  ])) : createCommentVNode("", true)
6348
6515
  ], 2);
6349
6516
  }
6350
- var radio = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$c]]);
6517
+ var radio = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$c]]);
6351
6518
  var radioGroup_vue_vue_type_style_index_0_lang = "";
6352
- const _sfc_main$d = defineComponent({
6519
+ const _sfc_main$c = defineComponent({
6353
6520
  name: "DaoRadioGroup",
6354
6521
  props: {
6355
6522
  modelValue: {
@@ -6390,9 +6557,9 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
6390
6557
  renderSlot(_ctx.$slots, "default")
6391
6558
  ], 2);
6392
6559
  }
6393
- var radioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$b]]);
6560
+ var radioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$b]]);
6394
6561
  var switch_vue_vue_type_style_index_0_lang = "";
6395
- const _sfc_main$c = defineComponent({
6562
+ const _sfc_main$b = defineComponent({
6396
6563
  name: "DaoSwitch",
6397
6564
  props: {
6398
6565
  modelValue: {
@@ -6479,9 +6646,9 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
6479
6646
  _ctx.showText ? (openBlock(), createElementBlock("span", _hoisted_2$5, toDisplayString(_ctx.currentValue ? _ctx.textContent.on : _ctx.textContent.off), 1)) : createCommentVNode("", true)
6480
6647
  ], 2);
6481
6648
  }
6482
- var _switch = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$a]]);
6649
+ var _switch = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a]]);
6483
6650
  var resizer_vue_vue_type_style_index_0_lang = "";
6484
- const _sfc_main$b = defineComponent({
6651
+ const _sfc_main$a = defineComponent({
6485
6652
  name: "DaoResizer",
6486
6653
  props: {
6487
6654
  column: {
@@ -6540,1765 +6707,1810 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
6540
6707
  }, null, 32)) : createCommentVNode("", true)
6541
6708
  ]);
6542
6709
  }
6543
- var DaoResizer = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$9]]);
6544
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
6545
- var freeGlobal$1 = freeGlobal;
6546
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
6547
- var root = freeGlobal$1 || freeSelf || Function("return this")();
6548
- var root$1 = root;
6549
- var Symbol$1 = root$1.Symbol;
6550
- var Symbol$2 = Symbol$1;
6551
- var objectProto$6 = Object.prototype;
6552
- var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
6553
- var nativeObjectToString$1 = objectProto$6.toString;
6554
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
6555
- function getRawTag(value) {
6556
- var isOwn = hasOwnProperty$4.call(value, symToStringTag$1), tag = value[symToStringTag$1];
6557
- try {
6558
- value[symToStringTag$1] = void 0;
6559
- var unmasked = true;
6560
- } catch (e) {
6561
- }
6562
- var result = nativeObjectToString$1.call(value);
6563
- if (unmasked) {
6564
- if (isOwn) {
6565
- value[symToStringTag$1] = tag;
6566
- } else {
6567
- delete value[symToStringTag$1];
6710
+ var DaoResizer = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$9]]);
6711
+ var tag_vue_vue_type_style_index_0_lang = "";
6712
+ const _sfc_main$9 = defineComponent({
6713
+ name: "DaoTag",
6714
+ components: {
6715
+ DaoIcon
6716
+ },
6717
+ props: {
6718
+ closable: {
6719
+ type: Boolean,
6720
+ default: false
6721
+ },
6722
+ separator: {
6723
+ type: String,
6724
+ default: ": "
6725
+ },
6726
+ label: {
6727
+ type: String,
6728
+ default: ""
6729
+ },
6730
+ value: {
6731
+ type: String,
6732
+ default: ""
6568
6733
  }
6569
- }
6570
- return result;
6571
- }
6572
- var objectProto$5 = Object.prototype;
6573
- var nativeObjectToString = objectProto$5.toString;
6574
- function objectToString(value) {
6575
- return nativeObjectToString.call(value);
6576
- }
6577
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
6578
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
6579
- function baseGetTag(value) {
6580
- if (value == null) {
6581
- return value === void 0 ? undefinedTag : nullTag;
6582
- }
6583
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
6584
- }
6585
- function isObjectLike(value) {
6586
- return value != null && typeof value == "object";
6587
- }
6588
- var isArray = Array.isArray;
6589
- var isArray$1 = isArray;
6590
- function isObject(value) {
6591
- var type = typeof value;
6592
- return value != null && (type == "object" || type == "function");
6593
- }
6594
- var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
6595
- function isFunction(value) {
6596
- if (!isObject(value)) {
6597
- return false;
6598
- }
6599
- var tag = baseGetTag(value);
6600
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
6601
- }
6602
- var coreJsData = root$1["__core-js_shared__"];
6603
- var coreJsData$1 = coreJsData;
6604
- var maskSrcKey = function() {
6605
- var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
6606
- return uid ? "Symbol(src)_1." + uid : "";
6607
- }();
6608
- function isMasked(func) {
6609
- return !!maskSrcKey && maskSrcKey in func;
6610
- }
6611
- var funcProto$1 = Function.prototype;
6612
- var funcToString$1 = funcProto$1.toString;
6613
- function toSource(func) {
6614
- if (func != null) {
6615
- try {
6616
- return funcToString$1.call(func);
6617
- } catch (e) {
6618
- }
6619
- try {
6620
- return func + "";
6621
- } catch (e) {
6622
- }
6623
- }
6624
- return "";
6625
- }
6626
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
6627
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
6628
- var funcProto = Function.prototype, objectProto$4 = Object.prototype;
6629
- var funcToString = funcProto.toString;
6630
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
6631
- var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$3).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
6632
- function baseIsNative(value) {
6633
- if (!isObject(value) || isMasked(value)) {
6634
- return false;
6635
- }
6636
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
6637
- return pattern.test(toSource(value));
6638
- }
6639
- function getValue(object, key) {
6640
- return object == null ? void 0 : object[key];
6641
- }
6642
- function getNative(object, key) {
6643
- var value = getValue(object, key);
6644
- return baseIsNative(value) ? value : void 0;
6645
- }
6646
- var WeakMap = getNative(root$1, "WeakMap");
6647
- var WeakMap$1 = WeakMap;
6648
- var MAX_SAFE_INTEGER = 9007199254740991;
6649
- function isLength(value) {
6650
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
6651
- }
6652
- function isArrayLike(value) {
6653
- return value != null && isLength(value.length) && !isFunction(value);
6654
- }
6655
- var objectProto$3 = Object.prototype;
6656
- function isPrototype(value) {
6657
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$3;
6658
- return value === proto;
6659
- }
6660
- var argsTag$1 = "[object Arguments]";
6661
- function baseIsArguments(value) {
6662
- return isObjectLike(value) && baseGetTag(value) == argsTag$1;
6663
- }
6664
- var objectProto$2 = Object.prototype;
6665
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
6666
- var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
6667
- var isArguments = baseIsArguments(function() {
6668
- return arguments;
6669
- }()) ? baseIsArguments : function(value) {
6670
- return isObjectLike(value) && hasOwnProperty$2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
6671
- };
6672
- var isArguments$1 = isArguments;
6673
- function stubFalse() {
6674
- return false;
6675
- }
6676
- var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
6677
- var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
6678
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
6679
- var Buffer2 = moduleExports$1 ? root$1.Buffer : void 0;
6680
- var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
6681
- var isBuffer = nativeIsBuffer || stubFalse;
6682
- var isBuffer$1 = isBuffer;
6683
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag = "[object Number]", objectTag$1 = "[object Object]", regexpTag = "[object RegExp]", setTag$2 = "[object Set]", stringTag = "[object String]", weakMapTag$1 = "[object WeakMap]";
6684
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
6685
- var typedArrayTags = {};
6686
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
6687
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag] = typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] = typedArrayTags[setTag$2] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false;
6688
- function baseIsTypedArray(value) {
6689
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
6690
- }
6691
- function baseUnary(func) {
6692
- return function(value) {
6693
- return func(value);
6694
- };
6695
- }
6696
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
6697
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
6698
- var moduleExports = freeModule && freeModule.exports === freeExports;
6699
- var freeProcess = moduleExports && freeGlobal$1.process;
6700
- var nodeUtil = function() {
6701
- try {
6702
- var types = freeModule && freeModule.require && freeModule.require("util").types;
6703
- if (types) {
6704
- return types;
6705
- }
6706
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
6707
- } catch (e) {
6708
- }
6709
- }();
6710
- var nodeUtil$1 = nodeUtil;
6711
- var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
6712
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
6713
- var isTypedArray$1 = isTypedArray;
6714
- function overArg(func, transform) {
6715
- return function(arg) {
6716
- return func(transform(arg));
6717
- };
6734
+ },
6735
+ emits: ["close"]
6736
+ });
6737
+ const _hoisted_1$5 = { class: "dao-tag" };
6738
+ const _hoisted_2$4 = { class: "dao-tag__key" };
6739
+ const _hoisted_3$3 = { class: "dao-tag__value" };
6740
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
6741
+ const _component_dao_icon = resolveComponent("dao-icon");
6742
+ return openBlock(), createElementBlock("span", _hoisted_1$5, [
6743
+ renderSlot(_ctx.$slots, "default", {}, () => [
6744
+ createElementVNode("span", null, [
6745
+ createElementVNode("span", _hoisted_2$4, [
6746
+ renderSlot(_ctx.$slots, "label", {}, () => [
6747
+ createTextVNode(toDisplayString(_ctx.label), 1)
6748
+ ]),
6749
+ createTextVNode(toDisplayString(_ctx.separator), 1)
6750
+ ]),
6751
+ createElementVNode("span", _hoisted_3$3, [
6752
+ renderSlot(_ctx.$slots, "value", {}, () => [
6753
+ createTextVNode(toDisplayString(_ctx.value), 1)
6754
+ ])
6755
+ ])
6756
+ ])
6757
+ ]),
6758
+ _ctx.closable ? (openBlock(), createBlock(_component_dao_icon, {
6759
+ key: 0,
6760
+ class: "dao-tag__close-icon",
6761
+ name: "icon-close",
6762
+ "use-font": "",
6763
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
6764
+ })) : createCommentVNode("", true)
6765
+ ]);
6718
6766
  }
6719
- var nativeKeys = overArg(Object.keys, Object);
6720
- var nativeKeys$1 = nativeKeys;
6721
- var objectProto$1 = Object.prototype;
6722
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
6723
- function baseKeys(object) {
6724
- if (!isPrototype(object)) {
6725
- return nativeKeys$1(object);
6726
- }
6727
- var result = [];
6728
- for (var key in Object(object)) {
6729
- if (hasOwnProperty$1.call(object, key) && key != "constructor") {
6730
- result.push(key);
6767
+ var DaoTag = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$8]]);
6768
+ var toolbarFilter_vue_vue_type_style_index_0_lang = "";
6769
+ const _sfc_main$8 = defineComponent({
6770
+ name: "DaoToolbarFilter",
6771
+ components: {
6772
+ DaoInput,
6773
+ DaoDropdown,
6774
+ DaoDropdownMenu,
6775
+ DaoDropdownItem
6776
+ },
6777
+ props: {
6778
+ search: {
6779
+ type: Object,
6780
+ default: () => ({})
6781
+ },
6782
+ searchPlaceholder: {
6783
+ type: String,
6784
+ default: ""
6785
+ },
6786
+ searchOptions: {
6787
+ type: Array,
6788
+ default: () => []
6789
+ },
6790
+ fuzzy: {
6791
+ type: Object,
6792
+ default: void 0
6731
6793
  }
6732
- }
6733
- return result;
6734
- }
6735
- var Map$1 = getNative(root$1, "Map");
6736
- var Map$2 = Map$1;
6737
- var DataView = getNative(root$1, "DataView");
6738
- var DataView$1 = DataView;
6739
- var Promise$1 = getNative(root$1, "Promise");
6740
- var Promise$2 = Promise$1;
6741
- var Set$1 = getNative(root$1, "Set");
6742
- var Set$2 = Set$1;
6743
- var mapTag$1 = "[object Map]", objectTag = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
6744
- var dataViewTag = "[object DataView]";
6745
- var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
6746
- var getTag = baseGetTag;
6747
- if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag || Map$2 && getTag(new Map$2()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$1 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
6748
- getTag = function(value) {
6749
- var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
6750
- if (ctorString) {
6751
- switch (ctorString) {
6752
- case dataViewCtorString:
6753
- return dataViewTag;
6754
- case mapCtorString:
6755
- return mapTag$1;
6756
- case promiseCtorString:
6757
- return promiseTag;
6758
- case setCtorString:
6759
- return setTag$1;
6760
- case weakMapCtorString:
6761
- return weakMapTag;
6794
+ },
6795
+ emits: ["update:search", "search"],
6796
+ setup(props, { emit }) {
6797
+ const { t } = useI18n();
6798
+ const searchModel = useVModel(props, "search", emit, {
6799
+ passive: true,
6800
+ deep: true
6801
+ });
6802
+ const visible = ref(false);
6803
+ const searchText = ref("");
6804
+ const dropdownRef = ref();
6805
+ const computedSearchPlaceholder = computed(() => props.searchPlaceholder || t("core.toolbar.searchPlaceholder"));
6806
+ const daoInputSearchRef = ref();
6807
+ const type = computed(() => searchText.value.includes(":") ? "value" : "key");
6808
+ const searchKey = computed(() => searchText.value.split(":")[0]);
6809
+ const searchValue = computed(() => searchText.value.split(":")[1].trim());
6810
+ const selectedKey = computed(() => {
6811
+ if (type.value === "key") {
6812
+ return void 0;
6813
+ }
6814
+ return props.searchOptions.find((i) => i.label === searchKey.value || i.key === searchKey.value);
6815
+ });
6816
+ const resetSearch = () => {
6817
+ emit("search");
6818
+ searchText.value = "";
6819
+ visible.value = false;
6820
+ daoInputSearchRef.value.input.focus();
6821
+ daoInputSearchRef.value.input.click();
6822
+ };
6823
+ const singleHasChose = (searchOption) => {
6824
+ var _a2;
6825
+ if (searchOption.single && ((_a2 = searchModel.value[searchOption.key]) == null ? void 0 : _a2.length)) {
6826
+ return true;
6762
6827
  }
6763
- }
6764
- return result;
6765
- };
6766
- }
6767
- var getTag$1 = getTag;
6768
- var mapTag = "[object Map]", setTag = "[object Set]";
6769
- var objectProto = Object.prototype;
6770
- var hasOwnProperty = objectProto.hasOwnProperty;
6771
- function isEmpty(value) {
6772
- if (value == null) {
6773
- return true;
6774
- }
6775
- if (isArrayLike(value) && (isArray$1(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer$1(value) || isTypedArray$1(value) || isArguments$1(value))) {
6776
- return !value.length;
6777
- }
6778
- var tag = getTag$1(value);
6779
- if (tag == mapTag || tag == setTag) {
6780
- return !value.size;
6781
- }
6782
- if (isPrototype(value)) {
6783
- return !baseKeys(value).length;
6784
- }
6785
- for (var key in value) {
6786
- if (hasOwnProperty.call(value, key)) {
6787
6828
  return false;
6788
- }
6829
+ };
6830
+ const hasFuzzyOption = (value) => {
6831
+ var _a2, _b2;
6832
+ const { fuzzy } = props;
6833
+ if (!fuzzy) {
6834
+ return true;
6835
+ }
6836
+ if ((fuzzy == null ? void 0 : fuzzy.single) && ((_a2 = searchModel.value[fuzzy.key]) == null ? void 0 : _a2.length)) {
6837
+ return true;
6838
+ }
6839
+ if ((_b2 = searchModel.value[fuzzy.key]) == null ? void 0 : _b2.includes(value)) {
6840
+ return true;
6841
+ }
6842
+ return false;
6843
+ };
6844
+ const addFuzzyOption = (value) => {
6845
+ const { fuzzy } = props;
6846
+ if (!fuzzy || hasFuzzyOption(value)) {
6847
+ return;
6848
+ }
6849
+ if (!searchModel.value[fuzzy.key]) {
6850
+ searchModel.value[fuzzy.key] = [value];
6851
+ } else {
6852
+ searchModel.value[fuzzy.key].push(value);
6853
+ }
6854
+ resetSearch();
6855
+ };
6856
+ const filteredKeys = computed(() => {
6857
+ if (type.value === "value") {
6858
+ return [];
6859
+ }
6860
+ return props.searchOptions.reduce((pre, cur) => {
6861
+ var _a2;
6862
+ const label = (_a2 = cur.label) != null ? _a2 : cur.key;
6863
+ if (!label.includes(searchKey.value) || singleHasChose(cur)) {
6864
+ return pre;
6865
+ }
6866
+ return [
6867
+ ...pre,
6868
+ {
6869
+ label,
6870
+ key: cur.key
6871
+ }
6872
+ ];
6873
+ }, []);
6874
+ });
6875
+ const filteredValues = computed(() => {
6876
+ var _a2, _b2;
6877
+ if (type.value === "key" || !selectedKey.value) {
6878
+ return [];
6879
+ }
6880
+ if (selectedKey.value.single && singleHasChose(selectedKey.value)) {
6881
+ return [];
6882
+ }
6883
+ return (_b2 = (_a2 = selectedKey.value.values) == null ? void 0 : _a2.filter((i) => {
6884
+ var _a3, _b3;
6885
+ return i.label.includes(searchValue.value) && !((_b3 = searchModel.value[((_a3 = selectedKey.value) == null ? void 0 : _a3.key) || ""]) == null ? void 0 : _b3.includes(i.value));
6886
+ })) != null ? _b2 : [];
6887
+ });
6888
+ const selectKey = (item) => {
6889
+ searchText.value = `${item.label}: `;
6890
+ daoInputSearchRef.value.input.focus();
6891
+ };
6892
+ const selectValue = (item) => {
6893
+ var _a2, _b2, _c;
6894
+ visible.value = false;
6895
+ const key = (_b2 = (_a2 = selectedKey.value) == null ? void 0 : _a2.key) != null ? _b2 : "";
6896
+ const target = (_c = searchModel.value) == null ? void 0 : _c[key];
6897
+ if (target) {
6898
+ target.push(item.value);
6899
+ } else {
6900
+ searchModel.value[key] = [item.value];
6901
+ }
6902
+ resetSearch();
6903
+ };
6904
+ const handleEnter = () => {
6905
+ var _a2, _b2, _c, _d, _e, _f, _g, _h;
6906
+ if (!searchText.value) {
6907
+ return;
6908
+ }
6909
+ if (type.value === "key") {
6910
+ const target2 = filteredKeys.value.find((i) => i.label === searchText.value || i.key === searchText.value);
6911
+ if (!target2) {
6912
+ addFuzzyOption(searchText.value);
6913
+ return;
6914
+ }
6915
+ selectKey(target2);
6916
+ return;
6917
+ }
6918
+ if (!searchValue.value) {
6919
+ return;
6920
+ }
6921
+ if (!((_a2 = selectedKey.value) == null ? void 0 : _a2.enum) || !((_c = (_b2 = selectedKey.value) == null ? void 0 : _b2.values) == null ? void 0 : _c.length)) {
6922
+ const key = (_e = (_d = selectedKey.value) == null ? void 0 : _d.key) != null ? _e : "";
6923
+ const target2 = (_f = searchModel.value) == null ? void 0 : _f[key];
6924
+ if (target2) {
6925
+ if (target2.includes(searchValue.value)) {
6926
+ return;
6927
+ }
6928
+ target2.push(searchValue.value);
6929
+ } else {
6930
+ searchModel.value[key] = [searchValue.value];
6931
+ }
6932
+ resetSearch();
6933
+ return;
6934
+ }
6935
+ const target = (_h = (_g = selectedKey.value) == null ? void 0 : _g.values) == null ? void 0 : _h.find((i) => i.label === searchValue.value);
6936
+ if (!target) {
6937
+ return;
6938
+ }
6939
+ selectValue(target);
6940
+ };
6941
+ const showPopover = () => {
6942
+ visible.value = true;
6943
+ };
6944
+ onClickOutside(dropdownRef, () => {
6945
+ visible.value = false;
6946
+ });
6947
+ return {
6948
+ computedSearchPlaceholder,
6949
+ daoInputSearchRef,
6950
+ filteredKeys,
6951
+ filteredValues,
6952
+ visible,
6953
+ searchText,
6954
+ type,
6955
+ selectedKey,
6956
+ dropdownRef,
6957
+ selectKey,
6958
+ selectValue,
6959
+ showPopover,
6960
+ handleEnter
6961
+ };
6789
6962
  }
6790
- return true;
6791
- }
6792
- function isNil(value) {
6793
- return value == null;
6794
- }
6795
- function withDefaultValue(val) {
6796
- return isNil(val) || isObject(val) && isEmpty(val) ? "-" : val;
6963
+ });
6964
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
6965
+ const _component_dao_input = resolveComponent("dao-input");
6966
+ const _component_dao_dropdown_item = resolveComponent("dao-dropdown-item");
6967
+ const _component_dao_dropdown_menu = resolveComponent("dao-dropdown-menu");
6968
+ const _component_dao_dropdown = resolveComponent("dao-dropdown");
6969
+ return openBlock(), createBlock(_component_dao_dropdown, {
6970
+ ref: "dropdownRef",
6971
+ "append-to": false,
6972
+ trigger: "manual",
6973
+ visible: _ctx.visible && !!(_ctx.filteredKeys.length || _ctx.filteredValues.length),
6974
+ placement: "bottom-start"
6975
+ }, {
6976
+ menu: withCtx(() => [
6977
+ createVNode(_component_dao_dropdown_menu, null, {
6978
+ default: withCtx(() => [
6979
+ _ctx.type === "key" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.filteredKeys, (item, index2) => {
6980
+ return openBlock(), createBlock(_component_dao_dropdown_item, {
6981
+ key: index2,
6982
+ onClick: ($event) => _ctx.selectKey(item)
6983
+ }, {
6984
+ default: withCtx(() => [
6985
+ createTextVNode(toDisplayString(item.label), 1)
6986
+ ]),
6987
+ _: 2
6988
+ }, 1032, ["onClick"]);
6989
+ }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.filteredValues, (item, index2) => {
6990
+ return openBlock(), createBlock(_component_dao_dropdown_item, {
6991
+ key: index2,
6992
+ onClick: ($event) => _ctx.selectValue(item)
6993
+ }, {
6994
+ default: withCtx(() => [
6995
+ createTextVNode(toDisplayString(item.label), 1)
6996
+ ]),
6997
+ _: 2
6998
+ }, 1032, ["onClick"]);
6999
+ }), 128))
7000
+ ]),
7001
+ _: 1
7002
+ })
7003
+ ]),
7004
+ default: withCtx(() => [
7005
+ createVNode(_component_dao_input, {
7006
+ ref: "daoInputSearchRef",
7007
+ modelValue: _ctx.searchText,
7008
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.searchText = $event),
7009
+ type: "search",
7010
+ borderless: "",
7011
+ block: "",
7012
+ placeholder: _ctx.computedSearchPlaceholder,
7013
+ onKeyup: withKeys(_ctx.handleEnter, ["enter"]),
7014
+ onClick: _ctx.showPopover
7015
+ }, null, 8, ["modelValue", "placeholder", "onKeyup", "onClick"])
7016
+ ]),
7017
+ _: 1
7018
+ }, 8, ["visible"]);
6797
7019
  }
6798
- const tableProps = {
6799
- id: {
7020
+ var DaoToolbarFilter = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7]]);
7021
+ const toolbarProps = {
7022
+ search: {
7023
+ type: Object,
7024
+ default: () => ({})
7025
+ },
7026
+ searchPlaceholder: {
6800
7027
  type: String,
6801
- require: true
7028
+ default: ""
6802
7029
  },
6803
- columns: {
7030
+ searchOptions: {
6804
7031
  type: Array,
6805
7032
  default: () => []
6806
7033
  },
6807
- data: {
6808
- type: Array,
6809
- default: () => []
7034
+ fuzzy: {
7035
+ type: Object,
7036
+ default: void 0
6810
7037
  },
6811
- showHeader: {
7038
+ hideRefresh: {
6812
7039
  type: Boolean,
6813
- default: true
6814
- },
6815
- selectable: {
6816
- type: [Function, Boolean],
6817
7040
  default: false
6818
7041
  },
6819
- selectedRows: {
6820
- type: Array,
6821
- default: () => []
6822
- },
6823
- expandable: {
7042
+ hideSearch: {
6824
7043
  type: Boolean,
6825
7044
  default: false
6826
- },
6827
- sort: {
6828
- type: Object,
6829
- default: () => ({ id: "", desc: true })
6830
- },
6831
- compact: {
6832
- type: Boolean,
6833
- default: false
6834
- },
6835
- pageSize: {
6836
- type: Number,
6837
- default: 10,
6838
- validator: (val) => val > 0 && Math.floor(val) === val
6839
- },
6840
- pageSizeOptions: {
6841
- type: Array,
6842
- default: () => [10, 20, 50]
6843
- },
6844
- pageFormat: {
6845
- type: Function,
6846
- default: void 0
6847
- },
6848
- total: {
6849
- type: Number,
6850
- default: 0
6851
- },
6852
- totalFormat: {
6853
- type: Function,
6854
- required: false
6855
- },
6856
- currentPage: {
6857
- type: Number,
6858
- default: 1
6859
- },
6860
- pageSizerWidth: {
6861
- type: Number,
6862
- default: 110
6863
- },
6864
- emptyText: {
6865
- type: String,
6866
- default: void 0
6867
- },
6868
- noShadow: {
6869
- type: Boolean,
6870
- default: false
6871
- },
6872
- pageLayout: paginationProps.layout
6873
- };
6874
- const _sfc_main$a = defineComponent({
6875
- components: {
6876
- DaoActionIcon,
6877
- DaoDropdown,
6878
- DaoDropdownMenu
6879
- },
6880
- setup() {
6881
- function handleClick(e) {
6882
- e.stopRowClick = true;
6883
- }
6884
- return {
6885
- handleClick
6886
- };
6887
7045
  }
6888
- });
6889
- function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
6890
- const _component_dao_action_icon = resolveComponent("dao-action-icon");
6891
- const _component_dao_dropdown_menu = resolveComponent("dao-dropdown-menu");
6892
- const _component_dao_dropdown = resolveComponent("dao-dropdown");
6893
- return openBlock(), createBlock(_component_dao_dropdown, { placement: "bottom-end" }, {
6894
- menu: withCtx(() => [
6895
- createVNode(_component_dao_dropdown_menu, null, {
6896
- default: withCtx(() => [
6897
- renderSlot(_ctx.$slots, "default")
6898
- ]),
6899
- _: 3
6900
- })
6901
- ]),
6902
- default: withCtx(() => [
6903
- createVNode(_component_dao_action_icon, {
6904
- name: "icon-more-vertical",
6905
- "data-action-td": "",
6906
- "use-font": "",
6907
- onClick: _ctx.handleClick
6908
- }, null, 8, ["onClick"])
6909
- ]),
6910
- _: 3
6911
- });
6912
- }
6913
- var TdAction = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$8]]);
6914
- var table_vue_vue_type_style_index_0_lang = "";
6915
- const positiveIntegerNumberReg = /^[1-9]\d*$/;
6916
- const defaultColumnConfig = {
6917
- defaultWidth: 1,
6918
- minWidth: 56,
6919
- sortable: false,
6920
- resizable: true,
6921
- hidable: true,
6922
- defaultHide: false
6923
7046
  };
6924
- const defaultSelectableFn = () => true;
6925
- const _sfc_main$9 = defineComponent({
6926
- name: "DaoTable",
7047
+ var toolbar_vue_vue_type_style_index_0_lang = "";
7048
+ const _sfc_main$7 = defineComponent({
7049
+ name: "DaoToolbar",
6927
7050
  components: {
6928
- DaoResizer,
6929
- DaoPagination,
6930
- DaoCheckbox,
6931
- TdAction
7051
+ DaoActionIcon,
7052
+ DaoToolbarFilter,
7053
+ DaoTag
6932
7054
  },
6933
- props: tableProps,
6934
- emits: [
6935
- "select",
6936
- "update:selectedRows",
6937
- "sortChange",
6938
- "hideColumn",
6939
- "afterResize",
6940
- "expandToggle",
6941
- "update:current-page",
6942
- "update:page-size",
6943
- "next",
6944
- "prev",
6945
- "pageChange",
6946
- "sizeChange",
6947
- "row-click"
6948
- ],
7055
+ props: toolbarProps,
7056
+ emits: ["update:search", "search", "refresh"],
6949
7057
  setup(props, { emit }) {
6950
7058
  const { t } = useI18n();
6951
- const tableId = computed(() => `DAO_TABLE_${props.id}`);
6952
- const tableSetting = reactive({});
6953
- const sort = reactive(props.sort);
6954
- const textContent = computed(() => ({
6955
- emptyText: props.emptyText || t("core.table.emptyText")
6956
- }));
6957
- const expandRows = reactive([]);
6958
- const global2 = reactive({
6959
- checked: false,
6960
- indeterminate: false
6961
- });
6962
- const selectedRowsModel = useVModel(props, "selectedRows", emit);
6963
- const selectedRowsSet = reactive(new Set());
6964
- const isRowSelected = (row) => selectedRowsSet.has(row);
6965
- const selectableFn = computed(() => typeof props.selectable === "function" ? props.selectable : defaultSelectableFn);
6966
- const selectableRows = computed(() => {
7059
+ const searchModel = useVModel(props, "search", emit);
7060
+ const isFuzzyOption = (key) => {
6967
7061
  var _a2;
6968
- const selectableRowsSet = new Set();
6969
- (_a2 = props.data) == null ? void 0 : _a2.forEach((item, index2) => {
6970
- if (selectableFn.value(item, index2)) {
6971
- selectableRowsSet.add(item);
6972
- }
6973
- });
6974
- return selectableRowsSet;
6975
- });
6976
- const toggleSelected = (row) => {
6977
- if (selectedRowsSet.has(row)) {
6978
- selectedRowsSet.delete(row);
6979
- } else {
6980
- selectedRowsSet.add(row);
7062
+ if (((_a2 = props.fuzzy) == null ? void 0 : _a2.key) === key) {
7063
+ return true;
6981
7064
  }
6982
- emit("select", Array.from(selectedRowsSet));
7065
+ return false;
6983
7066
  };
6984
- const clearSelection = () => {
6985
- selectedRowsSet.forEach((item) => {
6986
- if (selectableRows.value.has(item)) {
6987
- selectedRowsSet.delete(item);
6988
- }
6989
- });
7067
+ const getKeyLabel = (key) => {
7068
+ var _a2;
7069
+ const target = props.searchOptions.find((i) => i.key === key);
7070
+ return (_a2 = target == null ? void 0 : target.label) != null ? _a2 : key;
6990
7071
  };
6991
- const selectedAll = () => {
6992
- props.data.forEach((item) => {
6993
- if (selectableRows.value.has(item)) {
6994
- selectedRowsSet.add(item);
6995
- }
6996
- });
7072
+ const getValueLabel = (key, value) => {
7073
+ var _a2, _b2, _c;
7074
+ const searchOption = props.searchOptions.find((i) => i.key === key);
7075
+ return (_c = (_b2 = (_a2 = searchOption == null ? void 0 : searchOption.values) == null ? void 0 : _a2.find((i) => i.value === value)) == null ? void 0 : _b2.label) != null ? _c : value;
6997
7076
  };
6998
- const toggleSelectedAll = () => {
6999
- if (!global2.checked || global2.indeterminate) {
7000
- selectedAll();
7001
- } else {
7002
- clearSelection();
7077
+ const removeValue = (key, valueIndex) => {
7078
+ searchModel.value[key].splice(valueIndex, 1);
7079
+ if (searchModel.value[key].length === 0) {
7080
+ delete searchModel.value[key];
7003
7081
  }
7004
- emit("select", Array.from(selectedRowsSet));
7082
+ emit("search");
7005
7083
  };
7006
- const handleSelectedRows = () => {
7007
- const nowValue = selectedRowsModel.value;
7008
- const { data } = props;
7009
- const { length } = data;
7010
- selectedRowsSet.clear();
7011
- if (nowValue.length && length) {
7012
- for (let index2 = 0; index2 < length; index2 += 1) {
7013
- const row = data[index2];
7014
- if (nowValue.includes(row)) {
7015
- selectedRowsSet.add(row);
7016
- }
7017
- }
7018
- }
7084
+ const clearFilter = () => {
7085
+ Object.keys(searchModel.value).forEach((key) => {
7086
+ delete searchModel.value[key];
7087
+ });
7088
+ emit("search");
7019
7089
  };
7020
- watch([() => props.data, selectedRowsModel], handleSelectedRows, {
7021
- immediate: true,
7022
- deep: true
7023
- });
7024
- watch([selectedRowsSet, selectableRows], () => {
7025
- let have = 0;
7026
- let notHave = 0;
7027
- for (let i = 0; i < props.data.length; i += 1) {
7028
- const item = props.data[i];
7029
- if (selectedRowsSet.has(item)) {
7030
- have += 1;
7031
- } else if (selectableRows.value.has(item)) {
7032
- notHave += 1;
7033
- }
7034
- if (have && notHave) {
7035
- break;
7036
- }
7037
- }
7038
- if (have && notHave) {
7039
- global2.checked = false;
7040
- global2.indeterminate = true;
7041
- } else if (have) {
7042
- global2.checked = true;
7043
- global2.indeterminate = false;
7044
- } else {
7045
- global2.checked = false;
7046
- global2.indeterminate = false;
7047
- }
7048
- selectedRowsModel.value.splice(0, selectedRowsModel.value.length, ...Array.from(selectedRowsSet));
7049
- }, {
7050
- deep: true,
7051
- immediate: true,
7052
- flush: "post"
7053
- });
7054
- const expandedRows = reactive(new WeakSet());
7055
- const columnRefs = reactive({});
7056
- const columns = reactive([]);
7057
- const currentPage = computed({
7058
- get() {
7059
- return props.currentPage;
7060
- },
7061
- set(value) {
7062
- emit("update:current-page", value);
7063
- }
7064
- });
7065
- const pageSize = computed({
7066
- get() {
7067
- return props.pageSize;
7068
- },
7069
- set(value) {
7070
- emit("update:page-size", value);
7071
- }
7072
- });
7073
- const tableScroll = ref();
7074
- const setColumnRef = (columnId, el) => {
7075
- columnRefs[columnId] = el;
7076
- };
7077
- const getTableSetting = () => {
7078
- const setting = localStorage.getItem(tableId.value) || "";
7079
- try {
7080
- return JSON.parse(setting);
7081
- } catch (e) {
7082
- console.warn("JSON parse error", setting);
7083
- return null;
7084
- }
7085
- };
7086
- const setTableSetting = (setting) => {
7087
- try {
7088
- localStorage.setItem(tableId.value, JSON.stringify(setting));
7089
- } catch (e) {
7090
- console.error("JSON stringify error", setting);
7091
- }
7092
- };
7093
- watch(tableSetting, (val) => {
7094
- setTableSetting(val);
7095
- });
7096
- function formatDefaultTableSetting(tempColumns) {
7097
- return tempColumns.reduce((prev, current) => {
7098
- const preValue = prev;
7099
- preValue[current.id] = {
7100
- width: current.defaultWidth,
7101
- hide: current.hidable && current.defaultHide
7102
- };
7103
- return preValue;
7104
- }, {});
7105
- }
7106
- const init = () => {
7107
- const tempColumns = [];
7108
- props.columns.forEach((column) => {
7109
- tempColumns.push(__spreadValues(__spreadValues({}, defaultColumnConfig), column));
7110
- });
7111
- const storedTableSetting = getTableSetting();
7112
- const defaultTableSetting = formatDefaultTableSetting(tempColumns);
7113
- if (!storedTableSetting) {
7114
- Object.assign(tableSetting, defaultTableSetting);
7115
- } else {
7116
- tempColumns.forEach((column) => {
7117
- const { id } = column;
7118
- if (!storedTableSetting[id]) {
7119
- tableSetting[id] = {
7120
- width: column.defaultWidth,
7121
- hide: column.hidable && column.defaultHide
7122
- };
7123
- } else if (!column.hidable) {
7124
- tableSetting[id] = {
7125
- width: storedTableSetting[id].width,
7126
- hide: false
7127
- };
7128
- } else {
7129
- tableSetting[id] = storedTableSetting[id];
7130
- }
7131
- });
7132
- }
7133
- columns.splice(0, columns.length, ...tempColumns);
7134
- };
7135
- const columnStyle = (id) => {
7136
- const setting = tableSetting[id];
7137
- const { width } = setting;
7138
- if (positiveIntegerNumberReg.test(width.toString())) {
7139
- return { flex: `${width} ${width} auto` };
7140
- }
7141
- return { width };
7142
- };
7143
- const filterColumns = computed(() => columns.filter((c) => !tableSetting[c.id].hide));
7144
- const tableWrapperClasses = computed(() => {
7145
- const classes = [];
7146
- if (props.compact) {
7147
- classes.push("dao-table--compact");
7148
- }
7149
- if (props.selectable) {
7150
- classes.push("dao-table--selectable");
7151
- }
7152
- if (props.expandable) {
7153
- classes.push("dao-table--expandable");
7154
- }
7155
- return classes;
7156
- });
7157
- const isEmpty2 = computed(() => (props.data || []).length === 0);
7158
- const sortColumn = (column) => {
7159
- if (!column.sortable) {
7160
- return;
7161
- }
7162
- if (sort.id === column.id) {
7163
- sort.desc = !sort.desc;
7164
- } else {
7165
- sort.id = column.id;
7166
- sort.desc = true;
7167
- }
7168
- emit("sortChange", sort);
7169
- };
7170
- const thClass = (column) => {
7171
- if (column.sortable) {
7172
- return "dao-table-th--sortable";
7173
- }
7174
- return "";
7175
- };
7176
- const isRowExpanded = (row) => expandRows.includes(row);
7177
- const toggleExpand = (row, rowIndex) => {
7178
- expandedRows.add(row);
7179
- const index2 = expandRows.indexOf(row);
7180
- if (index2 > -1) {
7181
- expandRows.splice(index2, 1);
7182
- emit("expandToggle", row, rowIndex, false);
7183
- } else {
7184
- expandRows.push(row);
7185
- emit("expandToggle", row, rowIndex, true);
7186
- }
7187
- };
7188
- const fixedColumnWidth = () => {
7189
- columns.forEach((column) => {
7190
- tableSetting[column.id].width = `${columnRefs[column.id].clientWidth}px`;
7191
- });
7192
- };
7193
- const updateColumnWidth = (columnWidth, columnId) => {
7194
- tableSetting[columnId].width = `${columnWidth}px`;
7195
- };
7196
- const clearExpansion = () => {
7197
- expandRows.length = 0;
7198
- };
7199
- const clearState = () => {
7200
- clearExpansion();
7201
- clearSelection();
7202
- };
7203
- watch(() => props.columns, () => {
7204
- init();
7205
- }, { deep: true, immediate: true });
7206
- const isEllipsis = () => {
7207
- if (!tableScroll.value) {
7208
- return false;
7209
- }
7210
- return tableScroll.value.offsetWidth < tableScroll.value.scrollWidth;
7211
- };
7212
- const windowResize = () => {
7213
- if (isEllipsis()) {
7214
- return;
7215
- }
7216
- columns.forEach((column) => {
7217
- const width = column.defaultWidth;
7218
- if (positiveIntegerNumberReg.test(width.toString())) {
7219
- tableSetting[column.id].width = width;
7220
- }
7221
- });
7222
- };
7223
- onMounted(() => {
7224
- window.addEventListener("resize", windowResize);
7225
- });
7226
- onUnmounted(() => {
7227
- window.removeEventListener("resize", windowResize);
7228
- });
7229
- function onRowClick(e, row, rowIndex) {
7230
- if (e.stopRowClick) {
7231
- return;
7232
- }
7233
- emit("row-click", row, rowIndex);
7234
- }
7235
7090
  return {
7236
- textContent,
7237
- columns,
7238
- filterColumns,
7239
- tableWrapperClasses,
7240
- tableSetting,
7241
- columnStyle,
7242
- sortColumn,
7243
- sort,
7244
- thClass,
7245
- isRowExpanded,
7246
- toggleExpand,
7247
- setColumnRef,
7248
- fixedColumnWidth,
7249
- updateColumnWidth,
7250
- currentPage,
7251
- pageSize,
7252
- clearState,
7253
- global: global2,
7254
- tableScroll,
7255
- expandedRows,
7256
- onRowClick,
7257
- isEmpty: isEmpty2,
7258
- selectableRows,
7259
- isRowSelected,
7260
- toggleSelected,
7261
- toggleSelectedAll,
7262
- withDefaultValue
7091
+ t,
7092
+ searchModel,
7093
+ isFuzzyOption,
7094
+ removeValue,
7095
+ clearFilter,
7096
+ getKeyLabel,
7097
+ getValueLabel
7263
7098
  };
7264
7099
  }
7265
7100
  });
7266
- const _hoisted_1$5 = { class: "dao-table" };
7267
- const _hoisted_2$4 = {
7101
+ const _hoisted_1$4 = { class: "dao-toolbar-container" };
7102
+ const _hoisted_2$3 = { class: "dao-toolbar" };
7103
+ const _hoisted_3$2 = {
7268
7104
  key: 0,
7269
- class: "dao-table-thead"
7105
+ class: "dao-toolbar__filter"
7270
7106
  };
7271
- const _hoisted_3$3 = { class: "dao-table-tr" };
7272
7107
  const _hoisted_4$1 = {
7273
- key: 0,
7274
- class: "dao-table-th"
7275
- };
7276
- const _hoisted_5$1 = {
7277
7108
  key: 1,
7278
- class: "dao-table-th dao-table-th--expandable"
7279
- };
7280
- const _hoisted_6$1 = ["onClick"];
7281
- const _hoisted_7$1 = { class: "dao-table-th__content" };
7282
- const _hoisted_8 = { class: "dao-table-tbody" };
7283
- const _hoisted_9 = ["onClick"];
7284
- const _hoisted_10 = {
7285
- key: 0,
7286
- class: "dao-table-td"
7287
- };
7288
- const _hoisted_11 = {
7289
- key: 1,
7290
- class: "dao-table-td"
7109
+ class: "dao-toolbar__search"
7291
7110
  };
7292
- const _hoisted_12 = ["onClick"];
7293
- const _hoisted_13 = {
7294
- key: 0,
7295
- class: "dao-table-tr-expand"
7111
+ const _hoisted_5$1 = { class: "dao-toolbar__actions" };
7112
+ const _hoisted_6$1 = {
7113
+ key: 2,
7114
+ class: "dao-toolbar__primary-action"
7296
7115
  };
7297
- const _hoisted_14 = {
7116
+ const _hoisted_7$1 = {
7298
7117
  key: 0,
7299
- class: "dao-table__empty-block"
7118
+ class: "dao-toolbar__tag-container"
7300
7119
  };
7301
- const _hoisted_15 = { class: "dao-table-pagination" };
7302
- function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
7303
- const _component_dao_checkbox = resolveComponent("dao-checkbox");
7304
- const _component_dao_resizer = resolveComponent("dao-resizer");
7305
- const _component_td_action = resolveComponent("td-action");
7306
- const _component_dao_pagination = resolveComponent("dao-pagination");
7307
- return openBlock(), createElementBlock("div", {
7308
- class: normalizeClass(["dao-table-container", { "dao-table-container--with-shadow": !_ctx.noShadow }])
7309
- }, [
7310
- createElementVNode("div", {
7311
- ref: "tableScroll",
7312
- class: normalizeClass(["dao-table-scroll", _ctx.tableWrapperClasses])
7313
- }, [
7314
- createElementVNode("table", _hoisted_1$5, [
7315
- _ctx.showHeader ? (openBlock(), createElementBlock("thead", _hoisted_2$4, [
7316
- createElementVNode("tr", _hoisted_3$3, [
7317
- _ctx.selectable ? (openBlock(), createElementBlock("th", _hoisted_4$1, [
7318
- createVNode(_component_dao_checkbox, {
7319
- checked: _ctx.global.checked,
7320
- indeterminate: _ctx.global.indeterminate,
7321
- onChange: _ctx.toggleSelectedAll
7322
- }, null, 8, ["checked", "indeterminate", "onChange"])
7323
- ])) : createCommentVNode("", true),
7324
- _ctx.expandable ? (openBlock(), createElementBlock("th", _hoisted_5$1)) : createCommentVNode("", true),
7325
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filterColumns, (column) => {
7326
- return openBlock(), createElementBlock("th", {
7327
- key: column.id,
7328
- ref: (el) => _ctx.setColumnRef(column.id, el),
7329
- class: normalizeClass(["dao-table-th", _ctx.thClass(column)]),
7330
- style: normalizeStyle(_ctx.columnStyle(column.id)),
7331
- onClick: ($event) => _ctx.sortColumn(column)
7332
- }, [
7333
- createElementVNode("span", _hoisted_7$1, [
7334
- renderSlot(_ctx.$slots, `th-${column.id}`, { column }, () => [
7335
- createTextVNode(toDisplayString(column.header), 1)
7336
- ])
7337
- ]),
7338
- column.sortable ? withDirectives((openBlock(), createElementBlock("i", {
7339
- key: 0,
7340
- class: normalizeClass(["icon-sorting dao-table-sort-icon", { "dao-table-sort-icon--desc": _ctx.sort.desc }])
7341
- }, null, 2)), [
7342
- [vShow, _ctx.sort.id === column.id]
7343
- ]) : createCommentVNode("", true),
7344
- createVNode(_component_dao_resizer, {
7345
- disabled: !column.resizable,
7346
- setting: _ctx.tableSetting[column.id],
7347
- column,
7348
- onFixedColumnWidth: _ctx.fixedColumnWidth,
7349
- onUpdateColumnWidth: ($event) => _ctx.updateColumnWidth($event, column.id),
7350
- onAfterResize: ($event) => _ctx.$emit("afterResize", column.id)
7351
- }, null, 8, ["disabled", "setting", "column", "onFixedColumnWidth", "onUpdateColumnWidth", "onAfterResize"])
7352
- ], 14, _hoisted_6$1);
7353
- }), 128))
7354
- ])
7355
- ])) : createCommentVNode("", true),
7356
- createElementVNode("tbody", _hoisted_8, [
7357
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data, (row, index2) => {
7358
- return openBlock(), createElementBlock(Fragment, { key: index2 }, [
7359
- createElementVNode("tr", {
7360
- class: normalizeClass(["dao-table-tr", { "dao-table-tr--expandable-open": _ctx.expandable && _ctx.isRowExpanded(row) }]),
7361
- onClick: (e) => _ctx.onRowClick(e, row, index2)
7362
- }, [
7363
- _ctx.selectable ? (openBlock(), createElementBlock("td", _hoisted_10, [
7364
- createVNode(_component_dao_checkbox, {
7365
- disabled: !_ctx.selectableRows.has(row),
7366
- checked: _ctx.isRowSelected(row),
7367
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
7368
- }, ["stop"])),
7369
- onChange: ($event) => _ctx.toggleSelected(row)
7370
- }, null, 8, ["disabled", "checked", "onChange"])
7371
- ])) : createCommentVNode("", true),
7372
- _ctx.expandable ? (openBlock(), createElementBlock("td", _hoisted_11, [
7373
- createElementVNode("i", {
7374
- class: "dao-table-expand-toggle icon-arrow-sharp",
7375
- onClick: ($event) => _ctx.toggleExpand(row, index2)
7376
- }, null, 8, _hoisted_12)
7377
- ])) : createCommentVNode("", true),
7378
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filterColumns, (column) => {
7379
- return openBlock(), createElementBlock(Fragment, {
7380
- key: column.id
7381
- }, [
7382
- column.id === "action" ? (openBlock(), createElementBlock("td", {
7383
- key: 0,
7384
- class: "dao-table-td",
7385
- style: normalizeStyle(_ctx.columnStyle(column.id))
7386
- }, [
7387
- renderSlot(_ctx.$slots, `td-${column.id}`, {
7388
- value: row[column.id],
7389
- row,
7390
- rowIndex: index2
7391
- }, () => [
7392
- createVNode(_component_td_action, null, {
7393
- default: withCtx(() => [
7394
- renderSlot(_ctx.$slots, `td-${column.id}-menu`, {
7395
- value: row[column.id],
7396
- row,
7397
- rowIndex: index2
7398
- })
7399
- ]),
7400
- _: 2
7401
- }, 1024)
7402
- ])
7403
- ], 4)) : (openBlock(), createElementBlock("td", {
7404
- key: 1,
7405
- class: "dao-table-td",
7406
- style: normalizeStyle(_ctx.columnStyle(column.id))
7407
- }, [
7408
- renderSlot(_ctx.$slots, `td-${column.id}`, {
7409
- value: row[column.id],
7410
- row,
7411
- rowIndex: index2
7412
- }, () => [
7413
- createElementVNode("span", null, toDisplayString(_ctx.withDefaultValue(row[column.id])), 1)
7414
- ])
7415
- ], 4))
7416
- ], 64);
7417
- }), 128))
7418
- ], 10, _hoisted_9),
7419
- _ctx.expandable && _ctx.expandedRows.has(row) ? withDirectives((openBlock(), createElementBlock("tr", _hoisted_13, [
7420
- renderSlot(_ctx.$slots, "expand", {
7421
- row,
7422
- rowIndex: index2
7423
- })
7424
- ], 512)), [
7425
- [vShow, _ctx.isRowExpanded(row)]
7426
- ]) : createCommentVNode("", true)
7427
- ], 64);
7428
- }), 128)),
7429
- _ctx.isEmpty ? (openBlock(), createElementBlock("div", _hoisted_14, [
7430
- renderSlot(_ctx.$slots, "empty", {}, () => [
7431
- createTextVNode(toDisplayString(_ctx.textContent.emptyText), 1)
7432
- ])
7433
- ])) : createCommentVNode("", true)
7120
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
7121
+ const _component_dao_toolbar_filter = resolveComponent("dao-toolbar-filter");
7122
+ const _component_dao_action_icon = resolveComponent("dao-action-icon");
7123
+ const _component_dao_tag = resolveComponent("dao-tag");
7124
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
7125
+ createElementVNode("div", _hoisted_2$3, [
7126
+ _ctx.$slots.filter ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
7127
+ renderSlot(_ctx.$slots, "filter")
7128
+ ])) : createCommentVNode("", true),
7129
+ !_ctx.hideSearch ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
7130
+ renderSlot(_ctx.$slots, "search", {}, () => [
7131
+ createVNode(_component_dao_toolbar_filter, {
7132
+ search: _ctx.searchModel,
7133
+ "onUpdate:search": _cache[0] || (_cache[0] = ($event) => _ctx.searchModel = $event),
7134
+ "search-placeholder": _ctx.searchPlaceholder,
7135
+ "search-options": _ctx.searchOptions,
7136
+ fuzzy: _ctx.fuzzy,
7137
+ onSearch: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("search"))
7138
+ }, null, 8, ["search", "search-placeholder", "search-options", "fuzzy"])
7434
7139
  ])
7435
- ])
7436
- ], 2),
7437
- createElementVNode("div", _hoisted_15, [
7438
- renderSlot(_ctx.$slots, "pagination", {}, () => {
7439
- var _a2;
7440
- return [
7441
- !_ctx.isEmpty && ((_a2 = _ctx.pageLayout) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_dao_pagination, {
7442
- key: 0,
7443
- "current-page": _ctx.currentPage,
7444
- "onUpdate:current-page": _cache[1] || (_cache[1] = ($event) => _ctx.currentPage = $event),
7445
- "page-size": _ctx.pageSize,
7446
- "onUpdate:page-size": _cache[2] || (_cache[2] = ($event) => _ctx.pageSize = $event),
7447
- "page-size-options": _ctx.pageSizeOptions,
7448
- "page-format": _ctx.pageFormat,
7449
- compact: _ctx.compact,
7450
- total: _ctx.total,
7451
- "total-format": _ctx.totalFormat,
7452
- layout: _ctx.pageLayout,
7453
- "page-sizer-width": _ctx.pageSizerWidth,
7454
- onNext: _cache[3] || (_cache[3] = ($event) => {
7455
- _ctx.$emit("next", $event);
7456
- _ctx.clearState();
7457
- }),
7458
- onPrev: _cache[4] || (_cache[4] = ($event) => {
7459
- _ctx.$emit("prev", $event);
7460
- _ctx.clearState();
7461
- }),
7462
- onPageChange: _cache[5] || (_cache[5] = ($event) => {
7463
- _ctx.$emit("pageChange", $event);
7464
- _ctx.clearState();
7465
- }),
7466
- onSizeChange: _cache[6] || (_cache[6] = ($event) => {
7467
- _ctx.$emit("sizeChange", $event);
7468
- _ctx.clearState();
7469
- })
7470
- }, null, 8, ["current-page", "page-size", "page-size-options", "page-format", "compact", "total", "total-format", "layout", "page-sizer-width"])) : createCommentVNode("", true)
7471
- ];
7140
+ ])) : createCommentVNode("", true),
7141
+ createElementVNode("div", _hoisted_5$1, [
7142
+ !_ctx.hideRefresh ? (openBlock(), createBlock(_component_dao_action_icon, {
7143
+ key: 0,
7144
+ class: "dao-toolbar__actions-refresh",
7145
+ name: "icon-refresh",
7146
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("refresh"))
7147
+ })) : createCommentVNode("", true)
7148
+ ]),
7149
+ _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
7150
+ renderSlot(_ctx.$slots, "action")
7151
+ ])) : createCommentVNode("", true)
7152
+ ]),
7153
+ _ctx.search && Object.keys(_ctx.search).length ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
7154
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.search, (values, key) => {
7155
+ return openBlock(), createElementBlock(Fragment, { key }, [
7156
+ _ctx.isFuzzyOption(key) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(values, (value, index2) => {
7157
+ return openBlock(), createBlock(_component_dao_tag, {
7158
+ key: index2,
7159
+ "is-close-show": "",
7160
+ closable: "",
7161
+ onClose: ($event) => _ctx.removeValue(key, index2)
7162
+ }, {
7163
+ default: withCtx(() => [
7164
+ createTextVNode(toDisplayString(value), 1)
7165
+ ]),
7166
+ _: 2
7167
+ }, 1032, ["onClose"]);
7168
+ }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(values, (value, index2) => {
7169
+ return openBlock(), createBlock(_component_dao_tag, {
7170
+ key: index2,
7171
+ "is-close-show": "",
7172
+ closable: "",
7173
+ onClose: ($event) => _ctx.removeValue(key, index2)
7174
+ }, {
7175
+ label: withCtx(() => [
7176
+ createTextVNode(toDisplayString(_ctx.getKeyLabel(key)), 1)
7177
+ ]),
7178
+ value: withCtx(() => [
7179
+ createTextVNode(toDisplayString(_ctx.getValueLabel(key, value)), 1)
7180
+ ]),
7181
+ _: 2
7182
+ }, 1032, ["onClose"]);
7183
+ }), 128))
7184
+ ], 64);
7185
+ }), 128)),
7186
+ createElementVNode("span", {
7187
+ class: "dao-toolbar__clear",
7188
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.clearFilter && _ctx.clearFilter(...args))
7189
+ }, toDisplayString(_ctx.t("core.toolbar.clear")), 1)
7190
+ ])) : createCommentVNode("", true)
7191
+ ]);
7192
+ }
7193
+ var DaoToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6]]);
7194
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
7195
+ var freeGlobal$1 = freeGlobal;
7196
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
7197
+ var root = freeGlobal$1 || freeSelf || Function("return this")();
7198
+ var root$1 = root;
7199
+ var Symbol$1 = root$1.Symbol;
7200
+ var Symbol$2 = Symbol$1;
7201
+ var objectProto$6 = Object.prototype;
7202
+ var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
7203
+ var nativeObjectToString$1 = objectProto$6.toString;
7204
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
7205
+ function getRawTag(value) {
7206
+ var isOwn = hasOwnProperty$4.call(value, symToStringTag$1), tag = value[symToStringTag$1];
7207
+ try {
7208
+ value[symToStringTag$1] = void 0;
7209
+ var unmasked = true;
7210
+ } catch (e) {
7211
+ }
7212
+ var result = nativeObjectToString$1.call(value);
7213
+ if (unmasked) {
7214
+ if (isOwn) {
7215
+ value[symToStringTag$1] = tag;
7216
+ } else {
7217
+ delete value[symToStringTag$1];
7218
+ }
7219
+ }
7220
+ return result;
7221
+ }
7222
+ var objectProto$5 = Object.prototype;
7223
+ var nativeObjectToString = objectProto$5.toString;
7224
+ function objectToString(value) {
7225
+ return nativeObjectToString.call(value);
7226
+ }
7227
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
7228
+ var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
7229
+ function baseGetTag(value) {
7230
+ if (value == null) {
7231
+ return value === void 0 ? undefinedTag : nullTag;
7232
+ }
7233
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
7234
+ }
7235
+ function isObjectLike(value) {
7236
+ return value != null && typeof value == "object";
7237
+ }
7238
+ var isArray = Array.isArray;
7239
+ var isArray$1 = isArray;
7240
+ function isObject(value) {
7241
+ var type = typeof value;
7242
+ return value != null && (type == "object" || type == "function");
7243
+ }
7244
+ var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
7245
+ function isFunction(value) {
7246
+ if (!isObject(value)) {
7247
+ return false;
7248
+ }
7249
+ var tag = baseGetTag(value);
7250
+ return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
7251
+ }
7252
+ var coreJsData = root$1["__core-js_shared__"];
7253
+ var coreJsData$1 = coreJsData;
7254
+ var maskSrcKey = function() {
7255
+ var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
7256
+ return uid ? "Symbol(src)_1." + uid : "";
7257
+ }();
7258
+ function isMasked(func) {
7259
+ return !!maskSrcKey && maskSrcKey in func;
7260
+ }
7261
+ var funcProto$1 = Function.prototype;
7262
+ var funcToString$1 = funcProto$1.toString;
7263
+ function toSource(func) {
7264
+ if (func != null) {
7265
+ try {
7266
+ return funcToString$1.call(func);
7267
+ } catch (e) {
7268
+ }
7269
+ try {
7270
+ return func + "";
7271
+ } catch (e) {
7272
+ }
7273
+ }
7274
+ return "";
7275
+ }
7276
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
7277
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
7278
+ var funcProto = Function.prototype, objectProto$4 = Object.prototype;
7279
+ var funcToString = funcProto.toString;
7280
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
7281
+ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$3).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
7282
+ function baseIsNative(value) {
7283
+ if (!isObject(value) || isMasked(value)) {
7284
+ return false;
7285
+ }
7286
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
7287
+ return pattern.test(toSource(value));
7288
+ }
7289
+ function getValue(object, key) {
7290
+ return object == null ? void 0 : object[key];
7291
+ }
7292
+ function getNative(object, key) {
7293
+ var value = getValue(object, key);
7294
+ return baseIsNative(value) ? value : void 0;
7295
+ }
7296
+ var WeakMap = getNative(root$1, "WeakMap");
7297
+ var WeakMap$1 = WeakMap;
7298
+ var MAX_SAFE_INTEGER = 9007199254740991;
7299
+ function isLength(value) {
7300
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
7301
+ }
7302
+ function isArrayLike(value) {
7303
+ return value != null && isLength(value.length) && !isFunction(value);
7304
+ }
7305
+ var objectProto$3 = Object.prototype;
7306
+ function isPrototype(value) {
7307
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$3;
7308
+ return value === proto;
7309
+ }
7310
+ var argsTag$1 = "[object Arguments]";
7311
+ function baseIsArguments(value) {
7312
+ return isObjectLike(value) && baseGetTag(value) == argsTag$1;
7313
+ }
7314
+ var objectProto$2 = Object.prototype;
7315
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
7316
+ var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
7317
+ var isArguments = baseIsArguments(function() {
7318
+ return arguments;
7319
+ }()) ? baseIsArguments : function(value) {
7320
+ return isObjectLike(value) && hasOwnProperty$2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
7321
+ };
7322
+ var isArguments$1 = isArguments;
7323
+ function stubFalse() {
7324
+ return false;
7325
+ }
7326
+ var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
7327
+ var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
7328
+ var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
7329
+ var Buffer2 = moduleExports$1 ? root$1.Buffer : void 0;
7330
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
7331
+ var isBuffer = nativeIsBuffer || stubFalse;
7332
+ var isBuffer$1 = isBuffer;
7333
+ var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag = "[object Number]", objectTag$1 = "[object Object]", regexpTag = "[object RegExp]", setTag$2 = "[object Set]", stringTag = "[object String]", weakMapTag$1 = "[object WeakMap]";
7334
+ var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
7335
+ var typedArrayTags = {};
7336
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
7337
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag] = typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] = typedArrayTags[setTag$2] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false;
7338
+ function baseIsTypedArray(value) {
7339
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
7340
+ }
7341
+ function baseUnary(func) {
7342
+ return function(value) {
7343
+ return func(value);
7344
+ };
7345
+ }
7346
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
7347
+ var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
7348
+ var moduleExports = freeModule && freeModule.exports === freeExports;
7349
+ var freeProcess = moduleExports && freeGlobal$1.process;
7350
+ var nodeUtil = function() {
7351
+ try {
7352
+ var types = freeModule && freeModule.require && freeModule.require("util").types;
7353
+ if (types) {
7354
+ return types;
7355
+ }
7356
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
7357
+ } catch (e) {
7358
+ }
7359
+ }();
7360
+ var nodeUtil$1 = nodeUtil;
7361
+ var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
7362
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
7363
+ var isTypedArray$1 = isTypedArray;
7364
+ function overArg(func, transform) {
7365
+ return function(arg) {
7366
+ return func(transform(arg));
7367
+ };
7368
+ }
7369
+ var nativeKeys = overArg(Object.keys, Object);
7370
+ var nativeKeys$1 = nativeKeys;
7371
+ var objectProto$1 = Object.prototype;
7372
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
7373
+ function baseKeys(object) {
7374
+ if (!isPrototype(object)) {
7375
+ return nativeKeys$1(object);
7376
+ }
7377
+ var result = [];
7378
+ for (var key in Object(object)) {
7379
+ if (hasOwnProperty$1.call(object, key) && key != "constructor") {
7380
+ result.push(key);
7381
+ }
7382
+ }
7383
+ return result;
7384
+ }
7385
+ var Map$1 = getNative(root$1, "Map");
7386
+ var Map$2 = Map$1;
7387
+ var DataView = getNative(root$1, "DataView");
7388
+ var DataView$1 = DataView;
7389
+ var Promise$1 = getNative(root$1, "Promise");
7390
+ var Promise$2 = Promise$1;
7391
+ var Set$1 = getNative(root$1, "Set");
7392
+ var Set$2 = Set$1;
7393
+ var mapTag$1 = "[object Map]", objectTag = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
7394
+ var dataViewTag = "[object DataView]";
7395
+ var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
7396
+ var getTag = baseGetTag;
7397
+ if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag || Map$2 && getTag(new Map$2()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$1 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
7398
+ getTag = function(value) {
7399
+ var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
7400
+ if (ctorString) {
7401
+ switch (ctorString) {
7402
+ case dataViewCtorString:
7403
+ return dataViewTag;
7404
+ case mapCtorString:
7405
+ return mapTag$1;
7406
+ case promiseCtorString:
7407
+ return promiseTag;
7408
+ case setCtorString:
7409
+ return setTag$1;
7410
+ case weakMapCtorString:
7411
+ return weakMapTag;
7412
+ }
7413
+ }
7414
+ return result;
7415
+ };
7416
+ }
7417
+ var getTag$1 = getTag;
7418
+ var mapTag = "[object Map]", setTag = "[object Set]";
7419
+ var objectProto = Object.prototype;
7420
+ var hasOwnProperty = objectProto.hasOwnProperty;
7421
+ function isEmpty(value) {
7422
+ if (value == null) {
7423
+ return true;
7424
+ }
7425
+ if (isArrayLike(value) && (isArray$1(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer$1(value) || isTypedArray$1(value) || isArguments$1(value))) {
7426
+ return !value.length;
7427
+ }
7428
+ var tag = getTag$1(value);
7429
+ if (tag == mapTag || tag == setTag) {
7430
+ return !value.size;
7431
+ }
7432
+ if (isPrototype(value)) {
7433
+ return !baseKeys(value).length;
7434
+ }
7435
+ for (var key in value) {
7436
+ if (hasOwnProperty.call(value, key)) {
7437
+ return false;
7438
+ }
7439
+ }
7440
+ return true;
7441
+ }
7442
+ function isNil(value) {
7443
+ return value == null;
7444
+ }
7445
+ function withDefaultValue(val) {
7446
+ return isNil(val) || isObject(val) && isEmpty(val) ? "-" : val;
7447
+ }
7448
+ const tableProps = __spreadValues({
7449
+ id: {
7450
+ type: String,
7451
+ require: true
7452
+ },
7453
+ columns: {
7454
+ type: Array,
7455
+ default: () => []
7456
+ },
7457
+ data: {
7458
+ type: Array,
7459
+ default: () => []
7460
+ },
7461
+ showHeader: {
7462
+ type: Boolean,
7463
+ default: true
7464
+ },
7465
+ selectable: {
7466
+ type: [Function, Boolean],
7467
+ default: false
7468
+ },
7469
+ selectedRows: {
7470
+ type: Array,
7471
+ default: () => []
7472
+ },
7473
+ expandable: {
7474
+ type: Boolean,
7475
+ default: false
7476
+ },
7477
+ sort: {
7478
+ type: Object,
7479
+ default: () => ({ id: "", desc: true })
7480
+ },
7481
+ compact: {
7482
+ type: Boolean,
7483
+ default: false
7484
+ },
7485
+ pageSize: {
7486
+ type: Number,
7487
+ default: 10,
7488
+ validator: (val) => val > 0 && Math.floor(val) === val
7489
+ },
7490
+ pageSizeOptions: {
7491
+ type: Array,
7492
+ default: () => [10, 20, 50]
7493
+ },
7494
+ pageFormat: {
7495
+ type: Function,
7496
+ default: void 0
7497
+ },
7498
+ total: {
7499
+ type: Number,
7500
+ default: 0
7501
+ },
7502
+ totalFormat: {
7503
+ type: Function,
7504
+ required: false
7505
+ },
7506
+ currentPage: {
7507
+ type: Number,
7508
+ default: 1
7509
+ },
7510
+ pageSizerWidth: {
7511
+ type: Number,
7512
+ default: 110
7513
+ },
7514
+ emptyText: {
7515
+ type: String,
7516
+ default: void 0
7517
+ },
7518
+ noShadow: {
7519
+ type: Boolean,
7520
+ default: false
7521
+ },
7522
+ pageLayout: paginationProps.layout,
7523
+ hideBatchBar: {
7524
+ type: Boolean,
7525
+ default: false
7526
+ },
7527
+ hideToolbar: {
7528
+ type: Boolean,
7529
+ default: false
7530
+ },
7531
+ selectedFormat: {
7532
+ type: Function,
7533
+ default: void 0
7534
+ },
7535
+ deselectText: {
7536
+ type: String,
7537
+ default: void 0
7538
+ },
7539
+ removeText: {
7540
+ type: String,
7541
+ default: void 0
7542
+ }
7543
+ }, toolbarProps);
7544
+ const _sfc_main$6 = defineComponent({
7545
+ components: {
7546
+ DaoActionIcon,
7547
+ DaoDropdown,
7548
+ DaoDropdownMenu
7549
+ },
7550
+ setup() {
7551
+ function handleClick(e) {
7552
+ e.stopRowClick = true;
7553
+ }
7554
+ return {
7555
+ handleClick
7556
+ };
7557
+ }
7558
+ });
7559
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
7560
+ const _component_dao_action_icon = resolveComponent("dao-action-icon");
7561
+ const _component_dao_dropdown_menu = resolveComponent("dao-dropdown-menu");
7562
+ const _component_dao_dropdown = resolveComponent("dao-dropdown");
7563
+ return openBlock(), createBlock(_component_dao_dropdown, { placement: "bottom-end" }, {
7564
+ menu: withCtx(() => [
7565
+ createVNode(_component_dao_dropdown_menu, null, {
7566
+ default: withCtx(() => [
7567
+ renderSlot(_ctx.$slots, "default")
7568
+ ]),
7569
+ _: 3
7472
7570
  })
7473
- ])
7474
- ], 2);
7571
+ ]),
7572
+ default: withCtx(() => [
7573
+ createVNode(_component_dao_action_icon, {
7574
+ name: "icon-more-vertical",
7575
+ "data-action-td": "",
7576
+ "use-font": "",
7577
+ onClick: _ctx.handleClick
7578
+ }, null, 8, ["onClick"])
7579
+ ]),
7580
+ _: 3
7581
+ });
7475
7582
  }
7476
- var table = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$7]]);
7477
- var tabNav_scss_vue_type_style_index_0_src_lang = "";
7478
- const _sfc_main$8 = defineComponent({
7479
- name: "DaoTabNav",
7480
- props: {
7481
- type: {
7482
- type: String,
7483
- default: "card"
7484
- },
7485
- currentTab: {
7486
- type: String,
7487
- default: null
7488
- },
7489
- tabList: {
7490
- type: Array,
7491
- required: true
7492
- }
7583
+ var TdAction = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5]]);
7584
+ var table_vue_vue_type_style_index_0_lang = "";
7585
+ const positiveIntegerNumberReg = /^[1-9]\d*$/;
7586
+ const defaultColumnConfig = {
7587
+ defaultWidth: 1,
7588
+ minWidth: 56,
7589
+ sortable: false,
7590
+ resizable: true,
7591
+ hidable: true,
7592
+ defaultHide: false
7593
+ };
7594
+ const defaultSelectableFn = () => true;
7595
+ const _sfc_main$5 = defineComponent({
7596
+ name: "DaoTable",
7597
+ components: {
7598
+ DaoBatchBar,
7599
+ DaoResizer,
7600
+ DaoPagination,
7601
+ DaoCheckbox,
7602
+ DaoToolbar,
7603
+ TdAction
7493
7604
  },
7494
- emits: ["updateValue", "click"],
7605
+ props: tableProps,
7606
+ emits: [
7607
+ "select",
7608
+ "update:selectedRows",
7609
+ "sortChange",
7610
+ "hideColumn",
7611
+ "afterResize",
7612
+ "expandToggle",
7613
+ "update:current-page",
7614
+ "update:page-size",
7615
+ "next",
7616
+ "prev",
7617
+ "pageChange",
7618
+ "sizeChange",
7619
+ "row-click",
7620
+ "delete",
7621
+ "update:search",
7622
+ "search",
7623
+ "refresh"
7624
+ ],
7495
7625
  setup(props, { emit }) {
7496
- let onMouseenter;
7497
- let onMouseleave;
7498
- const activeTab = ref();
7499
- const tabNav = ref();
7500
- let lineStyle;
7501
- let setActiveLineStyle;
7502
- let tabResizeObserver;
7503
- const isLine = computed(() => props.type === "line");
7504
- const renderLines = () => {
7505
- if (!isLine.value) {
7506
- return;
7626
+ const { t } = useI18n();
7627
+ const tableId = computed(() => `DAO_TABLE_${props.id}`);
7628
+ const tableSetting = reactive({});
7629
+ const sort = reactive(props.sort);
7630
+ const textContent = computed(() => ({
7631
+ emptyText: props.emptyText || t("core.table.emptyText")
7632
+ }));
7633
+ const expandRows = reactive([]);
7634
+ const global2 = reactive({
7635
+ checked: false,
7636
+ indeterminate: false
7637
+ });
7638
+ const selectedRowsModel = useVModel(props, "selectedRows", emit);
7639
+ const selectedRowsSet = reactive(new Set());
7640
+ const isRowSelected = (row) => selectedRowsSet.has(row);
7641
+ const selectableFn = computed(() => typeof props.selectable === "function" ? props.selectable : defaultSelectableFn);
7642
+ const selectableRows = computed(() => {
7643
+ var _a2;
7644
+ const selectableRowsSet = new Set();
7645
+ (_a2 = props.data) == null ? void 0 : _a2.forEach((item, index2) => {
7646
+ if (selectableFn.value(item, index2)) {
7647
+ selectableRowsSet.add(item);
7648
+ }
7649
+ });
7650
+ return selectableRowsSet;
7651
+ });
7652
+ const toggleSelected = (row) => {
7653
+ if (selectedRowsSet.has(row)) {
7654
+ selectedRowsSet.delete(row);
7655
+ emit("select", Array.from(selectedRowsSet), [], [row]);
7656
+ } else {
7657
+ selectedRowsSet.add(row);
7658
+ emit("select", Array.from(selectedRowsSet), [row], []);
7507
7659
  }
7508
- const hoverTab = ref();
7509
- const hoverLineStyle = computed(() => {
7510
- const tab = unref(hoverTab);
7511
- return tab ? {
7512
- "--hover-line-width": `${tab.offsetWidth || 0}px`,
7513
- "--hover-line-left": `${tab.offsetLeft || 0}px`
7514
- } : {};
7660
+ };
7661
+ const clearSelection = () => {
7662
+ let removedRowsSnapshot = Array.from(selectedRowsSet);
7663
+ selectedRowsSet.forEach((item) => {
7664
+ if (selectableRows.value.has(item)) {
7665
+ selectedRowsSet.delete(item);
7666
+ }
7515
7667
  });
7516
- onMouseenter = (event) => {
7517
- if (event.target) {
7518
- hoverTab.value = event.target;
7668
+ emit("select", Array.from(selectedRowsSet), [], removedRowsSnapshot);
7669
+ removedRowsSnapshot = [];
7670
+ };
7671
+ const selectedAll = () => {
7672
+ props.data.forEach((item) => {
7673
+ if (selectableRows.value.has(item)) {
7674
+ selectedRowsSet.add(item);
7519
7675
  }
7520
- };
7521
- onMouseleave = (event) => {
7522
- if (event.target === hoverTab.value) {
7523
- hoverTab.value = void 0;
7676
+ });
7677
+ emit("select", Array.from(selectedRowsSet), Array.from(selectableRows.value), []);
7678
+ };
7679
+ const toggleSelectedAll = () => {
7680
+ if (!global2.checked || global2.indeterminate) {
7681
+ selectedAll();
7682
+ } else {
7683
+ clearSelection();
7684
+ }
7685
+ };
7686
+ const handleSelectedRows = () => {
7687
+ const nowValue = selectedRowsModel.value;
7688
+ const { data } = props;
7689
+ const { length } = data;
7690
+ selectedRowsSet.clear();
7691
+ if (nowValue.length && length) {
7692
+ for (let index2 = 0; index2 < length; index2 += 1) {
7693
+ const row = data[index2];
7694
+ if (nowValue.includes(row)) {
7695
+ selectedRowsSet.add(row);
7696
+ }
7524
7697
  }
7525
- };
7526
- const activeLineStyle = ref({});
7527
- setActiveLineStyle = () => {
7528
- const tab = unref(activeTab);
7529
- if (tab && tab.offsetWidth && tab.offsetLeft !== void 0) {
7530
- activeLineStyle.value = {
7531
- "--active-line-width": `${tab.offsetWidth || 0}px`,
7532
- "--active-line-left": `${tab.offsetLeft || 0}px`
7533
- };
7698
+ }
7699
+ };
7700
+ watch([() => props.data, selectedRowsModel], handleSelectedRows, {
7701
+ immediate: true,
7702
+ deep: true
7703
+ });
7704
+ watch([selectedRowsSet, selectableRows], () => {
7705
+ let have = 0;
7706
+ let notHave = 0;
7707
+ for (let i = 0; i < props.data.length; i += 1) {
7708
+ const item = props.data[i];
7709
+ if (selectedRowsSet.has(item)) {
7710
+ have += 1;
7711
+ } else if (selectableRows.value.has(item)) {
7712
+ notHave += 1;
7534
7713
  }
7535
- };
7536
- watch(activeTab, (val) => {
7537
- setActiveLineStyle();
7538
- tabResizeObserver == null ? void 0 : tabResizeObserver.disconnect();
7539
- tabResizeObserver = new ResizeObserver(setActiveLineStyle);
7540
- if (tabNav.value && val) {
7541
- tabResizeObserver.observe(val);
7714
+ if (have && notHave) {
7715
+ break;
7542
7716
  }
7543
- });
7544
- lineStyle = computed(() => __spreadValues(__spreadValues({}, activeLineStyle.value), hoverLineStyle.value));
7717
+ }
7718
+ if (have && notHave) {
7719
+ global2.checked = false;
7720
+ global2.indeterminate = true;
7721
+ } else if (have) {
7722
+ global2.checked = true;
7723
+ global2.indeterminate = false;
7724
+ } else {
7725
+ global2.checked = false;
7726
+ global2.indeterminate = false;
7727
+ }
7728
+ selectedRowsModel.value.splice(0, selectedRowsModel.value.length, ...Array.from(selectedRowsSet));
7729
+ }, {
7730
+ deep: true,
7731
+ immediate: true,
7732
+ flush: "post"
7733
+ });
7734
+ const expandedRows = reactive(new WeakSet());
7735
+ const columnRefs = reactive({});
7736
+ const columns = reactive([]);
7737
+ const currentPage = computed({
7738
+ get() {
7739
+ return props.currentPage;
7740
+ },
7741
+ set(value) {
7742
+ emit("update:current-page", value);
7743
+ }
7744
+ });
7745
+ const pageSize = computed({
7746
+ get() {
7747
+ return props.pageSize;
7748
+ },
7749
+ set(value) {
7750
+ emit("update:page-size", value);
7751
+ }
7752
+ });
7753
+ const tableScroll = ref();
7754
+ const setColumnRef = (columnId, el) => {
7755
+ columnRefs[columnId] = el;
7545
7756
  };
7546
- const stopWatch = watch(isLine, (val) => {
7547
- if (val) {
7548
- renderLines();
7549
- stopWatch();
7757
+ const getTableSetting = () => {
7758
+ const setting = localStorage.getItem(tableId.value) || "";
7759
+ try {
7760
+ return JSON.parse(setting);
7761
+ } catch (e) {
7762
+ console.warn("JSON parse error", setting);
7763
+ return null;
7764
+ }
7765
+ };
7766
+ const setTableSetting = (setting) => {
7767
+ try {
7768
+ localStorage.setItem(tableId.value, JSON.stringify(setting));
7769
+ } catch (e) {
7770
+ console.error("JSON stringify error", setting);
7550
7771
  }
7772
+ };
7773
+ watch(tableSetting, (val) => {
7774
+ setTableSetting(val);
7551
7775
  });
7552
- onMounted(renderLines);
7553
- onUnmounted(() => {
7554
- if (tabNav.value) {
7555
- tabResizeObserver == null ? void 0 : tabResizeObserver.disconnect();
7776
+ function formatDefaultTableSetting(tempColumns) {
7777
+ return tempColumns.reduce((prev, current) => {
7778
+ const preValue = prev;
7779
+ preValue[current.id] = {
7780
+ width: current.defaultWidth,
7781
+ hide: current.hidable && current.defaultHide
7782
+ };
7783
+ return preValue;
7784
+ }, {});
7785
+ }
7786
+ const init = () => {
7787
+ const tempColumns = [];
7788
+ props.columns.forEach((column) => {
7789
+ tempColumns.push(__spreadValues(__spreadValues({}, defaultColumnConfig), column));
7790
+ });
7791
+ const storedTableSetting = getTableSetting();
7792
+ const defaultTableSetting = formatDefaultTableSetting(tempColumns);
7793
+ if (!storedTableSetting) {
7794
+ Object.assign(tableSetting, defaultTableSetting);
7795
+ } else {
7796
+ tempColumns.forEach((column) => {
7797
+ const { id } = column;
7798
+ if (!storedTableSetting[id]) {
7799
+ tableSetting[id] = {
7800
+ width: column.defaultWidth,
7801
+ hide: column.hidable && column.defaultHide
7802
+ };
7803
+ } else if (!column.hidable) {
7804
+ tableSetting[id] = {
7805
+ width: storedTableSetting[id].width,
7806
+ hide: false
7807
+ };
7808
+ } else {
7809
+ tableSetting[id] = storedTableSetting[id];
7810
+ }
7811
+ });
7812
+ }
7813
+ columns.splice(0, columns.length, ...tempColumns);
7814
+ };
7815
+ const columnStyle = (id) => {
7816
+ const setting = tableSetting[id];
7817
+ const { width } = setting;
7818
+ if (positiveIntegerNumberReg.test(width.toString())) {
7819
+ return { flex: `${width} ${width} auto` };
7820
+ }
7821
+ return { width };
7822
+ };
7823
+ const filterColumns = computed(() => columns.filter((c) => !tableSetting[c.id].hide));
7824
+ const tableWrapperClasses = computed(() => {
7825
+ const classes = [];
7826
+ if (props.compact) {
7827
+ classes.push("dao-table--compact");
7556
7828
  }
7829
+ if (props.selectable) {
7830
+ classes.push("dao-table--selectable");
7831
+ }
7832
+ if (props.expandable) {
7833
+ classes.push("dao-table--expandable");
7834
+ }
7835
+ return classes;
7557
7836
  });
7558
- const handleClick = (event, tab) => {
7559
- const {
7560
- value,
7561
- disabled
7562
- } = tab;
7563
- if (typeof disabled !== "undefined" && disabled) {
7837
+ const isEmpty2 = computed(() => (props.data || []).length === 0);
7838
+ const sortColumn = (column) => {
7839
+ if (!column.sortable) {
7564
7840
  return;
7565
7841
  }
7566
- if (value !== props.currentTab) {
7567
- emit("updateValue", value);
7842
+ if (sort.id === column.id) {
7843
+ sort.desc = !sort.desc;
7844
+ } else {
7845
+ sort.id = column.id;
7846
+ sort.desc = true;
7568
7847
  }
7569
- emit("click", event, value);
7848
+ emit("sortChange", sort);
7570
7849
  };
7571
- const tabsLi = computed(() => props.tabList.map((tab, index2) => {
7572
- const { label } = tab;
7573
- const isNotString = typeof label !== "string";
7574
- const isActive = tab.value === props.currentTab;
7575
- const hasHoverLine = isLine.value && !tab.disabled;
7576
- const hasActiveLine = isLine.value && isActive;
7577
- return h("div", {
7578
- class: {
7579
- "dao-tabs__nav-item": true,
7580
- "dao-tabs__nav-item--active": isActive,
7581
- "dao-tabs__nav-item--custom": isNotString,
7582
- "dao-tabs__nav-item--disabled": tab.disabled
7583
- },
7584
- ref: hasActiveLine ? activeTab : void 0,
7585
- key: index2,
7586
- onClick: (event) => handleClick(event, tab),
7587
- onMouseenter: hasHoverLine ? onMouseenter : void 0,
7588
- onMouseleave: hasHoverLine ? onMouseleave : void 0
7589
- }, [isNotString ? label() : label]);
7590
- }));
7591
- return () => h("div", {
7592
- class: [
7593
- "dao-tabs__nav__scroll"
7594
- ]
7595
- }, h("div", {
7596
- class: [
7597
- "dao-tabs__nav"
7598
- ],
7599
- style: lineStyle == null ? void 0 : lineStyle.value,
7600
- ref: tabNav
7601
- }, tabsLi.value));
7602
- }
7603
- });
7604
- var tabs_scss_vue_type_style_index_0_src_lang = "";
7605
- const _sfc_main$7 = defineComponent({
7606
- name: "DaoTabs",
7607
- components: {
7608
- TabNav: _sfc_main$8
7609
- },
7610
- props: {
7611
- type: {
7612
- type: String,
7613
- default: "card",
7614
- validator: (value) => ["card", "line", "pill"].includes(value)
7615
- },
7616
- direction: {
7617
- type: String,
7618
- required: false,
7619
- default: "left",
7620
- validator: (value) => ["left", "right"].includes(value)
7621
- },
7622
- modelValue: {
7623
- type: String,
7624
- default: null
7625
- }
7626
- },
7627
- emits: ["change", "update:modelValue", "click"],
7628
- setup(props, { emit }) {
7629
- const { modelValue } = toRefs(props);
7630
- const currentValue = ref(modelValue.value);
7631
- watch(modelValue, (newV) => {
7632
- emit("change", newV);
7633
- if (newV !== currentValue.value) {
7634
- currentValue.value = newV;
7850
+ const thClass = (column) => {
7851
+ if (column.sortable) {
7852
+ return "dao-table-th--sortable";
7853
+ }
7854
+ return "";
7855
+ };
7856
+ const isRowExpanded = (row) => expandRows.includes(row);
7857
+ const toggleExpand = (row, rowIndex) => {
7858
+ expandedRows.add(row);
7859
+ const index2 = expandRows.indexOf(row);
7860
+ if (index2 > -1) {
7861
+ expandRows.splice(index2, 1);
7862
+ emit("expandToggle", row, rowIndex, false);
7863
+ } else {
7864
+ expandRows.push(row);
7865
+ emit("expandToggle", row, rowIndex, true);
7866
+ }
7867
+ };
7868
+ const fixedColumnWidth = () => {
7869
+ columns.forEach((column) => {
7870
+ tableSetting[column.id].width = `${columnRefs[column.id].clientWidth}px`;
7871
+ });
7872
+ };
7873
+ const updateColumnWidth = (columnWidth, columnId) => {
7874
+ tableSetting[columnId].width = `${columnWidth}px`;
7875
+ };
7876
+ const clearExpansion = () => {
7877
+ expandRows.length = 0;
7878
+ };
7879
+ const clearState = () => {
7880
+ clearExpansion();
7881
+ clearSelection();
7882
+ };
7883
+ const batchDelete = () => {
7884
+ emit("delete");
7885
+ };
7886
+ const deselect = () => {
7887
+ clearSelection();
7888
+ };
7889
+ const onSearch = () => {
7890
+ emit("search");
7891
+ };
7892
+ const onRefresh = () => {
7893
+ emit("refresh");
7894
+ };
7895
+ const searchModel = useVModel(props, "search", emit);
7896
+ const showBatchBar = computed(() => props.selectable && !props.hideBatchBar);
7897
+ const showToolbar = computed(() => {
7898
+ if (props.hideToolbar || showBatchBar.value && selectedRowsSet.size !== 0) {
7899
+ return false;
7635
7900
  }
7901
+ return true;
7636
7902
  });
7637
- watch(currentValue, (newV) => {
7638
- if (newV !== modelValue.value) {
7639
- emit("update:modelValue", newV);
7903
+ watch(() => props.columns, () => {
7904
+ init();
7905
+ }, { deep: true, immediate: true });
7906
+ const isEllipsis = () => {
7907
+ if (!tableScroll.value) {
7908
+ return false;
7640
7909
  }
7641
- });
7642
- const updateValue = (tabValue) => {
7643
- currentValue.value = tabValue;
7644
- };
7645
- provide(tabModelValueKey, modelValue);
7646
- const onClick = (e, tabValue) => {
7647
- emit("click", e, tabValue);
7910
+ return tableScroll.value.offsetWidth < tableScroll.value.scrollWidth;
7648
7911
  };
7649
- const tabList = reactive([]);
7650
- const tabBody = ref();
7651
- const addTab = (tab, child) => {
7652
- var _a2;
7653
- if (!child.value) {
7912
+ const windowResize = () => {
7913
+ if (isEllipsis()) {
7654
7914
  return;
7655
7915
  }
7656
- const index2 = Array.from(((_a2 = tabBody.value) == null ? void 0 : _a2.children) || []).indexOf(child.value);
7657
- if (index2 > -1) {
7658
- tabList.splice(index2, 0, tab);
7659
- }
7916
+ columns.forEach((column) => {
7917
+ const width = column.defaultWidth;
7918
+ if (positiveIntegerNumberReg.test(width.toString())) {
7919
+ tableSetting[column.id].width = width;
7920
+ }
7921
+ });
7660
7922
  };
7661
- provide(addTabFnKey, addTab);
7662
- const removeTab = (tab) => {
7663
- const index2 = tabList.indexOf(tab);
7664
- if (index2 > -1) {
7665
- tabList.splice(index2, 1);
7923
+ onMounted(() => {
7924
+ window.addEventListener("resize", windowResize);
7925
+ });
7926
+ onUnmounted(() => {
7927
+ window.removeEventListener("resize", windowResize);
7928
+ });
7929
+ function onRowClick(e, row, rowIndex) {
7930
+ if (e.stopRowClick) {
7931
+ return;
7666
7932
  }
7667
- };
7668
- provide(removeTabFnKey, removeTab);
7933
+ emit("row-click", row, rowIndex);
7934
+ }
7669
7935
  return {
7670
- tabList,
7671
- tabBody,
7672
- onClick,
7673
- updateValue
7936
+ textContent,
7937
+ columns,
7938
+ filterColumns,
7939
+ tableWrapperClasses,
7940
+ tableSetting,
7941
+ columnStyle,
7942
+ sortColumn,
7943
+ sort,
7944
+ thClass,
7945
+ isRowExpanded,
7946
+ toggleExpand,
7947
+ setColumnRef,
7948
+ fixedColumnWidth,
7949
+ updateColumnWidth,
7950
+ currentPage,
7951
+ pageSize,
7952
+ clearState,
7953
+ global: global2,
7954
+ tableScroll,
7955
+ expandedRows,
7956
+ onRowClick,
7957
+ isEmpty: isEmpty2,
7958
+ selectableRows,
7959
+ isRowSelected,
7960
+ toggleSelected,
7961
+ toggleSelectedAll,
7962
+ withDefaultValue,
7963
+ batchDelete,
7964
+ deselect,
7965
+ showBatchBar,
7966
+ onSearch,
7967
+ onRefresh,
7968
+ showToolbar,
7969
+ searchModel
7674
7970
  };
7675
7971
  }
7676
7972
  });
7677
- const _hoisted_1$4 = { class: "dao-tabs__nav__wrap" };
7678
- const _hoisted_2$3 = {
7973
+ const _hoisted_1$3 = {
7679
7974
  key: 0,
7680
- class: "dao-tabs__action"
7975
+ class: "dao-table__toolbar"
7681
7976
  };
7682
- const _hoisted_3$2 = {
7683
- ref: "tabBody",
7684
- class: "dao-tabs__body"
7977
+ const _hoisted_2$2 = { class: "dao-table" };
7978
+ const _hoisted_3$1 = {
7979
+ key: 0,
7980
+ class: "dao-table-thead"
7685
7981
  };
7686
- function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
7687
- const _component_tab_nav = resolveComponent("tab-nav");
7982
+ const _hoisted_4 = { class: "dao-table-tr" };
7983
+ const _hoisted_5 = {
7984
+ key: 0,
7985
+ class: "dao-table-th"
7986
+ };
7987
+ const _hoisted_6 = {
7988
+ key: 1,
7989
+ class: "dao-table-th dao-table-th--expandable"
7990
+ };
7991
+ const _hoisted_7 = ["onClick"];
7992
+ const _hoisted_8 = { class: "dao-table-th__content" };
7993
+ const _hoisted_9 = { class: "dao-table-tbody" };
7994
+ const _hoisted_10 = ["onClick"];
7995
+ const _hoisted_11 = {
7996
+ key: 0,
7997
+ class: "dao-table-td"
7998
+ };
7999
+ const _hoisted_12 = {
8000
+ key: 1,
8001
+ class: "dao-table-td"
8002
+ };
8003
+ const _hoisted_13 = ["onClick"];
8004
+ const _hoisted_14 = {
8005
+ key: 0,
8006
+ class: "dao-table-tr-expand"
8007
+ };
8008
+ const _hoisted_15 = {
8009
+ key: 0,
8010
+ class: "dao-table__empty-block"
8011
+ };
8012
+ const _hoisted_16 = { class: "dao-table-pagination" };
8013
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
8014
+ const _component_dao_toolbar = resolveComponent("dao-toolbar");
8015
+ const _component_dao_batch_bar = resolveComponent("dao-batch-bar");
8016
+ const _component_dao_checkbox = resolveComponent("dao-checkbox");
8017
+ const _component_dao_resizer = resolveComponent("dao-resizer");
8018
+ const _component_td_action = resolveComponent("td-action");
8019
+ const _component_dao_pagination = resolveComponent("dao-pagination");
7688
8020
  return openBlock(), createElementBlock("div", {
7689
- class: normalizeClass(["dao-tabs", ["dao-tabs--" + _ctx.type, _ctx.direction === "right" ? "dao-tabs--right" : ""]])
8021
+ class: normalizeClass(["dao-table-container", { "dao-table-container--with-shadow": !_ctx.noShadow }])
7690
8022
  }, [
8023
+ _ctx.showToolbar ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
8024
+ createVNode(_component_dao_toolbar, {
8025
+ search: _ctx.searchModel,
8026
+ "onUpdate:search": _cache[0] || (_cache[0] = ($event) => _ctx.searchModel = $event),
8027
+ "search-options": _ctx.searchOptions,
8028
+ fuzzy: _ctx.fuzzy,
8029
+ "search-placeholder": _ctx.searchPlaceholder,
8030
+ "hide-refresh": _ctx.hideRefresh,
8031
+ "hide-search": _ctx.hideSearch,
8032
+ onSearch: _ctx.onSearch,
8033
+ onRefresh: _ctx.onRefresh
8034
+ }, createSlots({
8035
+ search: withCtx(() => [
8036
+ renderSlot(_ctx.$slots, "search")
8037
+ ]),
8038
+ _: 2
8039
+ }, [
8040
+ _ctx.$slots.filter ? {
8041
+ name: "filter",
8042
+ fn: withCtx(() => [
8043
+ renderSlot(_ctx.$slots, "filter")
8044
+ ])
8045
+ } : void 0,
8046
+ _ctx.$slots.action ? {
8047
+ name: "action",
8048
+ fn: withCtx(() => [
8049
+ renderSlot(_ctx.$slots, "action")
8050
+ ])
8051
+ } : void 0
8052
+ ]), 1032, ["search", "search-options", "fuzzy", "search-placeholder", "hide-refresh", "hide-search", "onSearch", "onRefresh"])
8053
+ ])) : createCommentVNode("", true),
8054
+ withDirectives(createVNode(_component_dao_batch_bar, {
8055
+ total: _ctx.selectedRows.length,
8056
+ "deselect-text": _ctx.deselectText,
8057
+ "remove-text": _ctx.removeText,
8058
+ "selected-format": _ctx.selectedFormat,
8059
+ onDelete: _ctx.batchDelete,
8060
+ onDeselect: _ctx.deselect
8061
+ }, {
8062
+ default: withCtx(() => [
8063
+ renderSlot(_ctx.$slots, "batch-action")
8064
+ ]),
8065
+ _: 3
8066
+ }, 8, ["total", "deselect-text", "remove-text", "selected-format", "onDelete", "onDeselect"]), [
8067
+ [vShow, _ctx.showBatchBar]
8068
+ ]),
7691
8069
  createElementVNode("div", {
7692
- class: normalizeClass(["dao-tabs__header", "dao-tabs__header--" + _ctx.type])
8070
+ ref: "tableScroll",
8071
+ class: normalizeClass(["dao-table-scroll", _ctx.tableWrapperClasses])
7693
8072
  }, [
7694
- createElementVNode("div", _hoisted_1$4, [
7695
- createVNode(_component_tab_nav, {
7696
- type: _ctx.type,
7697
- "tab-list": _ctx.tabList,
7698
- "current-tab": _ctx.modelValue,
7699
- onUpdateValue: _ctx.updateValue,
7700
- onClick: _ctx.onClick
7701
- }, null, 8, ["type", "tab-list", "current-tab", "onUpdateValue", "onClick"])
7702
- ]),
7703
- _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
7704
- renderSlot(_ctx.$slots, "action")
7705
- ])) : createCommentVNode("", true)
7706
- ], 2),
7707
- createElementVNode("div", _hoisted_3$2, [
7708
- renderSlot(_ctx.$slots, "default")
7709
- ], 512)
7710
- ], 2);
7711
- }
7712
- var tabs = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6]]);
7713
- var tabItem_scss_vue_type_style_index_0_src_lang = "";
7714
- const _sfc_main$6 = defineComponent({
7715
- name: "DaoTabItem",
7716
- props: {
7717
- label: {
7718
- type: [String, Function],
7719
- required: true
7720
- },
7721
- value: {
7722
- type: String,
7723
- required: true
7724
- },
7725
- disabled: {
7726
- type: Boolean,
7727
- default: false
7728
- }
7729
- },
7730
- setup(props) {
7731
- const tabModelValue = inject(tabModelValueKey);
7732
- const active = computed(() => (tabModelValue == null ? void 0 : tabModelValue.value) === props.value);
7733
- const tabItem2 = ref();
7734
- const addTabFn = inject(addTabFnKey, NOOP);
7735
- const removeTabFn = inject(removeTabFnKey, NOOP);
7736
- onMounted(() => addTabFn(props, tabItem2));
7737
- onUnmounted(() => removeTabFn(props));
7738
- return {
7739
- active,
7740
- tabItem: tabItem2
7741
- };
7742
- }
7743
- });
7744
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
7745
- return openBlock(), createElementBlock("div", {
7746
- ref: "tabItem",
7747
- class: normalizeClass(["dao-tab-item", {
7748
- "dao-tab-item--hidden": !_ctx.active
7749
- }])
7750
- }, [
7751
- renderSlot(_ctx.$slots, "default")
7752
- ], 2);
7753
- }
7754
- var tabItem = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5]]);
7755
- var tag_vue_vue_type_style_index_0_lang = "";
7756
- const _sfc_main$5 = defineComponent({
7757
- name: "DaoTag",
7758
- components: {
7759
- DaoIcon
7760
- },
7761
- props: {
7762
- closable: {
7763
- type: Boolean,
7764
- default: false
7765
- },
7766
- separator: {
7767
- type: String,
7768
- default: ": "
7769
- },
7770
- label: {
7771
- type: String,
7772
- default: ""
7773
- },
7774
- value: {
7775
- type: String,
7776
- default: ""
7777
- }
7778
- },
7779
- emits: ["close"]
7780
- });
7781
- const _hoisted_1$3 = { class: "dao-tag" };
7782
- const _hoisted_2$2 = { class: "dao-tag__key" };
7783
- const _hoisted_3$1 = { class: "dao-tag__value" };
7784
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
7785
- const _component_dao_icon = resolveComponent("dao-icon");
7786
- return openBlock(), createElementBlock("span", _hoisted_1$3, [
7787
- renderSlot(_ctx.$slots, "default", {}, () => [
7788
- createElementVNode("span", null, [
7789
- createElementVNode("span", _hoisted_2$2, [
7790
- renderSlot(_ctx.$slots, "label", {}, () => [
7791
- createTextVNode(toDisplayString(_ctx.label), 1)
7792
- ]),
7793
- createTextVNode(toDisplayString(_ctx.separator), 1)
7794
- ]),
7795
- createElementVNode("span", _hoisted_3$1, [
7796
- renderSlot(_ctx.$slots, "value", {}, () => [
7797
- createTextVNode(toDisplayString(_ctx.value), 1)
8073
+ createElementVNode("table", _hoisted_2$2, [
8074
+ _ctx.showHeader ? (openBlock(), createElementBlock("thead", _hoisted_3$1, [
8075
+ createElementVNode("tr", _hoisted_4, [
8076
+ _ctx.selectable ? (openBlock(), createElementBlock("th", _hoisted_5, [
8077
+ createVNode(_component_dao_checkbox, {
8078
+ checked: _ctx.global.checked,
8079
+ indeterminate: _ctx.global.indeterminate,
8080
+ onChange: _ctx.toggleSelectedAll
8081
+ }, null, 8, ["checked", "indeterminate", "onChange"])
8082
+ ])) : createCommentVNode("", true),
8083
+ _ctx.expandable ? (openBlock(), createElementBlock("th", _hoisted_6)) : createCommentVNode("", true),
8084
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filterColumns, (column) => {
8085
+ return openBlock(), createElementBlock("th", {
8086
+ key: column.id,
8087
+ ref: (el) => _ctx.setColumnRef(column.id, el),
8088
+ class: normalizeClass(["dao-table-th", _ctx.thClass(column)]),
8089
+ style: normalizeStyle(_ctx.columnStyle(column.id)),
8090
+ onClick: ($event) => _ctx.sortColumn(column)
8091
+ }, [
8092
+ createElementVNode("span", _hoisted_8, [
8093
+ renderSlot(_ctx.$slots, `th-${column.id}`, { column }, () => [
8094
+ createTextVNode(toDisplayString(column.header), 1)
8095
+ ])
8096
+ ]),
8097
+ column.sortable ? withDirectives((openBlock(), createElementBlock("i", {
8098
+ key: 0,
8099
+ class: normalizeClass(["icon-sorting dao-table-sort-icon", { "dao-table-sort-icon--desc": _ctx.sort.desc }])
8100
+ }, null, 2)), [
8101
+ [vShow, _ctx.sort.id === column.id]
8102
+ ]) : createCommentVNode("", true),
8103
+ createVNode(_component_dao_resizer, {
8104
+ disabled: !column.resizable,
8105
+ setting: _ctx.tableSetting[column.id],
8106
+ column,
8107
+ onFixedColumnWidth: _ctx.fixedColumnWidth,
8108
+ onUpdateColumnWidth: ($event) => _ctx.updateColumnWidth($event, column.id),
8109
+ onAfterResize: ($event) => _ctx.$emit("afterResize", column.id)
8110
+ }, null, 8, ["disabled", "setting", "column", "onFixedColumnWidth", "onUpdateColumnWidth", "onAfterResize"])
8111
+ ], 14, _hoisted_7);
8112
+ }), 128))
7798
8113
  ])
8114
+ ])) : createCommentVNode("", true),
8115
+ createElementVNode("tbody", _hoisted_9, [
8116
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data, (row, index2) => {
8117
+ return openBlock(), createElementBlock(Fragment, { key: index2 }, [
8118
+ createElementVNode("tr", {
8119
+ class: normalizeClass(["dao-table-tr", { "dao-table-tr--expandable-open": _ctx.expandable && _ctx.isRowExpanded(row) }]),
8120
+ onClick: (e) => _ctx.onRowClick(e, row, index2)
8121
+ }, [
8122
+ _ctx.selectable ? (openBlock(), createElementBlock("td", _hoisted_11, [
8123
+ createVNode(_component_dao_checkbox, {
8124
+ disabled: !_ctx.selectableRows.has(row),
8125
+ checked: _ctx.isRowSelected(row),
8126
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
8127
+ }, ["stop"])),
8128
+ onChange: ($event) => _ctx.toggleSelected(row)
8129
+ }, null, 8, ["disabled", "checked", "onChange"])
8130
+ ])) : createCommentVNode("", true),
8131
+ _ctx.expandable ? (openBlock(), createElementBlock("td", _hoisted_12, [
8132
+ createElementVNode("i", {
8133
+ class: "dao-table-expand-toggle icon-arrow-sharp",
8134
+ onClick: ($event) => _ctx.toggleExpand(row, index2)
8135
+ }, null, 8, _hoisted_13)
8136
+ ])) : createCommentVNode("", true),
8137
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filterColumns, (column) => {
8138
+ return openBlock(), createElementBlock(Fragment, {
8139
+ key: column.id
8140
+ }, [
8141
+ column.id === "action" ? (openBlock(), createElementBlock("td", {
8142
+ key: 0,
8143
+ class: "dao-table-td",
8144
+ style: normalizeStyle(_ctx.columnStyle(column.id))
8145
+ }, [
8146
+ renderSlot(_ctx.$slots, `td-${column.id}`, {
8147
+ value: row[column.id],
8148
+ row,
8149
+ rowIndex: index2
8150
+ }, () => [
8151
+ createVNode(_component_td_action, null, {
8152
+ default: withCtx(() => [
8153
+ renderSlot(_ctx.$slots, `td-${column.id}-menu`, {
8154
+ value: row[column.id],
8155
+ row,
8156
+ rowIndex: index2
8157
+ })
8158
+ ]),
8159
+ _: 2
8160
+ }, 1024)
8161
+ ])
8162
+ ], 4)) : (openBlock(), createElementBlock("td", {
8163
+ key: 1,
8164
+ class: "dao-table-td",
8165
+ style: normalizeStyle(_ctx.columnStyle(column.id))
8166
+ }, [
8167
+ renderSlot(_ctx.$slots, `td-${column.id}`, {
8168
+ value: row[column.id],
8169
+ row,
8170
+ rowIndex: index2
8171
+ }, () => [
8172
+ createElementVNode("span", null, toDisplayString(_ctx.withDefaultValue(row[column.id])), 1)
8173
+ ])
8174
+ ], 4))
8175
+ ], 64);
8176
+ }), 128))
8177
+ ], 10, _hoisted_10),
8178
+ _ctx.expandable && _ctx.expandedRows.has(row) ? withDirectives((openBlock(), createElementBlock("tr", _hoisted_14, [
8179
+ renderSlot(_ctx.$slots, "expand", {
8180
+ row,
8181
+ rowIndex: index2
8182
+ })
8183
+ ], 512)), [
8184
+ [vShow, _ctx.isRowExpanded(row)]
8185
+ ]) : createCommentVNode("", true)
8186
+ ], 64);
8187
+ }), 128)),
8188
+ _ctx.isEmpty ? (openBlock(), createElementBlock("div", _hoisted_15, [
8189
+ renderSlot(_ctx.$slots, "empty", {}, () => [
8190
+ createTextVNode(toDisplayString(_ctx.textContent.emptyText), 1)
8191
+ ])
8192
+ ])) : createCommentVNode("", true)
7799
8193
  ])
7800
8194
  ])
7801
- ]),
7802
- _ctx.closable ? (openBlock(), createBlock(_component_dao_icon, {
7803
- key: 0,
7804
- class: "dao-tag__close-icon",
7805
- name: "icon-close",
7806
- "use-font": "",
7807
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
7808
- })) : createCommentVNode("", true)
7809
- ]);
8195
+ ], 2),
8196
+ createElementVNode("div", _hoisted_16, [
8197
+ renderSlot(_ctx.$slots, "pagination", {}, () => {
8198
+ var _a2;
8199
+ return [
8200
+ !_ctx.isEmpty && ((_a2 = _ctx.pageLayout) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_dao_pagination, {
8201
+ key: 0,
8202
+ "current-page": _ctx.currentPage,
8203
+ "onUpdate:current-page": _cache[2] || (_cache[2] = ($event) => _ctx.currentPage = $event),
8204
+ "page-size": _ctx.pageSize,
8205
+ "onUpdate:page-size": _cache[3] || (_cache[3] = ($event) => _ctx.pageSize = $event),
8206
+ "page-size-options": _ctx.pageSizeOptions,
8207
+ "page-format": _ctx.pageFormat,
8208
+ compact: _ctx.compact,
8209
+ total: _ctx.total,
8210
+ "total-format": _ctx.totalFormat,
8211
+ layout: _ctx.pageLayout,
8212
+ "page-sizer-width": _ctx.pageSizerWidth,
8213
+ onNext: _cache[4] || (_cache[4] = ($event) => {
8214
+ _ctx.$emit("next", $event);
8215
+ _ctx.clearState();
8216
+ }),
8217
+ onPrev: _cache[5] || (_cache[5] = ($event) => {
8218
+ _ctx.$emit("prev", $event);
8219
+ _ctx.clearState();
8220
+ }),
8221
+ onPageChange: _cache[6] || (_cache[6] = ($event) => {
8222
+ _ctx.$emit("pageChange", $event);
8223
+ _ctx.clearState();
8224
+ }),
8225
+ onSizeChange: _cache[7] || (_cache[7] = ($event) => {
8226
+ _ctx.$emit("sizeChange", $event);
8227
+ _ctx.clearState();
8228
+ })
8229
+ }, null, 8, ["current-page", "page-size", "page-size-options", "page-format", "compact", "total", "total-format", "layout", "page-sizer-width"])) : createCommentVNode("", true)
8230
+ ];
8231
+ })
8232
+ ])
8233
+ ], 2);
7810
8234
  }
7811
- var DaoTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4]]);
7812
- var toolbarFilter_vue_vue_type_style_index_0_lang = "";
8235
+ var table = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4]]);
8236
+ var tabNav_scss_vue_type_style_index_0_src_lang = "";
7813
8237
  const _sfc_main$4 = defineComponent({
7814
- name: "DaoToolbarFilter",
7815
- components: {
7816
- DaoInput,
7817
- DaoDropdown,
7818
- DaoDropdownMenu,
7819
- DaoDropdownItem
7820
- },
8238
+ name: "DaoTabNav",
7821
8239
  props: {
7822
- search: {
7823
- type: Object,
7824
- default: () => ({})
7825
- },
7826
- searchPlaceholder: {
8240
+ type: {
7827
8241
  type: String,
7828
- default: ""
7829
- },
7830
- searchOptions: {
7831
- type: Array,
7832
- default: () => []
8242
+ default: "card"
7833
8243
  },
7834
- fuzzy: {
7835
- type: Object,
7836
- default: void 0
7837
- }
7838
- },
7839
- emits: ["update:search", "search"],
7840
- setup(props, { emit }) {
7841
- const { t } = useI18n();
7842
- const searchModel = useVModel(props, "search", emit, {
7843
- passive: true,
7844
- deep: true
7845
- });
7846
- const visible = ref(false);
7847
- const searchText = ref("");
7848
- const dropdownRef = ref();
7849
- const computedSearchPlaceholder = computed(() => props.searchPlaceholder || t("core.toolbar.searchPlaceholder"));
7850
- const daoInputSearchRef = ref();
7851
- const type = computed(() => searchText.value.includes(":") ? "value" : "key");
7852
- const searchKey = computed(() => searchText.value.split(":")[0]);
7853
- const searchValue = computed(() => searchText.value.split(":")[1].trim());
7854
- const selectedKey = computed(() => {
7855
- if (type.value === "key") {
7856
- return void 0;
7857
- }
7858
- return props.searchOptions.find((i) => i.label === searchKey.value || i.key === searchKey.value);
7859
- });
7860
- const resetSearch = () => {
7861
- emit("search");
7862
- searchText.value = "";
7863
- visible.value = false;
7864
- daoInputSearchRef.value.input.focus();
7865
- daoInputSearchRef.value.input.click();
7866
- };
7867
- const singleHasChose = (searchOption) => {
7868
- var _a2;
7869
- if (searchOption.single && ((_a2 = searchModel.value[searchOption.key]) == null ? void 0 : _a2.length)) {
7870
- return true;
7871
- }
7872
- return false;
7873
- };
7874
- const hasFuzzyOption = (value) => {
7875
- var _a2, _b2;
7876
- const { fuzzy } = props;
7877
- if (!fuzzy) {
7878
- return true;
7879
- }
7880
- if ((fuzzy == null ? void 0 : fuzzy.single) && ((_a2 = searchModel.value[fuzzy.key]) == null ? void 0 : _a2.length)) {
7881
- return true;
7882
- }
7883
- if ((_b2 = searchModel.value[fuzzy.key]) == null ? void 0 : _b2.includes(value)) {
7884
- return true;
7885
- }
7886
- return false;
7887
- };
7888
- const addFuzzyOption = (value) => {
7889
- const { fuzzy } = props;
7890
- if (!fuzzy || hasFuzzyOption(value)) {
7891
- return;
7892
- }
7893
- if (!searchModel.value[fuzzy.key]) {
7894
- searchModel.value[fuzzy.key] = [value];
7895
- } else {
7896
- searchModel.value[fuzzy.key].push(value);
7897
- }
7898
- resetSearch();
7899
- };
7900
- const filteredKeys = computed(() => {
7901
- if (type.value === "value") {
7902
- return [];
7903
- }
7904
- return props.searchOptions.reduce((pre, cur) => {
7905
- var _a2;
7906
- const label = (_a2 = cur.label) != null ? _a2 : cur.key;
7907
- if (!label.includes(searchKey.value) || singleHasChose(cur)) {
7908
- return pre;
7909
- }
7910
- return [
7911
- ...pre,
7912
- {
7913
- label,
7914
- key: cur.key
7915
- }
7916
- ];
7917
- }, []);
7918
- });
7919
- const filteredValues = computed(() => {
7920
- var _a2, _b2;
7921
- if (type.value === "key" || !selectedKey.value) {
7922
- return [];
7923
- }
7924
- if (selectedKey.value.single && singleHasChose(selectedKey.value)) {
7925
- return [];
7926
- }
7927
- return (_b2 = (_a2 = selectedKey.value.values) == null ? void 0 : _a2.filter((i) => {
7928
- var _a3, _b3;
7929
- return i.label.includes(searchValue.value) && !((_b3 = searchModel.value[((_a3 = selectedKey.value) == null ? void 0 : _a3.key) || ""]) == null ? void 0 : _b3.includes(i.value));
7930
- })) != null ? _b2 : [];
7931
- });
7932
- const selectKey = (item) => {
7933
- searchText.value = `${item.label}: `;
7934
- daoInputSearchRef.value.input.focus();
7935
- };
7936
- const selectValue = (item) => {
7937
- var _a2, _b2, _c;
7938
- visible.value = false;
7939
- const key = (_b2 = (_a2 = selectedKey.value) == null ? void 0 : _a2.key) != null ? _b2 : "";
7940
- const target = (_c = searchModel.value) == null ? void 0 : _c[key];
7941
- if (target) {
7942
- target.push(item.value);
7943
- } else {
7944
- searchModel.value[key] = [item.value];
7945
- }
7946
- resetSearch();
7947
- };
7948
- const handleEnter = () => {
7949
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
7950
- if (!searchText.value) {
8244
+ currentTab: {
8245
+ type: String,
8246
+ default: null
8247
+ },
8248
+ tabList: {
8249
+ type: Array,
8250
+ required: true
8251
+ }
8252
+ },
8253
+ emits: ["updateValue", "click"],
8254
+ setup(props, { emit }) {
8255
+ let onMouseenter;
8256
+ let onMouseleave;
8257
+ const activeTab = ref();
8258
+ const tabNav = ref();
8259
+ let lineStyle;
8260
+ let setActiveLineStyle;
8261
+ let tabResizeObserver;
8262
+ const isLine = computed(() => props.type === "line");
8263
+ const renderLines = () => {
8264
+ if (!isLine.value) {
7951
8265
  return;
7952
8266
  }
7953
- if (type.value === "key") {
7954
- const target2 = filteredKeys.value.find((i) => i.label === searchText.value || i.key === searchText.value);
7955
- if (!target2) {
7956
- addFuzzyOption(searchText.value);
7957
- return;
8267
+ const hoverTab = ref();
8268
+ const hoverLineStyle = computed(() => {
8269
+ const tab = unref(hoverTab);
8270
+ return tab ? {
8271
+ "--hover-line-width": `${tab.offsetWidth || 0}px`,
8272
+ "--hover-line-left": `${tab.offsetLeft || 0}px`
8273
+ } : {};
8274
+ });
8275
+ onMouseenter = (event) => {
8276
+ if (event.target) {
8277
+ hoverTab.value = event.target;
7958
8278
  }
7959
- selectKey(target2);
7960
- return;
8279
+ };
8280
+ onMouseleave = (event) => {
8281
+ if (event.target === hoverTab.value) {
8282
+ hoverTab.value = void 0;
8283
+ }
8284
+ };
8285
+ const activeLineStyle = ref({});
8286
+ setActiveLineStyle = () => {
8287
+ const tab = unref(activeTab);
8288
+ if (tab && tab.offsetWidth && tab.offsetLeft !== void 0) {
8289
+ activeLineStyle.value = {
8290
+ "--active-line-width": `${tab.offsetWidth || 0}px`,
8291
+ "--active-line-left": `${tab.offsetLeft || 0}px`
8292
+ };
8293
+ }
8294
+ };
8295
+ watch(activeTab, (val) => {
8296
+ setActiveLineStyle();
8297
+ tabResizeObserver == null ? void 0 : tabResizeObserver.disconnect();
8298
+ tabResizeObserver = new ResizeObserver(setActiveLineStyle);
8299
+ if (tabNav.value && val) {
8300
+ tabResizeObserver.observe(val);
8301
+ }
8302
+ });
8303
+ lineStyle = computed(() => __spreadValues(__spreadValues({}, activeLineStyle.value), hoverLineStyle.value));
8304
+ };
8305
+ const stopWatch = watch(isLine, (val) => {
8306
+ if (val) {
8307
+ renderLines();
8308
+ stopWatch();
7961
8309
  }
7962
- if (!searchValue.value) {
7963
- return;
8310
+ });
8311
+ onMounted(renderLines);
8312
+ onUnmounted(() => {
8313
+ if (tabNav.value) {
8314
+ tabResizeObserver == null ? void 0 : tabResizeObserver.disconnect();
7964
8315
  }
7965
- if (!((_a2 = selectedKey.value) == null ? void 0 : _a2.enum) || !((_c = (_b2 = selectedKey.value) == null ? void 0 : _b2.values) == null ? void 0 : _c.length)) {
7966
- const key = (_e = (_d = selectedKey.value) == null ? void 0 : _d.key) != null ? _e : "";
7967
- const target2 = (_f = searchModel.value) == null ? void 0 : _f[key];
7968
- if (target2) {
7969
- if (target2.includes(searchValue.value)) {
7970
- return;
7971
- }
7972
- target2.push(searchValue.value);
7973
- } else {
7974
- searchModel.value[key] = [searchValue.value];
7975
- }
7976
- resetSearch();
8316
+ });
8317
+ const handleClick = (event, tab) => {
8318
+ const {
8319
+ value,
8320
+ disabled
8321
+ } = tab;
8322
+ if (typeof disabled !== "undefined" && disabled) {
7977
8323
  return;
7978
8324
  }
7979
- const target = (_h = (_g = selectedKey.value) == null ? void 0 : _g.values) == null ? void 0 : _h.find((i) => i.label === searchValue.value);
7980
- if (!target) {
7981
- return;
8325
+ if (value !== props.currentTab) {
8326
+ emit("updateValue", value);
7982
8327
  }
7983
- selectValue(target);
7984
- };
7985
- const showPopover = () => {
7986
- visible.value = true;
7987
- };
7988
- onClickOutside(dropdownRef, () => {
7989
- visible.value = false;
7990
- });
7991
- return {
7992
- computedSearchPlaceholder,
7993
- daoInputSearchRef,
7994
- filteredKeys,
7995
- filteredValues,
7996
- visible,
7997
- searchText,
7998
- type,
7999
- selectedKey,
8000
- dropdownRef,
8001
- selectKey,
8002
- selectValue,
8003
- showPopover,
8004
- handleEnter
8328
+ emit("click", event, value);
8005
8329
  };
8330
+ const tabsLi = computed(() => props.tabList.map((tab, index2) => {
8331
+ const { label } = tab;
8332
+ const isNotString = typeof label !== "string";
8333
+ const isActive = tab.value === props.currentTab;
8334
+ const hasHoverLine = isLine.value && !tab.disabled;
8335
+ const hasActiveLine = isLine.value && isActive;
8336
+ return h("div", {
8337
+ class: {
8338
+ "dao-tabs__nav-item": true,
8339
+ "dao-tabs__nav-item--active": isActive,
8340
+ "dao-tabs__nav-item--custom": isNotString,
8341
+ "dao-tabs__nav-item--disabled": tab.disabled
8342
+ },
8343
+ ref: hasActiveLine ? activeTab : void 0,
8344
+ key: index2,
8345
+ onClick: (event) => handleClick(event, tab),
8346
+ onMouseenter: hasHoverLine ? onMouseenter : void 0,
8347
+ onMouseleave: hasHoverLine ? onMouseleave : void 0
8348
+ }, [isNotString ? label() : label]);
8349
+ }));
8350
+ return () => h("div", {
8351
+ class: [
8352
+ "dao-tabs__nav__scroll"
8353
+ ]
8354
+ }, h("div", {
8355
+ class: [
8356
+ "dao-tabs__nav"
8357
+ ],
8358
+ style: lineStyle == null ? void 0 : lineStyle.value,
8359
+ ref: tabNav
8360
+ }, tabsLi.value));
8006
8361
  }
8007
8362
  });
8008
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
8009
- const _component_dao_input = resolveComponent("dao-input");
8010
- const _component_dao_dropdown_item = resolveComponent("dao-dropdown-item");
8011
- const _component_dao_dropdown_menu = resolveComponent("dao-dropdown-menu");
8012
- const _component_dao_dropdown = resolveComponent("dao-dropdown");
8013
- return openBlock(), createBlock(_component_dao_dropdown, {
8014
- ref: "dropdownRef",
8015
- "append-to": false,
8016
- trigger: "manual",
8017
- visible: _ctx.visible && !!(_ctx.filteredKeys.length || _ctx.filteredValues.length),
8018
- placement: "bottom-start"
8019
- }, {
8020
- menu: withCtx(() => [
8021
- createVNode(_component_dao_dropdown_menu, null, {
8022
- default: withCtx(() => [
8023
- _ctx.type === "key" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.filteredKeys, (item, index2) => {
8024
- return openBlock(), createBlock(_component_dao_dropdown_item, {
8025
- key: index2,
8026
- onClick: ($event) => _ctx.selectKey(item)
8027
- }, {
8028
- default: withCtx(() => [
8029
- createTextVNode(toDisplayString(item.label), 1)
8030
- ]),
8031
- _: 2
8032
- }, 1032, ["onClick"]);
8033
- }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.filteredValues, (item, index2) => {
8034
- return openBlock(), createBlock(_component_dao_dropdown_item, {
8035
- key: index2,
8036
- onClick: ($event) => _ctx.selectValue(item)
8037
- }, {
8038
- default: withCtx(() => [
8039
- createTextVNode(toDisplayString(item.label), 1)
8040
- ]),
8041
- _: 2
8042
- }, 1032, ["onClick"]);
8043
- }), 128))
8044
- ]),
8045
- _: 1
8046
- })
8047
- ]),
8048
- default: withCtx(() => [
8049
- createVNode(_component_dao_input, {
8050
- ref: "daoInputSearchRef",
8051
- modelValue: _ctx.searchText,
8052
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.searchText = $event),
8053
- type: "search",
8054
- borderless: "",
8055
- block: "",
8056
- placeholder: _ctx.computedSearchPlaceholder,
8057
- onKeyup: withKeys(_ctx.handleEnter, ["enter"]),
8058
- onClick: _ctx.showPopover
8059
- }, null, 8, ["modelValue", "placeholder", "onKeyup", "onClick"])
8060
- ]),
8061
- _: 1
8062
- }, 8, ["visible"]);
8063
- }
8064
- var DaoToolbarFilter = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3]]);
8065
- var toolbar_vue_vue_type_style_index_0_lang = "";
8363
+ var tabs_scss_vue_type_style_index_0_src_lang = "";
8066
8364
  const _sfc_main$3 = defineComponent({
8067
- name: "DaoToolbar",
8365
+ name: "DaoTabs",
8068
8366
  components: {
8069
- DaoActionIcon,
8070
- DaoToolbarFilter,
8071
- DaoTag
8367
+ TabNav: _sfc_main$4
8072
8368
  },
8073
8369
  props: {
8074
- search: {
8075
- type: Object,
8076
- default: () => ({})
8077
- },
8078
- searchPlaceholder: {
8370
+ type: {
8079
8371
  type: String,
8080
- default: ""
8081
- },
8082
- searchOptions: {
8083
- type: Array,
8084
- default: () => []
8085
- },
8086
- fuzzy: {
8087
- type: Object,
8088
- default: void 0
8372
+ default: "card",
8373
+ validator: (value) => ["card", "line", "pill"].includes(value)
8089
8374
  },
8090
- hideRefresh: {
8091
- type: Boolean,
8092
- default: false
8375
+ direction: {
8376
+ type: String,
8377
+ required: false,
8378
+ default: "left",
8379
+ validator: (value) => ["left", "right"].includes(value)
8093
8380
  },
8094
- hideSearch: {
8095
- type: Boolean,
8096
- default: false
8381
+ modelValue: {
8382
+ type: String,
8383
+ default: null
8097
8384
  }
8098
8385
  },
8099
- emits: ["update:search", "search", "refresh"],
8386
+ emits: ["change", "update:modelValue", "click"],
8100
8387
  setup(props, { emit }) {
8101
- const { t } = useI18n();
8102
- const searchModel = useVModel(props, "search", emit);
8103
- const isFuzzyOption = (key) => {
8104
- var _a2;
8105
- if (((_a2 = props.fuzzy) == null ? void 0 : _a2.key) === key) {
8106
- return true;
8388
+ const { modelValue } = toRefs(props);
8389
+ const currentValue = ref(modelValue.value);
8390
+ watch(modelValue, (newV) => {
8391
+ emit("change", newV);
8392
+ if (newV !== currentValue.value) {
8393
+ currentValue.value = newV;
8107
8394
  }
8108
- return false;
8109
- };
8110
- const getKeyLabel = (key) => {
8111
- var _a2;
8112
- const target = props.searchOptions.find((i) => i.key === key);
8113
- return (_a2 = target == null ? void 0 : target.label) != null ? _a2 : key;
8395
+ });
8396
+ watch(currentValue, (newV) => {
8397
+ if (newV !== modelValue.value) {
8398
+ emit("update:modelValue", newV);
8399
+ }
8400
+ });
8401
+ const updateValue = (tabValue) => {
8402
+ currentValue.value = tabValue;
8114
8403
  };
8115
- const getValueLabel = (key, value) => {
8116
- var _a2, _b2, _c;
8117
- const searchOption = props.searchOptions.find((i) => i.key === key);
8118
- return (_c = (_b2 = (_a2 = searchOption == null ? void 0 : searchOption.values) == null ? void 0 : _a2.find((i) => i.value === value)) == null ? void 0 : _b2.label) != null ? _c : value;
8404
+ provide(tabModelValueKey, modelValue);
8405
+ const onClick = (e, tabValue) => {
8406
+ emit("click", e, tabValue);
8119
8407
  };
8120
- const removeValue = (key, valueIndex) => {
8121
- searchModel.value[key].splice(valueIndex, 1);
8122
- if (searchModel.value[key].length === 0) {
8123
- delete searchModel.value[key];
8408
+ const tabList = reactive([]);
8409
+ const tabBody = ref();
8410
+ const addTab = (tab, child) => {
8411
+ var _a2;
8412
+ if (!child.value) {
8413
+ return;
8414
+ }
8415
+ const index2 = Array.from(((_a2 = tabBody.value) == null ? void 0 : _a2.children) || []).indexOf(child.value);
8416
+ if (index2 > -1) {
8417
+ tabList.splice(index2, 0, tab);
8124
8418
  }
8125
- emit("search");
8126
8419
  };
8127
- const clearFilter = () => {
8128
- Object.keys(searchModel.value).forEach((key) => {
8129
- delete searchModel.value[key];
8130
- });
8131
- emit("search");
8420
+ provide(addTabFnKey, addTab);
8421
+ const removeTab = (tab) => {
8422
+ const index2 = tabList.indexOf(tab);
8423
+ if (index2 > -1) {
8424
+ tabList.splice(index2, 1);
8425
+ }
8132
8426
  };
8427
+ provide(removeTabFnKey, removeTab);
8133
8428
  return {
8134
- t,
8135
- searchModel,
8136
- isFuzzyOption,
8137
- removeValue,
8138
- clearFilter,
8139
- getKeyLabel,
8140
- getValueLabel
8429
+ tabList,
8430
+ tabBody,
8431
+ onClick,
8432
+ updateValue
8141
8433
  };
8142
8434
  }
8143
8435
  });
8144
- const _hoisted_1$2 = { class: "dao-toolbar-container" };
8145
- const _hoisted_2$1 = { class: "dao-toolbar" };
8146
- const _hoisted_3 = {
8436
+ const _hoisted_1$2 = { class: "dao-tabs__nav__wrap" };
8437
+ const _hoisted_2$1 = {
8147
8438
  key: 0,
8148
- class: "dao-toolbar__filter"
8149
- };
8150
- const _hoisted_4 = {
8151
- key: 1,
8152
- class: "dao-toolbar__search"
8153
- };
8154
- const _hoisted_5 = { class: "dao-toolbar__actions" };
8155
- const _hoisted_6 = {
8156
- key: 2,
8157
- class: "dao-toolbar__primary-action"
8439
+ class: "dao-tabs__action"
8158
8440
  };
8159
- const _hoisted_7 = {
8160
- key: 0,
8161
- class: "dao-toolbar__tag-container"
8441
+ const _hoisted_3 = {
8442
+ ref: "tabBody",
8443
+ class: "dao-tabs__body"
8162
8444
  };
8163
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
8164
- const _component_dao_toolbar_filter = resolveComponent("dao-toolbar-filter");
8165
- const _component_dao_action_icon = resolveComponent("dao-action-icon");
8166
- const _component_dao_tag = resolveComponent("dao-tag");
8167
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
8168
- createElementVNode("div", _hoisted_2$1, [
8169
- _ctx.$slots.filter ? (openBlock(), createElementBlock("div", _hoisted_3, [
8170
- renderSlot(_ctx.$slots, "filter")
8171
- ])) : createCommentVNode("", true),
8172
- !_ctx.hideSearch ? (openBlock(), createElementBlock("div", _hoisted_4, [
8173
- renderSlot(_ctx.$slots, "search", {}, () => [
8174
- createVNode(_component_dao_toolbar_filter, {
8175
- search: _ctx.searchModel,
8176
- "onUpdate:search": _cache[0] || (_cache[0] = ($event) => _ctx.searchModel = $event),
8177
- "search-placeholder": _ctx.searchPlaceholder,
8178
- "search-options": _ctx.searchOptions,
8179
- fuzzy: _ctx.fuzzy,
8180
- onSearch: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("search"))
8181
- }, null, 8, ["search", "search-placeholder", "search-options", "fuzzy"])
8182
- ])
8183
- ])) : createCommentVNode("", true),
8184
- createElementVNode("div", _hoisted_5, [
8185
- !_ctx.hideRefresh ? (openBlock(), createBlock(_component_dao_action_icon, {
8186
- key: 0,
8187
- class: "dao-toolbar__actions-refresh",
8188
- name: "icon-refresh",
8189
- onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("refresh"))
8190
- })) : createCommentVNode("", true)
8445
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
8446
+ const _component_tab_nav = resolveComponent("tab-nav");
8447
+ return openBlock(), createElementBlock("div", {
8448
+ class: normalizeClass(["dao-tabs", ["dao-tabs--" + _ctx.type, _ctx.direction === "right" ? "dao-tabs--right" : ""]])
8449
+ }, [
8450
+ createElementVNode("div", {
8451
+ class: normalizeClass(["dao-tabs__header", "dao-tabs__header--" + _ctx.type])
8452
+ }, [
8453
+ createElementVNode("div", _hoisted_1$2, [
8454
+ createVNode(_component_tab_nav, {
8455
+ type: _ctx.type,
8456
+ "tab-list": _ctx.tabList,
8457
+ "current-tab": _ctx.modelValue,
8458
+ onUpdateValue: _ctx.updateValue,
8459
+ onClick: _ctx.onClick
8460
+ }, null, 8, ["type", "tab-list", "current-tab", "onUpdateValue", "onClick"])
8191
8461
  ]),
8192
- _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_6, [
8462
+ _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
8193
8463
  renderSlot(_ctx.$slots, "action")
8194
8464
  ])) : createCommentVNode("", true)
8195
- ]),
8196
- _ctx.search && Object.keys(_ctx.search).length ? (openBlock(), createElementBlock("div", _hoisted_7, [
8197
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.search, (values, key) => {
8198
- return openBlock(), createElementBlock(Fragment, { key }, [
8199
- _ctx.isFuzzyOption(key) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(values, (value, index2) => {
8200
- return openBlock(), createBlock(_component_dao_tag, {
8201
- key: index2,
8202
- "is-close-show": "",
8203
- closable: "",
8204
- onClose: ($event) => _ctx.removeValue(key, index2)
8205
- }, {
8206
- default: withCtx(() => [
8207
- createTextVNode(toDisplayString(value), 1)
8208
- ]),
8209
- _: 2
8210
- }, 1032, ["onClose"]);
8211
- }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(values, (value, index2) => {
8212
- return openBlock(), createBlock(_component_dao_tag, {
8213
- key: index2,
8214
- "is-close-show": "",
8215
- closable: "",
8216
- onClose: ($event) => _ctx.removeValue(key, index2)
8217
- }, {
8218
- label: withCtx(() => [
8219
- createTextVNode(toDisplayString(_ctx.getKeyLabel(key)), 1)
8220
- ]),
8221
- value: withCtx(() => [
8222
- createTextVNode(toDisplayString(_ctx.getValueLabel(key, value)), 1)
8223
- ]),
8224
- _: 2
8225
- }, 1032, ["onClose"]);
8226
- }), 128))
8227
- ], 64);
8228
- }), 128)),
8229
- createElementVNode("span", {
8230
- class: "dao-toolbar__clear",
8231
- onClick: _cache[3] || (_cache[3] = (...args) => _ctx.clearFilter && _ctx.clearFilter(...args))
8232
- }, toDisplayString(_ctx.t("core.toolbar.clear")), 1)
8233
- ])) : createCommentVNode("", true)
8234
- ]);
8465
+ ], 2),
8466
+ createElementVNode("div", _hoisted_3, [
8467
+ renderSlot(_ctx.$slots, "default")
8468
+ ], 512)
8469
+ ], 2);
8235
8470
  }
8236
- var toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2]]);
8237
- const textButtonType = ["default", "action", "link", "custom"];
8238
- var TextButtonProps = {
8239
- tag: {
8240
- type: [Object, String],
8241
- default: "button"
8242
- },
8243
- prop: {
8244
- type: Object,
8245
- default: () => ({
8246
- type: "default"
8247
- })
8248
- }
8249
- };
8250
- var textButton_vue_vue_type_style_index_0_lang = "";
8471
+ var tabs = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
8472
+ var tabItem_scss_vue_type_style_index_0_src_lang = "";
8251
8473
  const _sfc_main$2 = defineComponent({
8252
- name: "DaoTextButton",
8253
- components: {
8254
- DaoIcon
8474
+ name: "DaoTabItem",
8475
+ props: {
8476
+ label: {
8477
+ type: [String, Function],
8478
+ required: true
8479
+ },
8480
+ value: {
8481
+ type: String,
8482
+ required: true
8483
+ },
8484
+ disabled: {
8485
+ type: Boolean,
8486
+ default: false
8487
+ }
8255
8488
  },
8256
- props: TextButtonProps,
8257
- setup(props, { slots, attrs }) {
8258
- const prop = toRef(props, "prop");
8259
- const computedType = computed(() => {
8260
- var _a2;
8261
- return ((_a2 = prop.value) == null ? void 0 : _a2.type) && textButtonType.includes(prop.value.type) ? prop.value.type : "custom";
8262
- });
8263
- const componentComputed = computed(() => ({
8264
- class: [
8265
- "dao-text-button",
8266
- `dao-text-button--${computedType.value}`,
8267
- attrs.disabled ? "is-disabled" : ""
8268
- ]
8269
- }));
8270
- const iconTemp = computed(() => {
8271
- var _a2, _b2;
8272
- return ((_a2 = prop.value) == null ? void 0 : _a2.icon) ? h(DaoIcon, {
8273
- name: (_b2 = prop.value) == null ? void 0 : _b2.icon,
8274
- "use-font": true,
8275
- class: "dao-text-button__icon"
8276
- }) : null;
8277
- });
8278
- const slotTemp = computed(() => {
8279
- const _slots = __spreadValues({
8280
- default: () => ""
8281
- }, slots);
8282
- return Object.fromEntries(Object.entries(_slots).map(([key, item]) => {
8283
- const newSlot = isFunction$1(item) ? item : () => item || null;
8284
- if (key === "default") {
8285
- return [
8286
- key,
8287
- (...args) => {
8288
- const defaultSlot = newSlot.call(null, ...args);
8289
- return [
8290
- iconTemp.value,
8291
- defaultSlot ? h("span", { class: "dao-text-button__slot" }, { default: () => defaultSlot }) : ""
8292
- ];
8293
- }
8294
- ];
8295
- }
8296
- return [key, newSlot];
8297
- }));
8298
- });
8299
- return () => h(props.tag, __spreadValues({}, componentComputed.value), slotTemp.value);
8489
+ setup(props) {
8490
+ const tabModelValue = inject(tabModelValueKey);
8491
+ const active = computed(() => (tabModelValue == null ? void 0 : tabModelValue.value) === props.value);
8492
+ const tabItem2 = ref();
8493
+ const addTabFn = inject(addTabFnKey, NOOP);
8494
+ const removeTabFn = inject(removeTabFnKey, NOOP);
8495
+ onMounted(() => addTabFn(props, tabItem2));
8496
+ onUnmounted(() => removeTabFn(props));
8497
+ return {
8498
+ active,
8499
+ tabItem: tabItem2
8500
+ };
8300
8501
  }
8301
8502
  });
8503
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
8504
+ return openBlock(), createElementBlock("div", {
8505
+ ref: "tabItem",
8506
+ class: normalizeClass(["dao-tab-item", {
8507
+ "dao-tab-item--hidden": !_ctx.active
8508
+ }])
8509
+ }, [
8510
+ renderSlot(_ctx.$slots, "default")
8511
+ ], 2);
8512
+ }
8513
+ var tabItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
8302
8514
  const transferProps = {
8303
8515
  source: {
8304
8516
  type: Array,
@@ -8382,7 +8594,7 @@ const _sfc_main$1 = defineComponent({
8382
8594
  DaoCheckbox,
8383
8595
  DaoInput,
8384
8596
  DaoActionIcon,
8385
- DaoTextButton: _sfc_main$2,
8597
+ DaoTextButton: _sfc_main$O,
8386
8598
  DaoEllipsis
8387
8599
  },
8388
8600
  props: transferPanelProp,
@@ -8608,7 +8820,7 @@ const _sfc_main = defineComponent({
8608
8820
  name: "DaoTransfer",
8609
8821
  components: {
8610
8822
  transferPanel,
8611
- DaoTextButton: _sfc_main$2
8823
+ DaoTextButton: _sfc_main$O
8612
8824
  },
8613
8825
  props: transferProps,
8614
8826
  emits: ["update:modelValue", "add", "clear", "change", "refresh", "checkAll"],
@@ -8851,6 +9063,7 @@ var components = /* @__PURE__ */ Object.freeze({
8851
9063
  __proto__: null,
8852
9064
  [Symbol.toStringTag]: "Module",
8853
9065
  ActionIcon: DaoActionIcon,
9066
+ DaoBatchBar,
8854
9067
  Button: DaoButton,
8855
9068
  ButtonGroup: buttonGroup,
8856
9069
  Card: card,
@@ -8883,7 +9096,7 @@ var components = /* @__PURE__ */ Object.freeze({
8883
9096
  NavItem: navItem,
8884
9097
  NavSub: navSub,
8885
9098
  Pagination: DaoPagination,
8886
- Popover: _sfc_main$F,
9099
+ Popover: _sfc_main$E,
8887
9100
  Popper: DaoPopper,
8888
9101
  Progress: progress,
8889
9102
  Radio: radio,
@@ -8893,12 +9106,12 @@ var components = /* @__PURE__ */ Object.freeze({
8893
9106
  Switch: _switch,
8894
9107
  Table: table,
8895
9108
  Tabs: tabs,
8896
- TabNav: _sfc_main$8,
9109
+ TabNav: _sfc_main$4,
8897
9110
  TabItem: tabItem,
8898
9111
  Tag: DaoTag,
8899
- Toolbar: toolbar,
8900
- Tooltip: _sfc_main$G,
8901
- TextButton: _sfc_main$2,
9112
+ Toolbar: DaoToolbar,
9113
+ Tooltip: _sfc_main$F,
9114
+ TextButton: _sfc_main$O,
8902
9115
  DaoEllipsis,
8903
9116
  Transfer: transfer,
8904
9117
  TransferPanel: transferPanel
@@ -8946,6 +9159,11 @@ var enUS = {
8946
9159
  transfer: {
8947
9160
  checkAll: "Check all",
8948
9161
  clear: "Clear"
9162
+ },
9163
+ batchBar: {
9164
+ removeText: "Delete",
9165
+ deselectText: "Deselect",
9166
+ selectedFormat: "{n} item selected | {n} items selected"
8949
9167
  }
8950
9168
  }
8951
9169
  };
@@ -8987,6 +9205,11 @@ var zhCN = {
8987
9205
  transfer: {
8988
9206
  checkAll: "\u5168\u9009",
8989
9207
  clear: "\u6E05\u7A7A"
9208
+ },
9209
+ batchBar: {
9210
+ removeText: "\u5220\u9664",
9211
+ deselectText: "\u53D6\u6D88\u9009\u4E2D",
9212
+ selectedFormat: "\u9009\u4E2D {n} \u9879"
8990
9213
  }
8991
9214
  }
8992
9215
  };
@@ -9016,4 +9239,4 @@ var index = {
9016
9239
  install,
9017
9240
  locale
9018
9241
  };
9019
- export { DaoActionIcon as ActionIcon, breadcrumb as Breadcrumb, DaoBreadcrumbItem as BreadcrumbItem, DaoButton as Button, buttonGroup as ButtonGroup, card as Card, cardItem as CardItem, DaoCheckbox as Checkbox, checkboxGroup as CheckboxGroup, DaoEllipsis, dialog as Dialog, DialogFooter, DialogHeader, drawer as Drawer, DaoDropdown as Dropdown, DaoDropdownItem as DropdownItem, DaoDropdownMenu as DropdownMenu, expansion as Expansion, expansionItem as ExpansionItem, form as Form, formGroup as FormGroup, formItem as FormItem, header as Header, DaoIcon as Icon, DaoInput as Input, message as Message, nav as Nav, navHead as NavHead, navItem as NavItem, navSub as NavSub, DaoOption as Option, DaoPagination as Pagination, _sfc_main$F as Popover, DaoPopper as Popper, progress as Progress, radio as Radio, radioGroup as RadioGroup, DaoSelect as Select, _switch as Switch, tabItem as TabItem, _sfc_main$8 as TabNav, table as Table, tabs as Tabs, DaoTag as Tag, _sfc_main$2 as TextButton, toolbar as Toolbar, _sfc_main$G as Tooltip, transfer as Transfer, transferPanel as TransferPanel, index as default, formClassNames, formKey, formProps };
9242
+ export { DaoActionIcon as ActionIcon, breadcrumb as Breadcrumb, DaoBreadcrumbItem as BreadcrumbItem, DaoButton as Button, buttonGroup as ButtonGroup, card as Card, cardItem as CardItem, DaoCheckbox as Checkbox, checkboxGroup as CheckboxGroup, DaoBatchBar, DaoEllipsis, dialog as Dialog, DialogFooter, DialogHeader, drawer as Drawer, DaoDropdown as Dropdown, DaoDropdownItem as DropdownItem, DaoDropdownMenu as DropdownMenu, expansion as Expansion, expansionItem as ExpansionItem, form as Form, formGroup as FormGroup, formItem as FormItem, header as Header, DaoIcon as Icon, DaoInput as Input, message as Message, nav as Nav, navHead as NavHead, navItem as NavItem, navSub as NavSub, DaoOption as Option, DaoPagination as Pagination, _sfc_main$E as Popover, DaoPopper as Popper, progress as Progress, radio as Radio, radioGroup as RadioGroup, DaoSelect as Select, _switch as Switch, tabItem as TabItem, _sfc_main$4 as TabNav, table as Table, tabs as Tabs, DaoTag as Tag, _sfc_main$O as TextButton, DaoToolbar as Toolbar, _sfc_main$F as Tooltip, transfer as Transfer, transferPanel as TransferPanel, index as default, formClassNames, formKey, formProps };