tencent.jquery.pix.component 1.0.68 → 1.0.69
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.
|
@@ -31,9 +31,24 @@ const DEFAULTS = {
|
|
|
31
31
|
export function Waterfall(optionsInput = {}) {
|
|
32
32
|
$ = getEnv().$;
|
|
33
33
|
|
|
34
|
-
this.
|
|
34
|
+
this.optionsInput = optionsInput
|
|
35
|
+
|
|
36
|
+
this.init();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
Waterfall.prototype.init = function (optionsMain = null) {
|
|
41
|
+
if (optionsMain) {
|
|
42
|
+
this.options = Object.assign({}, DEFAULTS, optionsMain);
|
|
43
|
+
} else {
|
|
44
|
+
this.options = Object.assign({}, DEFAULTS, this.optionsInput);
|
|
45
|
+
}
|
|
46
|
+
const self = this;
|
|
35
47
|
const options = this.options;
|
|
36
48
|
const $container = $(options.container);
|
|
49
|
+
const $scrollDom = options.scrollDom ? $(options.scrollDom) : $container;
|
|
50
|
+
|
|
51
|
+
|
|
37
52
|
// 标记是否有更新元素用的回调函数
|
|
38
53
|
this.hasUpdateItem = options.updateItem && (options.updateItem.constructor === Function) ? true : false;
|
|
39
54
|
|
|
@@ -109,9 +124,14 @@ export function Waterfall(optionsInput = {}) {
|
|
|
109
124
|
this.columnItems.push(this.createColumn(i));
|
|
110
125
|
}
|
|
111
126
|
|
|
112
|
-
this
|
|
113
|
-
|
|
127
|
+
this.$scrollDom = $scrollDom;
|
|
128
|
+
|
|
114
129
|
this.nodePool = []; // DOM 节点池
|
|
130
|
+
this.activeNodes = new Map(); // 当前活跃节点(索引 -> DOM)
|
|
131
|
+
this.allReadyNodes = new Map(); // 所有节点(索引 -> DOM)
|
|
132
|
+
this.renderIndex = 0; // 渲染索引(保留兼容性)
|
|
133
|
+
|
|
134
|
+
|
|
115
135
|
|
|
116
136
|
// 新方案:初始化数据ID映射
|
|
117
137
|
this.dataIdMap = new Map(); // 数据ID -> 布局信息映射
|
|
@@ -128,23 +148,6 @@ export function Waterfall(optionsInput = {}) {
|
|
|
128
148
|
});
|
|
129
149
|
});
|
|
130
150
|
|
|
131
|
-
this.init();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
Waterfall.prototype.init = function () {
|
|
136
|
-
const self = this;
|
|
137
|
-
const options = this.options;
|
|
138
|
-
const $container = $(options.container);
|
|
139
|
-
const $scrollDom = options.scrollDom ? $(options.scrollDom) : $container;
|
|
140
|
-
|
|
141
|
-
this.$scrollDom = $scrollDom;
|
|
142
|
-
|
|
143
|
-
this.nodePool = []; // DOM 节点池
|
|
144
|
-
this.activeNodes = new Map(); // 当前活跃节点(索引 -> DOM)
|
|
145
|
-
this.allReadyNodes = new Map(); // 所有节点(索引 -> DOM)
|
|
146
|
-
this.renderIndex = 0; // 渲染索引(保留兼容性)
|
|
147
|
-
|
|
148
151
|
$container.html(`
|
|
149
152
|
<div class="waterfall-list-scroll" style="">
|
|
150
153
|
<div class="waterfall-list-viewport"></div>
|