@difizen/libro-core 0.3.38 → 0.3.40
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.
- package/es/cell/libro-cell-view.d.ts +9 -9
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -1
- package/es/cell/libro-edit-cell-view.js +2 -0
- package/es/components/dnd-component/dnd-list.js +1 -1
- package/es/libro-setting-contribution.d.ts +1 -1
- package/es/libro-setting-contribution.d.ts.map +1 -1
- package/es/libro-setting-contribution.js +2 -2
- package/es/libro-setting.d.ts +3 -0
- package/es/libro-setting.d.ts.map +1 -1
- package/es/libro-setting.js +35 -0
- package/es/libro-view-tracker.d.ts +3 -1
- package/es/libro-view-tracker.d.ts.map +1 -1
- package/es/libro-view-tracker.js +3 -1
- package/es/libro-view.d.ts.map +1 -1
- package/es/libro-view.js +4 -4
- package/es/virtualized-manager.d.ts +4 -2
- package/es/virtualized-manager.d.ts.map +1 -1
- package/es/virtualized-manager.js +35 -4
- package/package.json +5 -5
- package/src/cell/libro-edit-cell-view.tsx +3 -0
- package/src/components/dnd-component/dnd-list.tsx +1 -1
- package/src/libro-setting-contribution.ts +6 -0
- package/src/libro-setting.ts +37 -0
- package/src/libro-view-tracker.ts +2 -0
- package/src/libro-view.tsx +5 -4
- package/src/virtualized-manager.ts +34 -11
- package/es/components/dnd-component/virtualized-manager.d.ts +0 -19
- package/es/components/dnd-component/virtualized-manager.d.ts.map +0 -1
- package/es/components/dnd-component/virtualized-manager.js +0 -54
- package/src/components/dnd-component/virtualized-manager.ts +0 -37
|
@@ -41,16 +41,21 @@ export declare class LibroCellView extends BaseView implements CellView {
|
|
|
41
41
|
toJSON(): LibroCell;
|
|
42
42
|
toJSONWithoutId: () => {
|
|
43
43
|
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
44
|
-
|
|
45
|
-
cell_type:
|
|
46
|
-
metadata: Partial<import("@difizen/libro-common").IRawCellMetadata>;
|
|
47
|
-
attachments?: import("@difizen/libro-common").IAttachments | undefined;
|
|
44
|
+
metadata: Partial<import("./libro-cell-protocol.js").LibroCellMetadata>;
|
|
45
|
+
cell_type: string;
|
|
48
46
|
source: import("@difizen/libro-common").MultilineString;
|
|
49
47
|
} | {
|
|
50
48
|
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
51
49
|
cell_type: string;
|
|
52
50
|
source: import("@difizen/libro-common").MultilineString;
|
|
53
51
|
metadata: Partial<import("@difizen/libro-common").ICellMetadata>;
|
|
52
|
+
} | {
|
|
53
|
+
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
54
|
+
id?: string | undefined;
|
|
55
|
+
cell_type: "raw";
|
|
56
|
+
metadata: Partial<import("@difizen/libro-common").IRawCellMetadata>;
|
|
57
|
+
attachments?: import("@difizen/libro-common").IAttachments | undefined;
|
|
58
|
+
source: import("@difizen/libro-common").MultilineString;
|
|
54
59
|
} | {
|
|
55
60
|
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
56
61
|
id?: string | undefined;
|
|
@@ -66,11 +71,6 @@ export declare class LibroCellView extends BaseView implements CellView {
|
|
|
66
71
|
outputs: import("@difizen/libro-common").IOutput[];
|
|
67
72
|
execution_count: import("@difizen/libro-common").ExecutionCount;
|
|
68
73
|
source: import("@difizen/libro-common").MultilineString;
|
|
69
|
-
} | {
|
|
70
|
-
[x: string]: import("@difizen/libro-common").PartialJSONValue | undefined;
|
|
71
|
-
metadata: Partial<import("./libro-cell-protocol.js").LibroCellMetadata>;
|
|
72
|
-
cell_type: string;
|
|
73
|
-
source: import("@difizen/libro-common").MultilineString;
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
//# sourceMappingURL=libro-cell-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-edit-cell-view.d.ts","sourceRoot":"","sources":["../../src/cell/libro-edit-cell-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc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E,YAAY,CAA0B;IAEpD,YAAY,uDAKV;IAEO,WAAW;IASX,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;IAQ/D,SAAS,CAAC,WAAW;IAgBZ,KAAK,WAAY,OAAO,UAS/B;IAEO,IAAI,aAGX;IAEF,IAAI,UAAU,WAEb;IAED,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;CAGb"}
|
|
@@ -166,11 +166,13 @@ export var LibroEditorCellView = (_dec = prop(), _dec2 = inject(LibroContextKey)
|
|
|
166
166
|
_this3.afterEditorReady();
|
|
167
167
|
if (_this3.parent.libroViewTracker.isEnabledSpmReporter) {
|
|
168
168
|
if (_this3.parent.libroViewTracker.hasTracker(_this3.parent.model.options['modelId'] || _this3.parent.model.options['id'])) {
|
|
169
|
+
var _currentFileContents;
|
|
169
170
|
var libroTracker = _this3.parent.libroViewTracker.getOrCreateTrackers({
|
|
170
171
|
id: _this3.parent.model.options['modelId'] || _this3.parent.model.options['id']
|
|
171
172
|
});
|
|
172
173
|
libroTracker['endTime'] = Date.now();
|
|
173
174
|
libroTracker['extra'].cellsCount = _this3.parent.model.cells.length;
|
|
175
|
+
libroTracker['extra'].size = (_currentFileContents = _this3.parent.model.currentFileContents) === null || _currentFileContents === void 0 ? void 0 : _currentFileContents.size;
|
|
174
176
|
_this3.parent.libroViewTracker.tracker(libroTracker);
|
|
175
177
|
}
|
|
176
178
|
var id = _this3.options.id + _this3.parent.id + 'add';
|
|
@@ -157,7 +157,7 @@ export var DndCellsRender = /*#__PURE__*/forwardRef(function DndCellsRender(_ref
|
|
|
157
157
|
// TODO: 类型处理
|
|
158
158
|
var model = libroView.model;
|
|
159
159
|
if (model.currentFileContents && model.currentFileContents.size) {
|
|
160
|
-
size =
|
|
160
|
+
size = model.currentFileContents.size; // 单位 byte
|
|
161
161
|
path = model.currentFileContents.path || '';
|
|
162
162
|
}
|
|
163
163
|
setIsJudging(true);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigurationContribution } from '@difizen/mana-app';
|
|
2
2
|
export declare class LibroSettingContribution implements ConfigurationContribution {
|
|
3
|
-
registerConfigurations(): import("@difizen/mana-app").ConfigurationNode<boolean>[];
|
|
3
|
+
registerConfigurations(): (import("@difizen/mana-app").ConfigurationNode<boolean> | import("@difizen/mana-app").ConfigurationNode<number>)[];
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=libro-setting-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-setting-contribution.d.ts","sourceRoot":"","sources":["../src/libro-setting-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-setting-contribution.d.ts","sourceRoot":"","sources":["../src/libro-setting-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAiBzE,qBACa,wBAAyB,YAAW,yBAAyB;IACxE,sBAAsB;CAgBvB"}
|
|
@@ -6,7 +6,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
8
|
import { singleton, ConfigurationContribution } from '@difizen/mana-app';
|
|
9
|
-
import { AutoInsertWhenNoCell, CellSideToolbarVisible, CellTopToolbarSetting, CollapserClickActive, EnterEditModeWhenAddCell, HeaderToolbarVisible, LargeOutputDisplay, MultiSelectionWhenShiftClick, RightContentFixed } from "./libro-setting.js";
|
|
9
|
+
import { AutoInsertWhenNoCell, CellSideToolbarVisible, CellTopToolbarSetting, CollapserClickActive, EnterEditModeWhenAddCell, HeaderToolbarVisible, LargeOutputDisplay, MultiSelectionWhenShiftClick, RightContentFixed, VirtualizationEnabled, VirtualizationThresholdCellCount, VirtualizationThresholdFileSize } from "./libro-setting.js";
|
|
10
10
|
export var LibroSettingContribution = (_dec = singleton({
|
|
11
11
|
contrib: ConfigurationContribution
|
|
12
12
|
}), _dec(_class = /*#__PURE__*/function () {
|
|
@@ -16,7 +16,7 @@ export var LibroSettingContribution = (_dec = singleton({
|
|
|
16
16
|
_createClass(LibroSettingContribution, [{
|
|
17
17
|
key: "registerConfigurations",
|
|
18
18
|
value: function registerConfigurations() {
|
|
19
|
-
return [HeaderToolbarVisible, CellTopToolbarSetting, CellSideToolbarVisible, AutoInsertWhenNoCell, EnterEditModeWhenAddCell, CollapserClickActive, MultiSelectionWhenShiftClick, RightContentFixed, LargeOutputDisplay];
|
|
19
|
+
return [HeaderToolbarVisible, CellTopToolbarSetting, CellSideToolbarVisible, AutoInsertWhenNoCell, EnterEditModeWhenAddCell, CollapserClickActive, MultiSelectionWhenShiftClick, RightContentFixed, LargeOutputDisplay, VirtualizationEnabled, VirtualizationThresholdCellCount, VirtualizationThresholdFileSize];
|
|
20
20
|
}
|
|
21
21
|
}]);
|
|
22
22
|
return LibroSettingContribution;
|
package/es/libro-setting.d.ts
CHANGED
|
@@ -11,4 +11,7 @@ export declare const OutputScrollBtnVisiable: ConfigurationNode<boolean>;
|
|
|
11
11
|
export declare const SupportCodeFormat: ConfigurationNode<boolean>;
|
|
12
12
|
export declare const SpmReporter: ConfigurationNode<boolean>;
|
|
13
13
|
export declare const LargeOutputDisplay: ConfigurationNode<boolean>;
|
|
14
|
+
export declare const VirtualizationEnabled: ConfigurationNode<boolean>;
|
|
15
|
+
export declare const VirtualizationThresholdCellCount: ConfigurationNode<number>;
|
|
16
|
+
export declare const VirtualizationThresholdFileSize: ConfigurationNode<number>;
|
|
14
17
|
//# sourceMappingURL=libro-setting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-setting.d.ts","sourceRoot":"","sources":["../src/libro-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAS3D,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,OAAO,CAS5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,OAAO,CAS7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAS3D,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,OAAO,CAS/D,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAS3D,CAAC;AACF,eAAO,MAAM,4BAA4B,EAAE,iBAAiB,CAAC,OAAO,CASnE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CASxD,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,iBAAiB,CAAC,OAAO,CAS9D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CASxD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,OAAO,CASlD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,OAAO,CASzD,CAAC"}
|
|
1
|
+
{"version":3,"file":"libro-setting.d.ts","sourceRoot":"","sources":["../src/libro-setting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAS3D,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,OAAO,CAS5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,OAAO,CAS7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAS3D,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,OAAO,CAS/D,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAS3D,CAAC;AACF,eAAO,MAAM,4BAA4B,EAAE,iBAAiB,CAAC,OAAO,CASnE,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CASxD,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,iBAAiB,CAAC,OAAO,CAS9D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CASxD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,OAAO,CASlD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,OAAO,CASzD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,OAAO,CAS5D,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,iBAAiB,CAAC,MAAM,CAWtE,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,iBAAiB,CAAC,MAAM,CAWrE,CAAC"}
|
package/es/libro-setting.js
CHANGED
|
@@ -118,4 +118,39 @@ export var LargeOutputDisplay = {
|
|
|
118
118
|
schema: {
|
|
119
119
|
type: 'boolean'
|
|
120
120
|
}
|
|
121
|
+
};
|
|
122
|
+
export var VirtualizationEnabled = {
|
|
123
|
+
id: 'libro.virtualization.enabled',
|
|
124
|
+
description: l10n.t('是否启用虚拟滚动功能'),
|
|
125
|
+
title: l10n.t('虚拟滚动'),
|
|
126
|
+
type: 'checkbox',
|
|
127
|
+
defaultValue: false,
|
|
128
|
+
schema: {
|
|
129
|
+
type: 'boolean'
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
export var VirtualizationThresholdCellCount = {
|
|
133
|
+
id: 'libro.virtualization.threshold.cellcount',
|
|
134
|
+
description: l10n.t('启用虚拟滚动所需的cell数量阈值'),
|
|
135
|
+
title: l10n.t('虚拟滚动 cell 数量阈值'),
|
|
136
|
+
type: 'input',
|
|
137
|
+
defaultValue: 50,
|
|
138
|
+
schema: {
|
|
139
|
+
type: 'number',
|
|
140
|
+
minimum: 1,
|
|
141
|
+
maximum: 1000
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
export var VirtualizationThresholdFileSize = {
|
|
145
|
+
id: 'libro.virtualization.threshold.filesize',
|
|
146
|
+
description: l10n.t('启用虚拟滚动所需的文件大小阈值,单位 byte'),
|
|
147
|
+
title: l10n.t('虚拟滚动文件大小阈值'),
|
|
148
|
+
type: 'input',
|
|
149
|
+
defaultValue: 100 * 1024,
|
|
150
|
+
// 100KB
|
|
151
|
+
schema: {
|
|
152
|
+
type: 'number',
|
|
153
|
+
minimum: 1,
|
|
154
|
+
maximum: 1024 * 1024 * 1024 // 1GB
|
|
155
|
+
}
|
|
121
156
|
};
|
|
@@ -25,6 +25,7 @@ export declare class FpsTracker implements ITracker {
|
|
|
25
25
|
maxFrameTime: number;
|
|
26
26
|
totalDropped: number;
|
|
27
27
|
cellsCount: number;
|
|
28
|
+
size: number;
|
|
28
29
|
constructor(id?: string, extra?: any);
|
|
29
30
|
log(): {
|
|
30
31
|
id: string;
|
|
@@ -33,6 +34,7 @@ export declare class FpsTracker implements ITracker {
|
|
|
33
34
|
totalDropped: number;
|
|
34
35
|
extra: any;
|
|
35
36
|
cellsCount: number;
|
|
37
|
+
size: number;
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
export declare class LibroViewTracker {
|
|
@@ -42,7 +44,7 @@ export declare class LibroViewTracker {
|
|
|
42
44
|
isEnabledSpmReporter: boolean;
|
|
43
45
|
protected onTrackerEmitter: Emitter<Record<string, any>>;
|
|
44
46
|
get onTracker(): import("@difizen/mana-app").Event<Record<string, any>>;
|
|
45
|
-
getOrCreateTrackers(options: Options):
|
|
47
|
+
getOrCreateTrackers(options: Options): Tracker | ITracker | FpsTracker;
|
|
46
48
|
tracker(tracker: ITracker): void;
|
|
47
49
|
hasTracker(id: string): boolean;
|
|
48
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-view-tracker.d.ts","sourceRoot":"","sources":["../src/libro-view-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,OAAO,EACR,MAAM,qBAAqB,CAAC;AAE7B,qBAAa,OAAQ,YAAW,QAAQ;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;gBAEC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAMpC,QAAQ;IAKR,WAAW;IAOX,GAAG;;;;;;;CAWJ;AAED,qBAAa,UAAW,YAAW,QAAQ;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-view-tracker.d.ts","sourceRoot":"","sources":["../src/libro-view-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,KAAK,EACV,QAAQ,EACR,aAA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E,MAAM;CAGtB"}
|
package/es/libro-view-tracker.js
CHANGED
|
@@ -57,6 +57,7 @@ export var FpsTracker = /*#__PURE__*/function () {
|
|
|
57
57
|
this.maxFrameTime = void 0;
|
|
58
58
|
this.totalDropped = void 0;
|
|
59
59
|
this.cellsCount = void 0;
|
|
60
|
+
this.size = void 0;
|
|
60
61
|
this.id = id || v4();
|
|
61
62
|
this.extra = extra || {};
|
|
62
63
|
}
|
|
@@ -69,7 +70,8 @@ export var FpsTracker = /*#__PURE__*/function () {
|
|
|
69
70
|
maxFrameTime: this.maxFrameTime,
|
|
70
71
|
totalDropped: this.totalDropped,
|
|
71
72
|
extra: this.extra,
|
|
72
|
-
cellsCount: this.cellsCount
|
|
73
|
+
cellsCount: this.cellsCount,
|
|
74
|
+
size: this.size
|
|
73
75
|
};
|
|
74
76
|
return result;
|
|
75
77
|
}
|
package/es/libro-view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-view.d.ts","sourceRoot":"","sources":["../src/libro-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAM7D,OAAO,EAKL,QAAQ,EAIR,WAAW,EAEX,QAAQ,EAER,oBAAoB,EACpB,OAAO,EAIP,oBAAoB,EAErB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,EAAE,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI1E,OAAO,EACL,WAAW,EAIZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MA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AS,MAAM,mBAqEtD;IAEF,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO;IAI9C,IAAI;CAYL"}
|
package/es/libro-view.js
CHANGED
|
@@ -68,14 +68,17 @@ export var LibroContentComponent = /*#__PURE__*/memo(function LibroContentCompon
|
|
|
68
68
|
_useConfigurationValu4 = _slicedToArray(_useConfigurationValu3, 1),
|
|
69
69
|
rightContentFixed = _useConfigurationValu4[0];
|
|
70
70
|
useFrameMonitor(libroViewContentRef, instance.libroViewTracker.isEnabledSpmReporter, function (payload) {
|
|
71
|
+
var _instance$model$curre;
|
|
71
72
|
var fpsTracker = instance.libroViewTracker.getOrCreateTrackers({
|
|
72
|
-
type: 'fps'
|
|
73
|
+
type: 'fps',
|
|
74
|
+
id: instance.model.options['modelId'] + 'fps'
|
|
73
75
|
});
|
|
74
76
|
fpsTracker['avgFPS'] = payload.summary.avgFPS;
|
|
75
77
|
fpsTracker['maxFrameTime'] = payload.summary.maxFrameTime;
|
|
76
78
|
fpsTracker['totalDropped'] = payload.summary.totalDropped;
|
|
77
79
|
fpsTracker['extra'] = payload.frames;
|
|
78
80
|
fpsTracker['cells'] = instance.model.cells.length;
|
|
81
|
+
fpsTracker['size'] = (_instance$model$curre = instance.model.currentFileContents) === null || _instance$model$curre === void 0 ? void 0 : _instance$model$curre.size;
|
|
79
82
|
instance.libroViewTracker.tracker(fpsTracker);
|
|
80
83
|
});
|
|
81
84
|
var handleScroll = useCallback(function () {
|
|
@@ -993,7 +996,6 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
|
|
|
993
996
|
var selectedCell = _step2.value;
|
|
994
997
|
if (ExecutableCellView.is(selectedCell) && ExecutableCellModel.is(selectedCell.model)) {
|
|
995
998
|
selectedCell.clearExecution();
|
|
996
|
-
selectedCell.model.executing = false;
|
|
997
999
|
selectedCell.model.hasOutputHidden = false;
|
|
998
1000
|
}
|
|
999
1001
|
}
|
|
@@ -1005,7 +1007,6 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
|
|
|
1005
1007
|
} else {
|
|
1006
1008
|
if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
|
|
1007
1009
|
cell.clearExecution();
|
|
1008
|
-
cell.model.executing = false;
|
|
1009
1010
|
cell.model.hasOutputHidden = false;
|
|
1010
1011
|
}
|
|
1011
1012
|
}
|
|
@@ -1020,7 +1021,6 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
|
|
|
1020
1021
|
var cell = _step3.value;
|
|
1021
1022
|
if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
|
|
1022
1023
|
cell.clearExecution();
|
|
1023
|
-
cell.model.executing = false;
|
|
1024
1024
|
cell.model.hasOutputHidden = false;
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConfigurationService } from '@difizen/mana-app';
|
|
1
2
|
import type { NotebookModel } from './libro-protocol.js';
|
|
2
3
|
import { VirtualizedManagerOption } from './libro-protocol.js';
|
|
3
4
|
export interface IVirtualizedManager {
|
|
@@ -11,11 +12,12 @@ export declare class VirtualizedManager implements IVirtualizedManager {
|
|
|
11
12
|
*/
|
|
12
13
|
isVirtualized: boolean;
|
|
13
14
|
libroModel: NotebookModel;
|
|
14
|
-
|
|
15
|
+
protected configurationService: ConfigurationService;
|
|
16
|
+
constructor(virtualizedManagerOption: VirtualizedManagerOption, configurationService: ConfigurationService);
|
|
15
17
|
/**
|
|
16
18
|
*
|
|
17
19
|
* @param length cell个数
|
|
18
|
-
* @param size undefined 或者
|
|
20
|
+
* @param size undefined 或者 number,单位为 byte
|
|
19
21
|
* @returns 是否使用虚拟滚动
|
|
20
22
|
*/
|
|
21
23
|
openVirtualized: (length: number, size?: number, path?: string) => Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtualized-manager.d.ts","sourceRoot":"","sources":["../src/virtualized-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtualized-manager.d.ts","sourceRoot":"","sources":["../src/virtualized-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAO/D,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACpF,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,qBACa,kBAAmB,YAAW,mBAAmB;IAC5D;;;OAGG;IAEH,aAAa,UAAS;IAEtB,UAAU,EAAE,aAAa,CAAC;IAC1B,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;gBAInD,wBAAwB,EAAE,wBAAwB,EACpB,oBAAoB,EAAE,oBAAoB;IAM1E;;;;;OAKG;IACH,eAAe,WAAkB,MAAM,SAAS,MAAM,SAAS,MAAM,sBA2BnE;CACH"}
|
|
@@ -12,8 +12,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
12
12
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
13
13
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
14
14
|
import { transient, prop, inject } from '@difizen/mana-app';
|
|
15
|
+
import { ConfigurationService } from '@difizen/mana-app';
|
|
15
16
|
import { VirtualizedManagerOption } from "./libro-protocol.js";
|
|
16
|
-
|
|
17
|
+
import { VirtualizationEnabled, VirtualizationThresholdFileSize, VirtualizationThresholdCellCount } from "./libro-setting.js";
|
|
18
|
+
export var VirtualizedManager = (_dec = transient(), _dec2 = prop(), _dec(_class = (_class2 = /*#__PURE__*/_createClass(function VirtualizedManager(virtualizedManagerOption, configurationService) {
|
|
17
19
|
var _this = this;
|
|
18
20
|
_classCallCheck(this, VirtualizedManager);
|
|
19
21
|
/**
|
|
@@ -22,21 +24,48 @@ export var VirtualizedManager = (_dec = transient(), _dec2 = prop(), _dec(_class
|
|
|
22
24
|
*/
|
|
23
25
|
_initializerDefineProperty(this, "isVirtualized", _descriptor, this);
|
|
24
26
|
this.libroModel = void 0;
|
|
27
|
+
this.configurationService = void 0;
|
|
25
28
|
/**
|
|
26
29
|
*
|
|
27
30
|
* @param length cell个数
|
|
28
|
-
* @param size undefined 或者
|
|
31
|
+
* @param size undefined 或者 number,单位为 byte
|
|
29
32
|
* @returns 是否使用虚拟滚动
|
|
30
33
|
*/
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
34
|
this.openVirtualized = /*#__PURE__*/function () {
|
|
33
35
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(length, size, path) {
|
|
36
|
+
var virtualizationEnabled, virtualizationThresholdFileSize, virtualizationThresholdCellCount;
|
|
34
37
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
35
38
|
while (1) switch (_context.prev = _context.next) {
|
|
36
39
|
case 0:
|
|
40
|
+
_context.next = 2;
|
|
41
|
+
return _this.configurationService.get(VirtualizationEnabled);
|
|
42
|
+
case 2:
|
|
43
|
+
virtualizationEnabled = _context.sent;
|
|
44
|
+
_context.next = 5;
|
|
45
|
+
return _this.configurationService.get(VirtualizationThresholdFileSize);
|
|
46
|
+
case 5:
|
|
47
|
+
virtualizationThresholdFileSize = _context.sent;
|
|
48
|
+
_context.next = 8;
|
|
49
|
+
return _this.configurationService.get(VirtualizationThresholdCellCount);
|
|
50
|
+
case 8:
|
|
51
|
+
virtualizationThresholdCellCount = _context.sent;
|
|
52
|
+
if (virtualizationEnabled) {
|
|
53
|
+
_context.next = 12;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
37
56
|
_this.isVirtualized = false;
|
|
38
57
|
return _context.abrupt("return", false);
|
|
39
|
-
case
|
|
58
|
+
case 12:
|
|
59
|
+
if (!(length >= virtualizationThresholdCellCount || size && size >= virtualizationThresholdFileSize)) {
|
|
60
|
+
_context.next = 15;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
_this.isVirtualized = true;
|
|
64
|
+
return _context.abrupt("return", true);
|
|
65
|
+
case 15:
|
|
66
|
+
_this.isVirtualized = false;
|
|
67
|
+
return _context.abrupt("return", false);
|
|
68
|
+
case 17:
|
|
40
69
|
case "end":
|
|
41
70
|
return _context.stop();
|
|
42
71
|
}
|
|
@@ -47,6 +76,7 @@ export var VirtualizedManager = (_dec = transient(), _dec2 = prop(), _dec(_class
|
|
|
47
76
|
};
|
|
48
77
|
}();
|
|
49
78
|
this.libroModel = virtualizedManagerOption.libroModel;
|
|
79
|
+
this.configurationService = configurationService;
|
|
50
80
|
}), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "isVirtualized", [_dec2], {
|
|
51
81
|
configurable: true,
|
|
52
82
|
enumerable: true,
|
|
@@ -55,4 +85,5 @@ export var VirtualizedManager = (_dec = transient(), _dec2 = prop(), _dec(_class
|
|
|
55
85
|
return false;
|
|
56
86
|
}
|
|
57
87
|
})), _class2)) || _class);
|
|
88
|
+
VirtualizedManager = inject(ConfigurationService)(VirtualizedManager, undefined, 1) || VirtualizedManager;
|
|
58
89
|
VirtualizedManager = inject(VirtualizedManagerOption)(VirtualizedManager, undefined, 0) || VirtualizedManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@ant-design/icons": "^5.1.0",
|
|
37
|
-
"@difizen/libro-code-editor": "^0.3.
|
|
38
|
-
"@difizen/libro-common": "^0.3.
|
|
39
|
-
"@difizen/libro-shared-model": "^0.3.
|
|
40
|
-
"@difizen/libro-virtualized": "^0.3.
|
|
37
|
+
"@difizen/libro-code-editor": "^0.3.40",
|
|
38
|
+
"@difizen/libro-common": "^0.3.40",
|
|
39
|
+
"@difizen/libro-shared-model": "^0.3.40",
|
|
40
|
+
"@difizen/libro-virtualized": "^0.3.40",
|
|
41
41
|
"@difizen/mana-app": "latest",
|
|
42
42
|
"@difizen/mana-l10n": "latest",
|
|
43
43
|
"@difizen/mana-react": "latest",
|
|
@@ -139,6 +139,9 @@ export abstract class LibroEditorCellView
|
|
|
139
139
|
});
|
|
140
140
|
libroTracker['endTime'] = Date.now();
|
|
141
141
|
libroTracker['extra'].cellsCount = this.parent.model.cells.length;
|
|
142
|
+
libroTracker['extra'].size = (
|
|
143
|
+
this.parent.model as any
|
|
144
|
+
).currentFileContents?.size;
|
|
142
145
|
this.parent.libroViewTracker.tracker(libroTracker);
|
|
143
146
|
}
|
|
144
147
|
const id = this.options.id + this.parent.id + 'add';
|
|
@@ -169,7 +169,7 @@ export const DndCellsRender = forwardRef<
|
|
|
169
169
|
// TODO: 类型处理
|
|
170
170
|
const model = libroView.model as any;
|
|
171
171
|
if (model.currentFileContents && model.currentFileContents.size) {
|
|
172
|
-
size =
|
|
172
|
+
size = model.currentFileContents.size; // 单位 byte
|
|
173
173
|
path = model.currentFileContents.path || '';
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
LargeOutputDisplay,
|
|
11
11
|
MultiSelectionWhenShiftClick,
|
|
12
12
|
RightContentFixed,
|
|
13
|
+
VirtualizationEnabled,
|
|
14
|
+
VirtualizationThresholdCellCount,
|
|
15
|
+
VirtualizationThresholdFileSize,
|
|
13
16
|
} from './libro-setting.js';
|
|
14
17
|
|
|
15
18
|
@singleton({ contrib: ConfigurationContribution })
|
|
@@ -25,6 +28,9 @@ export class LibroSettingContribution implements ConfigurationContribution {
|
|
|
25
28
|
MultiSelectionWhenShiftClick,
|
|
26
29
|
RightContentFixed,
|
|
27
30
|
LargeOutputDisplay,
|
|
31
|
+
VirtualizationEnabled,
|
|
32
|
+
VirtualizationThresholdCellCount,
|
|
33
|
+
VirtualizationThresholdFileSize,
|
|
28
34
|
];
|
|
29
35
|
}
|
|
30
36
|
}
|
package/src/libro-setting.ts
CHANGED
|
@@ -130,3 +130,40 @@ export const LargeOutputDisplay: ConfigurationNode<boolean> = {
|
|
|
130
130
|
type: 'boolean',
|
|
131
131
|
},
|
|
132
132
|
};
|
|
133
|
+
|
|
134
|
+
export const VirtualizationEnabled: ConfigurationNode<boolean> = {
|
|
135
|
+
id: 'libro.virtualization.enabled',
|
|
136
|
+
description: l10n.t('是否启用虚拟滚动功能'),
|
|
137
|
+
title: l10n.t('虚拟滚动'),
|
|
138
|
+
type: 'checkbox',
|
|
139
|
+
defaultValue: false,
|
|
140
|
+
schema: {
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const VirtualizationThresholdCellCount: ConfigurationNode<number> = {
|
|
146
|
+
id: 'libro.virtualization.threshold.cellcount',
|
|
147
|
+
description: l10n.t('启用虚拟滚动所需的cell数量阈值'),
|
|
148
|
+
title: l10n.t('虚拟滚动 cell 数量阈值'),
|
|
149
|
+
type: 'input',
|
|
150
|
+
defaultValue: 50,
|
|
151
|
+
schema: {
|
|
152
|
+
type: 'number',
|
|
153
|
+
minimum: 1,
|
|
154
|
+
maximum: 1000,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const VirtualizationThresholdFileSize: ConfigurationNode<number> = {
|
|
159
|
+
id: 'libro.virtualization.threshold.filesize',
|
|
160
|
+
description: l10n.t('启用虚拟滚动所需的文件大小阈值,单位 byte'),
|
|
161
|
+
title: l10n.t('虚拟滚动文件大小阈值'),
|
|
162
|
+
type: 'input',
|
|
163
|
+
defaultValue: 100 * 1024, // 100KB
|
|
164
|
+
schema: {
|
|
165
|
+
type: 'number',
|
|
166
|
+
minimum: 1,
|
|
167
|
+
maximum: 1024 * 1024 * 1024, // 1GB
|
|
168
|
+
},
|
|
169
|
+
};
|
|
@@ -54,6 +54,7 @@ export class FpsTracker implements ITracker {
|
|
|
54
54
|
maxFrameTime: number;
|
|
55
55
|
totalDropped: number;
|
|
56
56
|
cellsCount: number;
|
|
57
|
+
size: number;
|
|
57
58
|
|
|
58
59
|
constructor(id?: string, extra?: any) {
|
|
59
60
|
this.id = id || v4();
|
|
@@ -68,6 +69,7 @@ export class FpsTracker implements ITracker {
|
|
|
68
69
|
totalDropped: this.totalDropped,
|
|
69
70
|
extra: this.extra,
|
|
70
71
|
cellsCount: this.cellsCount,
|
|
72
|
+
size: this.size,
|
|
71
73
|
};
|
|
72
74
|
return result;
|
|
73
75
|
}
|
package/src/libro-view.tsx
CHANGED
|
@@ -90,12 +90,16 @@ export const LibroContentComponent = memo(function LibroContentComponent() {
|
|
|
90
90
|
libroViewContentRef,
|
|
91
91
|
instance.libroViewTracker.isEnabledSpmReporter,
|
|
92
92
|
(payload) => {
|
|
93
|
-
const fpsTracker = instance.libroViewTracker.getOrCreateTrackers({
|
|
93
|
+
const fpsTracker = instance.libroViewTracker.getOrCreateTrackers({
|
|
94
|
+
type: 'fps',
|
|
95
|
+
id: instance.model.options['modelId'] + 'fps',
|
|
96
|
+
});
|
|
94
97
|
fpsTracker['avgFPS'] = payload.summary.avgFPS;
|
|
95
98
|
fpsTracker['maxFrameTime'] = payload.summary.maxFrameTime;
|
|
96
99
|
fpsTracker['totalDropped'] = payload.summary.totalDropped;
|
|
97
100
|
fpsTracker['extra'] = payload.frames;
|
|
98
101
|
fpsTracker['cells'] = instance.model.cells.length;
|
|
102
|
+
fpsTracker['size'] = instance.model.currentFileContents?.size;
|
|
99
103
|
instance.libroViewTracker.tracker(fpsTracker);
|
|
100
104
|
},
|
|
101
105
|
);
|
|
@@ -1041,14 +1045,12 @@ export class LibroView extends BaseView implements NotebookView {
|
|
|
1041
1045
|
ExecutableCellModel.is(selectedCell.model)
|
|
1042
1046
|
) {
|
|
1043
1047
|
selectedCell.clearExecution();
|
|
1044
|
-
selectedCell.model.executing = false;
|
|
1045
1048
|
selectedCell.model.hasOutputHidden = false;
|
|
1046
1049
|
}
|
|
1047
1050
|
}
|
|
1048
1051
|
} else {
|
|
1049
1052
|
if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
|
|
1050
1053
|
cell.clearExecution();
|
|
1051
|
-
cell.model.executing = false;
|
|
1052
1054
|
cell.model.hasOutputHidden = false;
|
|
1053
1055
|
}
|
|
1054
1056
|
}
|
|
@@ -1060,7 +1062,6 @@ export class LibroView extends BaseView implements NotebookView {
|
|
|
1060
1062
|
for (const cell of this.model.cells) {
|
|
1061
1063
|
if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
|
|
1062
1064
|
cell.clearExecution();
|
|
1063
|
-
cell.model.executing = false;
|
|
1064
1065
|
cell.model.hasOutputHidden = false;
|
|
1065
1066
|
}
|
|
1066
1067
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { transient, prop, inject } from '@difizen/mana-app';
|
|
2
|
+
import { ConfigurationService } from '@difizen/mana-app';
|
|
2
3
|
|
|
3
4
|
import type { NotebookModel } from './libro-protocol.js';
|
|
4
5
|
import { VirtualizedManagerOption } from './libro-protocol.js';
|
|
6
|
+
import {
|
|
7
|
+
VirtualizationEnabled,
|
|
8
|
+
VirtualizationThresholdFileSize,
|
|
9
|
+
VirtualizationThresholdCellCount,
|
|
10
|
+
} from './libro-setting.js';
|
|
5
11
|
|
|
6
12
|
export interface IVirtualizedManager {
|
|
7
13
|
openVirtualized: (length: number, size?: number, path?: string) => Promise<boolean>;
|
|
@@ -18,32 +24,49 @@ export class VirtualizedManager implements IVirtualizedManager {
|
|
|
18
24
|
isVirtualized = false;
|
|
19
25
|
|
|
20
26
|
libroModel: NotebookModel;
|
|
27
|
+
protected configurationService: ConfigurationService;
|
|
21
28
|
|
|
22
29
|
constructor(
|
|
23
30
|
@inject(VirtualizedManagerOption)
|
|
24
31
|
virtualizedManagerOption: VirtualizedManagerOption,
|
|
32
|
+
@inject(ConfigurationService) configurationService: ConfigurationService,
|
|
25
33
|
) {
|
|
26
34
|
this.libroModel = virtualizedManagerOption.libroModel;
|
|
35
|
+
this.configurationService = configurationService;
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
/**
|
|
30
39
|
*
|
|
31
40
|
* @param length cell个数
|
|
32
|
-
* @param size undefined 或者
|
|
41
|
+
* @param size undefined 或者 number,单位为 byte
|
|
33
42
|
* @returns 是否使用虚拟滚动
|
|
34
43
|
*/
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
44
|
openVirtualized = async (length: number, size?: number, path?: string) => {
|
|
45
|
+
// 获取配置项
|
|
46
|
+
const virtualizationEnabled =
|
|
47
|
+
await this.configurationService.get(VirtualizationEnabled);
|
|
48
|
+
const virtualizationThresholdFileSize = await this.configurationService.get(
|
|
49
|
+
VirtualizationThresholdFileSize,
|
|
50
|
+
);
|
|
51
|
+
const virtualizationThresholdCellCount = await this.configurationService.get(
|
|
52
|
+
VirtualizationThresholdCellCount,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (!virtualizationEnabled) {
|
|
56
|
+
this.isVirtualized = false;
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 如果启用虚拟化,根据阈值判断是否使用虚拟滚动
|
|
61
|
+
if (
|
|
62
|
+
length >= virtualizationThresholdCellCount ||
|
|
63
|
+
(size && size >= virtualizationThresholdFileSize)
|
|
64
|
+
) {
|
|
65
|
+
this.isVirtualized = true;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
37
69
|
this.isVirtualized = false;
|
|
38
70
|
return false;
|
|
39
|
-
// this.isVirtualized = true;
|
|
40
|
-
// return true;
|
|
41
|
-
// if (length > 100 || (size && size > 4)) {
|
|
42
|
-
// this.isVirtualized = true;
|
|
43
|
-
// return true;
|
|
44
|
-
// } else {
|
|
45
|
-
// this.isVirtualized = false;
|
|
46
|
-
// return false;
|
|
47
|
-
// }
|
|
48
71
|
};
|
|
49
72
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface IVirtualizedManager {
|
|
2
|
-
openVirtualized: (length: number, size?: number) => Promise<boolean>;
|
|
3
|
-
isVirtualized: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare class VirtualizedManager implements IVirtualizedManager {
|
|
6
|
-
/**
|
|
7
|
-
* 因为进行isVirtualized判断过后才会渲染list
|
|
8
|
-
* 所以它用于滚动到某个cell的判断依据是没有问题的。
|
|
9
|
-
*/
|
|
10
|
-
isVirtualized: boolean;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param length cell个数
|
|
14
|
-
* @param size undefined 或者 单位 为B
|
|
15
|
-
* @returns 是否使用虚拟滚动
|
|
16
|
-
*/
|
|
17
|
-
openVirtualized: (length: number, size?: number) => Promise<boolean>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=virtualized-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtualized-manager.d.ts","sourceRoot":"","sources":["../../../src/components/dnd-component/virtualized-manager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,qBACa,kBAAmB,YAAW,mBAAmB;IAC5D;;;OAGG;IAEH,aAAa,UAAS;IAEtB;;;;;OAKG;IAEH,eAAe,WAAkB,MAAM,SAAS,MAAM,sBAYpD;CACH"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _dec, _dec2, _class, _class2, _descriptor;
|
|
3
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
4
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
5
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6
|
-
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
7
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
8
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
-
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
13
|
-
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
14
|
-
import { prop, singleton } from '@difizen/mana-app';
|
|
15
|
-
export var VirtualizedManager = (_dec = singleton(), _dec2 = prop(), _dec(_class = (_class2 = /*#__PURE__*/_createClass(function VirtualizedManager() {
|
|
16
|
-
var _this = this;
|
|
17
|
-
_classCallCheck(this, VirtualizedManager);
|
|
18
|
-
/**
|
|
19
|
-
* 因为进行isVirtualized判断过后才会渲染list
|
|
20
|
-
* 所以它用于滚动到某个cell的判断依据是没有问题的。
|
|
21
|
-
*/
|
|
22
|
-
_initializerDefineProperty(this, "isVirtualized", _descriptor, this);
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param length cell个数
|
|
26
|
-
* @param size undefined 或者 单位 为B
|
|
27
|
-
* @returns 是否使用虚拟滚动
|
|
28
|
-
*/
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
-
this.openVirtualized = /*#__PURE__*/function () {
|
|
31
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(length, size) {
|
|
32
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
33
|
-
while (1) switch (_context.prev = _context.next) {
|
|
34
|
-
case 0:
|
|
35
|
-
_this.isVirtualized = false;
|
|
36
|
-
return _context.abrupt("return", false);
|
|
37
|
-
case 2:
|
|
38
|
-
case "end":
|
|
39
|
-
return _context.stop();
|
|
40
|
-
}
|
|
41
|
-
}, _callee);
|
|
42
|
-
}));
|
|
43
|
-
return function (_x, _x2) {
|
|
44
|
-
return _ref.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
}();
|
|
47
|
-
}), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "isVirtualized", [_dec2], {
|
|
48
|
-
configurable: true,
|
|
49
|
-
enumerable: true,
|
|
50
|
-
writable: true,
|
|
51
|
-
initializer: function initializer() {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
})), _class2)) || _class);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { prop, singleton } from '@difizen/mana-app';
|
|
2
|
-
|
|
3
|
-
export interface IVirtualizedManager {
|
|
4
|
-
openVirtualized: (length: number, size?: number) => Promise<boolean>;
|
|
5
|
-
isVirtualized: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@singleton()
|
|
9
|
-
export class VirtualizedManager implements IVirtualizedManager {
|
|
10
|
-
/**
|
|
11
|
-
* 因为进行isVirtualized判断过后才会渲染list
|
|
12
|
-
* 所以它用于滚动到某个cell的判断依据是没有问题的。
|
|
13
|
-
*/
|
|
14
|
-
@prop()
|
|
15
|
-
isVirtualized = false;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param length cell个数
|
|
20
|
-
* @param size undefined 或者 单位 为B
|
|
21
|
-
* @returns 是否使用虚拟滚动
|
|
22
|
-
*/
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
-
openVirtualized = async (length: number, size?: number) => {
|
|
25
|
-
this.isVirtualized = false;
|
|
26
|
-
return false;
|
|
27
|
-
// this.isVirtualized = true;
|
|
28
|
-
// return true;
|
|
29
|
-
// if (length > 100 || (size && size > 4)) {
|
|
30
|
-
// this.isVirtualized = true;
|
|
31
|
-
// return true;
|
|
32
|
-
// } else {
|
|
33
|
-
// this.isVirtualized = false;
|
|
34
|
-
// return false;
|
|
35
|
-
// }
|
|
36
|
-
};
|
|
37
|
-
}
|