@sankhyalabs/core 1.0.21 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/dataunit/DataUnit.d.ts +70 -0
  2. package/dist/dataunit/DataUnit.js +198 -0
  3. package/dist/dataunit/DataUnit.js.map +1 -0
  4. package/dist/dataunit/metadata/DataType.d.ts +9 -0
  5. package/dist/dataunit/metadata/DataType.js +37 -0
  6. package/dist/dataunit/metadata/DataType.js.map +1 -0
  7. package/dist/dataunit/metadata/UnitMetadata.d.ts +70 -0
  8. package/dist/dataunit/metadata/UnitMetadata.js +31 -0
  9. package/dist/dataunit/metadata/UnitMetadata.js.map +1 -0
  10. package/dist/dataunit/state/HistReducer.d.ts +10 -0
  11. package/dist/dataunit/state/HistReducer.js +28 -0
  12. package/dist/dataunit/state/HistReducer.js.map +1 -0
  13. package/dist/dataunit/state/StateManager.d.ts +57 -0
  14. package/dist/dataunit/state/StateManager.js +109 -0
  15. package/dist/dataunit/state/StateManager.js.map +1 -0
  16. package/dist/dataunit/state/action/DataUnitAction.d.ts +26 -0
  17. package/dist/dataunit/state/action/DataUnitAction.js +32 -0
  18. package/dist/dataunit/state/action/DataUnitAction.js.map +1 -0
  19. package/dist/dataunit/state/slice/AddedRecordsSlice.d.ts +10 -0
  20. package/dist/dataunit/state/slice/AddedRecordsSlice.js +25 -0
  21. package/dist/dataunit/state/slice/AddedRecordsSlice.js.map +1 -0
  22. package/dist/dataunit/state/slice/ChangesSlice.d.ts +12 -0
  23. package/dist/dataunit/state/slice/ChangesSlice.js +73 -0
  24. package/dist/dataunit/state/slice/ChangesSlice.js.map +1 -0
  25. package/dist/dataunit/state/slice/CurrentRecordsSlice.d.ts +11 -0
  26. package/dist/dataunit/state/slice/CurrentRecordsSlice.js +46 -0
  27. package/dist/dataunit/state/slice/CurrentRecordsSlice.js.map +1 -0
  28. package/dist/dataunit/state/slice/RecordsSlice.d.ts +10 -0
  29. package/dist/dataunit/state/slice/RecordsSlice.js +38 -0
  30. package/dist/dataunit/state/slice/RecordsSlice.js.map +1 -0
  31. package/dist/dataunit/state/slice/RemovedRecordsSlice.d.ts +9 -0
  32. package/dist/dataunit/state/slice/RemovedRecordsSlice.js +21 -0
  33. package/dist/dataunit/state/slice/RemovedRecordsSlice.js.map +1 -0
  34. package/dist/dataunit/state/slice/SelectionSlice.d.ts +11 -0
  35. package/dist/dataunit/state/slice/SelectionSlice.js +109 -0
  36. package/dist/dataunit/state/slice/SelectionSlice.js.map +1 -0
  37. package/dist/dataunit/state/slice/UnitMetadataSlice.d.ts +11 -0
  38. package/dist/dataunit/state/slice/UnitMetadataSlice.js +21 -0
  39. package/dist/dataunit/state/slice/UnitMetadataSlice.js.map +1 -0
  40. package/dist/index.d.ts +5 -1
  41. package/dist/index.js +5 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/ui/FloatingManager.js +23 -7
  44. package/dist/ui/FloatingManager.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/dataunit/DataUnit.ts +283 -0
  47. package/src/dataunit/metadata/DataType.ts +38 -0
  48. package/src/dataunit/metadata/UnitMetadata.ts +81 -0
  49. package/src/dataunit/state/HistReducer.ts +34 -0
  50. package/src/dataunit/state/StateManager.ts +153 -0
  51. package/src/dataunit/state/action/DataUnitAction.ts +48 -0
  52. package/src/dataunit/state/slice/AddedRecordsSlice.ts +31 -0
  53. package/src/dataunit/state/slice/ChangesSlice.ts +91 -0
  54. package/src/dataunit/state/slice/CurrentRecordsSlice.ts +54 -0
  55. package/src/dataunit/state/slice/RecordsSlice.ts +50 -0
  56. package/src/dataunit/state/slice/RemovedRecordsSlice.ts +26 -0
  57. package/src/dataunit/state/slice/SelectionSlice.ts +128 -0
  58. package/src/dataunit/state/slice/UnitMetadataSlice.ts +30 -0
  59. package/src/index.ts +13 -1
  60. package/src/ui/FloatingManager.ts +28 -9
@@ -0,0 +1,31 @@
1
+
2
+ import { ActionReducer, StateAction } from "../StateManager";
3
+ import { Action } from "../action/DataUnitAction";
4
+ import StateManager from "../StateManager";
5
+ import { Record } from "../../DataUnit";
6
+
7
+ class AddedRecordsReducerImpl implements ActionReducer{
8
+
9
+ public sliceName: string = "hist::addedRecords";
10
+
11
+ public reduce(_stateManager:StateManager, currentState: Array<Record>, action: StateAction): Array<Record>|undefined {
12
+ switch(action.type){
13
+ case Action.RECORDS_ADDED:
14
+ const newState:Array <Record> = currentState ? currentState.slice() : [];
15
+ action.payload.forEach((r: any) => {
16
+ newState.push({__record__id__: "NEW_" + (newState.length + 1), ...r});
17
+ });
18
+ return newState;
19
+ case Action.DATA_SAVED:
20
+ case Action.EDITION_CANCELED:
21
+ return undefined;
22
+ }
23
+ return currentState;
24
+ }
25
+ }
26
+
27
+ export const AddedRecordsReducer = new AddedRecordsReducerImpl();
28
+
29
+ export const getAddedRecords = (stateManager: StateManager): Array<Record> => {
30
+ return stateManager.select(AddedRecordsReducer.sliceName, (state: Array<Record>) => state);
31
+ };
@@ -0,0 +1,91 @@
1
+
2
+ import { ActionReducer, StateAction } from "../StateManager";
3
+ import { Action } from "../action/DataUnitAction";
4
+ import StateManager from "../StateManager";
5
+ import { getSelection } from "./SelectionSlice";
6
+ import { getRecords } from "./RecordsSlice";
7
+ import { getRemovedRecords } from "./RemovedRecordsSlice";
8
+ import { getAddedRecords } from "./AddedRecordsSlice";
9
+ import { Change, ChangeOperation } from "../../DataUnit";
10
+
11
+ class ChangesReducerImpl implements ActionReducer{
12
+
13
+ public sliceName: string = "hist::changes";
14
+
15
+ public reduce(stateManager:StateManager, currentState: Map<string, any>, action: StateAction): Map<string, any>|undefined {
16
+ switch(action.type){
17
+
18
+ case Action.DATA_CHANGED:
19
+ const selection: Array<string> = action.payload.records || getSelection(stateManager);
20
+ if(selection){
21
+ const newState = new Map(currentState);
22
+ selection.forEach(recordId => {
23
+ newState.set(recordId, {...newState.get(recordId), ...action.payload});
24
+ });
25
+ return newState;
26
+ }
27
+ return currentState;
28
+
29
+ case Action.DATA_SAVED:
30
+ case Action.EDITION_CANCELED:
31
+ return undefined;
32
+ }
33
+ return currentState;
34
+ }
35
+
36
+ }
37
+
38
+ export const ChangesReducer = new ChangesReducerImpl();
39
+
40
+ export const getChanges = (stateManager: StateManager): Map<string, any> => {
41
+ return stateManager.select(ChangesReducer.sliceName, (state: Map<string, any>) => state);
42
+ }
43
+
44
+ export const isDirty = (stateManager: StateManager): boolean => {
45
+
46
+ if (getAddedRecords(stateManager) !== undefined) {
47
+ return true;
48
+ }
49
+
50
+ if (getRemovedRecords(stateManager) !== undefined) {
51
+ return true;
52
+ }
53
+
54
+ return getChanges(stateManager) !== undefined;
55
+ }
56
+
57
+ export const getChangesToSave = (dataUnit: string, stateManager: StateManager): Array<Change> => {
58
+ const result: Array<Change> = [];
59
+
60
+ const changes = getChanges(stateManager);
61
+ const records = getRecords(stateManager);
62
+
63
+ if (records) {
64
+ records.forEach(r => {
65
+ if(changes){
66
+ const c = changes.get(r.__record__id__);
67
+ if (c) {
68
+ result.push(new Change(dataUnit, r, c, ChangeOperation.UPDATE));
69
+ }
70
+ }
71
+ });
72
+ }
73
+
74
+ const addedRecords = getAddedRecords(stateManager);
75
+ if (addedRecords) {
76
+ addedRecords.forEach(r => {
77
+ result.push(new Change(dataUnit, r, changes?.get(r.__record__id__), ChangeOperation.INSERT));
78
+ });
79
+ }
80
+
81
+ const removedRecords = getRemovedRecords(stateManager);
82
+ const recordsById: any = {};
83
+ records.forEach(r=>recordsById[r.__record__id__] = r);
84
+ if (removedRecords) {
85
+ removedRecords.forEach(id => {
86
+ result.push(new Change(dataUnit, recordsById[id], undefined, ChangeOperation.DELETE));
87
+ });
88
+ }
89
+
90
+ return result;
91
+ }
@@ -0,0 +1,54 @@
1
+
2
+ import { ActionReducer, StateAction } from "../StateManager";
3
+ import StateManager from "../StateManager";
4
+ import { Record } from "../../DataUnit";
5
+ import { getRecords } from "./RecordsSlice";
6
+ import { getSelection } from "./SelectionSlice";
7
+ import { getChanges } from "./ChangesSlice";
8
+ import { getRemovedRecords } from "./RemovedRecordsSlice";
9
+ import { getAddedRecords } from "./AddedRecordsSlice";
10
+
11
+
12
+ class CurrentRecordsReducerImpl implements ActionReducer{
13
+
14
+ public sliceName: string = "currentRecords";
15
+
16
+ public reduce(stateManager: StateManager, _currentState: Map<string, Record>, _action: StateAction): Map<string, Record> | undefined {
17
+ let records = getRecords(stateManager);
18
+ const added = getAddedRecords(stateManager);
19
+ if(!records && !added){
20
+ return undefined;
21
+ }
22
+ if(added){
23
+ records = (records||[]).concat(added);
24
+ }
25
+ const removedRecords = getRemovedRecords(stateManager);
26
+ if(removedRecords){
27
+ records = records.filter(r => !removedRecords.includes(r.__record__id__));
28
+ }
29
+ const changes = getChanges(stateManager);
30
+ return new Map(records.map(r => {
31
+ const recordId = r.__record__id__;
32
+ const record = {...r, ...changes?.get(recordId)};
33
+ return [recordId, record];
34
+ }));
35
+ }
36
+ }
37
+
38
+ export const CurrentRecordsReducer = new CurrentRecordsReducerImpl();
39
+
40
+ export const getCurrentRecords = (stateManager: StateManager): Map<string, Record> => {
41
+ return stateManager.select(CurrentRecordsReducer.sliceName, (state: Map<string, Record>) => state);
42
+ };
43
+
44
+ export const getFieldValue = (stateManager: StateManager, fieldName: string): any => {
45
+ const selection = getSelection(stateManager);
46
+ if(selection && selection.length > 0){
47
+ const currentRecords = getCurrentRecords(stateManager);
48
+ if(currentRecords){
49
+ const record = currentRecords.get(selection[0]);
50
+ return record ? record[fieldName] : undefined;
51
+ }
52
+ }
53
+ return undefined;
54
+ };
@@ -0,0 +1,50 @@
1
+
2
+ import { ActionReducer, StateAction } from "../StateManager";
3
+ import { Action } from "../action/DataUnitAction";
4
+ import StateManager from "../StateManager";
5
+ import { Record, SavedRecord } from "../../DataUnit";
6
+ import { getRemovedRecords } from "./RemovedRecordsSlice";
7
+
8
+
9
+ class RecordsReducerImpl implements ActionReducer {
10
+
11
+ public sliceName: string = "records";
12
+
13
+ public reduce(stateManager: StateManager, currentState: Array<Record>, action: StateAction): Array<Record> {
14
+ switch (action.type) {
15
+
16
+ case Action.DATA_LOADED:
17
+ return action.payload;
18
+
19
+ case Action.DATA_SAVED:
20
+
21
+ const recordsMap: Map<string, Record> = new Map();
22
+ const currentRecords = getRecords(stateManager);
23
+
24
+ if (currentRecords) {
25
+ const removed: Array<string> = getRemovedRecords(stateManager) || [];
26
+ currentRecords.forEach(r => {
27
+ if (!removed.includes(r.__record__id__)) {
28
+ recordsMap.set(r.__record__id__, r);
29
+ }
30
+ });
31
+ }
32
+
33
+ const savedRecords: Array<SavedRecord> = action.payload.records;
34
+ savedRecords.forEach(sr => {
35
+ const recordId = sr.__old__id__ || sr.__record__id__;
36
+ const newRecord: Record = { ...sr };
37
+ delete newRecord["__old__id__"];
38
+ recordsMap.set(recordId, newRecord);
39
+ });
40
+ return Array.from(recordsMap.values());
41
+ }
42
+ return currentState;
43
+ }
44
+ }
45
+
46
+ export const RecordsReducer = new RecordsReducerImpl();
47
+
48
+ export const getRecords = (stateManager: StateManager): Array<Record> => {
49
+ return stateManager.select(RecordsReducer.sliceName, (state: Array<Record>) => state);
50
+ };
@@ -0,0 +1,26 @@
1
+
2
+ import { ActionReducer, StateAction } from "../StateManager";
3
+ import { Action } from "../action/DataUnitAction";
4
+ import StateManager from "../StateManager";
5
+
6
+ class RemovedRecordsReducerImpl implements ActionReducer{
7
+
8
+ public sliceName: string = "hist::removedRecords";
9
+
10
+ public reduce(_stateManager:StateManager, currentState: Array<string>, action: StateAction): Array<string>|undefined {
11
+ switch(action.type){
12
+ case Action.RECORDS_REMOVED:
13
+ return (currentState||[]).concat(action.payload);
14
+ case Action.EDITION_CANCELED:
15
+ case Action.DATA_SAVED:
16
+ return undefined;
17
+ }
18
+ return currentState;
19
+ }
20
+ }
21
+
22
+ export const RemovedRecordsReducer = new RemovedRecordsReducerImpl();
23
+
24
+ export const getRemovedRecords = (stateManager: StateManager): Array<string> => {
25
+ return stateManager.select(RemovedRecordsReducer.sliceName, (state: Array<string>) => state);
26
+ };
@@ -0,0 +1,128 @@
1
+ import { ActionReducer, StateAction } from "../StateManager";
2
+ import { Action } from "../action/DataUnitAction";
3
+ import StateManager from "../StateManager";
4
+ import { getCurrentRecords } from "./CurrentRecordsSlice";
5
+ import { SavedRecord } from "../../DataUnit";
6
+
7
+ class SelectionReducerImpl implements ActionReducer {
8
+
9
+ public sliceName: string = "hist::selection";
10
+
11
+ public reduce(stateManager: StateManager, currentState: Array<string>, action: StateAction): Array<string>|undefined {
12
+
13
+ switch (action.type) {
14
+
15
+ case Action.DATA_SAVED:
16
+ return updateSavedIds(stateManager, action.payload.records);
17
+ case Action.RECORDS_REMOVED:
18
+ const removed: Array<string> = action.payload;
19
+ if (currentState && removed) {
20
+ return currentState.filter(recordId => !removed.includes(recordId))
21
+ }
22
+ return currentState;
23
+
24
+ case Action.NEXT_SELECTED:
25
+ case Action.PREVIOUS_SELECTED:
26
+
27
+ const currentRecords = getCurrentRecords(stateManager);
28
+ if (currentRecords && currentRecords.size > 0) {
29
+ let index: number;
30
+ if (!currentState || currentState.length === 0) {
31
+ index = action.type === Action.PREVIOUS_SELECTED ? 0 : Math.min(1, currentRecords.size);
32
+ } else {
33
+ index = getItemIndex(currentState[0], currentRecords) + (action.type === Action.PREVIOUS_SELECTED ? -1 : 1);
34
+ }
35
+ if (index < currentRecords.size && index >= 0) {
36
+ return [Array.from(currentRecords.values())[index].__record__id__];
37
+ }
38
+ }
39
+
40
+ return undefined;
41
+
42
+ case Action.SELECTION_CHANGED:
43
+ const { type, selection: selectionSource } = action.payload;
44
+
45
+ if (selectionSource && type === "index") {
46
+ const currentRecords = getCurrentRecords(stateManager);
47
+ if (currentRecords) {
48
+ const records = Array.from(currentRecords.values());
49
+ const selectionById: Array<string> = [];
50
+ selectionSource.forEach((i: number) => {
51
+ if (i > 0 && i < currentRecords.size) {
52
+ selectionById.push(records[i].__record__id__);
53
+ }
54
+ });
55
+ return selectionById;
56
+ }
57
+ }
58
+
59
+ return selectionSource;
60
+ }
61
+
62
+ return currentState;
63
+ }
64
+ }
65
+
66
+ export const SelectionReducer = new SelectionReducerImpl();
67
+
68
+ export const getSelection = (stateManager: StateManager): Array<string> => {
69
+ let selection: Array<string> = stateManager.select(SelectionReducer.sliceName, (state: Array<string>) => state);
70
+ const currentRecords = Array.from((getCurrentRecords(stateManager)||new Map()).keys());
71
+
72
+ if(selection){
73
+ selection = selection.filter( id => currentRecords.includes(id));
74
+ }
75
+
76
+ if (!selection || selection.length === 0) {
77
+ if (currentRecords && currentRecords.length > 0) {
78
+ return [currentRecords[0]];
79
+ }
80
+ }
81
+
82
+ return selection;
83
+ };
84
+
85
+ export const hasNext = (stateManager: StateManager): boolean => {
86
+ const records = getCurrentRecords(stateManager);
87
+ if (records) {
88
+ const selection = stateManager.select(SelectionReducer.sliceName, (state: Array<string>) => state);
89
+ if (!selection || selection.length === 0) {
90
+ return records.size > 0;
91
+ }
92
+ return records.size > (getItemIndex(selection[0], records) + 1);
93
+ }
94
+ return false;
95
+ };
96
+
97
+ export const hasPrevious = (stateManager: StateManager): boolean => {
98
+ const records = getCurrentRecords(stateManager);
99
+ if (records) {
100
+ const selection = stateManager.select(SelectionReducer.sliceName, (state: Array<string>) => state);
101
+ if (!selection || selection.length === 0) {
102
+ return false;
103
+ }
104
+ return getItemIndex(selection[0], records) > 0;
105
+ }
106
+ return false;
107
+ };
108
+
109
+ function getItemIndex(key: string, map: Map<string, any>): number {
110
+ return Array.from(map.keys()).indexOf(key);
111
+ }
112
+
113
+ function updateSavedIds(stateManager:StateManager, savedRecords:Array<SavedRecord>): Array<string>{
114
+ const currentSelection: Array<string> = getSelection(stateManager);
115
+ if(currentSelection){
116
+ const newSelection: Array<string> = [];
117
+ currentSelection.forEach( id => {
118
+ const record = savedRecords.find(r => r.__old__id__ === id);
119
+ if(record){
120
+ newSelection.push(record.__record__id__);
121
+ } else {
122
+ newSelection.push(id);
123
+ }
124
+ });
125
+ return newSelection;
126
+ }
127
+ return currentSelection;
128
+ }
@@ -0,0 +1,30 @@
1
+
2
+ import { ActionReducer, StateAction } from "../StateManager";
3
+ import { UnitMetadata, FieldDescriptor } from "../../metadata/UnitMetadata";
4
+ import { Action } from "../action/DataUnitAction";
5
+ import StateManager from "../StateManager";
6
+
7
+
8
+ class UnitMetadataReducerImpl implements ActionReducer{
9
+
10
+ public sliceName: string = "unitMetadata";
11
+
12
+ public reduce(_stateManager:StateManager, currentState: UnitMetadata, action: StateAction): UnitMetadata {
13
+ if(action.type === Action.METADATA_LOADED){
14
+ return action.payload;
15
+ }
16
+ return currentState;
17
+ }
18
+
19
+ }
20
+
21
+ export const UnitMetadataReducer = new UnitMetadataReducerImpl();
22
+
23
+ export const getMetadata = (stateManager: StateManager): UnitMetadata => {
24
+ return stateManager.select(UnitMetadataReducer.sliceName, (state: UnitMetadata) => state);
25
+ };
26
+
27
+ export const getField = (stateManager: StateManager, fieldName: string): FieldDescriptor|undefined => {
28
+ const md: UnitMetadata = getMetadata(stateManager);
29
+ return md ? md.fields.find(fmd => fmd.name === fieldName) : undefined;
30
+ }
package/src/index.ts CHANGED
@@ -8,6 +8,10 @@ import { HttpProvider } from "./http/HttpProvider";
8
8
  import { SkwHttpProvider } from "./http/SkwHttpProvider";
9
9
  import { RequestMetadata } from "./http/RequestMetadata";
10
10
  import { AuthorizedServiceCaller } from "./http/AuthorizedServiceCaller";
11
+ import DataUnit, {Record} from "./dataunit/DataUnit";
12
+ import { DataType } from "./dataunit/metadata/DataType";
13
+ import { UnitMetadata, FieldDescriptor, UserInterface } from "./dataunit/metadata/UnitMetadata";
14
+ import { DataUnitAction, Action } from "./dataunit/state/action/DataUnitAction";
11
15
 
12
16
  /*Classes públicas no pacote*/
13
17
  export {
@@ -20,5 +24,13 @@ export {
20
24
  SkwHttpProvider,
21
25
  HttpProvider,
22
26
  RequestMetadata,
23
- AuthorizedServiceCaller
27
+ AuthorizedServiceCaller,
28
+ DataUnit,
29
+ Record,
30
+ DataType,
31
+ UnitMetadata,
32
+ FieldDescriptor,
33
+ UserInterface,
34
+ DataUnitAction,
35
+ Action
24
36
  };
@@ -9,15 +9,36 @@ interface FloatingOptions {
9
9
 
10
10
  class FloatingEntry {
11
11
 
12
- public parent: WeakRef<HTMLElement>|HTMLElement;
13
- public content: WeakRef<HTMLElement>|HTMLElement;
12
+ private weakRefParent?: WeakRef<HTMLElement>;
13
+ private weakRefContent?: WeakRef<HTMLElement>;
14
+ private strongRefParent?: HTMLElement;
15
+ private strongRefContent?: HTMLElement;
14
16
  public options: FloatingOptions;
15
17
 
16
18
  constructor(parent: HTMLElement, content: HTMLElement, opts: FloatingOptions) {
17
- this.parent = WeakRef === undefined ? parent : new WeakRef(parent);
18
- this.content = WeakRef === undefined ? content : new WeakRef(content);
19
+ try{
20
+ this.weakRefParent = new WeakRef(parent);
21
+ this.weakRefContent = new WeakRef(content);
22
+ } catch(error){
23
+ this.strongRefParent = parent;
24
+ this.strongRefContent = content;
25
+ }
19
26
  this.options = opts;
20
27
  }
28
+
29
+ public get parent():HTMLElement|undefined{
30
+ if(this.weakRefParent){
31
+ return this.weakRefParent.deref();
32
+ }
33
+ return this.strongRefParent
34
+ }
35
+
36
+ public get content():HTMLElement|undefined{
37
+ if(this.weakRefContent){
38
+ return this.weakRefContent.deref();
39
+ }
40
+ return this.strongRefContent;
41
+ }
21
42
  }
22
43
 
23
44
  export default class FloatingManager {
@@ -46,8 +67,8 @@ export default class FloatingManager {
46
67
 
47
68
  private static doClose(id: number, entry: FloatingEntry, target?: HTMLElement) {
48
69
  if (!target || entry.options.autoClose) {
49
- const parent: HTMLElement | undefined = (WeakRef === undefined ? entry.parent as HTMLElement : (entry.parent as WeakRef<HTMLElement>).deref());
50
- const content: HTMLElement | undefined = (WeakRef === undefined ? entry.content as HTMLElement : (entry.content as WeakRef<HTMLElement>).deref());
70
+ const parent: HTMLElement | undefined = entry.parent;
71
+ const content: HTMLElement | undefined = entry.content;
51
72
 
52
73
  if (parent && content) {
53
74
  const innerClickFunction: Function = entry.options.innerClickTest ? entry.options.innerClickTest : FloatingManager.innerClick;
@@ -91,9 +112,7 @@ export default class FloatingManager {
91
112
 
92
113
  for (let index: number = 0; index < FloatingManager.entries.length; index++) {
93
114
  const entry: FloatingEntry = FloatingManager.entries[index];
94
- const entryParent: HTMLElement | undefined = (WeakRef === undefined ? entry.parent as HTMLElement : (entry.parent as WeakRef<HTMLElement>).deref());
95
- const entryContent: HTMLElement | undefined = (WeakRef === undefined ? entry.content as HTMLElement : (entry.content as WeakRef<HTMLElement>).deref());
96
- if (entry && content === entryContent && parent === entryParent) {
115
+ if (entry && content === entry.content && parent === entry.parent) {
97
116
  return index;
98
117
  }
99
118
  }