@sdata/web-vue 3.2.0 → 3.3.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.
Files changed (72) hide show
  1. package/README.md +2 -2
  2. package/dist/sd.css +89 -9
  3. package/dist/sd.min.css +1 -1
  4. package/es/_components/select-view/style/index.css +4 -2
  5. package/es/_components/virtual-list-v2/hooks/use-size.d.ts +17 -0
  6. package/es/_components/virtual-list-v2/hooks/use-size.js +95 -0
  7. package/es/_components/virtual-list-v2/index.d.ts +2 -0
  8. package/es/_components/virtual-list-v2/index.js +5 -0
  9. package/es/_components/virtual-list-v2/interface.d.ts +44 -0
  10. package/es/_components/virtual-list-v2/virtual-list-item.d.ts +22 -0
  11. package/es/_components/virtual-list-v2/virtual-list-item.js +37 -0
  12. package/es/_components/virtual-list-v2/virtual-list.js +47 -0
  13. package/es/_components/virtual-list-v2/virtual-list.vue.d.ts +749 -0
  14. package/es/_components/virtual-list-v2/virtual-list.vue_vue_type_script_lang.js +179 -0
  15. package/es/_hooks/use-config-provider-prop.d.ts +1 -1
  16. package/es/_virtual/_plugin-vue_export-helper.js +8 -0
  17. package/es/color-picker/hooks/use-control-block.js +4 -1
  18. package/es/components.d.ts +1 -0
  19. package/es/config-provider/config-provider.vue.d.ts +7 -1
  20. package/es/config-provider/config-provider.vue_vue_type_script_setup_true_lang.js +7 -1
  21. package/es/config-provider/context.d.ts +14 -0
  22. package/es/config-provider/index.d.ts +9 -0
  23. package/es/image/hooks/use-image-drag.js +1 -1
  24. package/es/index.css +89 -9
  25. package/es/index.d.ts +2 -0
  26. package/es/index.js +2 -1
  27. package/es/index.scss +1 -0
  28. package/es/input-tag/style/index.css +4 -2
  29. package/es/input-tag/style/input-tag.scss +29 -7
  30. package/es/message/message.vue_vue_type_script_setup_true_lang.js +1 -1
  31. package/es/pagination/pagination.js +101 -19
  32. package/es/sd-vue.js +2 -0
  33. package/es/table/context.d.ts +1 -1
  34. package/es/table/hooks/use-column-resize.d.ts +3 -2
  35. package/es/table/hooks/use-column-resize.js +21 -48
  36. package/es/table/hooks/use-drag.d.ts +1 -3
  37. package/es/table/hooks/use-drag.js +2 -18
  38. package/es/table/index.d.ts +21 -36
  39. package/es/table/style/index.css +12 -5
  40. package/es/table/style/index.scss +16 -6
  41. package/es/table/table-operation-td.js +15 -12
  42. package/es/table/table-operation-th.js +2 -2
  43. package/es/table/table-tbody.js +3 -1
  44. package/es/table/table-td.js +3 -4
  45. package/es/table/table-th.js +24 -40
  46. package/es/table/table-thead.js +3 -1
  47. package/es/table/table.d.ts +13 -19
  48. package/es/table/table.js +205 -424
  49. package/es/table/utils.d.ts +2 -0
  50. package/es/table/utils.js +11 -1
  51. package/es/tag/index.d.ts +3 -3
  52. package/es/tag/tag.vue.d.ts +2 -2
  53. package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +16 -5
  54. package/es/toolbar/index.d.ts +72 -0
  55. package/es/toolbar/index.js +10 -0
  56. package/es/toolbar/style/css.js +2 -0
  57. package/es/toolbar/style/index.css +85 -0
  58. package/es/toolbar/style/index.d.ts +2 -0
  59. package/es/toolbar/style/index.js +2 -0
  60. package/es/toolbar/style/index.scss +97 -0
  61. package/es/toolbar/style/token.scss +25 -0
  62. package/es/toolbar/toolbar.js +5 -0
  63. package/es/toolbar/toolbar.vue.d.ts +44 -0
  64. package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +197 -0
  65. package/es/toolbar/types.d.ts +26 -0
  66. package/es/trigger/interface.d.ts +7 -0
  67. package/es/trigger/trigger.js +5 -1
  68. package/json/vetur-attributes.json +76 -1
  69. package/json/vetur-tags.json +24 -0
  70. package/json/web-types.json +163 -7
  71. package/package.json +1 -1
  72. package/es/table/table-col-group.vue.d.ts +0 -29
@@ -820,6 +820,8 @@
820
820
  font-size: 12px;
821
821
  white-space: pre-wrap;
822
822
  word-break: break-word;
823
+ }
824
+ .sd-select-view-multiple .sd-select-view-inner .sd-select-view-tag:not(.sd-tag-custom-color):not(.sd-tag-red):not(.sd-tag-orangered):not(.sd-tag-orange):not(.sd-tag-gold):not(.sd-tag-lime):not(.sd-tag-green):not(.sd-tag-cyan):not(.sd-tag-blue):not(.sd-tag-sdblue):not(.sd-tag-purple):not(.sd-tag-pinkpurple):not(.sd-tag-magenta) {
823
825
  background-color: var(--sd-color-bg-2);
824
826
  border-color: var(--sd-color-fill-3);
825
827
  }
@@ -903,14 +905,14 @@
903
905
  max-width: 100%;
904
906
  vertical-align: bottom;
905
907
  }
906
- .sd-select-view-multiple.sd-select-view-focus .sd-select-view-tag {
908
+ .sd-select-view-multiple.sd-select-view-focus .sd-select-view-tag:not(.sd-tag-custom-color):not(.sd-tag-red):not(.sd-tag-orangered):not(.sd-tag-orange):not(.sd-tag-gold):not(.sd-tag-lime):not(.sd-tag-green):not(.sd-tag-cyan):not(.sd-tag-blue):not(.sd-tag-sdblue):not(.sd-tag-purple):not(.sd-tag-pinkpurple):not(.sd-tag-magenta) {
907
909
  background-color: var(--sd-color-fill-2);
908
910
  border-color: var(--sd-color-fill-2);
909
911
  }
910
912
  .sd-select-view-multiple.sd-select-view-focus .sd-select-view-tag .sd-icon-hover:hover::before {
911
913
  background-color: var(--sd-color-fill-3);
912
914
  }
913
- .sd-select-view-multiple.sd-select-view-disabled .sd-select-view-tag {
915
+ .sd-select-view-multiple.sd-select-view-disabled .sd-select-view-tag:not(.sd-tag-custom-color):not(.sd-tag-red):not(.sd-tag-orangered):not(.sd-tag-orange):not(.sd-tag-gold):not(.sd-tag-lime):not(.sd-tag-green):not(.sd-tag-cyan):not(.sd-tag-blue):not(.sd-tag-sdblue):not(.sd-tag-purple):not(.sd-tag-pinkpurple):not(.sd-tag-magenta) {
914
916
  color: var(--sd-color-text-4);
915
917
  background-color: var(--sd-color-fill-2);
916
918
  border-color: var(--sd-color-fill-3);
@@ -0,0 +1,17 @@
1
+ import { Ref } from 'vue';
2
+ export declare const useSize: ({ dataKeys, fixedSize, estimatedSize, buffer, }: {
3
+ dataKeys: Ref<(string | number)[]>;
4
+ fixedSize: Ref<boolean>;
5
+ estimatedSize: Ref<number | undefined>;
6
+ buffer: Ref<number>;
7
+ }) => {
8
+ frontPadding: import("vue").ComputedRef<number>;
9
+ behindPadding: import("vue").ComputedRef<number>;
10
+ start: Ref<number, number>;
11
+ end: import("vue").ComputedRef<number>;
12
+ getStartByScroll: (scrollOffset: number) => number;
13
+ setItemSize: (key: string | number, size: number) => void;
14
+ hasItemSize: (key: string | number) => boolean;
15
+ setStart: (index: number) => void;
16
+ getScrollOffset: (index: number) => number;
17
+ };
@@ -0,0 +1,95 @@
1
+ import { computed, onMounted, ref } from "vue";
2
+ //#region components/_components/virtual-list-v2/hooks/use-size.ts
3
+ var useSize = ({ dataKeys, fixedSize, estimatedSize, buffer }) => {
4
+ const firstRangeAverageSize = ref(0);
5
+ const sizeMap = /* @__PURE__ */ new Map();
6
+ const total = computed(() => dataKeys.value.length);
7
+ const start = ref(0);
8
+ const end = computed(() => {
9
+ const _end = start.value + buffer.value * 3;
10
+ if (_end > total.value) return total.value;
11
+ return _end;
12
+ });
13
+ const maxStart = computed(() => {
14
+ const max = total.value - buffer.value * 3;
15
+ if (max < 0) return 0;
16
+ return max;
17
+ });
18
+ const setStart = (index) => {
19
+ if (index < 0) start.value = 0;
20
+ else if (index > maxStart.value) start.value = maxStart.value;
21
+ else start.value = index;
22
+ };
23
+ const isFixed = ref(fixedSize.value);
24
+ const _estimatedSize = computed(() => {
25
+ var _estimatedSize$value;
26
+ const nextEstimatedSize = (_estimatedSize$value = estimatedSize.value) !== null && _estimatedSize$value !== void 0 ? _estimatedSize$value : 30;
27
+ if (nextEstimatedSize !== 30) return nextEstimatedSize;
28
+ return firstRangeAverageSize.value || nextEstimatedSize;
29
+ });
30
+ const setItemSize = (key, size) => {
31
+ sizeMap.set(key, size);
32
+ };
33
+ const getItemSize = (index) => {
34
+ var _sizeMap$get;
35
+ if (isFixed.value) return _estimatedSize.value;
36
+ const _key = dataKeys.value[index];
37
+ if (_key === void 0) return _estimatedSize.value;
38
+ return (_sizeMap$get = sizeMap.get(_key)) !== null && _sizeMap$get !== void 0 ? _sizeMap$get : _estimatedSize.value;
39
+ };
40
+ const hasItemSize = (key) => {
41
+ return sizeMap.has(key);
42
+ };
43
+ onMounted(() => {
44
+ const firstRangeTotalSize = Array.from(sizeMap.values()).reduce((pre, value) => pre + value, 0);
45
+ if (firstRangeTotalSize > 0) firstRangeAverageSize.value = firstRangeTotalSize / sizeMap.size;
46
+ });
47
+ const getScrollOffset = (index) => {
48
+ if (isFixed.value) return _estimatedSize.value * index;
49
+ return getOffset(0, index);
50
+ };
51
+ const getOffset = (start, end) => {
52
+ let offset = 0;
53
+ for (let i = start; i < end; i++) offset += getItemSize(i);
54
+ return offset;
55
+ };
56
+ const frontPadding = computed(() => {
57
+ if (isFixed.value) return _estimatedSize.value * start.value;
58
+ return getOffset(0, start.value);
59
+ });
60
+ const getOffsetIndex = (scrollOffset) => {
61
+ const isForward = scrollOffset >= frontPadding.value;
62
+ let offset = Math.abs(scrollOffset - frontPadding.value);
63
+ const _start = isForward ? start.value : start.value - 1;
64
+ let offsetIndex = 0;
65
+ while (offset > 0) {
66
+ const itemSize = getItemSize(_start + offsetIndex);
67
+ offset -= itemSize;
68
+ isForward ? offsetIndex++ : offsetIndex--;
69
+ }
70
+ return offsetIndex;
71
+ };
72
+ const getStartByScroll = (scrollOffset) => {
73
+ const offsetIndex = getOffsetIndex(scrollOffset);
74
+ const _start = start.value + offsetIndex - buffer.value;
75
+ if (_start < 0) return 0;
76
+ if (_start > maxStart.value) return maxStart.value;
77
+ return _start;
78
+ };
79
+ return {
80
+ frontPadding,
81
+ behindPadding: computed(() => {
82
+ if (isFixed.value) return _estimatedSize.value * (total.value - end.value);
83
+ return getOffset(end.value, total.value);
84
+ }),
85
+ start,
86
+ end,
87
+ getStartByScroll,
88
+ setItemSize,
89
+ hasItemSize,
90
+ setStart,
91
+ getScrollOffset
92
+ };
93
+ };
94
+ //#endregion
95
+ export { useSize };
@@ -0,0 +1,2 @@
1
+ import VirtualList from './virtual-list.vue';
2
+ export default VirtualList;
@@ -0,0 +1,5 @@
1
+ import virtual_list_default from "./virtual-list.js";
2
+ //#region components/_components/virtual-list-v2/index.ts
3
+ var virtual_list_v2_default = virtual_list_default;
4
+ //#endregion
5
+ export { virtual_list_v2_default as default };
@@ -0,0 +1,44 @@
1
+ import { VNode } from 'vue';
2
+ import type { ScrollbarProps } from '../../scrollbar';
3
+ export type VirtualItemKey = string | number;
4
+ export interface InternalDataItem {
5
+ key: VirtualItemKey;
6
+ index: number;
7
+ item: unknown;
8
+ }
9
+ export type ItemSlot = (props: {
10
+ item: unknown;
11
+ index: number;
12
+ }) => VNode[];
13
+ export interface ScrollIntoViewOptions {
14
+ index?: number;
15
+ key?: VirtualItemKey;
16
+ align: 'auto' | 'top' | 'bottom';
17
+ }
18
+ export interface VirtualListProps {
19
+ height?: number | string;
20
+ threshold?: number;
21
+ isStaticItemHeight?: boolean;
22
+ fixedSize?: boolean;
23
+ estimatedSize?: number;
24
+ buffer?: number;
25
+ data?: unknown[];
26
+ itemKey?: string | ((item: unknown) => VirtualItemKey);
27
+ component?: keyof HTMLElementTagNameMap | {
28
+ container?: keyof HTMLElementTagNameMap;
29
+ list?: keyof HTMLElementTagNameMap;
30
+ content?: keyof HTMLElementTagNameMap;
31
+ };
32
+ listAttrs?: Record<string, unknown>;
33
+ contentAttrs?: Record<string, unknown>;
34
+ paddingPosition?: 'content' | 'list';
35
+ scrollbar?: boolean | ScrollbarProps;
36
+ }
37
+ export type ScrollOptions = number | {
38
+ index?: number;
39
+ key?: VirtualItemKey;
40
+ align?: 'auto' | 'top' | 'bottom';
41
+ };
42
+ export interface VirtualListRef {
43
+ scrollTo: (options: ScrollOptions) => void;
44
+ }
@@ -0,0 +1,22 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ hasItemSize: {
3
+ type: FunctionConstructor;
4
+ required: true;
5
+ };
6
+ setItemSize: {
7
+ type: FunctionConstructor;
8
+ required: true;
9
+ };
10
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
11
+ [key: string]: any;
12
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ hasItemSize: {
14
+ type: FunctionConstructor;
15
+ required: true;
16
+ };
17
+ setItemSize: {
18
+ type: FunctionConstructor;
19
+ required: true;
20
+ };
21
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
22
+ export default _default;
@@ -0,0 +1,37 @@
1
+ import { getFirstComponent } from "../../_utils/vue-utils.js";
2
+ import { cloneVNode, defineComponent, getCurrentInstance, onBeforeUnmount, onMounted, ref } from "vue";
3
+ //#region components/_components/virtual-list-v2/virtual-list-item.tsx
4
+ var virtual_list_item_default = /* @__PURE__ */ defineComponent({
5
+ name: "VirtualListItem",
6
+ props: {
7
+ hasItemSize: {
8
+ type: Function,
9
+ required: true
10
+ },
11
+ setItemSize: {
12
+ type: Function,
13
+ required: true
14
+ }
15
+ },
16
+ setup(props, { slots }) {
17
+ var _getCurrentInstance;
18
+ const key = (_getCurrentInstance = getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.vnode.key;
19
+ const itemRef = ref();
20
+ const setItemSize = () => {
21
+ var _itemRef$value$$el, _itemRef$value, _ele$getBoundingClien, _ele$getBoundingClien2;
22
+ const ele = (_itemRef$value$$el = (_itemRef$value = itemRef.value) === null || _itemRef$value === void 0 ? void 0 : _itemRef$value.$el) !== null && _itemRef$value$$el !== void 0 ? _itemRef$value$$el : itemRef.value;
23
+ const height = (_ele$getBoundingClien = ele === null || ele === void 0 || (_ele$getBoundingClien2 = ele.getBoundingClientRect) === null || _ele$getBoundingClien2 === void 0 ? void 0 : _ele$getBoundingClien2.call(ele).height) !== null && _ele$getBoundingClien !== void 0 ? _ele$getBoundingClien : ele === null || ele === void 0 ? void 0 : ele.offsetHeight;
24
+ if (height) props.setItemSize(key, height);
25
+ };
26
+ onMounted(() => setItemSize());
27
+ onBeforeUnmount(() => setItemSize());
28
+ return () => {
29
+ var _slots$default;
30
+ const child = getFirstComponent((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots));
31
+ if (child) return cloneVNode(child, { ref: itemRef }, true);
32
+ return null;
33
+ };
34
+ }
35
+ });
36
+ //#endregion
37
+ export { virtual_list_item_default as default };
@@ -0,0 +1,47 @@
1
+ import virtual_list_vue_vue_type_script_lang_default from "./virtual-list.vue_vue_type_script_lang.js";
2
+ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { Fragment, createBlock, createElementBlock, mergeProps, openBlock, renderList, renderSlot, resolveComponent, resolveDynamicComponent, withCtx } from "vue";
4
+ //#region components/_components/virtual-list-v2/virtual-list.vue
5
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6
+ const _component_VirtualListItem = resolveComponent("VirtualListItem");
7
+ return openBlock(), createBlock(resolveDynamicComponent(_ctx.containerComponent), mergeProps({
8
+ ref: "containerRef",
9
+ class: _ctx.prefixCls,
10
+ style: _ctx.style
11
+ }, _ctx.containerProps, { onScroll: _ctx.onScroll }), {
12
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.mergedComponent.list), mergeProps(_ctx.listAttrs, { style: _ctx.paddingPosition === "list" ? {
13
+ paddingTop: `${_ctx.frontPadding}px`,
14
+ paddingBottom: `${_ctx.behindPadding}px`
15
+ } : {} }), {
16
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.mergedComponent.content), mergeProps({ ref: "contentRef" }, _ctx.contentAttrs, { style: _ctx.paddingPosition === "content" ? {
17
+ paddingTop: `${_ctx.frontPadding}px`,
18
+ paddingBottom: `${_ctx.behindPadding}px`
19
+ } : {} }), {
20
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.currentList, (item, index) => {
21
+ var _item$_ctx$itemKey;
22
+ return openBlock(), createBlock(_component_VirtualListItem, {
23
+ key: (_item$_ctx$itemKey = item[_ctx.itemKey]) !== null && _item$_ctx$itemKey !== void 0 ? _item$_ctx$itemKey : _ctx.start + index,
24
+ "has-item-size": _ctx.hasItemSize,
25
+ "set-item-size": _ctx.setItemSize
26
+ }, {
27
+ default: withCtx(() => [renderSlot(_ctx.$slots, "item", {
28
+ item,
29
+ index: _ctx.start + index
30
+ })]),
31
+ _: 2
32
+ }, 1032, ["has-item-size", "set-item-size"]);
33
+ }), 128))]),
34
+ _: 3
35
+ }, 16, ["style"]))]),
36
+ _: 3
37
+ }, 16, ["style"]))]),
38
+ _: 3
39
+ }, 16, [
40
+ "class",
41
+ "style",
42
+ "onScroll"
43
+ ]);
44
+ }
45
+ var virtual_list_default = /*#__PURE__*/ _plugin_vue_export_helper_default(virtual_list_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
46
+ //#endregion
47
+ export { virtual_list_default as default };