Browse Source

Fix types

pages-datasources
mohamedsalem401 1 year ago
parent
commit
0cb1a839cb
  1. 6
      packages/core/src/data_sources/model/data_collection/types.ts
  2. 4
      packages/core/src/dom_components/model/Component.ts

6
packages/core/src/data_sources/model/data_collection/types.ts

@ -26,9 +26,11 @@ export interface DataCollectionState {
[DataCollectionStateType.remainingItems]: number;
}
export interface DataCollectionStateMap {
export type DataCollectionStateMap = {
[key: string]: DataCollectionState;
}
} & {
__pages?: { [DataCollectionStateType.currentItem]: DataCollectionState };
};
export interface ComponentDataCollectionProps extends ComponentDefinition {
type: typeof DataCollectionType;

4
packages/core/src/dom_components/model/Component.ts

@ -364,13 +364,13 @@ export default class Component extends StyleableModel<ComponentProperties> {
this.components().forEach((cmp) => cmp.syncComponentsCollectionState());
}
stopSyncComponentCollectionState() {
protected stopSyncComponentCollectionState() {
this.stopListening(this.components(), 'add remove reset', this.syncOnComponentChange);
this.collectionsStateMap = {};
this.components().forEach((cmp) => cmp.stopSyncComponentCollectionState());
}
syncOnComponentChange(model: Component, collection: Components, opts: any) {
protected syncOnComponentChange(model: Component, collection: Components, opts: any) {
if (!this.collectionsStateMap || !Object.keys(this.collectionsStateMap).length) return;
const options = opts || collection || {};

Loading…
Cancel
Save