vxe-pc-ui 4.20.32 → 4.20.34

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 (92) hide show
  1. package/dist/all.esm.js +788 -584
  2. package/dist/all.esm.min.js +3 -3
  3. package/dist/style.css +127 -2
  4. package/dist/style.mini.css +1 -1
  5. package/es/dynamics/index.d.ts +1 -0
  6. package/es/icon/style.css +1 -1
  7. package/es/icon/style.mini.css +1 -1
  8. package/es/modal/index.d.ts +38 -0
  9. package/es/modal/src/modal.d.ts +9 -0
  10. package/es/modal/src/modal.js +66 -44
  11. package/es/select/src/option.js +2 -1
  12. package/es/select/src/select.js +25 -20
  13. package/es/style.css +127 -2
  14. package/es/style.mini.css +1 -1
  15. package/es/timeline/index.d.ts +92 -0
  16. package/es/timeline/src/timeline-info.d.ts +6 -0
  17. package/es/timeline/src/timeline-info.js +19 -0
  18. package/es/timeline/src/timeline-item.d.ts +11 -8
  19. package/es/timeline/src/timeline-item.js +33 -45
  20. package/es/timeline/src/timeline.d.ts +22 -0
  21. package/es/timeline/src/timeline.js +182 -48
  22. package/es/timeline/src/util.d.ts +7 -0
  23. package/es/timeline/src/util.js +41 -0
  24. package/es/timeline/style.css +122 -0
  25. package/es/timeline/style.mini.css +1 -0
  26. package/es/timeline-item/index.d.ts +42 -34
  27. package/es/ui/index.js +1 -1
  28. package/es/ui/src/log.js +1 -1
  29. package/es/vxe-icon/style.css +1 -1
  30. package/es/vxe-icon/style.mini.css +1 -1
  31. package/es/vxe-timeline/style.css +122 -0
  32. package/es/vxe-timeline/style.mini.css +1 -0
  33. package/lib/icon/style/style.css +1 -1
  34. package/lib/icon/style/style.mini.css +1 -1
  35. package/lib/index.umd.js +976 -771
  36. package/lib/index.umd.min.js +3 -3
  37. package/lib/modal/src/modal.js +66 -44
  38. package/lib/select/src/option.js +2 -1
  39. package/lib/select/src/select.js +25 -20
  40. package/lib/style.css +127 -2
  41. package/lib/style.mini.css +1 -1
  42. package/lib/timeline/src/timeline-info.js +48 -0
  43. package/lib/timeline/src/timeline-item.js +32 -54
  44. package/lib/timeline/src/timeline.js +181 -47
  45. package/lib/timeline/src/util.js +71 -0
  46. package/lib/timeline/style/style.css +122 -0
  47. package/lib/timeline/style/style.mini.css +1 -0
  48. package/lib/ui/index.js +1 -1
  49. package/lib/ui/src/log.js +1 -1
  50. package/lib/vxe-icon/style/style.css +1 -1
  51. package/lib/vxe-icon/style/style.mini.css +1 -1
  52. package/lib/vxe-timeline/style/style.css +122 -0
  53. package/lib/vxe-timeline/style/style.mini.css +1 -0
  54. package/package.json +10 -3
  55. package/packages/modal/src/modal.ts +90 -47
  56. package/packages/select/src/option.ts +3 -1
  57. package/packages/select/src/select.ts +25 -20
  58. package/packages/slider/src/slider.ts +1 -16
  59. package/packages/timeline/src/timeline-info.ts +17 -0
  60. package/packages/timeline/src/timeline-item.ts +25 -50
  61. package/packages/timeline/src/timeline.ts +154 -15
  62. package/packages/timeline/src/util.ts +41 -0
  63. package/styles/components/timeline.scss +133 -0
  64. package/styles/theme/dark.scss +2 -1
  65. package/styles/theme/light.scss +1 -0
  66. package/styles/variable.scss +2 -1
  67. package/types/components/modal.d.ts +2 -0
  68. package/types/components/optgroup.d.ts +0 -1
  69. package/types/components/option.d.ts +0 -1
  70. package/types/components/timeline-item.d.ts +21 -17
  71. package/types/components/timeline.d.ts +41 -8
  72. /package/dist/{iconfont.1793082793047.ttf → iconfont.1793330162657.ttf} +0 -0
  73. /package/dist/{iconfont.1793082793047.woff → iconfont.1793330162657.woff} +0 -0
  74. /package/dist/{iconfont.1793082793047.woff2 → iconfont.1793330162657.woff2} +0 -0
  75. /package/es/icon/{iconfont.1793082793047.ttf → iconfont.1793330162657.ttf} +0 -0
  76. /package/es/icon/{iconfont.1793082793047.woff → iconfont.1793330162657.woff} +0 -0
  77. /package/es/icon/{iconfont.1793082793047.woff2 → iconfont.1793330162657.woff2} +0 -0
  78. /package/es/{iconfont.1793082793047.ttf → iconfont.1793330162657.ttf} +0 -0
  79. /package/es/{iconfont.1793082793047.woff → iconfont.1793330162657.woff} +0 -0
  80. /package/es/{iconfont.1793082793047.woff2 → iconfont.1793330162657.woff2} +0 -0
  81. /package/es/vxe-icon/{iconfont.1793082793047.ttf → iconfont.1793330162657.ttf} +0 -0
  82. /package/es/vxe-icon/{iconfont.1793082793047.woff → iconfont.1793330162657.woff} +0 -0
  83. /package/es/vxe-icon/{iconfont.1793082793047.woff2 → iconfont.1793330162657.woff2} +0 -0
  84. /package/lib/icon/style/{iconfont.1793082793047.ttf → iconfont.1793330162657.ttf} +0 -0
  85. /package/lib/icon/style/{iconfont.1793082793047.woff → iconfont.1793330162657.woff} +0 -0
  86. /package/lib/icon/style/{iconfont.1793082793047.woff2 → iconfont.1793330162657.woff2} +0 -0
  87. /package/lib/{iconfont.1793082793047.ttf → iconfont.1793330162657.ttf} +0 -0
  88. /package/lib/{iconfont.1793082793047.woff → iconfont.1793330162657.woff} +0 -0
  89. /package/lib/{iconfont.1793082793047.woff2 → iconfont.1793330162657.woff2} +0 -0
  90. /package/lib/vxe-icon/style/{iconfont.1793082793047.ttf → iconfont.1793330162657.ttf} +0 -0
  91. /package/lib/vxe-icon/style/{iconfont.1793082793047.woff → iconfont.1793330162657.woff} +0 -0
  92. /package/lib/vxe-icon/style/{iconfont.1793082793047.woff2 → iconfont.1793330162657.woff2} +0 -0
@@ -5,13 +5,35 @@ export declare const VxeTimeline: {
5
5
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
6
6
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
7
7
  };
8
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
9
+ reverse: {
10
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
11
+ default: () => boolean | undefined;
12
+ };
13
+ vertical: {
14
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
15
+ default: () => boolean | undefined;
16
+ };
17
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
8
18
  }>> & {}, import("../../types").VxeTimelineConstructor & import("../../types").VxeTimelinePrivateMethods, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, [], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
9
19
  size: {
10
20
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
11
21
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
12
22
  };
23
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
24
+ reverse: {
25
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
26
+ default: () => boolean | undefined;
27
+ };
28
+ vertical: {
29
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
30
+ default: () => boolean | undefined;
31
+ };
32
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
13
33
  }>> & {}, {
34
+ reverse: boolean;
14
35
  size: import("@vxe-ui/core").VxeComponentSizeType;
36
+ vertical: boolean;
15
37
  }, true, {}, {}, {
16
38
  P: {};
17
39
  B: {};
@@ -24,8 +46,20 @@ export declare const VxeTimeline: {
24
46
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
25
47
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
26
48
  };
49
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
50
+ reverse: {
51
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
52
+ default: () => boolean | undefined;
53
+ };
54
+ vertical: {
55
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
56
+ default: () => boolean | undefined;
57
+ };
58
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
27
59
  }>> & {}, import("../../types").VxeTimelineConstructor & import("../../types").VxeTimelinePrivateMethods, {}, {}, {}, {
60
+ reverse: boolean;
28
61
  size: import("@vxe-ui/core").VxeComponentSizeType;
62
+ vertical: boolean;
29
63
  }>;
30
64
  __isFragment?: never;
31
65
  __isTeleport?: never;
@@ -35,8 +69,20 @@ export declare const VxeTimeline: {
35
69
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
36
70
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
37
71
  };
72
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
73
+ reverse: {
74
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
75
+ default: () => boolean | undefined;
76
+ };
77
+ vertical: {
78
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
79
+ default: () => boolean | undefined;
80
+ };
81
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
38
82
  }>> & {}, import("../../types").VxeTimelineConstructor & import("../../types").VxeTimelinePrivateMethods, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, [], never, {
83
+ reverse: boolean;
39
84
  size: import("@vxe-ui/core").VxeComponentSizeType;
85
+ vertical: boolean;
40
86
  }, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
41
87
  install(app: App): void;
42
88
  };
@@ -46,13 +92,35 @@ export declare const Timeline: {
46
92
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
47
93
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
48
94
  };
95
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
96
+ reverse: {
97
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
98
+ default: () => boolean | undefined;
99
+ };
100
+ vertical: {
101
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
102
+ default: () => boolean | undefined;
103
+ };
104
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
49
105
  }>> & {}, import("../../types").VxeTimelineConstructor & import("../../types").VxeTimelinePrivateMethods, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, [], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
50
106
  size: {
51
107
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
52
108
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
53
109
  };
110
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
111
+ reverse: {
112
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
113
+ default: () => boolean | undefined;
114
+ };
115
+ vertical: {
116
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
117
+ default: () => boolean | undefined;
118
+ };
119
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
54
120
  }>> & {}, {
121
+ reverse: boolean;
55
122
  size: import("@vxe-ui/core").VxeComponentSizeType;
123
+ vertical: boolean;
56
124
  }, true, {}, {}, {
57
125
  P: {};
58
126
  B: {};
@@ -65,8 +133,20 @@ export declare const Timeline: {
65
133
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
66
134
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
67
135
  };
136
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
137
+ reverse: {
138
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
139
+ default: () => boolean | undefined;
140
+ };
141
+ vertical: {
142
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
143
+ default: () => boolean | undefined;
144
+ };
145
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
68
146
  }>> & {}, import("../../types").VxeTimelineConstructor & import("../../types").VxeTimelinePrivateMethods, {}, {}, {}, {
147
+ reverse: boolean;
69
148
  size: import("@vxe-ui/core").VxeComponentSizeType;
149
+ vertical: boolean;
70
150
  }>;
71
151
  __isFragment?: never;
72
152
  __isTeleport?: never;
@@ -76,8 +156,20 @@ export declare const Timeline: {
76
156
  type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Size>;
77
157
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
78
158
  };
159
+ options: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Options>;
160
+ reverse: {
161
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Reverse>;
162
+ default: () => boolean | undefined;
163
+ };
164
+ vertical: {
165
+ type: import("vue").PropType<import("../../types").VxeTimelinePropTypes.Vertical>;
166
+ default: () => boolean | undefined;
167
+ };
168
+ optionProps: import("vue").PropType<import("../../types").VxeTimelinePropTypes.OptionProps>;
79
169
  }>> & {}, import("../../types").VxeTimelineConstructor & import("../../types").VxeTimelinePrivateMethods, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, [], never, {
170
+ reverse: boolean;
80
171
  size: import("@vxe-ui/core").VxeComponentSizeType;
172
+ vertical: boolean;
81
173
  }, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
82
174
  install(app: App): void;
83
175
  };
@@ -0,0 +1,6 @@
1
+ export declare class TimelineItemInfo {
2
+ id: string;
3
+ constructor($xeTimeline: any, _vm: any);
4
+ update(name: any, value: any): void;
5
+ [key: string]: any;
6
+ }
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import XEUtils from "xe-utils";
5
+ class TimelineItemInfo {
6
+ constructor($xeTimeline, _vm) {
7
+ __publicField(this, "id", XEUtils.uniqueId("timeline_item_"));
8
+ Object.assign(this, {
9
+ title: _vm.title,
10
+ content: _vm.content
11
+ });
12
+ }
13
+ update(name, value) {
14
+ this[name] = value;
15
+ }
16
+ }
17
+ export {
18
+ TimelineItemInfo
19
+ };
@@ -1,9 +1,12 @@
1
- import type { VxeTimelineItemConstructor, VxeTimelineItemPrivateMethods } from '../../../types';
2
- declare const _default: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
3
- [x: string]: unknown;
4
- }>>, VxeTimelineItemConstructor & VxeTimelineItemPrivateMethods, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, [], never, import("vue").PublicProps, Readonly<readonly string[] | import("vue").ExtractPropTypes<Readonly<import("vue").ComponentObjectPropsOptions<{
5
- [x: string]: unknown;
6
- }>>>> & {}, {
7
- readonly [x: number]: string;
8
- } | {}, {}>;
1
+ import { PropType } from 'vue';
2
+ import type { VxeTimelineItemPropTypes } from '../../../types';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ title: PropType<VxeTimelineItemPropTypes.Title>;
5
+ content: PropType<VxeTimelineItemPropTypes.Content>;
6
+ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
7
+ [key: string]: any;
8
+ }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
9
+ title: PropType<VxeTimelineItemPropTypes.Title>;
10
+ content: PropType<VxeTimelineItemPropTypes.Content>;
11
+ }>>, {}, {}>;
9
12
  export default _default;
@@ -1,50 +1,38 @@
1
- import { ref, h, reactive } from "vue";
1
+ import { ref, h, inject, onMounted, onUnmounted } from "vue";
2
2
  import { defineVxeComponent } from "../../ui/src/comp";
3
- import XEUtils from "xe-utils";
4
- import { VxeUI } from "@vxe-ui/core";
5
- const { createEvent } = VxeUI;
6
- var timeline_item_default = defineVxeComponent({
7
- name: "VxeTimelineItem",
8
- props: {},
9
- emits: [],
10
- setup(props, context) {
11
- const { emit } = context;
12
- const xID = XEUtils.uniqueId();
13
- const refElem = ref();
14
- const reactData = reactive({});
15
- const refMaps = {
16
- refElem
17
- };
18
- const computeMaps = {};
19
- const $xeTimelineItem = {
20
- xID,
21
- props,
22
- context,
23
- reactData,
24
- getRefMaps: () => refMaps,
25
- getComputeMaps: () => computeMaps
26
- };
27
- const dispatchEvent = (type, params, evnt) => {
28
- emit(type, createEvent(evnt, { $timelineItem: $xeTimelineItem }, params));
29
- };
30
- const tagMethods = {
31
- dispatchEvent
32
- };
33
- const tagPrivateMethods = {};
34
- Object.assign($xeTimelineItem, tagMethods, tagPrivateMethods);
35
- const renderVN = () => {
36
- return h("div", {
37
- ref: refElem,
38
- class: "vxe-timeline-item"
3
+ import { createTimelineItem, watchTimelineItem, assembleTimelineItem, destroyTimelineItem } from "./util";
4
+ var timeline_item_default = (
5
+ /* define-vxe-component start */
6
+ defineVxeComponent({
7
+ name: "VxeTimelineItem",
8
+ props: {
9
+ title: [String, Number],
10
+ content: [String, Number]
11
+ },
12
+ setup(props, context) {
13
+ const { slots } = context;
14
+ const refElem = ref();
15
+ const $xeTimeline = inject("$xeTimeline", {});
16
+ const itemConfig = createTimelineItem($xeTimeline, props);
17
+ itemConfig.slots = slots;
18
+ watchTimelineItem(props, itemConfig);
19
+ onMounted(() => {
20
+ const el = refElem.value;
21
+ if (el) {
22
+ assembleTimelineItem($xeTimeline, el, itemConfig);
23
+ }
39
24
  });
40
- };
41
- $xeTimelineItem.renderVN = renderVN;
42
- return $xeTimelineItem;
43
- },
44
- render() {
45
- return this.renderVN();
46
- }
47
- });
25
+ onUnmounted(() => {
26
+ destroyTimelineItem($xeTimeline, itemConfig);
27
+ });
28
+ return () => {
29
+ return h("div", {
30
+ ref: refElem
31
+ });
32
+ };
33
+ }
34
+ })
35
+ );
48
36
  export {
49
37
  timeline_item_default as default
50
38
  };
@@ -5,12 +5,34 @@ declare const _default: import("vue").DefineComponent<{
5
5
  type: PropType<VxeTimelinePropTypes.Size>;
6
6
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
7
7
  };
8
+ options: PropType<VxeTimelinePropTypes.Options>;
9
+ reverse: {
10
+ type: PropType<VxeTimelinePropTypes.Reverse>;
11
+ default: () => boolean | undefined;
12
+ };
13
+ vertical: {
14
+ type: PropType<VxeTimelinePropTypes.Vertical>;
15
+ default: () => boolean | undefined;
16
+ };
17
+ optionProps: PropType<VxeTimelinePropTypes.OptionProps>;
8
18
  }, VxeTimelineConstructor & VxeTimelinePrivateMethods, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, [], never, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
9
19
  size: {
10
20
  type: PropType<VxeTimelinePropTypes.Size>;
11
21
  default: () => import("@vxe-ui/core").VxeComponentSizeType;
12
22
  };
23
+ options: PropType<VxeTimelinePropTypes.Options>;
24
+ reverse: {
25
+ type: PropType<VxeTimelinePropTypes.Reverse>;
26
+ default: () => boolean | undefined;
27
+ };
28
+ vertical: {
29
+ type: PropType<VxeTimelinePropTypes.Vertical>;
30
+ default: () => boolean | undefined;
31
+ };
32
+ optionProps: PropType<VxeTimelinePropTypes.OptionProps>;
13
33
  }>> & {}, {
34
+ reverse: boolean;
14
35
  size: import("@vxe-ui/core").VxeComponentSizeType;
36
+ vertical: boolean;
15
37
  }, {}>;
16
38
  export default _default;
@@ -1,55 +1,189 @@
1
- import { ref, h, reactive } from "vue";
1
+ import { ref, h, reactive, computed, watch, provide, onMounted, onBeforeUnmount } from "vue";
2
2
  import { defineVxeComponent } from "../../ui/src/comp";
3
3
  import XEUtils from "xe-utils";
4
4
  import { VxeUI } from "@vxe-ui/core";
5
- const { getConfig, createEvent } = VxeUI;
6
- var timeline_default = defineVxeComponent({
7
- name: "VxeTimeline",
8
- props: {
9
- size: {
10
- type: String,
11
- default: () => getConfig().timeline.size || getConfig().size
5
+ import { getText } from "../../ui/src/utils";
6
+ const { getConfig, useFns, createEvent } = VxeUI;
7
+ function createInternalData() {
8
+ return {
9
+ fullData: []
10
+ };
11
+ }
12
+ function createReactData() {
13
+ return {
14
+ itemList: [],
15
+ staticItems: [],
16
+ isOptConf: false
17
+ };
18
+ }
19
+ var timeline_default = (
20
+ /* define-vxe-component start */
21
+ defineVxeComponent({
22
+ name: "VxeTimeline",
23
+ props: {
24
+ size: {
25
+ type: String,
26
+ default: () => getConfig().timeline.size || getConfig().size
27
+ },
28
+ options: Array,
29
+ reverse: {
30
+ type: Boolean,
31
+ default: () => getConfig().timeline.reverse
32
+ },
33
+ vertical: {
34
+ type: Boolean,
35
+ default: () => getConfig().timeline.vertical
36
+ },
37
+ optionProps: Object
38
+ },
39
+ emits: [],
40
+ setup(props, context) {
41
+ const { slots, emit } = context;
42
+ const xID = XEUtils.uniqueId();
43
+ const { computeSize } = useFns.useSize(props);
44
+ const refElem = ref();
45
+ const reactData = reactive(createReactData());
46
+ const internalData = createInternalData();
47
+ const refMaps = {
48
+ refElem
49
+ };
50
+ const computeMaps = {};
51
+ const $xeTimeline = {
52
+ xID,
53
+ props,
54
+ context,
55
+ reactData,
56
+ internalData,
57
+ getRefMaps: () => refMaps,
58
+ getComputeMaps: () => computeMaps
59
+ };
60
+ const computePropsOpts = computed(() => {
61
+ return Object.assign({}, getConfig().timeline.optionProps, props.optionProps);
62
+ });
63
+ const computeTitleField = computed(() => {
64
+ const propsOpts = computePropsOpts.value;
65
+ return propsOpts.title || "title";
66
+ });
67
+ const computeContentField = computed(() => {
68
+ const propsOpts = computePropsOpts.value;
69
+ return propsOpts.content || "content";
70
+ });
71
+ const dispatchEvent = (type, params, evnt) => {
72
+ emit(type, createEvent(evnt, { $timeline: $xeTimeline }, params));
73
+ };
74
+ const loadData = (opts, isOptConf) => {
75
+ reactData.isOptConf = isOptConf;
76
+ internalData.fullData = opts || [];
77
+ updateItems();
78
+ };
79
+ const updateItems = () => {
80
+ const { reverse } = props;
81
+ const { fullData } = internalData;
82
+ reactData.itemList = reverse ? fullData.slice(0).reverse() : fullData.slice(0);
83
+ };
84
+ const timelineMethods = {
85
+ dispatchEvent
86
+ };
87
+ const timelinePrivateMethods = {};
88
+ Object.assign($xeTimeline, timelineMethods, timelinePrivateMethods);
89
+ const renderItem = (item, index) => {
90
+ const { itemList, isOptConf } = reactData;
91
+ const titleField = computeTitleField.value;
92
+ const contentField = computeContentField.value;
93
+ const titleVal = getText(isOptConf ? item[titleField] : item.title);
94
+ const contentVal = getText(isOptConf ? item[contentField] : item.content);
95
+ const titleSlot = slots.title;
96
+ const contentSlot = slots.content;
97
+ return h(
98
+ "div",
99
+ {
100
+ key: index,
101
+ class: ["vxe-timeline--item", {
102
+ "is--last": index === itemList.length - 1
103
+ }]
104
+ },
105
+ [
106
+ h("div", {
107
+ class: "vxe-timeline--item-line"
108
+ }),
109
+ h("div", {
110
+ class: "vxe-timeline--item-node"
111
+ }),
112
+ h("div", {
113
+ class: "vxe-timeline--item-wrapper"
114
+ }, [
115
+ h("div", {
116
+ class: "vxe-timeline--item-title"
117
+ }, titleSlot ? titleSlot({ item }) : titleVal),
118
+ h("div", {
119
+ class: "vxe-timeline--item-content"
120
+ }, contentSlot ? contentSlot({ item }) : contentVal)
121
+ ])
122
+ ]
123
+ );
124
+ };
125
+ const renderVN = () => {
126
+ const { vertical } = props;
127
+ const { itemList } = reactData;
128
+ const vSize = computeSize.value;
129
+ const defaultSlot = slots.default;
130
+ return h(
131
+ "div",
132
+ {
133
+ ref: refElem,
134
+ class: ["vxe-timeline", {
135
+ [`size--${vSize}`]: vSize,
136
+ "is--vertical": vertical,
137
+ "is--horizontal": !vertical
138
+ }]
139
+ },
140
+ [
141
+ h("div", {
142
+ class: "vxe-timeline--slots"
143
+ }, defaultSlot ? defaultSlot({}) : []),
144
+ h("div", {
145
+ class: "vxe-timeline--body"
146
+ }, itemList.map((item, index) => renderItem(item, index)))
147
+ ]
148
+ );
149
+ };
150
+ watch(() => reactData.staticItems, (val) => {
151
+ loadData(val, false);
152
+ });
153
+ const refOptsFlag = ref(0);
154
+ watch(() => props.options, () => {
155
+ refOptsFlag.value++;
156
+ });
157
+ watch(() => props.options ? props.options.length : -1, () => {
158
+ refOptsFlag.value++;
159
+ });
160
+ watch(refOptsFlag, () => {
161
+ loadData(props.options || [], true);
162
+ });
163
+ watch(() => props.reverse, () => {
164
+ updateItems();
165
+ });
166
+ onMounted(() => {
167
+ const { staticItems } = reactData;
168
+ if (staticItems.length) {
169
+ loadData(staticItems, false);
170
+ } else {
171
+ loadData(props.options || [], true);
172
+ }
173
+ });
174
+ onBeforeUnmount(() => {
175
+ XEUtils.assign(reactData, createReactData());
176
+ XEUtils.assign(internalData, createInternalData());
177
+ });
178
+ provide("$xeTimeline", $xeTimeline);
179
+ $xeTimeline.renderVN = renderVN;
180
+ return $xeTimeline;
181
+ },
182
+ render() {
183
+ return this.renderVN();
12
184
  }
13
- },
14
- emits: [],
15
- setup(props, context) {
16
- const { emit } = context;
17
- const xID = XEUtils.uniqueId();
18
- const refElem = ref();
19
- const reactData = reactive({});
20
- const refMaps = {
21
- refElem
22
- };
23
- const computeMaps = {};
24
- const $xeTimeline = {
25
- xID,
26
- props,
27
- context,
28
- reactData,
29
- getRefMaps: () => refMaps,
30
- getComputeMaps: () => computeMaps
31
- };
32
- const dispatchEvent = (type, params, evnt) => {
33
- emit(type, createEvent(evnt, { $timeline: $xeTimeline }, params));
34
- };
35
- const tagMethods = {
36
- dispatchEvent
37
- };
38
- const tagPrivateMethods = {};
39
- Object.assign($xeTimeline, tagMethods, tagPrivateMethods);
40
- const renderVN = () => {
41
- return h("div", {
42
- ref: refElem,
43
- class: "vxe-timeline"
44
- });
45
- };
46
- $xeTimeline.renderVN = renderVN;
47
- return $xeTimeline;
48
- },
49
- render() {
50
- return this.renderVN();
51
- }
52
- });
185
+ })
186
+ );
53
187
  export {
54
188
  timeline_default as default
55
189
  };
@@ -0,0 +1,7 @@
1
+ import { TimelineItemInfo } from './timeline-info';
2
+ import type { VxeTimelineConstructor } from '../../../types';
3
+ export declare function isTimelineItem(item: any): item is TimelineItemInfo;
4
+ export declare function createTimelineItem($xeTimeline: VxeTimelineConstructor, _vm: any): TimelineItemInfo;
5
+ export declare function watchTimelineItem(props: any, itemInfo: TimelineItemInfo): void;
6
+ export declare function assembleTimelineItem($xeTimeline: VxeTimelineConstructor, el: HTMLDivElement, itemInfo: TimelineItemInfo): void;
7
+ export declare function destroyTimelineItem($xeTimeline: VxeTimelineConstructor, itemInfo: TimelineItemInfo): void;
@@ -0,0 +1,41 @@
1
+ import { watch } from "vue";
2
+ import XEUtils from "xe-utils";
3
+ import { TimelineItemInfo } from "./timeline-info";
4
+ function isTimelineItem(item) {
5
+ return item instanceof TimelineItemInfo;
6
+ }
7
+ function createTimelineItem($xeTimeline, _vm) {
8
+ return isTimelineItem(_vm) ? _vm : new TimelineItemInfo($xeTimeline, _vm);
9
+ }
10
+ function watchTimelineItem(props, itemInfo) {
11
+ Object.keys(props).forEach((name) => {
12
+ watch(() => props[name], (value) => {
13
+ itemInfo.update(name, value);
14
+ });
15
+ });
16
+ }
17
+ function assembleTimelineItem($xeTimeline, el, itemInfo) {
18
+ const { reactData } = $xeTimeline;
19
+ const { staticItems } = reactData;
20
+ const parentElem = el.parentNode;
21
+ if (parentElem && staticItems) {
22
+ staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, el), 0, itemInfo);
23
+ reactData.staticItems = staticItems.slice(0);
24
+ }
25
+ }
26
+ function destroyTimelineItem($xeTimeline, itemInfo) {
27
+ const { reactData } = $xeTimeline;
28
+ const { staticItems } = reactData;
29
+ const index = XEUtils.findIndexOf(staticItems, (item) => item.id === itemInfo.id);
30
+ if (index > -1) {
31
+ staticItems.splice(index, 1);
32
+ }
33
+ reactData.staticItems = staticItems.slice(0);
34
+ }
35
+ export {
36
+ assembleTimelineItem,
37
+ createTimelineItem,
38
+ destroyTimelineItem,
39
+ isTimelineItem,
40
+ watchTimelineItem
41
+ };