vary-ui 3.22.5 → 3.22.7

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-hgJwxZBi.js → Loading-DHBUHbEf.js} +2 -2
  2. package/dist/{Wrap-DJliKx91.js → Wrap-BTaVaBPq.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 +6 -6
  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 +141 -57
  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-Bp4p6NX-.js → utils-BKZVDLCZ.js} +1 -0
  34. package/dist/vary-ui.js +6 -6
  35. package/package.json +1 -1
  36. /package/dist/{_plugin-vue_export-helper--PDl7dnF.js → _plugin-vue_export-helper-D-x43h3i.js} +0 -0
  37. /package/dist/{_tslib-rNUxhnxV.js → _tslib-Cr-cI6Nu.js} +0 -0
  38. /package/dist/{config-D2SQJPyn.js → config-BP1eDKTh.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, onMounted, createVNode } from 'vue';
2
- import { c as config } from './config-D2SQJPyn.js';
3
- import { _ as _export_sfc } from './_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { c as config } from './config-BP1eDKTh.js';
3
+ import { _ as _export_sfc } from './_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
2
+ import { _ as _export_sfc } from './_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
2
+ import { c as config } from '../../config-BP1eDKTh.js';
3
3
  import { Icon } from '@iconify/vue';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { c as config } from '../../config-BP1eDKTh.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { c as config } from '../../config-BP1eDKTh.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-Bp4p6NX-.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { i as isArray } from '../../utils-BKZVDLCZ.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
4
- import '../../config-D2SQJPyn.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.js';
4
+ import '../../config-BP1eDKTh.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-Bp4p6NX-.js';
2
+ import { n as now, e as isTime, g as isYear, h as isMonth, d as isDate, f as isDateTime } from '../../utils-BKZVDLCZ.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-DJliKx91.js';
7
- import { c as config } from '../../config-D2SQJPyn.js';
8
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
6
+ import { W as Wrap } from '../../Wrap-BTaVaBPq.js';
7
+ import { c as config } from '../../config-BP1eDKTh.js';
8
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-rNUxhnxV.js';
2
+ import { _ as __awaiter } from '../../_tslib-Cr-cI6Nu.js';
3
3
  import Schema from 'async-validator';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-rNUxhnxV.js';
3
- import { c as config } from '../../config-D2SQJPyn.js';
2
+ import { _ as __awaiter } from '../../_tslib-Cr-cI6Nu.js';
3
+ import { c as config } from '../../config-BP1eDKTh.js';
4
4
  import Schema from 'async-validator';
5
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
5
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-DJliKx91.js';
3
- import { c as isFun } from '../../utils-Bp4p6NX-.js';
4
- import { c as config } from '../../config-D2SQJPyn.js';
5
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { W as Wrap } from '../../Wrap-BTaVaBPq.js';
3
+ import { c as isFun } from '../../utils-BKZVDLCZ.js';
4
+ import { c as config } from '../../config-BP1eDKTh.js';
5
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { c as config } from '../../config-BP1eDKTh.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-hgJwxZBi.js';
3
- import { c as config } from '../../config-D2SQJPyn.js';
4
- import '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { L as Loading } from '../../Loading-DHBUHbEf.js';
3
+ import { c as config } from '../../config-BP1eDKTh.js';
4
+ import '../../_plugin-vue_export-helper-D-x43h3i.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-Bp4p6NX-.js';
2
+ import { k as debounce } from '../../utils-BKZVDLCZ.js';
3
3
  import Scroll from '../Scroll/Scroll.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { c as config } from '../../config-BP1eDKTh.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
5
- import '../../_tslib-rNUxhnxV.js';
6
- import '../../utils-Bp4p6NX-.js';
3
+ import { c as config } from '../../config-BP1eDKTh.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.js';
5
+ import '../../_tslib-Cr-cI6Nu.js';
6
+ import '../../utils-BKZVDLCZ.js';
7
7
  import '../Popover/Popover.js';
8
- import '../../Wrap-DJliKx91.js';
8
+ import '../../Wrap-BTaVaBPq.js';
9
9
  import '../Input/Input.js';
10
10
  import '../Checkbox/Checkbox.js';
11
11
  import '../Scroll/Scroll.js';
12
- import '../../Loading-hgJwxZBi.js';
12
+ import '../../Loading-DHBUHbEf.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-Bp4p6NX-.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { t as throttle } from '../../utils-BKZVDLCZ.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { c as config } from '../../config-BP1eDKTh.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-D2SQJPyn.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { c as config } from '../../config-BP1eDKTh.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-Bp4p6NX-.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { k as debounce } from '../../utils-BKZVDLCZ.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-rNUxhnxV.js';
3
- import { i as isArray, a as isObject, k as debounce } from '../../utils-Bp4p6NX-.js';
2
+ import { _ as __awaiter } from '../../_tslib-Cr-cI6Nu.js';
3
+ import { i as isArray, a as isObject, k as debounce } from '../../utils-BKZVDLCZ.js';
4
4
  import Popover from '../Popover/Popover.js';
5
- import { W as Wrap } from '../../Wrap-DJliKx91.js';
5
+ import { W as Wrap } from '../../Wrap-BTaVaBPq.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-D2SQJPyn.js';
10
- import { L as Loading } from '../../Loading-hgJwxZBi.js';
11
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
9
+ import { c as config } from '../../config-BP1eDKTh.js';
10
+ import { L as Loading } from '../../Loading-DHBUHbEf.js';
11
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.js';
12
12
 
13
13
  /**
14
14
  关于远程搜索:
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createVNode } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-Bp4p6NX-.js';
2
+ import { m as matchChildrenCoponent } from '../../utils-BKZVDLCZ.js';
3
3
  import TabPanel from '../TabPanel/TabPanel.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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-Bp4p6NX-.js';
2
+ import { k as debounce, m as matchChildrenCoponent, t as throttle } from '../../utils-BKZVDLCZ.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-D2SQJPyn.js';
7
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
6
+ import { c as config } from '../../config-BP1eDKTh.js';
7
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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 => {
@@ -498,16 +496,74 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
498
496
  function emitSelectionChange() {
499
497
  debug && console.log("emitSelectionChange", selectedRowMap.value);
500
498
  const selection = Object.values(selectedRowMap.value);
499
+ const partial = Object.values(partialRowMap.value);
501
500
  _emit("update:selection", selection);
502
- _emit("selection-change", selection);
501
+ _emit("selection-change", selection, partial);
502
+ }
503
+ function findChildrenAndSelect(data, select) {
504
+ for (const row of data) {
505
+ const rowKey = getRowKey(row);
506
+ if (select) {
507
+ selectedRowMap.value[rowKey] = row;
508
+ } else {
509
+ delete selectedRowMap.value[rowKey];
510
+ }
511
+ if (_props.bindLevel) {
512
+ const children = processedData.value.filter(d => d._parentId == rowKey);
513
+ if (children.length > 0) {
514
+ findChildrenAndSelect(children, select);
515
+ }
516
+ }
517
+ }
518
+ }
519
+ function upperUpdate() {
520
+ // 向上遍历更新
521
+ function p(data, lastCount = {
522
+ checked: 0,
523
+ partial: 0
524
+ }) {
525
+ for (const row of data) {
526
+ const rowKey = getRowKey(row);
527
+ if (row._hasChildren) {
528
+ const count = {
529
+ checked: 0,
530
+ partial: 0
531
+ };
532
+ const children = processedData.value.filter(d => d._parentId == rowKey);
533
+ p(children, count);
534
+ if (count.checked == children.length) {
535
+ // 如果选中数量等于children数量, 设置为选中
536
+ delete partialRowMap.value[rowKey];
537
+ selectedRowMap.value[rowKey] = row;
538
+ lastCount.checked++;
539
+ } else if (count.checked + count.partial > 0) {
540
+ // 如果选中数量+部分选中数量大于0, 设置为部分选中
541
+ partialRowMap.value[rowKey] = row;
542
+ lastCount.partial++;
543
+ } else {
544
+ // 如果选中数量+部分选中数量等于0, 不操作
545
+ delete partialRowMap.value[rowKey];
546
+ delete selectedRowMap.value[rowKey];
547
+ }
548
+ } else {
549
+ // 终端节点,如果已被选中
550
+ if (selectedRowMap.value[rowKey]) {
551
+ lastCount.checked++;
552
+ }
553
+ }
554
+ }
555
+ }
556
+ p(processedData.value.filter(d => !d._parentId));
503
557
  }
504
558
  /**
505
559
  * 切换全部状态, 全选或者全不选
506
560
  * @param selected 是否选中
507
561
  */
508
562
  function toggleAllSelection(selected) {
563
+ partialRowMap.value = {}; // 不管是否选中, 都要清空partialRowMap
509
564
  if (selected) {
510
- displayData.value.forEach(r => {
565
+ // 注意bindLevel的值, 如果为true, 则使用processedData.value, 否则使用displayData.value
566
+ (_props.bindLevel ? processedData.value : displayData.value).forEach(r => {
511
567
  selectedRowMap.value[getRowKey(r)] = r;
512
568
  });
513
569
  } else {
@@ -516,17 +572,19 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
516
572
  emitSelectionChange();
517
573
  }
518
574
  /**
519
- * 自动切换某一行的选中状态
575
+ * 切换某一行的选中状态
520
576
  * @param row 行数据
521
- * @param clearAll 是否清空所有选中的行
522
577
  */
523
578
  function toggleRowSelection(row) {
524
579
  const key = getRowKey(row);
525
580
  if (selectedRowMap.value[key]) {
526
- delete selectedRowMap.value[key];
581
+ // 移除选中
582
+ findChildrenAndSelect([row], false);
527
583
  } else {
528
- selectedRowMap.value[key] = row;
584
+ // 添加选中
585
+ findChildrenAndSelect([row], true);
529
586
  }
587
+ upperUpdate();
530
588
  emitSelectionChange();
531
589
  }
532
590
  /**
@@ -535,14 +593,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
535
593
  * @param selected 是否选中
536
594
  * @param clearAll 是否清空所有选中的行
537
595
  */
538
- function setRowSelection(row, selected, clearAll = false) {
539
- if (clearAll) selectedRowMap.value = {};
540
- const key = getRowKey(row);
596
+ function setRowSelection(row, selected) {
541
597
  if (selected) {
542
- selectedRowMap.value[key] = row;
598
+ findChildrenAndSelect([row], true);
543
599
  } else {
544
- delete selectedRowMap.value[key];
600
+ findChildrenAndSelect([row], false);
545
601
  }
602
+ upperUpdate();
546
603
  emitSelectionChange();
547
604
  }
548
605
  /**
@@ -706,7 +763,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
706
763
  setExpandedKeys
707
764
  });
708
765
  onMounted(() => {
709
- init();
766
+ initData();
767
+ console.log("watch data 1", _props.autoExpandAll);
768
+ if (_props.autoExpandAll) {
769
+ expandAll();
770
+ }
771
+ // 如果selection不为空, 则更新selectedRowMap
772
+ if (_props.selection.length > 0) {
773
+ findChildrenAndSelect(_props.selection, true);
774
+ upperUpdate();
775
+ }
710
776
  nextTick(() => {
711
777
  initStyle();
712
778
  if (rootRef.value) {
@@ -715,7 +781,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
715
781
  });
716
782
  });
717
783
  watch(() => _props.data, () => {
718
- init();
784
+ initData();
785
+ console.log("watch data 2", _props.autoExpandAll);
786
+ if (_props.autoExpandAll) {
787
+ expandAll();
788
+ }
789
+ selectedRowMap.value = {};
790
+ partialRowMap.value = {};
791
+ if (_props.selection.length > 0) {
792
+ findChildrenAndSelect(_props.selection, true);
793
+ upperUpdate();
794
+ }
719
795
  colsWidth.value = [];
720
796
  defineWidth.value = 0;
721
797
  nextTick(() => {
@@ -727,7 +803,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
727
803
  });
728
804
  watch(() => _props.columns, v => {
729
805
  debug && console.log("watch columns", v);
730
- init();
806
+ initData();
731
807
  colsWidth.value = [];
732
808
  defineWidth.value = 0;
733
809
  nextTick(() => {
@@ -744,7 +820,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
744
820
  const oldKeys = Object.keys(selectedRowMap.value).sort().join(",");
745
821
  debug && console.log("watch selection", newKeys, oldKeys);
746
822
  if (newKeys !== oldKeys) {
747
- updateSelectedRowMap(newVal);
823
+ // 如果newKeys和oldKeys不相等, 说明有新的选中
824
+ findChildrenAndSelect(newVal, true);
748
825
  }
749
826
  }, {
750
827
  deep: true
@@ -762,10 +839,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
762
839
  let body = null;
763
840
  if (c.prop === "selection") {
764
841
  // 多选框的列单独处理
842
+ let checkAll = false;
843
+ let partial = false;
844
+ const length = Object.keys(selectedRowMap.value).length;
845
+ if (_props.bindLevel) {
846
+ // 父子关联状态
847
+ if (length == processedData.value.length) {
848
+ checkAll = true;
849
+ } else if (length > 0) {
850
+ partial = true;
851
+ }
852
+ } else {
853
+ // 非父子关联状态
854
+ if (length == displayData.value.length) {
855
+ checkAll = true;
856
+ } else if (length > 0) {
857
+ partial = true;
858
+ }
859
+ }
765
860
  body = createVNode(Checkbox, {
766
861
  "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,
862
+ "partial": partial,
863
+ "modelValue": checkAll,
769
864
  "onChange": v => {
770
865
  if (v) {
771
866
  // 全选
@@ -774,7 +869,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
774
869
  // 取消全选
775
870
  toggleAllSelection(false);
776
871
  }
777
- _emit("selection-change", Object.values(selectedRowMap.value));
872
+ emitSelectionChange();
778
873
  }
779
874
  }, null);
780
875
  } else {
@@ -871,9 +966,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
871
966
  index: ri
872
967
  });
873
968
  } else if (c.prop === "selection") {
969
+ const isChecked = selectedRowMap.value[rowKey] ? true : false;
970
+ const isPartial = partialRowMap.value[rowKey] ? true : false;
874
971
  body = createVNode(Checkbox, {
875
972
  "key": rowKey,
876
- "modelValue": selectedRowMap.value[rowKey] ? true : false,
973
+ "modelValue": isChecked,
974
+ "partial": isPartial,
877
975
  "readonly": true,
878
976
  "onChange": v => {
879
977
  if (!_props.autoSelectRowOnClick && !_props.autoToggleRowOnClick) {
@@ -905,6 +1003,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
905
1003
  currentRowIndex.value = ri;
906
1004
  currentColIndex.value = ci;
907
1005
  },
1006
+ "onMouseleave": e => {
1007
+ if (!_props.hover) return;
1008
+ currentRowIndex.value = -1;
1009
+ currentColIndex.value = -1;
1010
+ },
908
1011
  "onClick": e => {
909
1012
  rowClick(e, {
910
1013
  row: r,
@@ -989,7 +1092,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
989
1092
  command
990
1093
  }, data));
991
1094
  }
992
- function rowClick(e, p) {
1095
+ const rowClick = throttle((e, p) => {
993
1096
  // 点击单元格事件
994
1097
  const {
995
1098
  column,
@@ -1001,7 +1104,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1001
1104
  } else {
1002
1105
  if (_props.autoSelectRowOnClick) {
1003
1106
  // 点击行时只选中当前行
1004
- setRowSelection(row, true, true);
1107
+ clearAllSelection();
1108
+ setRowSelection(row, true);
1005
1109
  } else if (_props.autoToggleRowOnClick) {
1006
1110
  // 点击行时切换当前行选中状态
1007
1111
  toggleRowSelection(row);
@@ -1011,24 +1115,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1011
1115
  cell: p.row[p.column.prop],
1012
1116
  $event: e
1013
1117
  }));
1014
- }
1118
+ }, 500);
1015
1119
  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
1120
  _emit("row-dblclick", Object.assign(Object.assign({}, p), {
1033
1121
  $event: e
1034
1122
  }));
@@ -1045,10 +1133,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1045
1133
  "v_table--layout-fixed": defineWidth.value > 0,
1046
1134
  "v_table--debug": debug
1047
1135
  }],
1048
- "onMouseleave": () => {
1049
- currentRowIndex.value = -1;
1050
- currentColIndex.value = -1;
1051
- },
1052
1136
  "style": {
1053
1137
  height: _props.height,
1054
1138
  width: _props.width
@@ -1,5 +1,5 @@
1
1
  import { defineComponent } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper--PDl7dnF.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D-x43h3i.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--PDl7dnF.js';
20
+ import { _ as _export_sfc } from './_plugin-vue_export-helper-D-x43h3i.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-Bp4p6NX-.js';
34
- import { s as setConfig } from './config-D2SQJPyn.js';
35
- import { L as Loading } from './Loading-hgJwxZBi.js';
36
- import './Wrap-DJliKx91.js';
37
- import './_tslib-rNUxhnxV.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-BKZVDLCZ.js';
34
+ import { s as setConfig } from './config-BP1eDKTh.js';
35
+ import { L as Loading } from './Loading-DHBUHbEf.js';
36
+ import './Wrap-BTaVaBPq.js';
37
+ import './_tslib-Cr-cI6Nu.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.5",
3
+ "version": "3.22.7",
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