@igo2/common 1.8.1 → 1.9.3
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/bundles/igo2-common.umd.js +10700 -10473
- package/bundles/igo2-common.umd.js.map +1 -1
- package/esm2015/igo2-common.js +5 -5
- package/esm2015/lib/action/action.module.js +29 -28
- package/esm2015/lib/action/actionbar/actionbar-item.component.js +257 -257
- package/esm2015/lib/action/actionbar/actionbar.component.js +385 -387
- package/esm2015/lib/action/actionbar/actionbar.module.js +59 -58
- package/esm2015/lib/action/index.js +3 -3
- package/esm2015/lib/action/shared/action.enums.js +7 -7
- package/esm2015/lib/action/shared/action.interfaces.js +2 -1
- package/esm2015/lib/action/shared/index.js +4 -4
- package/esm2015/lib/action/shared/store.js +8 -8
- package/esm2015/lib/backdrop/backdrop.component.js +30 -30
- package/esm2015/lib/backdrop/backdrop.module.js +25 -24
- package/esm2015/lib/backdrop/index.js +2 -2
- package/esm2015/lib/badge-icon/badge-icon.directive.js +125 -121
- package/esm2015/lib/badge-icon/badge-icon.module.js +26 -25
- package/esm2015/lib/badge-icon/index.js +2 -2
- package/esm2015/lib/clickout/clickout.directive.js +32 -32
- package/esm2015/lib/clickout/clickout.module.js +24 -23
- package/esm2015/lib/clickout/index.js +2 -2
- package/esm2015/lib/clone/clone.module.js +24 -23
- package/esm2015/lib/clone/clone.pipe.js +24 -24
- package/esm2015/lib/clone/index.js +2 -2
- package/esm2015/lib/collapsible/collapse.directive.js +55 -55
- package/esm2015/lib/collapsible/collapsible.component.js +63 -63
- package/esm2015/lib/collapsible/collapsible.module.js +27 -26
- package/esm2015/lib/collapsible/index.js +3 -3
- package/esm2015/lib/confirm-dialog/confirm-dialog.component.js +50 -51
- package/esm2015/lib/confirm-dialog/confirm-dialog.module.js +29 -28
- package/esm2015/lib/confirm-dialog/confirm-dialog.service.js +22 -23
- package/esm2015/lib/confirm-dialog/index.js +3 -3
- package/esm2015/lib/context-menu/context-menu.directive.js +135 -89
- package/esm2015/lib/context-menu/context-menu.module.js +24 -23
- package/esm2015/lib/context-menu/index.js +2 -2
- package/esm2015/lib/custom-html/custom-html.component.js +32 -32
- package/esm2015/lib/custom-html/custom-html.module.js +49 -48
- package/esm2015/lib/custom-html/custom-html.pipe.js +18 -19
- package/esm2015/lib/custom-html/index.js +3 -3
- package/esm2015/lib/drag-drop/drag-drop.directive.js +88 -88
- package/esm2015/lib/drag-drop/drag-drop.module.js +24 -23
- package/esm2015/lib/drag-drop/index.js +2 -2
- package/esm2015/lib/dynamic-component/dynamic-component.module.js +33 -32
- package/esm2015/lib/dynamic-component/dynamic-outlet/dynamic-outlet.component.js +124 -125
- package/esm2015/lib/dynamic-component/dynamic-outlet/dynamic-outlet.module.js +30 -29
- package/esm2015/lib/dynamic-component/index.js +3 -3
- package/esm2015/lib/dynamic-component/shared/dynamic-component.interfaces.js +2 -1
- package/esm2015/lib/dynamic-component/shared/dynamic-component.js +174 -174
- package/esm2015/lib/dynamic-component/shared/dynamic-component.service.js +29 -29
- package/esm2015/lib/dynamic-component/shared/index.js +4 -4
- package/esm2015/lib/entity/entity-selector/entity-selector.component.js +201 -202
- package/esm2015/lib/entity/entity-selector/entity-selector.module.js +34 -33
- package/esm2015/lib/entity/entity-table/entity-table-row.directive.js +137 -137
- package/esm2015/lib/entity/entity-table/entity-table.component.js +912 -916
- package/esm2015/lib/entity/entity-table/entity-table.module.js +77 -76
- package/esm2015/lib/entity/entity-table-paginator/entity-table-paginator.component.js +138 -140
- package/esm2015/lib/entity/entity-table-paginator/entity-table-paginator.interface.js +2 -1
- package/esm2015/lib/entity/entity-table-paginator/entity-table-paginator.module.js +30 -29
- package/esm2015/lib/entity/entity.module.js +33 -32
- package/esm2015/lib/entity/index.js +6 -6
- package/esm2015/lib/entity/shared/entity.enums.js +27 -27
- package/esm2015/lib/entity/shared/entity.interfaces.js +2 -1
- package/esm2015/lib/entity/shared/entity.utils.js +67 -67
- package/esm2015/lib/entity/shared/index.js +10 -10
- package/esm2015/lib/entity/shared/state.js +191 -191
- package/esm2015/lib/entity/shared/store.js +288 -288
- package/esm2015/lib/entity/shared/strategies/filter-custom-function.js +79 -79
- package/esm2015/lib/entity/shared/strategies/filter-selection.js +84 -84
- package/esm2015/lib/entity/shared/strategies/index.js +4 -4
- package/esm2015/lib/entity/shared/strategies/strategy.js +75 -75
- package/esm2015/lib/entity/shared/transaction.js +316 -316
- package/esm2015/lib/entity/shared/view.js +315 -315
- package/esm2015/lib/entity/shared/watcher.js +120 -120
- package/esm2015/lib/flexible/flexible.component.js +158 -159
- package/esm2015/lib/flexible/flexible.module.js +24 -23
- package/esm2015/lib/flexible/flexible.type.js +2 -1
- package/esm2015/lib/flexible/index.js +3 -3
- package/esm2015/lib/form/form/form.component.js +125 -125
- package/esm2015/lib/form/form/form.module.js +42 -41
- package/esm2015/lib/form/form-field/form-field-select.component.js +132 -132
- package/esm2015/lib/form/form-field/form-field-text.component.js +108 -108
- package/esm2015/lib/form/form-field/form-field-textarea.component.js +110 -110
- package/esm2015/lib/form/form-field/form-field.component.js +77 -78
- package/esm2015/lib/form/form-field/form-field.module.js +76 -75
- package/esm2015/lib/form/form-field/index.js +5 -5
- package/esm2015/lib/form/form-group/form-group.component.js +110 -110
- package/esm2015/lib/form/form-group/form-group.module.js +42 -41
- package/esm2015/lib/form/form.module.js +51 -50
- package/esm2015/lib/form/index.js +5 -5
- package/esm2015/lib/form/shared/form-field-component.js +7 -7
- package/esm2015/lib/form/shared/form-field.service.js +29 -29
- package/esm2015/lib/form/shared/form.interfaces.js +2 -1
- package/esm2015/lib/form/shared/form.service.js +77 -77
- package/esm2015/lib/form/shared/form.utils.js +40 -40
- package/esm2015/lib/form/shared/index.js +6 -6
- package/esm2015/lib/home-button/home-button.component.js +35 -0
- package/esm2015/lib/home-button/home-button.module.js +43 -0
- package/esm2015/lib/home-button/index.js +2 -0
- package/esm2015/lib/image/image.module.js +24 -23
- package/esm2015/lib/image/index.js +2 -2
- package/esm2015/lib/image/secure-image.pipe.js +48 -51
- package/esm2015/lib/interactive-tour/index.js +5 -5
- package/esm2015/lib/interactive-tour/interactive-tour.component.js +140 -142
- package/esm2015/lib/interactive-tour/interactive-tour.interface.js +2 -1
- package/esm2015/lib/interactive-tour/interactive-tour.loader.js +44 -46
- package/esm2015/lib/interactive-tour/interactive-tour.module.js +42 -41
- package/esm2015/lib/interactive-tour/interactive-tour.service.js +285 -288
- package/esm2015/lib/json-dialog/index.js +3 -3
- package/esm2015/lib/json-dialog/json-dialog.component.js +116 -117
- package/esm2015/lib/json-dialog/json-dialog.module.js +29 -28
- package/esm2015/lib/json-dialog/json-dialog.service.js +24 -25
- package/esm2015/lib/keyvalue/index.js +2 -2
- package/esm2015/lib/keyvalue/keyvalue.module.js +24 -23
- package/esm2015/lib/keyvalue/keyvalue.pipe.js +18 -18
- package/esm2015/lib/list/index.js +3 -3
- package/esm2015/lib/list/list-item.directive.js +165 -165
- package/esm2015/lib/list/list.component.js +266 -266
- package/esm2015/lib/list/list.module.js +29 -28
- package/esm2015/lib/panel/index.js +2 -2
- package/esm2015/lib/panel/panel.component.js +67 -67
- package/esm2015/lib/panel/panel.module.js +19 -18
- package/esm2015/lib/sidenav/index.js +2 -2
- package/esm2015/lib/sidenav/sidenav-shim.directive.js +55 -56
- package/esm2015/lib/sidenav/sidenav.module.js +24 -23
- package/esm2015/lib/spinner/index.js +3 -3
- package/esm2015/lib/spinner/spinner-activity.directive.js +47 -49
- package/esm2015/lib/spinner/spinner.component.js +40 -40
- package/esm2015/lib/spinner/spinner.module.js +21 -20
- package/esm2015/lib/stop-propagation/index.js +3 -3
- package/esm2015/lib/stop-propagation/stop-drop-propagation.directive.js +22 -22
- package/esm2015/lib/stop-propagation/stop-propagation.directive.js +21 -21
- package/esm2015/lib/stop-propagation/stop-propagation.module.js +25 -24
- package/esm2015/lib/table/index.js +6 -6
- package/esm2015/lib/table/table-action-color.enum.js +7 -7
- package/esm2015/lib/table/table-database.js +28 -28
- package/esm2015/lib/table/table-datasource.js +61 -61
- package/esm2015/lib/table/table-model.interface.js +2 -1
- package/esm2015/lib/table/table.component.js +310 -311
- package/esm2015/lib/table/table.module.js +69 -68
- package/esm2015/lib/tool/index.js +3 -3
- package/esm2015/lib/tool/shared/index.js +6 -6
- package/esm2015/lib/tool/shared/tool-component.js +9 -9
- package/esm2015/lib/tool/shared/tool.interface.js +2 -1
- package/esm2015/lib/tool/shared/tool.service.js +43 -43
- package/esm2015/lib/tool/shared/toolbox.enums.js +7 -7
- package/esm2015/lib/tool/shared/toolbox.js +179 -179
- package/esm2015/lib/tool/tool.module.js +34 -33
- package/esm2015/lib/tool/toolbox/toolbox.animation.js +10 -10
- package/esm2015/lib/tool/toolbox/toolbox.component.js +261 -262
- package/esm2015/lib/tool/toolbox/toolbox.module.js +38 -37
- package/esm2015/lib/widget/index.js +3 -3
- package/esm2015/lib/widget/shared/index.js +4 -4
- package/esm2015/lib/widget/shared/widget.interfaces.js +2 -1
- package/esm2015/lib/widget/shared/widget.js +4 -4
- package/esm2015/lib/widget/shared/widget.service.js +20 -21
- package/esm2015/lib/widget/widget-outlet/widget-outlet.component.js +121 -122
- package/esm2015/lib/widget/widget-outlet/widget-outlet.module.js +34 -33
- package/esm2015/lib/widget/widget.module.js +34 -33
- package/esm2015/lib/workspace/index.js +4 -4
- package/esm2015/lib/workspace/shared/index.js +4 -4
- package/esm2015/lib/workspace/shared/store.js +40 -40
- package/esm2015/lib/workspace/shared/workspace.interfaces.js +2 -1
- package/esm2015/lib/workspace/shared/workspace.js +117 -117
- package/esm2015/lib/workspace/workspace-selector/workspace-selector.component.js +54 -55
- package/esm2015/lib/workspace/workspace-selector/workspace-selector.module.js +34 -33
- package/esm2015/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.component.js +93 -94
- package/esm2015/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.module.js +34 -33
- package/esm2015/lib/workspace/workspace.module.js +29 -28
- package/esm2015/public_api.js +72 -70
- package/fesm2015/igo2-common.js +9015 -8846
- package/fesm2015/igo2-common.js.map +1 -1
- package/igo2-common.d.ts +5 -5
- package/lib/action/action.module.d.ts +8 -7
- package/lib/action/actionbar/actionbar-item.component.d.ts +78 -78
- package/lib/action/actionbar/actionbar.component.d.ts +146 -146
- package/lib/action/actionbar/actionbar.module.d.ts +20 -19
- package/lib/action/index.d.ts +2 -2
- package/lib/action/shared/action.enums.d.ts +5 -5
- package/lib/action/shared/action.interfaces.d.ts +17 -17
- package/lib/action/shared/index.d.ts +3 -3
- package/lib/action/shared/store.d.ts +8 -8
- package/lib/backdrop/backdrop.component.d.ts +9 -9
- package/lib/backdrop/backdrop.module.d.ts +10 -9
- package/lib/backdrop/index.d.ts +1 -1
- package/lib/badge-icon/badge-icon.directive.d.ts +32 -27
- package/lib/badge-icon/badge-icon.module.d.ts +11 -10
- package/lib/badge-icon/index.d.ts +1 -1
- package/lib/clickout/clickout.directive.d.ts +10 -10
- package/lib/clickout/clickout.module.d.ts +9 -8
- package/lib/clickout/index.d.ts +1 -1
- package/lib/clone/clone.module.d.ts +9 -8
- package/lib/clone/clone.pipe.d.ts +7 -7
- package/lib/clone/index.d.ts +1 -1
- package/lib/collapsible/collapse.directive.d.ts +19 -19
- package/lib/collapsible/collapsible.component.d.ts +13 -13
- package/lib/collapsible/collapsible.module.d.ts +12 -11
- package/lib/collapsible/index.d.ts +2 -2
- package/lib/confirm-dialog/confirm-dialog.component.d.ts +9 -9
- package/lib/confirm-dialog/confirm-dialog.module.d.ts +12 -11
- package/lib/confirm-dialog/confirm-dialog.service.d.ts +10 -10
- package/lib/confirm-dialog/index.d.ts +2 -2
- package/lib/context-menu/context-menu.directive.d.ts +27 -21
- package/lib/context-menu/context-menu.module.d.ts +9 -8
- package/lib/context-menu/index.d.ts +1 -1
- package/lib/custom-html/custom-html.component.d.ts +9 -9
- package/lib/custom-html/custom-html.module.d.ts +16 -15
- package/lib/custom-html/custom-html.pipe.d.ts +10 -10
- package/lib/custom-html/index.d.ts +2 -2
- package/lib/drag-drop/drag-drop.directive.d.ts +14 -14
- package/lib/drag-drop/drag-drop.module.d.ts +9 -8
- package/lib/drag-drop/index.d.ts +1 -1
- package/lib/dynamic-component/dynamic-component.module.d.ts +8 -7
- package/lib/dynamic-component/dynamic-outlet/dynamic-outlet.component.d.ts +70 -70
- package/lib/dynamic-component/dynamic-outlet/dynamic-outlet.module.d.ts +11 -10
- package/lib/dynamic-component/index.d.ts +2 -2
- package/lib/dynamic-component/shared/dynamic-component.d.ts +88 -88
- package/lib/dynamic-component/shared/dynamic-component.interfaces.d.ts +3 -3
- package/lib/dynamic-component/shared/dynamic-component.service.d.ts +18 -18
- package/lib/dynamic-component/shared/index.d.ts +3 -3
- package/lib/entity/entity-selector/entity-selector.component.d.ts +92 -92
- package/lib/entity/entity-selector/entity-selector.module.d.ts +13 -12
- package/lib/entity/entity-table/entity-table-row.directive.d.ts +69 -69
- package/lib/entity/entity-table/entity-table.component.d.ts +275 -275
- package/lib/entity/entity-table/entity-table.module.d.ts +23 -22
- package/lib/entity/entity-table-paginator/entity-table-paginator.component.d.ts +49 -49
- package/lib/entity/entity-table-paginator/entity-table-paginator.interface.d.ts +8 -8
- package/lib/entity/entity-table-paginator/entity-table-paginator.module.d.ts +11 -10
- package/lib/entity/entity.module.d.ts +10 -9
- package/lib/entity/index.d.ts +5 -5
- package/lib/entity/shared/entity.enums.d.ts +22 -22
- package/lib/entity/shared/entity.interfaces.d.ts +88 -88
- package/lib/entity/shared/entity.utils.d.ts +49 -49
- package/lib/entity/shared/index.d.ts +9 -9
- package/lib/entity/shared/state.d.ts +103 -103
- package/lib/entity/shared/store.d.ts +176 -176
- package/lib/entity/shared/strategies/filter-custom-function.d.ts +51 -51
- package/lib/entity/shared/strategies/filter-selection.d.ts +48 -48
- package/lib/entity/shared/strategies/index.d.ts +3 -3
- package/lib/entity/shared/strategies/strategy.d.ts +56 -56
- package/lib/entity/shared/transaction.d.ts +168 -168
- package/lib/entity/shared/view.d.ts +193 -193
- package/lib/entity/shared/watcher.d.ts +72 -72
- package/lib/flexible/flexible.component.d.ts +41 -41
- package/lib/flexible/flexible.module.d.ts +9 -8
- package/lib/flexible/flexible.type.d.ts +2 -2
- package/lib/flexible/index.d.ts +2 -2
- package/lib/form/form/form.component.d.ts +53 -53
- package/lib/form/form/form.module.d.ts +12 -11
- package/lib/form/form-field/form-field-select.component.d.ts +48 -48
- package/lib/form/form-field/form-field-text.component.d.ts +41 -41
- package/lib/form/form-field/form-field-textarea.component.d.ts +41 -41
- package/lib/form/form-field/form-field.component.d.ts +34 -34
- package/lib/form/form-field/form-field.module.d.ts +21 -20
- package/lib/form/form-field/index.d.ts +4 -4
- package/lib/form/form-group/form-group.component.d.ts +49 -49
- package/lib/form/form-group/form-group.module.d.ts +14 -13
- package/lib/form/form.module.d.ts +13 -12
- package/lib/form/index.d.ts +4 -4
- package/lib/form/shared/form-field-component.d.ts +1 -1
- package/lib/form/shared/form-field.service.d.ts +19 -19
- package/lib/form/shared/form.interfaces.d.ts +57 -57
- package/lib/form/shared/form.service.d.ts +15 -15
- package/lib/form/shared/form.utils.d.ts +11 -11
- package/lib/form/shared/index.d.ts +5 -5
- package/lib/home-button/home-button.component.d.ts +9 -0
- package/lib/home-button/home-button.module.d.ts +15 -0
- package/lib/home-button/index.d.ts +1 -0
- package/lib/image/image.module.d.ts +9 -8
- package/lib/image/index.d.ts +1 -1
- package/lib/image/secure-image.pipe.d.ts +11 -11
- package/lib/interactive-tour/index.d.ts +4 -4
- package/lib/interactive-tour/interactive-tour.component.d.ts +30 -30
- package/lib/interactive-tour/interactive-tour.interface.d.ts +32 -32
- package/lib/interactive-tour/interactive-tour.loader.d.ts +18 -18
- package/lib/interactive-tour/interactive-tour.module.d.ts +12 -11
- package/lib/interactive-tour/interactive-tour.service.d.ts +29 -29
- package/lib/json-dialog/index.d.ts +2 -2
- package/lib/json-dialog/json-dialog.component.d.ts +13 -13
- package/lib/json-dialog/json-dialog.module.d.ts +13 -12
- package/lib/json-dialog/json-dialog.service.d.ts +10 -10
- package/lib/keyvalue/index.d.ts +1 -1
- package/lib/keyvalue/keyvalue.module.d.ts +9 -8
- package/lib/keyvalue/keyvalue.pipe.d.ts +7 -7
- package/lib/list/index.d.ts +2 -2
- package/lib/list/list-item.directive.d.ts +43 -43
- package/lib/list/list.component.d.ts +51 -51
- package/lib/list/list.module.d.ts +14 -13
- package/lib/panel/index.d.ts +1 -1
- package/lib/panel/panel.component.d.ts +11 -11
- package/lib/panel/panel.module.d.ts +8 -7
- package/lib/sidenav/index.d.ts +1 -1
- package/lib/sidenav/sidenav-shim.directive.d.ts +20 -20
- package/lib/sidenav/sidenav.module.d.ts +9 -8
- package/lib/spinner/index.d.ts +2 -2
- package/lib/spinner/spinner-activity.directive.d.ts +32 -32
- package/lib/spinner/spinner.component.d.ts +12 -12
- package/lib/spinner/spinner.module.d.ts +10 -9
- package/lib/stop-propagation/index.d.ts +2 -2
- package/lib/stop-propagation/stop-drop-propagation.directive.d.ts +6 -6
- package/lib/stop-propagation/stop-propagation.directive.d.ts +6 -6
- package/lib/stop-propagation/stop-propagation.module.d.ts +10 -9
- package/lib/table/index.d.ts +5 -5
- package/lib/table/table-action-color.enum.d.ts +5 -5
- package/lib/table/table-database.d.ts +10 -10
- package/lib/table/table-datasource.d.ts +17 -17
- package/lib/table/table-model.interface.d.ts +28 -28
- package/lib/table/table.component.d.ts +40 -40
- package/lib/table/table.module.d.ts +20 -19
- package/lib/tool/index.d.ts +2 -2
- package/lib/tool/shared/index.d.ts +5 -5
- package/lib/tool/shared/tool-component.d.ts +2 -2
- package/lib/tool/shared/tool.interface.d.ts +18 -18
- package/lib/tool/shared/tool.service.d.ts +30 -30
- package/lib/tool/shared/toolbox.d.ts +95 -95
- package/lib/tool/shared/toolbox.enums.d.ts +5 -5
- package/lib/tool/tool.module.d.ts +10 -9
- package/lib/tool/toolbox/toolbox.animation.d.ts +2 -2
- package/lib/tool/toolbox/toolbox.component.d.ts +127 -127
- package/lib/tool/toolbox/toolbox.module.d.ts +13 -12
- package/lib/widget/index.d.ts +2 -2
- package/lib/widget/shared/index.d.ts +3 -3
- package/lib/widget/shared/widget.d.ts +4 -4
- package/lib/widget/shared/widget.interfaces.d.ts +12 -12
- package/lib/widget/shared/widget.service.d.ts +10 -10
- package/lib/widget/widget-outlet/widget-outlet.component.d.ts +71 -71
- package/lib/widget/widget-outlet/widget-outlet.module.d.ts +12 -11
- package/lib/widget/widget.module.d.ts +8 -7
- package/lib/workspace/index.d.ts +3 -3
- package/lib/workspace/shared/index.d.ts +3 -3
- package/lib/workspace/shared/store.d.ts +20 -20
- package/lib/workspace/shared/workspace.d.ts +108 -108
- package/lib/workspace/shared/workspace.interfaces.d.ts +11 -11
- package/lib/workspace/workspace-selector/workspace-selector.component.d.ts +35 -35
- package/lib/workspace/workspace-selector/workspace-selector.module.d.ts +12 -11
- package/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.component.d.ts +57 -57
- package/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.module.d.ts +12 -11
- package/lib/workspace/workspace.module.d.ts +9 -8
- package/package.json +8 -7
- package/public_api.d.ts +68 -66
- package/style/common.theming.scss +12 -236
- package/style/partial/action.scss +18 -18
- package/style/partial/common.variables.scss +8 -8
- package/bundles/igo2-common.umd.min.js +0 -17
- package/bundles/igo2-common.umd.min.js.map +0 -1
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
import { skip } from 'rxjs/operators';
|
|
2
|
-
import { ObjectUtils } from '@igo2/utils';
|
|
3
|
-
/**
|
|
4
|
-
* This class is used to synchronize a component's changes
|
|
5
|
-
* detection with an EntityStore changes. For example, it is frequent
|
|
6
|
-
* to have a component subscribe to a store's selected entity and, at the same time,
|
|
7
|
-
* this component provides a way to select an entity with, let's say, a click.
|
|
8
|
-
*
|
|
9
|
-
* This class automatically handles those case and triggers the compoent's
|
|
10
|
-
* change detection when needed.
|
|
11
|
-
*
|
|
12
|
-
* Note: If the component observes the store's stateView, a workspace is
|
|
13
|
-
* probably not required because the stateView catches any changes to the
|
|
14
|
-
* entities and their state.
|
|
15
|
-
*/
|
|
16
|
-
export class EntityStoreWatcher {
|
|
17
|
-
constructor(store, cdRef) {
|
|
18
|
-
/**
|
|
19
|
-
* Component inner state
|
|
20
|
-
*/
|
|
21
|
-
this.innerStateIndex = new Map();
|
|
22
|
-
this.setChangeDetector(cdRef);
|
|
23
|
-
this.setStore(store);
|
|
24
|
-
}
|
|
25
|
-
destroy() {
|
|
26
|
-
this.setChangeDetector(undefined);
|
|
27
|
-
this.setStore(undefined);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Bind this workspace to a store and start watching for changes
|
|
31
|
-
* @param store Entity store
|
|
32
|
-
*/
|
|
33
|
-
setStore(store) {
|
|
34
|
-
if (store === undefined) {
|
|
35
|
-
this.teardownObservers();
|
|
36
|
-
this.innerStateIndex.clear();
|
|
37
|
-
this.store = undefined;
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
this.setStore(undefined);
|
|
41
|
-
this.store = store;
|
|
42
|
-
this.setupObservers();
|
|
43
|
-
this.detectChanges();
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Bind this workspace to a component's change detector
|
|
47
|
-
* @param cdRef Change detector
|
|
48
|
-
*/
|
|
49
|
-
setChangeDetector(cdRef) {
|
|
50
|
-
this.cdRef = cdRef;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Set up observers on a store's entities and their state
|
|
54
|
-
* @param store Entity store
|
|
55
|
-
*/
|
|
56
|
-
setupObservers() {
|
|
57
|
-
this.teardownObservers();
|
|
58
|
-
this.entities$$ = this.store.entities$
|
|
59
|
-
.subscribe((entities) => this.onEntitiesChange(entities));
|
|
60
|
-
this.state$$ = this.store.state.change$
|
|
61
|
-
.pipe(skip(1))
|
|
62
|
-
.subscribe(() => this.onStateChange());
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Teardown store observers
|
|
66
|
-
*/
|
|
67
|
-
teardownObservers() {
|
|
68
|
-
if (this.entities$$ !== undefined) {
|
|
69
|
-
this.entities$$.unsubscribe();
|
|
70
|
-
}
|
|
71
|
-
if (this.state$$ !== undefined) {
|
|
72
|
-
this.state$$.unsubscribe();
|
|
73
|
-
}
|
|
74
|
-
this.entities$$ = undefined;
|
|
75
|
-
this.state$$ = undefined;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* When the entities change, always trigger the changes detection
|
|
79
|
-
*/
|
|
80
|
-
onEntitiesChange(entities) {
|
|
81
|
-
this.detectChanges();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* When the entities state change, trigger the change detection
|
|
85
|
-
* only if the component has not handled these changes yet. For example,
|
|
86
|
-
* the component might have initiated thoses changes itself.
|
|
87
|
-
*/
|
|
88
|
-
onStateChange() {
|
|
89
|
-
let changesDetected = false;
|
|
90
|
-
const storeIndex = this.store.state.index;
|
|
91
|
-
const innerIndex = this.innerStateIndex;
|
|
92
|
-
if (storeIndex.size !== innerIndex.size) {
|
|
93
|
-
changesDetected = this.detectChanges();
|
|
94
|
-
}
|
|
95
|
-
const storeKeys = Array.from(storeIndex.keys());
|
|
96
|
-
for (const key of storeKeys) {
|
|
97
|
-
const storeValue = storeIndex.get(key);
|
|
98
|
-
const innerValue = innerIndex.get(key);
|
|
99
|
-
if (changesDetected === false) {
|
|
100
|
-
if (innerValue === undefined) {
|
|
101
|
-
changesDetected = this.detectChanges();
|
|
102
|
-
}
|
|
103
|
-
else if (!ObjectUtils.objectsAreEquivalent(storeValue, innerValue)) {
|
|
104
|
-
changesDetected = this.detectChanges();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
this.innerStateIndex.set(key, Object.assign({}, storeValue));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Trigger the change detection of the workspace is bound to a change detector
|
|
112
|
-
*/
|
|
113
|
-
detectChanges() {
|
|
114
|
-
if (this.cdRef !== undefined) {
|
|
115
|
-
this.cdRef.detectChanges();
|
|
116
|
-
}
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
import { skip } from 'rxjs/operators';
|
|
2
|
+
import { ObjectUtils } from '@igo2/utils';
|
|
3
|
+
/**
|
|
4
|
+
* This class is used to synchronize a component's changes
|
|
5
|
+
* detection with an EntityStore changes. For example, it is frequent
|
|
6
|
+
* to have a component subscribe to a store's selected entity and, at the same time,
|
|
7
|
+
* this component provides a way to select an entity with, let's say, a click.
|
|
8
|
+
*
|
|
9
|
+
* This class automatically handles those case and triggers the compoent's
|
|
10
|
+
* change detection when needed.
|
|
11
|
+
*
|
|
12
|
+
* Note: If the component observes the store's stateView, a workspace is
|
|
13
|
+
* probably not required because the stateView catches any changes to the
|
|
14
|
+
* entities and their state.
|
|
15
|
+
*/
|
|
16
|
+
export class EntityStoreWatcher {
|
|
17
|
+
constructor(store, cdRef) {
|
|
18
|
+
/**
|
|
19
|
+
* Component inner state
|
|
20
|
+
*/
|
|
21
|
+
this.innerStateIndex = new Map();
|
|
22
|
+
this.setChangeDetector(cdRef);
|
|
23
|
+
this.setStore(store);
|
|
24
|
+
}
|
|
25
|
+
destroy() {
|
|
26
|
+
this.setChangeDetector(undefined);
|
|
27
|
+
this.setStore(undefined);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Bind this workspace to a store and start watching for changes
|
|
31
|
+
* @param store Entity store
|
|
32
|
+
*/
|
|
33
|
+
setStore(store) {
|
|
34
|
+
if (store === undefined) {
|
|
35
|
+
this.teardownObservers();
|
|
36
|
+
this.innerStateIndex.clear();
|
|
37
|
+
this.store = undefined;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.setStore(undefined);
|
|
41
|
+
this.store = store;
|
|
42
|
+
this.setupObservers();
|
|
43
|
+
this.detectChanges();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Bind this workspace to a component's change detector
|
|
47
|
+
* @param cdRef Change detector
|
|
48
|
+
*/
|
|
49
|
+
setChangeDetector(cdRef) {
|
|
50
|
+
this.cdRef = cdRef;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Set up observers on a store's entities and their state
|
|
54
|
+
* @param store Entity store
|
|
55
|
+
*/
|
|
56
|
+
setupObservers() {
|
|
57
|
+
this.teardownObservers();
|
|
58
|
+
this.entities$$ = this.store.entities$
|
|
59
|
+
.subscribe((entities) => this.onEntitiesChange(entities));
|
|
60
|
+
this.state$$ = this.store.state.change$
|
|
61
|
+
.pipe(skip(1))
|
|
62
|
+
.subscribe(() => this.onStateChange());
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Teardown store observers
|
|
66
|
+
*/
|
|
67
|
+
teardownObservers() {
|
|
68
|
+
if (this.entities$$ !== undefined) {
|
|
69
|
+
this.entities$$.unsubscribe();
|
|
70
|
+
}
|
|
71
|
+
if (this.state$$ !== undefined) {
|
|
72
|
+
this.state$$.unsubscribe();
|
|
73
|
+
}
|
|
74
|
+
this.entities$$ = undefined;
|
|
75
|
+
this.state$$ = undefined;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* When the entities change, always trigger the changes detection
|
|
79
|
+
*/
|
|
80
|
+
onEntitiesChange(entities) {
|
|
81
|
+
this.detectChanges();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* When the entities state change, trigger the change detection
|
|
85
|
+
* only if the component has not handled these changes yet. For example,
|
|
86
|
+
* the component might have initiated thoses changes itself.
|
|
87
|
+
*/
|
|
88
|
+
onStateChange() {
|
|
89
|
+
let changesDetected = false;
|
|
90
|
+
const storeIndex = this.store.state.index;
|
|
91
|
+
const innerIndex = this.innerStateIndex;
|
|
92
|
+
if (storeIndex.size !== innerIndex.size) {
|
|
93
|
+
changesDetected = this.detectChanges();
|
|
94
|
+
}
|
|
95
|
+
const storeKeys = Array.from(storeIndex.keys());
|
|
96
|
+
for (const key of storeKeys) {
|
|
97
|
+
const storeValue = storeIndex.get(key);
|
|
98
|
+
const innerValue = innerIndex.get(key);
|
|
99
|
+
if (changesDetected === false) {
|
|
100
|
+
if (innerValue === undefined) {
|
|
101
|
+
changesDetected = this.detectChanges();
|
|
102
|
+
}
|
|
103
|
+
else if (!ObjectUtils.objectsAreEquivalent(storeValue, innerValue)) {
|
|
104
|
+
changesDetected = this.detectChanges();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
this.innerStateIndex.set(key, Object.assign({}, storeValue));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Trigger the change detection of the workspace is bound to a change detector
|
|
112
|
+
*/
|
|
113
|
+
detectChanges() {
|
|
114
|
+
if (this.cdRef !== undefined) {
|
|
115
|
+
this.cdRef.detectChanges();
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2F0Y2hlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbW1vbi9zcmMvbGliL2VudGl0eS9zaGFyZWQvd2F0Y2hlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFdEMsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUsxQzs7Ozs7Ozs7Ozs7O0dBWUc7QUFDSCxNQUFNLE9BQU8sa0JBQWtCO0lBMkI3QixZQUFZLEtBQXNCLEVBQUUsS0FBeUI7UUFmN0Q7O1dBRUc7UUFDSyxvQkFBZSxHQUFHLElBQUksR0FBRyxFQUFtQyxDQUFDO1FBYW5FLElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxLQUFLLENBQ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