vary-ui 3.22.4 → 3.22.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/{Loading-BnGv9LWk.js → Loading-D2EKKVv8.js} +2 -2
  2. package/dist/{Wrap-Ycc974-K.js → Wrap-COnCnup_.js} +1 -1
  3. package/dist/lib/Button/Button.js +2 -2
  4. package/dist/lib/Card/Card.js +2 -2
  5. package/dist/lib/Checkbox/Checkbox.js +2 -2
  6. package/dist/lib/CheckboxGroup/CheckboxGroup.js +2 -2
  7. package/dist/lib/Confirm/Confirm.js +2 -2
  8. package/dist/lib/Date/Date.js +4 -4
  9. package/dist/lib/Dialog/Dialog.js +1 -1
  10. package/dist/lib/Divider/Divider.js +1 -1
  11. package/dist/lib/Form/Form.js +2 -2
  12. package/dist/lib/FormItem/FormItem.js +3 -3
  13. package/dist/lib/Input/Input.js +4 -4
  14. package/dist/lib/Link/Link.js +2 -2
  15. package/dist/lib/Loading/Loading.js +3 -3
  16. package/dist/lib/Menu/Menu.js +2 -2
  17. package/dist/lib/Message/Message.js +2 -2
  18. package/dist/lib/Pagination/Pagination.js +6 -6
  19. package/dist/lib/Popover/Popover.js +2 -2
  20. package/dist/lib/Radio/Radio.js +2 -2
  21. package/dist/lib/RadioButton/RadioButton.js +2 -2
  22. package/dist/lib/RadioGroup/RadioGroup.js +1 -1
  23. package/dist/lib/Scene/Scene.js +1 -1
  24. package/dist/lib/Scroll/Scroll.js +2 -2
  25. package/dist/lib/Select/Select.js +12 -13
  26. package/dist/lib/Skeleton/Skeleton.js +1 -1
  27. package/dist/lib/Tab/Tab.js +2 -2
  28. package/dist/lib/TabPanel/TabPanel.js +1 -1
  29. package/dist/lib/Table/Table.js +131 -55
  30. package/dist/lib/TableColumn/TableColumn.js +1 -1
  31. package/dist/types/lib/Table/Table.vue.d.ts +18 -0
  32. package/dist/types/lib/utils.d.ts +1 -0
  33. package/dist/{utils-Jva0LPUd.js → utils-DlFoypiE.js} +1 -0
  34. package/dist/vary-ui.js +6 -6
  35. package/package.json +1 -1
  36. /package/dist/{_plugin-vue_export-helper-DwsUpw2c.js → _plugin-vue_export-helper-DgG6qUS3.js} +0 -0
  37. /package/dist/{_tslib-8iNYr_bE.js → _tslib-DQRjy92I.js} +0 -0
  38. /package/dist/{config-CZrNfTTX.js → config-DPPlVIeO.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, onMounted, createVNode } from 'vue';
2
- import { c as config } from './config-CZrNfTTX.js';
3
- import { _ as _export_sfc } from './_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { c as config } from './config-DPPlVIeO.js';
3
+ import { _ as _export_sfc } from './_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _a;
6
6
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createVNode } from 'vue';
2
- import { _ as _export_sfc } from './_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from './_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  props: {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, computed, createVNode } from 'vue';
2
- import { c as config } from '../../config-CZrNfTTX.js';
2
+ import { c as config } from '../../config-DPPlVIeO.js';
3
3
  import { Icon } from '@iconify/vue';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
5
5
 
6
6
  var _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, createVNode, createTextVNode } from 'vue';
2
- import { c as config } from '../../config-CZrNfTTX.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { c as config } from '../../config-DPPlVIeO.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, computed, ref, createVNode } from 'vue';
2
- import { c as config } from '../../config-CZrNfTTX.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { c as config } from '../../config-DPPlVIeO.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, provide, computed, createVNode } from 'vue';
2
- import { i as isArray } from '../../utils-Jva0LPUd.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { i as isArray } from '../../utils-DlFoypiE.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, createVNode, createApp, h } from 'vue';
2
2
  import Button from '../Button/Button.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
4
- import '../../config-CZrNfTTX.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
+ import '../../config-DPPlVIeO.js';
5
5
  import '@iconify/vue';
6
6
 
7
7
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,11 +1,11 @@
1
1
  import { defineComponent, shallowRef, ref, reactive, watch, createVNode, createTextVNode } from 'vue';
2
- import { n as now, e as isTime, g as isYear, h as isMonth, d as isDate, f as isDateTime } from '../../utils-Jva0LPUd.js';
2
+ import { n as now, e as isTime, g as isYear, h as isMonth, d as isDate, f as isDateTime } from '../../utils-DlFoypiE.js';
3
3
  import Popover from '../Popover/Popover.js';
4
4
  import Scroll from '../Scroll/Scroll.js';
5
5
  import Link from '../Link/Link.js';
6
- import { W as Wrap } from '../../Wrap-Ycc974-K.js';
7
- import { c as config } from '../../config-CZrNfTTX.js';
8
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
6
+ import { W as Wrap } from '../../Wrap-COnCnup_.js';
7
+ import { c as config } from '../../config-DPPlVIeO.js';
8
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
9
9
 
10
10
  const weeks = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
11
11
  const months = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"].map((r, i) => {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, watch, onMounted, onBeforeUnmount, createVNode, createTextVNode } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  props: {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createVNode } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  props: {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, computed, provide, createVNode } from 'vue';
2
- import { _ as __awaiter } from '../../_tslib-8iNYr_bE.js';
2
+ import { _ as __awaiter } from '../../_tslib-DQRjy92I.js';
3
3
  import Schema from 'async-validator';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
5
5
 
6
6
  var _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  props: {
@@ -1,8 +1,8 @@
1
1
  import { defineComponent, inject, computed, ref, onMounted, onUnmounted, provide, createVNode } from 'vue';
2
- import { _ as __awaiter } from '../../_tslib-8iNYr_bE.js';
3
- import { c as config } from '../../config-CZrNfTTX.js';
2
+ import { _ as __awaiter } from '../../_tslib-DQRjy92I.js';
3
+ import { c as config } from '../../config-DPPlVIeO.js';
4
4
  import Schema from 'async-validator';
5
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
5
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
6
6
 
7
7
  var _sfc_main = /* @__PURE__ */ defineComponent({
8
8
  props: {
@@ -1,8 +1,8 @@
1
1
  import { defineComponent, ref, inject, watch, createVNode } from 'vue';
2
- import { W as Wrap } from '../../Wrap-Ycc974-K.js';
3
- import { c as isFun } from '../../utils-Jva0LPUd.js';
4
- import { c as config } from '../../config-CZrNfTTX.js';
5
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { W as Wrap } from '../../Wrap-COnCnup_.js';
3
+ import { c as isFun } from '../../utils-DlFoypiE.js';
4
+ import { c as config } from '../../config-DPPlVIeO.js';
5
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
6
6
 
7
7
  var _sfc_main = /* @__PURE__ */ defineComponent({
8
8
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, createVNode } from 'vue';
2
- import { c as config } from '../../config-CZrNfTTX.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { c as config } from '../../config-DPPlVIeO.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,7 +1,7 @@
1
1
  import { shallowRef, createApp, h } from 'vue';
2
- import { L as Loading } from '../../Loading-BnGv9LWk.js';
3
- import { c as config } from '../../config-CZrNfTTX.js';
4
- import '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { L as Loading } from '../../Loading-D2EKKVv8.js';
3
+ import { c as config } from '../../config-DPPlVIeO.js';
4
+ import '../../_plugin-vue_export-helper-DgG6qUS3.js';
5
5
 
6
6
  const defaultOptions = {
7
7
  lock: false,
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, watch, createVNode } from 'vue';
2
- import { k as debounce } from '../../utils-Jva0LPUd.js';
2
+ import { k as debounce } from '../../utils-DlFoypiE.js';
3
3
  import Scroll from '../Scroll/Scroll.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
5
5
 
6
6
  var _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, onMounted, h, createApp } from 'vue';
2
- import { c as config } from '../../config-CZrNfTTX.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { c as config } from '../../config-DPPlVIeO.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = defineComponent({
6
6
  props: {
@@ -1,15 +1,15 @@
1
1
  import { defineComponent, ref, watch, createVNode, createTextVNode } from 'vue';
2
2
  import Select from '../Select/Select.js';
3
- import { c as config } from '../../config-CZrNfTTX.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
5
- import '../../_tslib-8iNYr_bE.js';
6
- import '../../utils-Jva0LPUd.js';
3
+ import { c as config } from '../../config-DPPlVIeO.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
5
+ import '../../_tslib-DQRjy92I.js';
6
+ import '../../utils-DlFoypiE.js';
7
7
  import '../Popover/Popover.js';
8
- import '../../Wrap-Ycc974-K.js';
8
+ import '../../Wrap-COnCnup_.js';
9
9
  import '../Input/Input.js';
10
10
  import '../Checkbox/Checkbox.js';
11
11
  import '../Scroll/Scroll.js';
12
- import '../../Loading-BnGv9LWk.js';
12
+ import '../../Loading-D2EKKVv8.js';
13
13
 
14
14
  var _sfc_main = /* @__PURE__ */ defineComponent({
15
15
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, shallowRef, ref, watch, onMounted, onBeforeUnmount, createVNode, nextTick } from 'vue';
2
- import { t as throttle } from '../../utils-Jva0LPUd.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { t as throttle } from '../../utils-DlFoypiE.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, ref, computed, createVNode } from 'vue';
2
- import { c as config } from '../../config-CZrNfTTX.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { c as config } from '../../config-DPPlVIeO.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, ref, computed, createVNode } from 'vue';
2
- import { c as config } from '../../config-CZrNfTTX.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { c as config } from '../../config-DPPlVIeO.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, provide, computed, createVNode } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  props: {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, renderSlot } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /*@__PURE__*/ defineComponent({
5
5
  __name: 'Scene',
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, shallowRef, ref, onMounted, nextTick, onBeforeUnmount, createVNode } from 'vue';
2
- import { k as debounce } from '../../utils-Jva0LPUd.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { k as debounce } from '../../utils-DlFoypiE.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
4
4
 
5
5
  /**
6
6
  * note:
@@ -1,14 +1,14 @@
1
1
  import { defineComponent, ref, shallowRef, reactive, watch, onMounted, createVNode, createTextVNode, nextTick, isVNode } from 'vue';
2
- import { _ as __awaiter } from '../../_tslib-8iNYr_bE.js';
3
- import { i as isArray, a as isObject, k as debounce } from '../../utils-Jva0LPUd.js';
2
+ import { _ as __awaiter } from '../../_tslib-DQRjy92I.js';
3
+ import { i as isArray, a as isObject, k as debounce } from '../../utils-DlFoypiE.js';
4
4
  import Popover from '../Popover/Popover.js';
5
- import { W as Wrap } from '../../Wrap-Ycc974-K.js';
5
+ import { W as Wrap } from '../../Wrap-COnCnup_.js';
6
6
  import Input from '../Input/Input.js';
7
7
  import Checkbox from '../Checkbox/Checkbox.js';
8
8
  import Scroll from '../Scroll/Scroll.js';
9
- import { c as config } from '../../config-CZrNfTTX.js';
10
- import { L as Loading } from '../../Loading-BnGv9LWk.js';
11
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
9
+ import { c as config } from '../../config-DPPlVIeO.js';
10
+ import { L as Loading } from '../../Loading-D2EKKVv8.js';
11
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
12
12
 
13
13
  /**
14
14
  关于远程搜索:
@@ -169,8 +169,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
169
169
  if (!/^\d+$/.test(_props.maxLength + "")) {
170
170
  console.warn("MaxLength prop must be Number or String of numbers");
171
171
  }
172
- // 保存modelValue的值
173
- reactive([]);
174
172
  const labelProp = _props.props.label || "label";
175
173
  const valueProp = _props.props.value || "value";
176
174
  const childrenProp = _props.props.children || "children";
@@ -401,7 +399,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
401
399
  } else {
402
400
  if (selectedSet.has(node.__full_value)) {
403
401
  // 如果已经有了
404
- selectedSet.clear();
402
+ selectedSet.delete(node.__full_value);
405
403
  } else {
406
404
  selectedSet.add(node.__full_value);
407
405
  }
@@ -447,14 +445,15 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
447
445
  __value: value,
448
446
  __ancestor_value: parent ? parent.__ancestor_value + "-" + parent.__value : "",
449
447
  __chain_label: parent ? parent.__chain_label.concat(label) : [label],
450
- __hasChildren: item.children && item.children.length > 0,
451
448
  __originData: item
452
449
  };
453
450
  d.__full_value = d.__ancestor_value + "-" + d.__value;
454
- // debug && console.log(d);
451
+ debug && console.log(d);
455
452
  list.push(d);
456
453
  const children = item[childrenProp];
457
- if (d.__hasChildren) {
454
+ // 先判断是否为tree模式
455
+ if (_props.tree && isArray(children) && children.length > 0) {
456
+ d.__hasChildren = true;
458
457
  recursiveFlatten(children, d);
459
458
  }
460
459
  });
@@ -555,7 +554,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
555
554
  // 如果有children
556
555
  addNode(row, true);
557
556
  } else {
558
- addNode(row, true);
557
+ addNode(row);
559
558
  }
560
559
  }
561
560
  } else {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createVNode } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  props: {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, watch, onBeforeUnmount, createVNode } from 'vue';
2
- import { m as matchChildrenCoponent } from '../../utils-Jva0LPUd.js';
2
+ import { m as matchChildrenCoponent } from '../../utils-DlFoypiE.js';
3
3
  import TabPanel from '../TabPanel/TabPanel.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
5
5
 
6
6
  var _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  props: {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createVNode } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  setup(_props, {
@@ -1,10 +1,10 @@
1
1
  import { defineComponent, ref, shallowRef, reactive, computed, nextTick, onMounted, watch, onBeforeMount, createVNode, createTextVNode } from 'vue';
2
- import { k as debounce, m as matchChildrenCoponent } from '../../utils-Jva0LPUd.js';
2
+ import { k as debounce, m as matchChildrenCoponent, t as throttle } from '../../utils-DlFoypiE.js';
3
3
  import Checkbox from '../Checkbox/Checkbox.js';
4
4
  import Scroll from '../Scroll/Scroll.js';
5
5
  import TableColumn from '../TableColumn/TableColumn.js';
6
- import { c as config } from '../../config-CZrNfTTX.js';
7
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
6
+ import { c as config } from '../../config-DPPlVIeO.js';
7
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
8
8
 
9
9
  let colKey = 0;
10
10
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -83,6 +83,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
83
83
  default: false
84
84
  },
85
85
  // 点击行时切换当前行选中状态
86
+ bindLevel: {
87
+ type: Boolean,
88
+ default: true
89
+ },
86
90
  headMenu: {
87
91
  type: Object,
88
92
  default: () => ({
@@ -115,6 +119,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
115
119
  type: String,
116
120
  default: "name"
117
121
  },
122
+ autoExpandAll: {
123
+ type: Boolean,
124
+ default: false
125
+ },
118
126
  sortRemote: {
119
127
  type: Boolean,
120
128
  default: false
@@ -143,17 +151,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
143
151
  const rootRef = ref(null);
144
152
  // 启用选中功能时, 保存选中的行key
145
153
  const selectedRowMap = ref({});
146
- function updateSelectedRowMap(selection) {
147
- selectedRowMap.value = {}; // 清空selectedRowMap
148
- selection.forEach(r => {
149
- const key = getRowKey(r);
150
- selectedRowMap.value[key] = r;
151
- });
152
- }
153
- // 如果selection不为空, 则更新selectedRowMap
154
- if (_props.selection.length > 0) {
155
- updateSelectedRowMap(_props.selection);
156
- }
154
+ const partialRowMap = ref({});
157
155
  const showLeftShadow = ref(false); // 是否显示左浮动表格的阴影
158
156
  const showRightShadow = ref(false); // 是否显示右浮动表格的阴影
159
157
  const rowsHeight = ref([]); // 行高
@@ -269,7 +267,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
269
267
  /**
270
268
  * 初始化表格, 初始化表格的列, 行数据
271
269
  */
272
- function init() {
270
+ function initData() {
273
271
  mergeColumns = JSON.parse(JSON.stringify(_props.columns)).filter(c => !!c.prop); // 先从_props.columns中获取 , 并过滤掉没有prop的列
274
272
  const slotColumns = _slots.default ? matchChildrenCoponent(_slots.default(), TableColumn) : [];
275
273
  slotColumns.forEach(r => {
@@ -501,13 +499,54 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
501
499
  _emit("update:selection", selection);
502
500
  _emit("selection-change", selection);
503
501
  }
502
+ function upperUpdate() {
503
+ // 向上遍历更新
504
+ function p(data, lastCount = {
505
+ checked: 0,
506
+ partial: 0
507
+ }) {
508
+ for (const row of data) {
509
+ const rowKey = getRowKey(row);
510
+ if (row._hasChildren) {
511
+ const count = {
512
+ checked: 0,
513
+ partial: 0
514
+ };
515
+ const children = processedData.value.filter(d => d._parentId == rowKey);
516
+ p(children, count);
517
+ if (count.checked == children.length) {
518
+ // 如果选中数量等于children数量, 设置为选中
519
+ delete partialRowMap.value[rowKey];
520
+ selectedRowMap.value[rowKey] = row;
521
+ lastCount.checked++;
522
+ } else if (count.checked + count.partial > 0) {
523
+ // 如果选中数量+部分选中数量大于0, 设置为部分选中
524
+ partialRowMap.value[rowKey] = row;
525
+ lastCount.partial++;
526
+ } else {
527
+ // 如果选中数量+部分选中数量等于0, 不操作
528
+ delete partialRowMap.value[rowKey];
529
+ delete selectedRowMap.value[rowKey];
530
+ }
531
+ } else {
532
+ // 终端节点,如果已被选中
533
+ if (selectedRowMap.value[rowKey]) {
534
+ lastCount.checked++;
535
+ }
536
+ }
537
+ }
538
+ }
539
+ p(processedData.value.filter(d => !d._parentId));
540
+ }
504
541
  /**
505
542
  * 切换全部状态, 全选或者全不选
506
543
  * @param selected 是否选中
507
544
  */
508
545
  function toggleAllSelection(selected) {
546
+ partialRowMap.value = {}; // 不管是否选中, 都要清空partialRowMap
509
547
  if (selected) {
510
- displayData.value.forEach(r => {
548
+ // 注意bindLevel的值, 如果为true, 则使用processedData.value, 否则使用displayData.value
549
+ (_props.bindLevel ? processedData.value : displayData.value).forEach(r => {
511
550
  selectedRowMap.value[getRowKey(r)] = r;
512
551
  });
513
552
  } else {
@@ -516,32 +555,48 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
516
555
  emitSelectionChange();
517
556
  }
518
557
  /**
519
- * 自动切换某一行的选中状态
558
+ * 切换某一行的选中状态
520
559
  * @param row 行数据
521
- * @param clearAll 是否清空所有选中的行
522
560
  */
523
561
  function toggleRowSelection(row) {
524
562
  const key = getRowKey(row);
525
563
  if (selectedRowMap.value[key]) {
526
- delete selectedRowMap.value[key];
564
+ // 移除选中
565
+ findChildrenAndSelect([row], false);
527
566
  } else {
528
- selectedRowMap.value[key] = row;
567
+ // 添加选中
568
+ findChildrenAndSelect([row], true);
529
569
  }
530
570
  emitSelectionChange();
531
571
  }
572
+ function findChildrenAndSelect(data, select) {
573
+ for (const row of data) {
574
+ const rowKey = getRowKey(row);
575
+ if (select) {
576
+ selectedRowMap.value[rowKey] = row;
577
+ } else {
578
+ delete selectedRowMap.value[rowKey];
579
+ }
580
+ if (_props.bindLevel) {
581
+ const children = processedData.value.filter(d => d._parentId == rowKey);
582
+ if (children.length > 0) {
583
+ findChildrenAndSelect(children, select);
584
+ }
585
+ }
586
+ }
587
+ }
532
588
  /**
533
589
  * 设置某一行的选中状态
534
590
  * @param row 行数据
535
591
  * @param selected 是否选中
536
592
  * @param clearAll 是否清空所有选中的行
537
593
  */
538
- function setRowSelection(row, selected, clearAll = false) {
539
- if (clearAll) selectedRowMap.value = {};
540
- const key = getRowKey(row);
594
+ function setRowSelection(row, selected) {
595
+ getRowKey(row);
541
596
  if (selected) {
542
- selectedRowMap.value[key] = row;
597
+ findChildrenAndSelect([row], true);
543
598
  } else {
544
- delete selectedRowMap.value[key];
599
+ findChildrenAndSelect([row], false);
545
600
  }
546
601
  emitSelectionChange();
547
602
  }
@@ -706,16 +761,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
706
761
  setExpandedKeys
707
762
  });
708
763
  onMounted(() => {
709
- init();
764
+ initData();
765
+ // 如果selection不为空, 则更新selectedRowMap
766
+ if (_props.selection.length > 0) {
767
+ findChildrenAndSelect(_props.selection, true);
768
+ upperUpdate();
769
+ }
710
770
  nextTick(() => {
711
771
  initStyle();
712
772
  if (rootRef.value) {
713
773
  ro.observe(rootRef.value);
714
774
  }
775
+ if (_props.autoExpandAll) {
776
+ expandAll();
777
+ }
715
778
  });
716
779
  });
717
780
  watch(() => _props.data, () => {
718
- init();
781
+ initData();
782
+ if (_props.selection.length > 0) {
783
+ findChildrenAndSelect(_props.selection, true);
784
+ upperUpdate();
785
+ }
719
786
  colsWidth.value = [];
720
787
  defineWidth.value = 0;
721
788
  nextTick(() => {
@@ -727,7 +794,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
727
794
  });
728
795
  watch(() => _props.columns, v => {
729
796
  debug && console.log("watch columns", v);
730
- init();
797
+ initData();
731
798
  colsWidth.value = [];
732
799
  defineWidth.value = 0;
733
800
  nextTick(() => {
@@ -744,7 +811,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
744
811
  const oldKeys = Object.keys(selectedRowMap.value).sort().join(",");
745
812
  debug && console.log("watch selection", newKeys, oldKeys);
746
813
  if (newKeys !== oldKeys) {
747
- updateSelectedRowMap(newVal);
814
+ // 如果newKeys和oldKeys不相等, 说明有新的选中
815
+ findChildrenAndSelect(newVal, true);
748
816
  }
749
817
  }, {
750
818
  deep: true
@@ -762,10 +830,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
762
830
  let body = null;
763
831
  if (c.prop === "selection") {
764
832
  // 多选框的列单独处理
833
+ let checkAll = false;
834
+ let partial = false;
835
+ const length = Object.keys(selectedRowMap.value).length;
836
+ if (_props.bindLevel) {
837
+ // 父子关联状态
838
+ if (length == processedData.value.length) {
839
+ checkAll = true;
840
+ } else if (length > 0) {
841
+ partial = true;
842
+ }
843
+ } else {
844
+ // 非父子关联状态
845
+ if (length == displayData.value.length) {
846
+ checkAll = true;
847
+ } else if (length > 0) {
848
+ partial = true;
849
+ }
850
+ }
765
851
  body = createVNode(Checkbox, {
766
852
  "key": "all",
767
- "partial": Object.keys(selectedRowMap.value).length > 0 && Object.keys(selectedRowMap.value).length < displayData.value.length,
768
- "modelValue": displayData.value.length > 0 && Object.keys(selectedRowMap.value).length === displayData.value.length ? true : false,
853
+ "partial": partial,
854
+ "modelValue": checkAll,
769
855
  "onChange": v => {
770
856
  if (v) {
771
857
  // 全选
@@ -871,9 +957,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
871
957
  index: ri
872
958
  });
873
959
  } else if (c.prop === "selection") {
960
+ const isChecked = selectedRowMap.value[rowKey] ? true : false;
961
+ const isPartial = partialRowMap.value[rowKey] ? true : false;
874
962
  body = createVNode(Checkbox, {
875
963
  "key": rowKey,
876
- "modelValue": selectedRowMap.value[rowKey] ? true : false,
964
+ "modelValue": isChecked,
965
+ "partial": isPartial,
877
966
  "readonly": true,
878
967
  "onChange": v => {
879
968
  if (!_props.autoSelectRowOnClick && !_props.autoToggleRowOnClick) {
@@ -905,6 +994,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
905
994
  currentRowIndex.value = ri;
906
995
  currentColIndex.value = ci;
907
996
  },
997
+ "onMouseleave": e => {
998
+ if (!_props.hover) return;
999
+ currentRowIndex.value = -1;
1000
+ currentColIndex.value = -1;
1001
+ },
908
1002
  "onClick": e => {
909
1003
  rowClick(e, {
910
1004
  row: r,
@@ -989,7 +1083,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
989
1083
  command
990
1084
  }, data));
991
1085
  }
992
- function rowClick(e, p) {
1086
+ const rowClick = throttle((e, p) => {
993
1087
  // 点击单元格事件
994
1088
  const {
995
1089
  column,
@@ -1001,34 +1095,20 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1001
1095
  } else {
1002
1096
  if (_props.autoSelectRowOnClick) {
1003
1097
  // 点击行时只选中当前行
1004
- setRowSelection(row, true, true);
1098
+ clearAllSelection();
1099
+ setRowSelection(row, true);
1005
1100
  } else if (_props.autoToggleRowOnClick) {
1006
1101
  // 点击行时切换当前行选中状态
1007
1102
  toggleRowSelection(row);
1008
1103
  }
1009
1104
  }
1105
+ upperUpdate();
1010
1106
  _emit("row-click", Object.assign(Object.assign({}, p), {
1011
1107
  cell: p.row[p.column.prop],
1012
1108
  $event: e
1013
1109
  }));
1014
- }
1110
+ }, 500);
1015
1111
  function rowDblClick(e, p) {
1016
- const {
1017
- column,
1018
- row
1019
- } = p;
1020
- if (column.prop === "selection") {
1021
- // 如果点击的是selection列, 切换状态即可
1022
- toggleRowSelection(row);
1023
- } else {
1024
- if (_props.autoSelectRowOnClick) {
1025
- // 点击行时只选中当前行
1026
- setRowSelection(row, true, true);
1027
- } else if (_props.autoToggleRowOnClick) {
1028
- // 点击行时切换当前行选中状态
1029
- toggleRowSelection(row);
1030
- }
1031
- }
1032
1112
  _emit("row-dblclick", Object.assign(Object.assign({}, p), {
1033
1113
  $event: e
1034
1114
  }));
@@ -1045,10 +1125,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1045
1125
  "v_table--layout-fixed": defineWidth.value > 0,
1046
1126
  "v_table--debug": debug
1047
1127
  }],
1048
- "onMouseleave": () => {
1049
- currentRowIndex.value = -1;
1050
- currentColIndex.value = -1;
1051
- },
1052
1128
  "style": {
1053
1129
  height: _props.height,
1054
1130
  width: _props.width
@@ -1,5 +1,5 @@
1
1
  import { defineComponent } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DwsUpw2c.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-DgG6qUS3.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  props: {
@@ -94,6 +94,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
94
94
  type: BooleanConstructor;
95
95
  default: boolean;
96
96
  };
97
+ bindLevel: {
98
+ type: BooleanConstructor;
99
+ default: boolean;
100
+ };
97
101
  headMenu: {
98
102
  type: PropType<MenuConfig>;
99
103
  default: () => {
@@ -112,6 +116,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
112
116
  type: StringConstructor;
113
117
  default: string;
114
118
  };
119
+ autoExpandAll: {
120
+ type: BooleanConstructor;
121
+ default: boolean;
122
+ };
115
123
  sortRemote: {
116
124
  type: BooleanConstructor;
117
125
  default: boolean;
@@ -213,6 +221,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
213
221
  type: BooleanConstructor;
214
222
  default: boolean;
215
223
  };
224
+ bindLevel: {
225
+ type: BooleanConstructor;
226
+ default: boolean;
227
+ };
216
228
  headMenu: {
217
229
  type: PropType<MenuConfig>;
218
230
  default: () => {
@@ -231,6 +243,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
231
243
  type: StringConstructor;
232
244
  default: string;
233
245
  };
246
+ autoExpandAll: {
247
+ type: BooleanConstructor;
248
+ default: boolean;
249
+ };
234
250
  sortRemote: {
235
251
  type: BooleanConstructor;
236
252
  default: boolean;
@@ -287,9 +303,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
287
303
  width: string;
288
304
  autoSelectRowOnClick: boolean;
289
305
  autoToggleRowOnClick: boolean;
306
+ bindLevel: boolean;
290
307
  headMenu: MenuConfig;
291
308
  bodyMenu: MenuConfig;
292
309
  expandProp: string;
310
+ autoExpandAll: boolean;
293
311
  sortRemote: boolean;
294
312
  trStyle: (p: {
295
313
  row: any;
@@ -20,6 +20,7 @@ export declare function debounce(func: any, wait?: number): (this: any, ...args:
20
20
  * 节流函数:在某段时间内只执行一次, 时间段内点击多次不会重新计时
21
21
  * @param {目标函数} func
22
22
  * @param {等待时间} delay
23
+ * @param {类型} type 类型: pre 前执行, post 后执行
23
24
  * @returns
24
25
  */
25
26
  export declare function throttle(func: any, delay?: number, type?: string): (this: any, ...args: any[]) => void;
@@ -58,6 +58,7 @@ function debounce(func, wait = 500) {
58
58
  * 节流函数:在某段时间内只执行一次, 时间段内点击多次不会重新计时
59
59
  * @param {目标函数} func
60
60
  * @param {等待时间} delay
61
+ * @param {类型} type 类型: pre 前执行, post 后执行
61
62
  * @returns
62
63
  */
63
64
  function throttle(func, delay = 1000, type = "pre") {
package/dist/vary-ui.js CHANGED
@@ -17,7 +17,7 @@ import Scroll from './lib/Scroll/Scroll.js';
17
17
  import Select from './lib/Select/Select.js';
18
18
  import Skeleton from './lib/Skeleton/Skeleton.js';
19
19
  import { defineComponent, ref, watch, createVNode, onMounted, onBeforeUnmount, createTextVNode } from 'vue';
20
- import { _ as _export_sfc } from './_plugin-vue_export-helper-DwsUpw2c.js';
20
+ import { _ as _export_sfc } from './_plugin-vue_export-helper-DgG6qUS3.js';
21
21
  import Tab from './lib/Tab/Tab.js';
22
22
  import Table from './lib/Table/Table.js';
23
23
  import TableColumn from './lib/TableColumn/TableColumn.js';
@@ -30,11 +30,11 @@ import createConfirm from './lib/Confirm/Confirm.js';
30
30
  import './lib/Loading/Loading.js';
31
31
  import { Icon } from '@iconify/vue';
32
32
  export { Icon } from '@iconify/vue';
33
- export { k as debounce, i as isArray, b as isBoolean, d as isDate, f as isDateTime, c as isFun, h as isMonth, j as isNumber, a as isObject, e as isTime, g as isYear, m as matchChildrenCoponent, n as now, t as throttle } from './utils-Jva0LPUd.js';
34
- import { s as setConfig } from './config-CZrNfTTX.js';
35
- import { L as Loading } from './Loading-BnGv9LWk.js';
36
- import './Wrap-Ycc974-K.js';
37
- import './_tslib-8iNYr_bE.js';
33
+ export { k as debounce, i as isArray, b as isBoolean, d as isDate, f as isDateTime, c as isFun, h as isMonth, j as isNumber, a as isObject, e as isTime, g as isYear, m as matchChildrenCoponent, n as now, t as throttle } from './utils-DlFoypiE.js';
34
+ import { s as setConfig } from './config-DPPlVIeO.js';
35
+ import { L as Loading } from './Loading-D2EKKVv8.js';
36
+ import './Wrap-COnCnup_.js';
37
+ import './_tslib-DQRjy92I.js';
38
38
  import 'async-validator';
39
39
 
40
40
  var _sfc_main$2 = /* @__PURE__ */ defineComponent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vary-ui",
3
- "version": "3.22.4",
3
+ "version": "3.22.6",
4
4
  "description": "vary-ui base vue3",
5
5
  "homepage": "https://varyui.com",
6
6
  "main": "dist/vary-ui.js",
File without changes
File without changes