qidian-vue-ui 2.0.8 → 2.0.10

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.
@@ -1,5 +1,8 @@
1
- .qd-dict-tag[data-v-b88cab23] {
1
+ .qd-dict-tag[data-v-e8a6ce9c] {
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  flex-wrap: wrap;
5
5
  }
6
+ .qd-dict-tag[data-v-e8a6ce9c] > .t-loading {
7
+ position: static;
8
+ }
@@ -2,7 +2,7 @@ import './index.css'
2
2
  import _sfc_main from "./index.vue2.mjs";
3
3
  /* empty css */
4
4
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
5
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b88cab23"]]);
5
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e8a6ce9c"]]);
6
6
  export {
7
7
  index as default
8
8
  };
@@ -1,66 +1,66 @@
1
- .qd-service-table[data-v-ee419bfb] {
1
+ .qd-service-table[data-v-70f0f849] {
2
2
  height: 100%;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  }
6
- .qd-service-table[data-v-ee419bfb] > .t-table__content {
6
+ .qd-service-table[data-v-70f0f849] > .t-table__content {
7
7
  flex: 1;
8
8
  }
9
- .qd-service-table--mini[data-v-ee419bfb] {
9
+ .qd-service-table--mini[data-v-70f0f849] {
10
10
  font: var(--td-font-body-small);
11
11
  }
12
- .qd-service-table--mini[data-v-ee419bfb] th,
13
- .qd-service-table--mini[data-v-ee419bfb] tr:not(.t-table__expanded-row) > td {
12
+ .qd-service-table--mini[data-v-70f0f849] th,
13
+ .qd-service-table--mini[data-v-70f0f849] tr:not(.t-table__expanded-row) > td {
14
14
  padding: var(--td-comp-paddingTB-xxs) var(--td-comp-paddingLR-xxs);
15
15
  line-height: var(--td-line-height-body-small);
16
16
  }
17
- .qd-service-table[data-v-ee419bfb] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
17
+ .qd-service-table[data-v-70f0f849] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
18
18
  margin-left: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
19
19
  }
20
- .qd-service-table[data-v-ee419bfb] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
20
+ .qd-service-table[data-v-70f0f849] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
21
21
  width: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
22
22
  }
23
- .qd-service-table[data-v-ee419bfb] .t-affix > .t-table__affixed-header-elm-wrap,
24
- .qd-service-table[data-v-ee419bfb] .t-affix > .t-table__scrollbar--obvious {
25
- transform: var(--v5f2dd170);
23
+ .qd-service-table[data-v-70f0f849] .t-affix > .t-table__affixed-header-elm-wrap,
24
+ .qd-service-table[data-v-70f0f849] .t-affix > .t-table__scrollbar--obvious {
25
+ transform: var(--v7c61d920);
26
26
  }
27
- .qd-service-table--horizontal-bar-static[data-v-ee419bfb] .t-table__scrollbar--obvious {
27
+ .qd-service-table--horizontal-bar-static[data-v-70f0f849] .t-table__scrollbar--obvious {
28
28
  visibility: hidden;
29
29
  pointer-events: none;
30
30
  }
31
- .qd-service-table[data-v-ee419bfb] .t-table__affixed-header-elm-wrap {
31
+ .qd-service-table[data-v-70f0f849] .t-table__affixed-header-elm-wrap {
32
32
  height: auto !important;
33
33
  }
34
- .qd-service-table[data-v-ee419bfb] .t-table__affixed-header-elm {
34
+ .qd-service-table[data-v-70f0f849] .t-table__affixed-header-elm {
35
35
  position: relative;
36
36
  scrollbar-width: none;
37
37
  }
38
- .qd-service-table[data-v-ee419bfb] .t-table__affixed-header-elm::-webkit-scrollbar {
38
+ .qd-service-table[data-v-70f0f849] .t-table__affixed-header-elm::-webkit-scrollbar {
39
39
  display: none;
40
40
  width: 0;
41
41
  height: 0;
42
42
  }
43
- .qd-service-table[data-v-ee419bfb] .t-table__virtual-scroll-cursor + table {
43
+ .qd-service-table[data-v-70f0f849] .t-table__virtual-scroll-cursor + table {
44
44
  border-collapse: separate;
45
45
  }
46
- .qd-service-table[data-v-ee419bfb] .t-table__expanded-row-inner {
46
+ .qd-service-table[data-v-70f0f849] .t-table__expanded-row-inner {
47
47
  position: sticky;
48
48
  left: 0;
49
- width: var(--v1d473786) !important;
49
+ width: var(--v30216815) !important;
50
50
  }
51
- .qd-service-table[data-v-ee419bfb] .t-table__cell-wrap > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
51
+ .qd-service-table[data-v-70f0f849] .t-table__cell-wrap > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
52
52
  width: 100%;
53
53
  }
54
- .qd-service-table[data-v-ee419bfb] .qd-service-table__non-editable-col {
54
+ .qd-service-table[data-v-70f0f849] .qd-service-table__non-editable-col {
55
55
  background-color: color-mix(in srgb, var(--td-bg-color-component) 50%, transparent);
56
56
  }
57
- .qd-service-table[data-v-ee419bfb] .qd-service-table__non-editable-col:is(
57
+ .qd-service-table[data-v-70f0f849] .qd-service-table__non-editable-col:is(
58
58
  .t-table__cell--fixed-left,
59
59
  .t-table__cell--fixed-right
60
60
  ) {
61
61
  background-color: inherit;
62
62
  background-image: linear-gradient(color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent), color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent));
63
63
  }
64
- .qd-service-table--disable-horizontal-scroll[data-v-ee419bfb] colgroup > col {
64
+ .qd-service-table--disable-horizontal-scroll[data-v-70f0f849] colgroup > col {
65
65
  width: auto !important;
66
66
  }
@@ -2,7 +2,7 @@ import './index.css'
2
2
  import _sfc_main from "./index.vue2.mjs";
3
3
  /* empty css */
4
4
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
5
- const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ee419bfb"]]);
5
+ const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-70f0f849"]]);
6
6
  export {
7
7
  QdServiceTable as default
8
8
  };
@@ -19,6 +19,7 @@ const defaultMinWidth = 80;
19
19
  const defaultVirtualScrollBufferSize = 2;
20
20
  const defaultVirtualScrollUpdateInterval = 16;
21
21
  const minVirtualScrollUpdateInterval = 8;
22
+ const scrollRestoreMaxAttempts = 4;
22
23
  const _sfc_main = /* @__PURE__ */ defineComponent({
23
24
  ...{
24
25
  name: "QdServiceTable"
@@ -320,8 +321,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
320
321
  emit: __emit
321
322
  }) {
322
323
  useCssVars((_ctx) => ({
323
- "v5f2dd170": affixedHeaderTransform.value,
324
- "v1d473786": expandedRowWidth.value
324
+ "v7c61d920": affixedHeaderTransform.value,
325
+ "v30216815": expandedRowWidth.value
325
326
  }));
326
327
  const props = __props;
327
328
  const emit = __emit;
@@ -413,8 +414,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
413
414
  let offscreenInstance = null;
414
415
  const scrollRecord = {
415
416
  top: 0,
416
- left: 0
417
+ left: 0,
418
+ bottom: false
417
419
  };
420
+ let scrollRestoreRafId = 0;
418
421
  const outsideScrollEl = ref(null);
419
422
  const tableHeaderEl = ref(null);
420
423
  const tableContentEl = ref(null);
@@ -649,12 +652,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
649
652
  onScroll?.(params);
650
653
  const target = params.e.target;
651
654
  if (!target) return;
655
+ if (!activated.value) return;
652
656
  const {
653
657
  scrollTop,
654
- scrollLeft
658
+ scrollLeft,
659
+ scrollHeight,
660
+ clientHeight
655
661
  } = target;
656
662
  scrollRecord.top = scrollTop;
657
663
  scrollRecord.left = scrollLeft;
664
+ scrollRecord.bottom = !isVirtualScroll.value && Math.abs(scrollHeight - clientHeight - scrollTop) <= 1;
658
665
  };
659
666
  const reOnCellClick = (context) => {
660
667
  handleCellClick(context);
@@ -1585,25 +1592,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1585
1592
  return reColumn;
1586
1593
  });
1587
1594
  }
1588
- function setScrollElTo() {
1589
- const el = tableRef.value?.$el;
1590
- if (!el) return;
1591
- const scrollEl = tableContentEl.value;
1595
+ function getCurrentTableContentEl() {
1596
+ const rootEl = tableRef.value?.$el ?? currentInstance?.proxy?.$el;
1597
+ if (!(rootEl instanceof HTMLElement)) return tableContentEl.value;
1598
+ return rootEl.querySelector(".t-table__content") ?? tableContentEl.value;
1599
+ }
1600
+ function setScrollElTo(position = scrollRecord) {
1601
+ const scrollEl = getCurrentTableContentEl();
1592
1602
  if (!scrollEl) return;
1593
1603
  const {
1594
1604
  scrollTop,
1595
1605
  scrollLeft
1596
1606
  } = scrollEl;
1597
1607
  const {
1598
- top,
1599
1608
  left
1600
- } = scrollRecord;
1609
+ } = position;
1610
+ const top = position.bottom && !isVirtualScroll.value ? Math.max(scrollEl.scrollHeight - scrollEl.clientHeight, 0) : position.top;
1601
1611
  if (top === scrollTop && left === scrollLeft) return;
1602
1612
  scrollEl.scrollTo({
1603
1613
  top,
1604
1614
  left
1605
1615
  });
1606
1616
  }
1617
+ function cancelScrollRestore() {
1618
+ if (!scrollRestoreRafId) return;
1619
+ cancelAnimationFrame(scrollRestoreRafId);
1620
+ scrollRestoreRafId = 0;
1621
+ }
1622
+ function scheduleScrollRestore(position, attempts = scrollRestoreMaxAttempts) {
1623
+ scrollRestoreRafId = requestAnimationFrame(() => {
1624
+ scrollRestoreRafId = 0;
1625
+ if (!activated.value) return;
1626
+ setScrollElTo(position);
1627
+ if (attempts <= 1) return;
1628
+ scheduleScrollRestore(position, attempts - 1);
1629
+ });
1630
+ }
1607
1631
  async function triggerAffixedRefresh() {
1608
1632
  if (!outsideScrollEl.value) return;
1609
1633
  outsideScrollEl.value.scrollTo({
@@ -1836,14 +1860,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1836
1860
  document.addEventListener("click", handleDocumentClick);
1837
1861
  document.addEventListener("keydown", handleDocumentKeydown);
1838
1862
  });
1839
- onActivated(() => {
1840
- setScrollElTo();
1863
+ onActivated(async () => {
1864
+ const position = {
1865
+ ...scrollRecord
1866
+ };
1841
1867
  tableContentResume();
1868
+ await nextTick();
1869
+ if (!activated.value) return;
1870
+ cancelScrollRestore();
1871
+ scheduleScrollRestore(position);
1842
1872
  });
1843
1873
  onDeactivated(() => {
1874
+ cancelScrollRestore();
1844
1875
  tableContentPause();
1845
1876
  });
1846
1877
  onBeforeUnmount(() => {
1878
+ cancelScrollRestore();
1847
1879
  tableContentStop();
1848
1880
  if (probeRafId) cancelAnimationFrame(probeRafId);
1849
1881
  if (affixRefreshRafId) cancelAnimationFrame(affixRefreshRafId);
@@ -234,6 +234,7 @@ p {
234
234
  }
235
235
  .t-card.t-size-s {
236
236
  --td-card-padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s);
237
+ font: var(--td-font-body-small);
237
238
  }
238
239
  .t-upload__card-name {
239
240
  display: inline-flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",
@@ -130,7 +130,7 @@
130
130
  "vue-codemirror": "^6.1.1",
131
131
  "vue-echarts": "^8.0.1",
132
132
  "vue-stream-markdown": "1.0.1-beta.1",
133
- "qidian-shared": "1.2.3"
133
+ "qidian-shared": "1.2.4"
134
134
  },
135
135
  "scripts": {
136
136
  "clean": "rm -rf dist",