@difizen/libro-core 0.3.39 → 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.
@@ -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
- id?: string | undefined;
45
- cell_type: "raw";
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
@@ -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 = parseFloat((model.currentFileContents.size / 1048576).toFixed(3)); // 单位MB
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;AAczE,qBACa,wBAAyB,YAAW,yBAAyB;IACxE,sBAAsB;CAavB"}
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;
@@ -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"}
@@ -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
  };
@@ -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,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAyB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,Y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KAAE;IAsBhC,qBAAqB,SAAU,QAAQ,UAYrC;IAEF,sBAAsB,SAAU,QAAQ,UAatC;IAEF,yBAAyB,aAOvB;IAEF,wBAAwB,aAOtB;IAEF,QAAQ,UAAS;IAER,OAAO;IAShB,gBAAgB,cAAe,OAAO,UAUpC;IAEF,aAAa,aAIX;IAEF,cAAc,SAAU,QAAQ,UAO9B;IAEF,YAAY,SAAU,QAAQ,UAO5B;IAEF,cAAc,SAAgB,QAAQ,mBA+BpC;IAEF,cAAc,SAAgB,QAAQ,mBA8BpC;IAEF,UAAU,SAAgB,QAAQ,mBAgChC;IACF,aAAa,aAEX;IAEF,SAAS,SAAgB,QAAQ,mBA0C/B;IACF,kBAAkB,aAKhB;IAEF,gBAAgB,aAId;IAEF;;OAEG;IACH,iBAAiB,SAAgB,QAAQ,SAAS,MAAM,mBAqEtD;IAEF,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO;IAI9C,IAAI;CAYL"}
package/es/libro-view.js CHANGED
@@ -996,7 +996,6 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
996
996
  var selectedCell = _step2.value;
997
997
  if (ExecutableCellView.is(selectedCell) && ExecutableCellModel.is(selectedCell.model)) {
998
998
  selectedCell.clearExecution();
999
- selectedCell.model.executing = false;
1000
999
  selectedCell.model.hasOutputHidden = false;
1001
1000
  }
1002
1001
  }
@@ -1008,7 +1007,6 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1008
1007
  } else {
1009
1008
  if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
1010
1009
  cell.clearExecution();
1011
- cell.model.executing = false;
1012
1010
  cell.model.hasOutputHidden = false;
1013
1011
  }
1014
1012
  }
@@ -1023,7 +1021,6 @@ export var LibroView = (_dec = transient(), _dec2 = view(notebookViewFactoryId),
1023
1021
  var cell = _step3.value;
1024
1022
  if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
1025
1023
  cell.clearExecution();
1026
- cell.model.executing = false;
1027
1024
  cell.model.hasOutputHidden = false;
1028
1025
  }
1029
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
- constructor(virtualizedManagerOption: VirtualizedManagerOption);
15
+ protected configurationService: ConfigurationService;
16
+ constructor(virtualizedManagerOption: VirtualizedManagerOption, configurationService: ConfigurationService);
15
17
  /**
16
18
  *
17
19
  * @param length cell个数
18
- * @param size undefined 或者 单位 为B
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":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/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;gBAIxB,wBAAwB,EAAE,wBAAwB;IAKpD;;;;;OAKG;IAEH,eAAe,WAAkB,MAAM,SAAS,MAAM,SAAS,MAAM,sBAYnE;CACH"}
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
- export var VirtualizedManager = (_dec = transient(), _dec2 = prop(), _dec(_class = (_class2 = /*#__PURE__*/_createClass(function VirtualizedManager(virtualizedManagerOption) {
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 或者 单位 为B
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 2:
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.39",
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.39",
38
- "@difizen/libro-common": "^0.3.39",
39
- "@difizen/libro-shared-model": "^0.3.39",
40
- "@difizen/libro-virtualized": "^0.3.39",
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",
@@ -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 = parseFloat((model.currentFileContents.size / 1048576).toFixed(3)); // 单位MB
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
  }
@@ -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
+ };
@@ -1045,14 +1045,12 @@ export class LibroView extends BaseView implements NotebookView {
1045
1045
  ExecutableCellModel.is(selectedCell.model)
1046
1046
  ) {
1047
1047
  selectedCell.clearExecution();
1048
- selectedCell.model.executing = false;
1049
1048
  selectedCell.model.hasOutputHidden = false;
1050
1049
  }
1051
1050
  }
1052
1051
  } else {
1053
1052
  if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
1054
1053
  cell.clearExecution();
1055
- cell.model.executing = false;
1056
1054
  cell.model.hasOutputHidden = false;
1057
1055
  }
1058
1056
  }
@@ -1064,7 +1062,6 @@ export class LibroView extends BaseView implements NotebookView {
1064
1062
  for (const cell of this.model.cells) {
1065
1063
  if (ExecutableCellView.is(cell) && ExecutableCellModel.is(cell.model)) {
1066
1064
  cell.clearExecution();
1067
- cell.model.executing = false;
1068
1065
  cell.model.hasOutputHidden = false;
1069
1066
  }
1070
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 或者 单位 为B
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
- }