@igo2/common 16.3.0 → 17.0.0-next.10
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/action/action.module.d.ts +10 -0
- package/action/actionbar/actionbar-item.component.d.ts +75 -0
- package/action/actionbar/actionbar.component.d.ts +148 -0
- package/action/actionbar/actionbar.module.d.ts +10 -0
- package/action/index.d.ts +5 -0
- package/action/public_api.d.ts +4 -0
- package/action/shared/action.interfaces.d.ts +18 -0
- package/action/shared/store.d.ts +8 -0
- package/action/src/action.theming.scss +5 -0
- package/action/src/actionbar/actionbar-item.theming.scss +32 -0
- package/action/src/actionbar/actionbar.theming.scss +22 -0
- package/backdrop/backdrop.component.d.ts +9 -0
- package/backdrop/backdrop.module.d.ts +12 -0
- package/backdrop/index.d.ts +5 -0
- package/backdrop/public_api.d.ts +2 -0
- package/badge/badge-icon.directive.d.ts +34 -0
- package/badge/badge-icon.module.d.ts +12 -0
- package/badge/index.d.ts +5 -0
- package/badge/public_api.d.ts +2 -0
- package/clickout/clickout.directive.d.ts +10 -0
- package/clickout/clickout.module.d.ts +12 -0
- package/clickout/index.d.ts +5 -0
- package/clickout/public_api.d.ts +2 -0
- package/clone/clone.module.d.ts +12 -0
- package/clone/clone.pipe.d.ts +7 -0
- package/clone/index.d.ts +5 -0
- package/clone/public_api.d.ts +2 -0
- package/collapsible/collapse.directive.d.ts +19 -0
- package/collapsible/collapsible.component.d.ts +13 -0
- package/collapsible/collapsible.module.d.ts +13 -0
- package/collapsible/index.d.ts +5 -0
- package/collapsible/public_api.d.ts +6 -0
- package/collapsible/src/collapsible.theming.scss +22 -0
- package/color/color-picker-form-field/color-picker-form-field.component.d.ts +29 -0
- package/color/color-picker-form-field/color-picker-form-field.module.d.ts +10 -0
- package/color/color-picker-form-field/index.d.ts +2 -0
- package/color/index.d.ts +5 -0
- package/color/public_api.d.ts +1 -0
- package/confirm-dialog/confirm-dialog.component.d.ts +12 -0
- package/confirm-dialog/confirm-dialog.module.d.ts +12 -0
- package/confirm-dialog/index.d.ts +5 -0
- package/confirm-dialog/public_api.d.ts +4 -0
- package/context-menu/context-menu.directive.d.ts +21 -0
- package/context-menu/context-menu.module.d.ts +13 -0
- package/context-menu/index.d.ts +5 -0
- package/context-menu/long-press.directive.d.ts +20 -0
- package/context-menu/public_api.d.ts +6 -0
- package/custom-html/custom-html.component.d.ts +9 -0
- package/custom-html/custom-html.module.d.ts +13 -0
- package/custom-html/custom-html.pipe.d.ts +10 -0
- package/custom-html/index.d.ts +5 -0
- package/custom-html/public_api.d.ts +6 -0
- package/dom/dom.module.d.ts +14 -0
- package/dom/index.d.ts +5 -0
- package/dom/public_api.d.ts +3 -0
- package/drag-drop/drag-drop.directive.d.ts +14 -0
- package/drag-drop/drag-drop.module.d.ts +12 -0
- package/drag-drop/index.d.ts +5 -0
- package/drag-drop/public_api.d.ts +2 -0
- package/dynamic-component/dynamic-component.module.d.ts +10 -0
- package/dynamic-component/dynamic-outlet/dynamic-outlet.component.d.ts +70 -0
- package/dynamic-component/dynamic-outlet/dynamic-outlet.module.d.ts +10 -0
- package/dynamic-component/index.d.ts +5 -0
- package/dynamic-component/public_api.d.ts +4 -0
- package/entity/entity-selector/entity-selector.component.d.ts +93 -0
- package/entity/entity-selector/entity-selector.module.d.ts +10 -0
- package/entity/entity-selector/index.d.ts +2 -0
- package/entity/entity-table/entity-table-row.directive.d.ts +69 -0
- package/entity/entity-table/entity-table.component.d.ts +342 -0
- package/entity/entity-table/entity-table.module.d.ts +10 -0
- package/entity/entity-table/index.d.ts +2 -0
- package/entity/entity-table-paginator/entity-table-paginator.component.d.ts +50 -0
- package/entity/entity-table-paginator/entity-table-paginator.module.d.ts +10 -0
- package/entity/entity-table-paginator/index.d.ts +3 -0
- package/entity/entity.module.d.ts +16 -0
- package/entity/index.d.ts +5 -0
- package/entity/public_api.d.ts +5 -0
- package/entity/shared/entity.interfaces.d.ts +102 -0
- package/entity/shared/transaction.d.ts +179 -0
- package/entity/src/entity-selector/entity-selector.theming.scss +21 -0
- package/entity/src/entity-table/entity-table.theming.scss +37 -0
- package/entity/src/entity.theming.scss +7 -0
- package/environment/index.d.ts +5 -0
- package/esm2022/action/action.module.mjs +19 -0
- package/esm2022/action/actionbar/actionbar-item.component.mjs +192 -0
- package/esm2022/action/actionbar/actionbar.component.mjs +277 -0
- package/esm2022/action/actionbar/actionbar.module.mjs +19 -0
- package/esm2022/action/igo2-common-action.mjs +5 -0
- package/esm2022/action/public_api.mjs +5 -0
- package/esm2022/action/shared/action.enums.mjs +7 -0
- package/esm2022/action/shared/action.interfaces.mjs +2 -0
- package/esm2022/action/shared/index.mjs +4 -0
- package/esm2022/action/shared/store.mjs +8 -0
- package/esm2022/backdrop/backdrop.component.mjs +22 -0
- package/esm2022/backdrop/backdrop.module.mjs +25 -0
- package/esm2022/backdrop/igo2-common-backdrop.mjs +5 -0
- package/esm2022/backdrop/public_api.mjs +3 -0
- package/esm2022/badge/badge-icon.directive.mjs +149 -0
- package/esm2022/badge/badge-icon.module.mjs +25 -0
- package/esm2022/badge/igo2-common-badge.mjs +5 -0
- package/esm2022/badge/public_api.mjs +3 -0
- package/esm2022/clickout/clickout.directive.mjs +32 -0
- package/esm2022/clickout/clickout.module.mjs +25 -0
- package/esm2022/clickout/igo2-common-clickout.mjs +5 -0
- package/esm2022/clickout/public_api.mjs +3 -0
- package/esm2022/clone/clone.module.mjs +25 -0
- package/esm2022/clone/clone.pipe.mjs +25 -0
- package/esm2022/clone/igo2-common-clone.mjs +5 -0
- package/esm2022/clone/public_api.mjs +3 -0
- package/esm2022/collapsible/collapse.directive.mjs +57 -0
- package/esm2022/collapsible/collapsible.component.mjs +38 -0
- package/esm2022/collapsible/collapsible.module.mjs +26 -0
- package/esm2022/collapsible/igo2-common-collapsible.mjs +5 -0
- package/esm2022/collapsible/public_api.mjs +10 -0
- package/esm2022/color/color-picker-form-field/color-picker-form-field.component.mjs +104 -0
- package/esm2022/color/color-picker-form-field/color-picker-form-field.module.mjs +19 -0
- package/esm2022/color/color-picker-form-field/index.mjs +3 -0
- package/esm2022/color/igo2-common-color.mjs +5 -0
- package/esm2022/color/public_api.mjs +2 -0
- package/esm2022/confirm-dialog/confirm-dialog.component.mjs +31 -0
- package/esm2022/confirm-dialog/confirm-dialog.interface.mjs +2 -0
- package/esm2022/confirm-dialog/confirm-dialog.module.mjs +27 -0
- package/esm2022/confirm-dialog/confirm-dialog.service.mjs +35 -0
- package/esm2022/confirm-dialog/igo2-common-confirm-dialog.mjs +5 -0
- package/esm2022/confirm-dialog/public_api.mjs +5 -0
- package/esm2022/context-menu/context-menu.directive.mjs +109 -0
- package/esm2022/context-menu/context-menu.module.mjs +26 -0
- package/esm2022/context-menu/igo2-common-context-menu.mjs +5 -0
- package/esm2022/context-menu/long-press.directive.mjs +66 -0
- package/esm2022/context-menu/public_api.mjs +10 -0
- package/esm2022/custom-html/custom-html.component.mjs +22 -0
- package/esm2022/custom-html/custom-html.module.mjs +25 -0
- package/esm2022/custom-html/custom-html.pipe.mjs +23 -0
- package/esm2022/custom-html/igo2-common-custom-html.mjs +5 -0
- package/esm2022/custom-html/public_api.mjs +10 -0
- package/esm2022/dom/dom.interfaces.mjs +2 -0
- package/esm2022/dom/dom.module.mjs +27 -0
- package/esm2022/dom/dom.service.mjs +35 -0
- package/esm2022/dom/igo2-common-dom.mjs +5 -0
- package/esm2022/dom/public_api.mjs +4 -0
- package/esm2022/drag-drop/drag-drop.directive.mjs +82 -0
- package/esm2022/drag-drop/drag-drop.module.mjs +25 -0
- package/esm2022/drag-drop/igo2-common-drag-drop.mjs +5 -0
- package/esm2022/drag-drop/public_api.mjs +3 -0
- package/esm2022/dynamic-component/dynamic-component.module.mjs +19 -0
- package/esm2022/dynamic-component/dynamic-outlet/dynamic-outlet.component.mjs +129 -0
- package/esm2022/dynamic-component/dynamic-outlet/dynamic-outlet.module.mjs +19 -0
- package/esm2022/dynamic-component/igo2-common-dynamic-component.mjs +5 -0
- package/esm2022/dynamic-component/public_api.mjs +5 -0
- package/esm2022/dynamic-component/shared/dynamic-component.interfaces.mjs +2 -0
- package/esm2022/dynamic-component/shared/dynamic-component.mjs +183 -0
- package/esm2022/dynamic-component/shared/dynamic-component.service.mjs +30 -0
- package/esm2022/dynamic-component/shared/index.mjs +4 -0
- package/esm2022/entity/entity-selector/entity-selector.component.mjs +174 -0
- package/esm2022/entity/entity-selector/entity-selector.module.mjs +19 -0
- package/esm2022/entity/entity-selector/index.mjs +3 -0
- package/esm2022/entity/entity-table/entity-table-row.directive.mjs +138 -0
- package/esm2022/entity/entity-table/entity-table.component.mjs +883 -0
- package/esm2022/entity/entity-table/entity-table.module.mjs +19 -0
- package/esm2022/entity/entity-table/index.mjs +3 -0
- package/esm2022/entity/entity-table-paginator/entity-table-paginator.component.mjs +158 -0
- package/esm2022/entity/entity-table-paginator/entity-table-paginator.interface.mjs +2 -0
- package/esm2022/entity/entity-table-paginator/entity-table-paginator.module.mjs +19 -0
- package/esm2022/entity/entity-table-paginator/index.mjs +4 -0
- package/esm2022/entity/entity.module.mjs +30 -0
- package/esm2022/entity/igo2-common-entity.mjs +5 -0
- package/esm2022/entity/public_api.mjs +6 -0
- package/esm2022/entity/shared/entity.enums.mjs +28 -0
- package/esm2022/entity/shared/entity.interfaces.mjs +2 -0
- package/esm2022/entity/shared/entity.utils.mjs +73 -0
- package/esm2022/entity/shared/index.mjs +10 -0
- package/esm2022/entity/shared/state.mjs +194 -0
- package/esm2022/entity/shared/store.mjs +322 -0
- package/esm2022/entity/shared/strategies/filter-custom-function.mjs +80 -0
- package/esm2022/entity/shared/strategies/filter-selection.mjs +81 -0
- package/esm2022/entity/shared/strategies/index.mjs +4 -0
- package/esm2022/entity/shared/strategies/strategy.mjs +78 -0
- package/esm2022/entity/shared/transaction.mjs +329 -0
- package/esm2022/entity/shared/view.mjs +330 -0
- package/esm2022/entity/shared/watcher.mjs +135 -0
- package/esm2022/environment/environment.interface.mjs +2 -0
- package/esm2022/environment/igo2-common-environment.mjs +5 -0
- package/esm2022/environment/public_api.mjs +2 -0
- package/esm2022/flexible/flexible.component.mjs +135 -0
- package/esm2022/flexible/flexible.module.mjs +25 -0
- package/esm2022/flexible/flexible.type.mjs +2 -0
- package/esm2022/flexible/igo2-common-flexible.mjs +5 -0
- package/esm2022/flexible/public_api.mjs +4 -0
- package/esm2022/form/form/form.component.mjs +103 -0
- package/esm2022/form/form/form.module.mjs +19 -0
- package/esm2022/form/form/index.mjs +3 -0
- package/esm2022/form/form-dialog/form-dialog.component.mjs +94 -0
- package/esm2022/form/form-dialog/form-dialog.interface.mjs +2 -0
- package/esm2022/form/form-dialog/form-dialog.module.mjs +31 -0
- package/esm2022/form/form-dialog/form-dialog.service.mjs +30 -0
- package/esm2022/form/form-dialog/index.mjs +5 -0
- package/esm2022/form/form-field/form-field-select.component.mjs +117 -0
- package/esm2022/form/form-field/form-field-text.component.mjs +126 -0
- package/esm2022/form/form-field/form-field-textarea.component.mjs +95 -0
- package/esm2022/form/form-field/form-field.component.mjs +65 -0
- package/esm2022/form/form-field/form-field.directive.mjs +11 -0
- package/esm2022/form/form-field/form-field.module.mjs +23 -0
- package/esm2022/form/form-field/index.mjs +7 -0
- package/esm2022/form/form-group/form-group.component.mjs +82 -0
- package/esm2022/form/form-group/form-group.module.mjs +19 -0
- package/esm2022/form/form-group/index.mjs +3 -0
- package/esm2022/form/form.module.mjs +32 -0
- package/esm2022/form/igo2-common-form.mjs +5 -0
- package/esm2022/form/public_api.mjs +7 -0
- package/esm2022/form/shared/form-field-component.mjs +7 -0
- package/esm2022/form/shared/form-field.service.mjs +29 -0
- package/esm2022/form/shared/form.interfaces.mjs +2 -0
- package/esm2022/form/shared/form.service.mjs +82 -0
- package/esm2022/form/shared/form.utils.mjs +41 -0
- package/esm2022/form/shared/index.mjs +6 -0
- package/esm2022/home-button/home-button.component.mjs +26 -0
- package/esm2022/home-button/home-button.module.mjs +19 -0
- package/esm2022/home-button/igo2-common-home-button.mjs +5 -0
- package/esm2022/home-button/public_api.mjs +3 -0
- package/esm2022/icon/icon/icon.component.mjs +38 -0
- package/esm2022/icon/icon.provider.mjs +14 -0
- package/esm2022/icon/igo2-common-icon.mjs +5 -0
- package/esm2022/icon/public_api.mjs +4 -0
- package/esm2022/icon/shared/icon.interface.mjs +2 -0
- package/esm2022/icon/shared/icon.service.mjs +26 -0
- package/esm2022/icon/shared/icons.mjs +32 -0
- package/esm2022/icon/shared/index.mjs +4 -0
- package/esm2022/image/igo2-common-image.mjs +5 -0
- package/esm2022/image/image-error.directive.mjs +35 -0
- package/esm2022/image/image.module.mjs +26 -0
- package/esm2022/image/public_api.mjs +7 -0
- package/esm2022/image/secure-image.pipe.mjs +66 -0
- package/esm2022/interactive-tour/igo2-common-interactive-tour.mjs +5 -0
- package/esm2022/interactive-tour/interactive-tour.component.mjs +133 -0
- package/esm2022/interactive-tour/interactive-tour.interface.mjs +2 -0
- package/esm2022/interactive-tour/interactive-tour.loader.mjs +49 -0
- package/esm2022/interactive-tour/interactive-tour.module.mjs +19 -0
- package/esm2022/interactive-tour/interactive-tour.service.mjs +303 -0
- package/esm2022/interactive-tour/public_api.mjs +6 -0
- package/esm2022/json-dialog/igo2-common-json-dialog.mjs +5 -0
- package/esm2022/json-dialog/json-dialog.component.mjs +38 -0
- package/esm2022/json-dialog/json-dialog.module.mjs +26 -0
- package/esm2022/json-dialog/json-dialog.service.mjs +26 -0
- package/esm2022/json-dialog/public_api.mjs +4 -0
- package/esm2022/keyvalue/igo2-common-keyvalue.mjs +5 -0
- package/esm2022/keyvalue/keyvalue.module.mjs +25 -0
- package/esm2022/keyvalue/keyvalue.pipe.mjs +19 -0
- package/esm2022/keyvalue/public_api.mjs +3 -0
- package/esm2022/list/igo2-common-list.mjs +5 -0
- package/esm2022/list/list-item.directive.mjs +166 -0
- package/esm2022/list/list.component.mjs +252 -0
- package/esm2022/list/list.module.mjs +26 -0
- package/esm2022/list/public_api.mjs +7 -0
- package/esm2022/panel/igo2-common-panel.mjs +5 -0
- package/esm2022/panel/panel.component.mjs +30 -0
- package/esm2022/panel/panel.module.mjs +19 -0
- package/esm2022/panel/public_api.mjs +3 -0
- package/esm2022/public_api.mjs +17 -78
- package/esm2022/select-value-dialog/igo2-common-select-value-dialog.mjs +5 -0
- package/esm2022/select-value-dialog/public_api.mjs +6 -0
- package/esm2022/select-value-dialog/select-value-check-radio-dialog.component.mjs +103 -0
- package/esm2022/select-value-dialog/select-value-dialog.enums.mjs +6 -0
- package/esm2022/select-value-dialog/select-value-dialog.interface.mjs +2 -0
- package/esm2022/select-value-dialog/select-value-dialog.module.mjs +27 -0
- package/esm2022/select-value-dialog/select-value-dialog.service.mjs +29 -0
- package/esm2022/sidenav/igo2-common-sidenav.mjs +5 -0
- package/esm2022/sidenav/public_api.mjs +3 -0
- package/esm2022/sidenav/sidenav-shim.directive.mjs +58 -0
- package/esm2022/sidenav/sidenav.module.mjs +25 -0
- package/esm2022/spinner/igo2-common-spinner.mjs +5 -0
- package/esm2022/spinner/public_api.mjs +4 -0
- package/esm2022/spinner/spinner-activity.directive.mjs +56 -0
- package/esm2022/spinner/spinner.component.mjs +30 -0
- package/esm2022/spinner/spinner.module.mjs +26 -0
- package/esm2022/stop-propagation/igo2-common-stop-propagation.mjs +5 -0
- package/esm2022/stop-propagation/public_api.mjs +10 -0
- package/esm2022/stop-propagation/stop-drop-propagation.directive.mjs +21 -0
- package/esm2022/stop-propagation/stop-propagation.directive.mjs +20 -0
- package/esm2022/stop-propagation/stop-propagation.module.mjs +26 -0
- package/esm2022/table/igo2-common-table.mjs +5 -0
- package/esm2022/table/public_api.mjs +7 -0
- package/esm2022/table/table-action-color.enum.mjs +7 -0
- package/esm2022/table/table-database.mjs +28 -0
- package/esm2022/table/table-datasource.mjs +64 -0
- package/esm2022/table/table-model.interface.mjs +2 -0
- package/esm2022/table/table.component.mjs +143 -0
- package/esm2022/table/table.module.mjs +25 -0
- package/esm2022/tool/igo2-common-tool.mjs +5 -0
- package/esm2022/tool/public_api.mjs +4 -0
- package/esm2022/tool/shared/index.mjs +6 -0
- package/esm2022/tool/shared/tool-component.mjs +9 -0
- package/esm2022/tool/shared/tool.interface.mjs +2 -0
- package/esm2022/tool/shared/tool.service.mjs +43 -0
- package/esm2022/tool/shared/toolbox.enums.mjs +2 -0
- package/esm2022/tool/shared/toolbox.mjs +192 -0
- package/esm2022/tool/tool.module.mjs +28 -0
- package/esm2022/tool/toolbox/index.mjs +3 -0
- package/esm2022/tool/toolbox/toolbox.animation.mjs +10 -0
- package/esm2022/tool/toolbox/toolbox.component.mjs +241 -0
- package/esm2022/tool/toolbox/toolbox.module.mjs +19 -0
- package/esm2022/widget/igo2-common-widget.mjs +5 -0
- package/esm2022/widget/public_api.mjs +4 -0
- package/esm2022/widget/shared/index.mjs +4 -0
- package/esm2022/widget/shared/widget.interfaces.mjs +2 -0
- package/esm2022/widget/shared/widget.mjs +4 -0
- package/esm2022/widget/shared/widget.service.mjs +22 -0
- package/esm2022/widget/widget-outlet/index.mjs +3 -0
- package/esm2022/widget/widget-outlet/widget-outlet.component.mjs +113 -0
- package/esm2022/widget/widget-outlet/widget-outlet.module.mjs +19 -0
- package/esm2022/widget/widget.module.mjs +22 -0
- package/esm2022/workspace/igo2-common-workspace.mjs +5 -0
- package/esm2022/workspace/public_api.mjs +5 -0
- package/esm2022/workspace/shared/index.mjs +4 -0
- package/esm2022/workspace/shared/store.mjs +37 -0
- package/esm2022/workspace/shared/workspace.interfaces.mjs +2 -0
- package/esm2022/workspace/shared/workspace.mjs +143 -0
- package/esm2022/workspace/workspace-selector/index.mjs +3 -0
- package/esm2022/workspace/workspace-selector/workspace-selector.component.mjs +51 -0
- package/esm2022/workspace/workspace-selector/workspace-selector.module.mjs +19 -0
- package/esm2022/workspace/workspace-widget-outlet/index.mjs +3 -0
- package/esm2022/workspace/workspace-widget-outlet/workspace-widget-outlet.component.mjs +74 -0
- package/esm2022/workspace/workspace-widget-outlet/workspace-widget-outlet.module.mjs +19 -0
- package/esm2022/workspace/workspace.module.mjs +27 -0
- package/fesm2022/igo2-common-action.mjs +505 -0
- package/fesm2022/igo2-common-action.mjs.map +1 -0
- package/fesm2022/igo2-common-backdrop.mjs +51 -0
- package/fesm2022/igo2-common-backdrop.mjs.map +1 -0
- package/fesm2022/igo2-common-badge.mjs +178 -0
- package/fesm2022/igo2-common-badge.mjs.map +1 -0
- package/fesm2022/igo2-common-clickout.mjs +61 -0
- package/fesm2022/igo2-common-clickout.mjs.map +1 -0
- package/fesm2022/igo2-common-clone.mjs +54 -0
- package/fesm2022/igo2-common-clone.mjs.map +1 -0
- package/fesm2022/igo2-common-collapsible.mjs +126 -0
- package/fesm2022/igo2-common-collapsible.mjs.map +1 -0
- package/fesm2022/igo2-common-color.mjs +127 -0
- package/fesm2022/igo2-common-color.mjs.map +1 -0
- package/fesm2022/igo2-common-confirm-dialog.mjs +91 -0
- package/fesm2022/igo2-common-confirm-dialog.mjs.map +1 -0
- package/fesm2022/igo2-common-context-menu.mjs +206 -0
- package/fesm2022/igo2-common-context-menu.mjs.map +1 -0
- package/fesm2022/igo2-common-custom-html.mjs +74 -0
- package/fesm2022/igo2-common-custom-html.mjs.map +1 -0
- package/fesm2022/igo2-common-dom.mjs +65 -0
- package/fesm2022/igo2-common-dom.mjs.map +1 -0
- package/fesm2022/igo2-common-drag-drop.mjs +111 -0
- package/fesm2022/igo2-common-drag-drop.mjs.map +1 -0
- package/fesm2022/igo2-common-dynamic-component.mjs +375 -0
- package/fesm2022/igo2-common-dynamic-component.mjs.map +1 -0
- package/fesm2022/igo2-common-entity.mjs +3036 -0
- package/fesm2022/igo2-common-entity.mjs.map +1 -0
- package/fesm2022/igo2-common-environment.mjs +4 -0
- package/fesm2022/igo2-common-environment.mjs.map +1 -0
- package/fesm2022/igo2-common-flexible.mjs +163 -0
- package/fesm2022/igo2-common-flexible.mjs.map +1 -0
- package/fesm2022/igo2-common-form.mjs +898 -0
- package/fesm2022/igo2-common-form.mjs.map +1 -0
- package/fesm2022/igo2-common-home-button.mjs +49 -0
- package/fesm2022/igo2-common-home-button.mjs.map +1 -0
- package/fesm2022/igo2-common-icon.mjs +108 -0
- package/fesm2022/igo2-common-icon.mjs.map +1 -0
- package/fesm2022/igo2-common-image.mjs +129 -0
- package/fesm2022/igo2-common-image.mjs.map +1 -0
- package/fesm2022/igo2-common-interactive-tour.mjs +490 -0
- package/fesm2022/igo2-common-interactive-tour.mjs.map +1 -0
- package/fesm2022/igo2-common-json-dialog.mjs +88 -0
- package/fesm2022/igo2-common-json-dialog.mjs.map +1 -0
- package/fesm2022/igo2-common-keyvalue.mjs +48 -0
- package/fesm2022/igo2-common-keyvalue.mjs.map +1 -0
- package/fesm2022/igo2-common-list.mjs +446 -0
- package/fesm2022/igo2-common-list.mjs.map +1 -0
- package/fesm2022/igo2-common-panel.mjs +53 -0
- package/fesm2022/igo2-common-panel.mjs.map +1 -0
- package/fesm2022/igo2-common-select-value-dialog.mjs +161 -0
- package/fesm2022/igo2-common-select-value-dialog.mjs.map +1 -0
- package/fesm2022/igo2-common-sidenav.mjs +86 -0
- package/fesm2022/igo2-common-sidenav.mjs.map +1 -0
- package/fesm2022/igo2-common-spinner.mjs +110 -0
- package/fesm2022/igo2-common-spinner.mjs.map +1 -0
- package/fesm2022/igo2-common-stop-propagation.mjs +73 -0
- package/fesm2022/igo2-common-stop-propagation.mjs.map +1 -0
- package/fesm2022/igo2-common-table.mjs +264 -0
- package/fesm2022/igo2-common-table.mjs.map +1 -0
- package/fesm2022/igo2-common-tool.mjs +535 -0
- package/fesm2022/igo2-common-tool.mjs.map +1 -0
- package/fesm2022/igo2-common-widget.mjs +176 -0
- package/fesm2022/igo2-common-widget.mjs.map +1 -0
- package/fesm2022/igo2-common-workspace.mjs +361 -0
- package/fesm2022/igo2-common-workspace.mjs.map +1 -0
- package/fesm2022/igo2-common.mjs +16 -8760
- package/fesm2022/igo2-common.mjs.map +1 -1
- package/flexible/flexible.component.d.ts +41 -0
- package/flexible/flexible.module.d.ts +12 -0
- package/flexible/index.d.ts +5 -0
- package/flexible/public_api.d.ts +3 -0
- package/form/form/form.component.d.ts +53 -0
- package/form/form/form.module.d.ts +10 -0
- package/form/form/index.d.ts +2 -0
- package/form/form-dialog/form-dialog.component.d.ts +23 -0
- package/form/form-dialog/form-dialog.interface.d.ts +18 -0
- package/form/form-dialog/form-dialog.module.d.ts +16 -0
- package/form/form-dialog/index.d.ts +4 -0
- package/form/form-field/form-field-select.component.d.ts +52 -0
- package/form/form-field/form-field-text.component.d.ts +51 -0
- package/form/form-field/form-field-textarea.component.d.ts +41 -0
- package/form/form-field/form-field.component.d.ts +29 -0
- package/form/form-field/form-field.directive.d.ts +5 -0
- package/form/form-field/form-field.module.d.ts +13 -0
- package/form/form-field/index.d.ts +6 -0
- package/form/form-group/form-group.component.d.ts +49 -0
- package/form/form-group/form-group.module.d.ts +10 -0
- package/form/form-group/index.d.ts +2 -0
- package/form/form.module.d.ts +18 -0
- package/form/index.d.ts +5 -0
- package/form/public_api.d.ts +6 -0
- package/home-button/home-button.component.d.ts +9 -0
- package/home-button/home-button.module.d.ts +10 -0
- package/home-button/index.d.ts +5 -0
- package/home-button/public_api.d.ts +2 -0
- package/home-button/src/home-button.theming.scss +18 -0
- package/icon/icon/icon.component.d.ts +14 -0
- package/icon/icon.provider.d.ts +4 -0
- package/icon/index.d.ts +5 -0
- package/icon/public_api.d.ts +3 -0
- package/icon/shared/icon.interface.d.ts +4 -0
- package/icon/shared/icon.service.d.ts +12 -0
- package/icon/shared/icons.d.ts +9 -0
- package/icon/shared/index.d.ts +3 -0
- package/image/image-error.directive.d.ts +11 -0
- package/image/image.module.d.ts +13 -0
- package/image/index.d.ts +5 -0
- package/image/public_api.d.ts +6 -0
- package/image/secure-image.pipe.d.ts +13 -0
- package/interactive-tour/index.d.ts +5 -0
- package/interactive-tour/interactive-tour.component.d.ts +33 -0
- package/interactive-tour/interactive-tour.loader.d.ts +18 -0
- package/interactive-tour/interactive-tour.module.d.ts +7 -0
- package/interactive-tour/interactive-tour.service.d.ts +31 -0
- package/interactive-tour/public_api.d.ts +5 -0
- package/interactive-tour/src/interactive-tour.theming.scss +32 -0
- package/json-dialog/index.d.ts +5 -0
- package/json-dialog/json-dialog.component.d.ts +13 -0
- package/json-dialog/json-dialog.module.d.ts +12 -0
- package/json-dialog/public_api.d.ts +3 -0
- package/keyvalue/index.d.ts +5 -0
- package/keyvalue/keyvalue.module.d.ts +12 -0
- package/keyvalue/keyvalue.pipe.d.ts +7 -0
- package/keyvalue/public_api.d.ts +2 -0
- package/list/index.d.ts +5 -0
- package/list/list-item.directive.d.ts +43 -0
- package/list/list.component.d.ts +51 -0
- package/list/list.module.d.ts +13 -0
- package/list/public_api.d.ts +6 -0
- package/list/src/list.theming.scss +58 -0
- package/locale/en.common.json +59 -59
- package/locale/fr.common.json +59 -59
- package/package.json +206 -8
- package/panel/index.d.ts +5 -0
- package/panel/panel.component.d.ts +10 -0
- package/panel/panel.module.d.ts +10 -0
- package/panel/public_api.d.ts +2 -0
- package/panel/src/panel.theming.scss +30 -0
- package/public_api.d.ts +16 -77
- package/select-value-dialog/index.d.ts +5 -0
- package/select-value-dialog/public_api.d.ts +5 -0
- package/select-value-dialog/select-value-check-radio-dialog.component.d.ts +25 -0
- package/select-value-dialog/select-value-dialog.module.d.ts +12 -0
- package/sidenav/index.d.ts +5 -0
- package/sidenav/public_api.d.ts +2 -0
- package/sidenav/sidenav-shim.directive.d.ts +20 -0
- package/sidenav/sidenav.module.d.ts +12 -0
- package/spinner/index.d.ts +5 -0
- package/spinner/public_api.d.ts +3 -0
- package/spinner/spinner-activity.directive.d.ts +32 -0
- package/spinner/spinner.component.d.ts +12 -0
- package/spinner/spinner.module.d.ts +14 -0
- package/src/common-theme.scss +19 -19
- package/src/style/partial/common-utils.scss +9 -9
- package/src/style/partial/common.variables.scss +8 -8
- package/src/style/style.scss +1 -1
- package/stop-propagation/index.d.ts +5 -0
- package/stop-propagation/public_api.d.ts +6 -0
- package/stop-propagation/stop-drop-propagation.directive.d.ts +6 -0
- package/stop-propagation/stop-propagation.directive.d.ts +6 -0
- package/stop-propagation/stop-propagation.module.d.ts +13 -0
- package/table/index.d.ts +5 -0
- package/table/public_api.d.ts +6 -0
- package/table/table.component.d.ts +40 -0
- package/table/table.module.d.ts +12 -0
- package/tool/index.d.ts +5 -0
- package/tool/public_api.d.ts +3 -0
- package/tool/shared/tool.interface.d.ts +18 -0
- package/tool/shared/toolbox.d.ts +98 -0
- package/tool/shared/toolbox.enums.d.ts +1 -0
- package/tool/src/tool.theming.scss +5 -0
- package/tool/src/toolbox/toolbox.theming.scss +105 -0
- package/tool/tool.module.d.ts +15 -0
- package/tool/toolbox/index.d.ts +2 -0
- package/tool/toolbox/toolbox.component.d.ts +128 -0
- package/tool/toolbox/toolbox.module.d.ts +10 -0
- package/widget/index.d.ts +5 -0
- package/widget/public_api.d.ts +3 -0
- package/widget/shared/widget.d.ts +4 -0
- package/widget/shared/widget.service.d.ts +10 -0
- package/widget/widget-outlet/index.d.ts +2 -0
- package/widget/widget-outlet/widget-outlet.component.d.ts +71 -0
- package/widget/widget-outlet/widget-outlet.module.d.ts +10 -0
- package/widget/widget.module.d.ts +10 -0
- package/workspace/index.d.ts +5 -0
- package/workspace/public_api.d.ts +4 -0
- package/workspace/shared/store.d.ts +20 -0
- package/workspace/shared/workspace.d.ts +108 -0
- package/workspace/shared/workspace.interfaces.d.ts +11 -0
- package/workspace/workspace-selector/index.d.ts +2 -0
- package/workspace/workspace-selector/workspace-selector.component.d.ts +38 -0
- package/workspace/workspace-selector/workspace-selector.module.d.ts +10 -0
- package/workspace/workspace-widget-outlet/index.d.ts +2 -0
- package/workspace/workspace-widget-outlet/workspace-widget-outlet.component.d.ts +57 -0
- package/workspace/workspace-widget-outlet/workspace-widget-outlet.module.d.ts +10 -0
- package/workspace/workspace.module.d.ts +14 -0
- package/esm2022/lib/action/action.module.mjs +0 -19
- package/esm2022/lib/action/actionbar/actionbar-item.component.mjs +0 -190
- package/esm2022/lib/action/actionbar/actionbar.component.mjs +0 -258
- package/esm2022/lib/action/actionbar/actionbar.module.mjs +0 -56
- package/esm2022/lib/action/index.mjs +0 -3
- package/esm2022/lib/action/shared/action.enums.mjs +0 -7
- package/esm2022/lib/action/shared/action.interfaces.mjs +0 -2
- package/esm2022/lib/action/shared/index.mjs +0 -4
- package/esm2022/lib/action/shared/store.mjs +0 -8
- package/esm2022/lib/backdrop/backdrop.component.mjs +0 -22
- package/esm2022/lib/backdrop/backdrop.module.mjs +0 -24
- package/esm2022/lib/backdrop/index.mjs +0 -2
- package/esm2022/lib/badge-icon/badge-icon.directive.mjs +0 -150
- package/esm2022/lib/badge-icon/badge-icon.module.mjs +0 -25
- package/esm2022/lib/badge-icon/index.mjs +0 -2
- package/esm2022/lib/clickout/clickout.directive.mjs +0 -31
- package/esm2022/lib/clickout/clickout.module.mjs +0 -23
- package/esm2022/lib/clickout/index.mjs +0 -2
- package/esm2022/lib/clone/clone.module.mjs +0 -23
- package/esm2022/lib/clone/clone.pipe.mjs +0 -24
- package/esm2022/lib/clone/index.mjs +0 -2
- package/esm2022/lib/collapsible/collapse.directive.mjs +0 -56
- package/esm2022/lib/collapsible/collapsible.component.mjs +0 -36
- package/esm2022/lib/collapsible/collapsible.module.mjs +0 -26
- package/esm2022/lib/collapsible/index.mjs +0 -3
- package/esm2022/lib/color-picker-form-field/color-picker-form-field.component.mjs +0 -91
- package/esm2022/lib/color-picker-form-field/color-picker-form-field.module.mjs +0 -51
- package/esm2022/lib/color-picker-form-field/index.mjs +0 -2
- package/esm2022/lib/confirm-dialog/confirm-dialog.component.mjs +0 -23
- package/esm2022/lib/confirm-dialog/confirm-dialog.interface.mjs +0 -2
- package/esm2022/lib/confirm-dialog/confirm-dialog.module.mjs +0 -28
- package/esm2022/lib/confirm-dialog/confirm-dialog.service.mjs +0 -34
- package/esm2022/lib/confirm-dialog/index.mjs +0 -4
- package/esm2022/lib/context-menu/context-menu.directive.mjs +0 -108
- package/esm2022/lib/context-menu/context-menu.module.mjs +0 -24
- package/esm2022/lib/context-menu/index.mjs +0 -3
- package/esm2022/lib/context-menu/long-press.directive.mjs +0 -65
- package/esm2022/lib/custom-html/custom-html.component.mjs +0 -22
- package/esm2022/lib/custom-html/custom-html.module.mjs +0 -46
- package/esm2022/lib/custom-html/custom-html.pipe.mjs +0 -20
- package/esm2022/lib/custom-html/index.mjs +0 -3
- package/esm2022/lib/dom/dom.interfaces.mjs +0 -2
- package/esm2022/lib/dom/dom.module.mjs +0 -21
- package/esm2022/lib/dom/dom.service.mjs +0 -35
- package/esm2022/lib/dom/index.mjs +0 -3
- package/esm2022/lib/drag-drop/drag-drop.directive.mjs +0 -81
- package/esm2022/lib/drag-drop/drag-drop.module.mjs +0 -23
- package/esm2022/lib/drag-drop/index.mjs +0 -2
- package/esm2022/lib/dynamic-component/dynamic-component.module.mjs +0 -19
- package/esm2022/lib/dynamic-component/dynamic-outlet/dynamic-outlet.component.mjs +0 -129
- package/esm2022/lib/dynamic-component/dynamic-outlet/dynamic-outlet.module.mjs +0 -21
- package/esm2022/lib/dynamic-component/index.mjs +0 -3
- package/esm2022/lib/dynamic-component/shared/dynamic-component.interfaces.mjs +0 -2
- package/esm2022/lib/dynamic-component/shared/dynamic-component.mjs +0 -183
- package/esm2022/lib/dynamic-component/shared/dynamic-component.service.mjs +0 -30
- package/esm2022/lib/dynamic-component/shared/index.mjs +0 -4
- package/esm2022/lib/entity/entity-selector/entity-selector.component.mjs +0 -164
- package/esm2022/lib/entity/entity-selector/entity-selector.module.mjs +0 -23
- package/esm2022/lib/entity/entity-table/entity-table-row.directive.mjs +0 -137
- package/esm2022/lib/entity/entity-table/entity-table.component.mjs +0 -842
- package/esm2022/lib/entity/entity-table/entity-table.module.mjs +0 -95
- package/esm2022/lib/entity/entity-table-paginator/entity-table-paginator.component.mjs +0 -156
- package/esm2022/lib/entity/entity-table-paginator/entity-table-paginator.interface.mjs +0 -2
- package/esm2022/lib/entity/entity-table-paginator/entity-table-paginator.module.mjs +0 -21
- package/esm2022/lib/entity/entity.module.mjs +0 -28
- package/esm2022/lib/entity/index.mjs +0 -6
- package/esm2022/lib/entity/shared/entity.enums.mjs +0 -28
- package/esm2022/lib/entity/shared/entity.interfaces.mjs +0 -2
- package/esm2022/lib/entity/shared/entity.utils.mjs +0 -73
- package/esm2022/lib/entity/shared/index.mjs +0 -10
- package/esm2022/lib/entity/shared/state.mjs +0 -194
- package/esm2022/lib/entity/shared/store.mjs +0 -322
- package/esm2022/lib/entity/shared/strategies/filter-custom-function.mjs +0 -80
- package/esm2022/lib/entity/shared/strategies/filter-selection.mjs +0 -81
- package/esm2022/lib/entity/shared/strategies/index.mjs +0 -4
- package/esm2022/lib/entity/shared/strategies/strategy.mjs +0 -78
- package/esm2022/lib/entity/shared/transaction.mjs +0 -329
- package/esm2022/lib/entity/shared/view.mjs +0 -330
- package/esm2022/lib/entity/shared/watcher.mjs +0 -135
- package/esm2022/lib/environment/environment.interface.mjs +0 -2
- package/esm2022/lib/environment/index.mjs +0 -2
- package/esm2022/lib/flexible/flexible.component.mjs +0 -135
- package/esm2022/lib/flexible/flexible.module.mjs +0 -23
- package/esm2022/lib/flexible/flexible.type.mjs +0 -2
- package/esm2022/lib/flexible/index.mjs +0 -3
- package/esm2022/lib/form/form/form.component.mjs +0 -102
- package/esm2022/lib/form/form/form.module.mjs +0 -22
- package/esm2022/lib/form/form-field/form-field-select.component.mjs +0 -99
- package/esm2022/lib/form/form-field/form-field-text.component.mjs +0 -109
- package/esm2022/lib/form/form-field/form-field-textarea.component.mjs +0 -80
- package/esm2022/lib/form/form-field/form-field.component.mjs +0 -65
- package/esm2022/lib/form/form-field/form-field.module.mjs +0 -77
- package/esm2022/lib/form/form-field/index.mjs +0 -5
- package/esm2022/lib/form/form-group/form-group.component.mjs +0 -73
- package/esm2022/lib/form/form-group/form-group.module.mjs +0 -35
- package/esm2022/lib/form/form.module.mjs +0 -26
- package/esm2022/lib/form/index.mjs +0 -5
- package/esm2022/lib/form/shared/form-field-component.mjs +0 -7
- package/esm2022/lib/form/shared/form-field.service.mjs +0 -29
- package/esm2022/lib/form/shared/form.interfaces.mjs +0 -2
- package/esm2022/lib/form/shared/form.service.mjs +0 -82
- package/esm2022/lib/form/shared/form.utils.mjs +0 -41
- package/esm2022/lib/form/shared/index.mjs +0 -6
- package/esm2022/lib/form-dialog/form-dialog.component.mjs +0 -80
- package/esm2022/lib/form-dialog/form-dialog.interface.mjs +0 -2
- package/esm2022/lib/form-dialog/form-dialog.module.mjs +0 -52
- package/esm2022/lib/form-dialog/form-dialog.service.mjs +0 -30
- package/esm2022/lib/form-dialog/index.mjs +0 -4
- package/esm2022/lib/home-button/home-button.component.mjs +0 -22
- package/esm2022/lib/home-button/home-button.module.mjs +0 -40
- package/esm2022/lib/home-button/index.mjs +0 -2
- package/esm2022/lib/image/image-error.directive.mjs +0 -34
- package/esm2022/lib/image/image.module.mjs +0 -24
- package/esm2022/lib/image/index.mjs +0 -3
- package/esm2022/lib/image/secure-image.pipe.mjs +0 -65
- package/esm2022/lib/interactive-tour/index.mjs +0 -5
- package/esm2022/lib/interactive-tour/interactive-tour.component.mjs +0 -114
- package/esm2022/lib/interactive-tour/interactive-tour.interface.mjs +0 -2
- package/esm2022/lib/interactive-tour/interactive-tour.loader.mjs +0 -49
- package/esm2022/lib/interactive-tour/interactive-tour.module.mjs +0 -39
- package/esm2022/lib/interactive-tour/interactive-tour.service.mjs +0 -299
- package/esm2022/lib/json-dialog/index.mjs +0 -3
- package/esm2022/lib/json-dialog/json-dialog.component.mjs +0 -29
- package/esm2022/lib/json-dialog/json-dialog.module.mjs +0 -28
- package/esm2022/lib/json-dialog/json-dialog.service.mjs +0 -26
- package/esm2022/lib/keyvalue/index.mjs +0 -2
- package/esm2022/lib/keyvalue/keyvalue.module.mjs +0 -23
- package/esm2022/lib/keyvalue/keyvalue.pipe.mjs +0 -18
- package/esm2022/lib/list/index.mjs +0 -3
- package/esm2022/lib/list/list-item.directive.mjs +0 -165
- package/esm2022/lib/list/list.component.mjs +0 -251
- package/esm2022/lib/list/list.module.mjs +0 -28
- package/esm2022/lib/panel/index.mjs +0 -2
- package/esm2022/lib/panel/panel.component.mjs +0 -30
- package/esm2022/lib/panel/panel.module.mjs +0 -18
- package/esm2022/lib/select-value-dialog/index.mjs +0 -5
- package/esm2022/lib/select-value-dialog/select-value-check-radio-dialog.component.mjs +0 -87
- package/esm2022/lib/select-value-dialog/select-value-dialog.enums.mjs +0 -6
- package/esm2022/lib/select-value-dialog/select-value-dialog.interface.mjs +0 -2
- package/esm2022/lib/select-value-dialog/select-value-dialog.module.mjs +0 -59
- package/esm2022/lib/select-value-dialog/select-value-dialog.service.mjs +0 -29
- package/esm2022/lib/sidenav/index.mjs +0 -2
- package/esm2022/lib/sidenav/sidenav-shim.directive.mjs +0 -57
- package/esm2022/lib/sidenav/sidenav.module.mjs +0 -23
- package/esm2022/lib/spinner/index.mjs +0 -3
- package/esm2022/lib/spinner/spinner-activity.directive.mjs +0 -55
- package/esm2022/lib/spinner/spinner.component.mjs +0 -30
- package/esm2022/lib/spinner/spinner.module.mjs +0 -20
- package/esm2022/lib/stop-propagation/index.mjs +0 -3
- package/esm2022/lib/stop-propagation/stop-drop-propagation.directive.mjs +0 -20
- package/esm2022/lib/stop-propagation/stop-propagation.directive.mjs +0 -19
- package/esm2022/lib/stop-propagation/stop-propagation.module.mjs +0 -24
- package/esm2022/lib/table/index.mjs +0 -6
- package/esm2022/lib/table/table-action-color.enum.mjs +0 -7
- package/esm2022/lib/table/table-database.mjs +0 -28
- package/esm2022/lib/table/table-datasource.mjs +0 -64
- package/esm2022/lib/table/table-model.interface.mjs +0 -2
- package/esm2022/lib/table/table.component.mjs +0 -124
- package/esm2022/lib/table/table.module.mjs +0 -66
- package/esm2022/lib/tool/index.mjs +0 -3
- package/esm2022/lib/tool/shared/index.mjs +0 -6
- package/esm2022/lib/tool/shared/tool-component.mjs +0 -9
- package/esm2022/lib/tool/shared/tool.interface.mjs +0 -2
- package/esm2022/lib/tool/shared/tool.service.mjs +0 -43
- package/esm2022/lib/tool/shared/toolbox.enums.mjs +0 -7
- package/esm2022/lib/tool/shared/toolbox.mjs +0 -184
- package/esm2022/lib/tool/tool.module.mjs +0 -25
- package/esm2022/lib/tool/toolbox/toolbox.animation.mjs +0 -10
- package/esm2022/lib/tool/toolbox/toolbox.component.mjs +0 -238
- package/esm2022/lib/tool/toolbox/toolbox.module.mjs +0 -23
- package/esm2022/lib/widget/index.mjs +0 -3
- package/esm2022/lib/widget/shared/index.mjs +0 -4
- package/esm2022/lib/widget/shared/widget.interfaces.mjs +0 -2
- package/esm2022/lib/widget/shared/widget.mjs +0 -4
- package/esm2022/lib/widget/shared/widget.service.mjs +0 -22
- package/esm2022/lib/widget/widget-outlet/widget-outlet.component.mjs +0 -114
- package/esm2022/lib/widget/widget-outlet/widget-outlet.module.mjs +0 -22
- package/esm2022/lib/widget/widget.module.mjs +0 -20
- package/esm2022/lib/workspace/index.mjs +0 -4
- package/esm2022/lib/workspace/shared/index.mjs +0 -4
- package/esm2022/lib/workspace/shared/store.mjs +0 -37
- package/esm2022/lib/workspace/shared/workspace.interfaces.mjs +0 -2
- package/esm2022/lib/workspace/shared/workspace.mjs +0 -143
- package/esm2022/lib/workspace/workspace-selector/workspace-selector.component.mjs +0 -52
- package/esm2022/lib/workspace/workspace-selector/workspace-selector.module.mjs +0 -22
- package/esm2022/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.component.mjs +0 -74
- package/esm2022/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.module.mjs +0 -22
- package/esm2022/lib/workspace/workspace.module.mjs +0 -19
- package/lib/action/action.module.d.ts +0 -8
- package/lib/action/actionbar/actionbar-item.component.d.ts +0 -78
- package/lib/action/actionbar/actionbar.component.d.ts +0 -147
- package/lib/action/actionbar/actionbar.module.d.ts +0 -20
- package/lib/action/index.d.ts +0 -2
- package/lib/action/shared/action.interfaces.d.ts +0 -17
- package/lib/action/shared/store.d.ts +0 -8
- package/lib/backdrop/backdrop.component.d.ts +0 -9
- package/lib/backdrop/backdrop.module.d.ts +0 -10
- package/lib/backdrop/index.d.ts +0 -1
- package/lib/badge-icon/badge-icon.directive.d.ts +0 -36
- package/lib/badge-icon/badge-icon.module.d.ts +0 -11
- package/lib/badge-icon/index.d.ts +0 -1
- package/lib/clickout/clickout.directive.d.ts +0 -10
- package/lib/clickout/clickout.module.d.ts +0 -9
- package/lib/clickout/index.d.ts +0 -1
- package/lib/clone/clone.module.d.ts +0 -9
- package/lib/clone/clone.pipe.d.ts +0 -7
- package/lib/clone/index.d.ts +0 -1
- package/lib/collapsible/collapse.directive.d.ts +0 -19
- package/lib/collapsible/collapsible.component.d.ts +0 -13
- package/lib/collapsible/collapsible.module.d.ts +0 -12
- package/lib/collapsible/index.d.ts +0 -2
- package/lib/color-picker-form-field/color-picker-form-field.component.d.ts +0 -29
- package/lib/color-picker-form-field/color-picker-form-field.module.d.ts +0 -15
- package/lib/color-picker-form-field/index.d.ts +0 -1
- package/lib/confirm-dialog/confirm-dialog.component.d.ts +0 -12
- package/lib/confirm-dialog/confirm-dialog.module.d.ts +0 -12
- package/lib/confirm-dialog/index.d.ts +0 -3
- package/lib/context-menu/context-menu.directive.d.ts +0 -21
- package/lib/context-menu/context-menu.module.d.ts +0 -10
- package/lib/context-menu/index.d.ts +0 -2
- package/lib/context-menu/long-press.directive.d.ts +0 -20
- package/lib/custom-html/custom-html.component.d.ts +0 -9
- package/lib/custom-html/custom-html.module.d.ts +0 -16
- package/lib/custom-html/custom-html.pipe.d.ts +0 -10
- package/lib/custom-html/index.d.ts +0 -2
- package/lib/dom/dom.module.d.ts +0 -8
- package/lib/dom/index.d.ts +0 -2
- package/lib/drag-drop/drag-drop.directive.d.ts +0 -14
- package/lib/drag-drop/drag-drop.module.d.ts +0 -9
- package/lib/drag-drop/index.d.ts +0 -1
- package/lib/dynamic-component/dynamic-component.module.d.ts +0 -8
- package/lib/dynamic-component/dynamic-outlet/dynamic-outlet.component.d.ts +0 -70
- package/lib/dynamic-component/dynamic-outlet/dynamic-outlet.module.d.ts +0 -11
- package/lib/dynamic-component/index.d.ts +0 -2
- package/lib/entity/entity-selector/entity-selector.component.d.ts +0 -92
- package/lib/entity/entity-selector/entity-selector.module.d.ts +0 -13
- package/lib/entity/entity-table/entity-table-row.directive.d.ts +0 -69
- package/lib/entity/entity-table/entity-table.component.d.ts +0 -342
- package/lib/entity/entity-table/entity-table.module.d.ts +0 -29
- package/lib/entity/entity-table-paginator/entity-table-paginator.component.d.ts +0 -49
- package/lib/entity/entity-table-paginator/entity-table-paginator.module.d.ts +0 -11
- package/lib/entity/entity.module.d.ts +0 -10
- package/lib/entity/index.d.ts +0 -5
- package/lib/entity/shared/entity.interfaces.d.ts +0 -95
- package/lib/entity/shared/transaction.d.ts +0 -180
- package/lib/flexible/flexible.component.d.ts +0 -41
- package/lib/flexible/flexible.module.d.ts +0 -9
- package/lib/flexible/index.d.ts +0 -2
- package/lib/form/form/form.component.d.ts +0 -53
- package/lib/form/form/form.module.d.ts +0 -12
- package/lib/form/form-field/form-field-select.component.d.ts +0 -52
- package/lib/form/form-field/form-field-text.component.d.ts +0 -51
- package/lib/form/form-field/form-field-textarea.component.d.ts +0 -41
- package/lib/form/form-field/form-field.component.d.ts +0 -29
- package/lib/form/form-field/form-field.module.d.ts +0 -22
- package/lib/form/form-field/index.d.ts +0 -4
- package/lib/form/form-group/form-group.component.d.ts +0 -49
- package/lib/form/form-group/form-group.module.d.ts +0 -14
- package/lib/form/form.module.d.ts +0 -13
- package/lib/form/index.d.ts +0 -4
- package/lib/form-dialog/form-dialog.component.d.ts +0 -24
- package/lib/form-dialog/form-dialog.interface.d.ts +0 -18
- package/lib/form-dialog/form-dialog.module.d.ts +0 -16
- package/lib/form-dialog/index.d.ts +0 -3
- package/lib/home-button/home-button.component.d.ts +0 -9
- package/lib/home-button/home-button.module.d.ts +0 -15
- package/lib/home-button/index.d.ts +0 -1
- package/lib/image/image-error.directive.d.ts +0 -11
- package/lib/image/image.module.d.ts +0 -10
- package/lib/image/index.d.ts +0 -2
- package/lib/image/secure-image.pipe.d.ts +0 -13
- package/lib/interactive-tour/index.d.ts +0 -4
- package/lib/interactive-tour/interactive-tour.component.d.ts +0 -30
- package/lib/interactive-tour/interactive-tour.loader.d.ts +0 -18
- package/lib/interactive-tour/interactive-tour.module.d.ts +0 -12
- package/lib/interactive-tour/interactive-tour.service.d.ts +0 -29
- package/lib/json-dialog/index.d.ts +0 -2
- package/lib/json-dialog/json-dialog.component.d.ts +0 -13
- package/lib/json-dialog/json-dialog.module.d.ts +0 -13
- package/lib/keyvalue/index.d.ts +0 -1
- package/lib/keyvalue/keyvalue.module.d.ts +0 -9
- package/lib/keyvalue/keyvalue.pipe.d.ts +0 -7
- package/lib/list/index.d.ts +0 -2
- package/lib/list/list-item.directive.d.ts +0 -43
- package/lib/list/list.component.d.ts +0 -51
- package/lib/list/list.module.d.ts +0 -14
- package/lib/panel/index.d.ts +0 -1
- package/lib/panel/panel.component.d.ts +0 -10
- package/lib/panel/panel.module.d.ts +0 -8
- package/lib/select-value-dialog/index.d.ts +0 -4
- package/lib/select-value-dialog/select-value-check-radio-dialog.component.d.ts +0 -25
- package/lib/select-value-dialog/select-value-dialog.module.d.ts +0 -17
- package/lib/sidenav/index.d.ts +0 -1
- package/lib/sidenav/sidenav-shim.directive.d.ts +0 -20
- package/lib/sidenav/sidenav.module.d.ts +0 -9
- package/lib/spinner/index.d.ts +0 -2
- package/lib/spinner/spinner-activity.directive.d.ts +0 -32
- package/lib/spinner/spinner.component.d.ts +0 -12
- package/lib/spinner/spinner.module.d.ts +0 -10
- package/lib/stop-propagation/index.d.ts +0 -2
- package/lib/stop-propagation/stop-drop-propagation.directive.d.ts +0 -6
- package/lib/stop-propagation/stop-propagation.directive.d.ts +0 -6
- package/lib/stop-propagation/stop-propagation.module.d.ts +0 -10
- package/lib/table/index.d.ts +0 -5
- package/lib/table/table.component.d.ts +0 -40
- package/lib/table/table.module.d.ts +0 -20
- package/lib/tool/index.d.ts +0 -2
- package/lib/tool/shared/tool.interface.d.ts +0 -18
- package/lib/tool/shared/toolbox.d.ts +0 -95
- package/lib/tool/shared/toolbox.enums.d.ts +0 -5
- package/lib/tool/tool.module.d.ts +0 -10
- package/lib/tool/toolbox/toolbox.component.d.ts +0 -128
- package/lib/tool/toolbox/toolbox.module.d.ts +0 -13
- package/lib/widget/index.d.ts +0 -2
- package/lib/widget/shared/widget.d.ts +0 -4
- package/lib/widget/shared/widget.service.d.ts +0 -10
- package/lib/widget/widget-outlet/widget-outlet.component.d.ts +0 -71
- package/lib/widget/widget-outlet/widget-outlet.module.d.ts +0 -12
- package/lib/widget/widget.module.d.ts +0 -8
- package/lib/workspace/index.d.ts +0 -3
- package/lib/workspace/shared/store.d.ts +0 -20
- package/lib/workspace/shared/workspace.d.ts +0 -108
- package/lib/workspace/shared/workspace.interfaces.d.ts +0 -11
- package/lib/workspace/workspace-selector/workspace-selector.component.d.ts +0 -39
- package/lib/workspace/workspace-selector/workspace-selector.module.d.ts +0 -12
- package/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.component.d.ts +0 -57
- package/lib/workspace/workspace-widget-outlet/workspace-widget-outlet.module.d.ts +0 -12
- package/lib/workspace/workspace.module.d.ts +0 -9
- package/src/lib/action/action.theming.scss +0 -5
- package/src/lib/action/actionbar/actionbar-item.theming.scss +0 -32
- package/src/lib/action/actionbar/actionbar.theming.scss +0 -22
- package/src/lib/collapsible/collapsible.theming.scss +0 -22
- package/src/lib/entity/entity-selector/entity-selector.theming.scss +0 -21
- package/src/lib/entity/entity-table/entity-table.theming.scss +0 -37
- package/src/lib/entity/entity.theming.scss +0 -7
- package/src/lib/home-button/home-button.theming.scss +0 -18
- package/src/lib/interactive-tour/interactive-tour.theming.scss +0 -32
- package/src/lib/list/list.theming.scss +0 -58
- package/src/lib/panel/panel.theming.scss +0 -30
- package/src/lib/tool/tool.theming.scss +0 -5
- package/src/lib/tool/toolbox/toolbox.theming.scss +0 -105
- /package/{lib/action → action}/shared/action.enums.d.ts +0 -0
- /package/{lib/action → action}/shared/index.d.ts +0 -0
- /package/{lib/confirm-dialog → confirm-dialog}/confirm-dialog.interface.d.ts +0 -0
- /package/{lib/confirm-dialog → confirm-dialog}/confirm-dialog.service.d.ts +0 -0
- /package/{lib/dom → dom}/dom.interfaces.d.ts +0 -0
- /package/{lib/dom → dom}/dom.service.d.ts +0 -0
- /package/{lib/dynamic-component → dynamic-component}/shared/dynamic-component.d.ts +0 -0
- /package/{lib/dynamic-component → dynamic-component}/shared/dynamic-component.interfaces.d.ts +0 -0
- /package/{lib/dynamic-component → dynamic-component}/shared/dynamic-component.service.d.ts +0 -0
- /package/{lib/dynamic-component → dynamic-component}/shared/index.d.ts +0 -0
- /package/{lib/entity → entity}/entity-table-paginator/entity-table-paginator.interface.d.ts +0 -0
- /package/{lib/entity → entity}/shared/entity.enums.d.ts +0 -0
- /package/{lib/entity → entity}/shared/entity.utils.d.ts +0 -0
- /package/{lib/entity → entity}/shared/index.d.ts +0 -0
- /package/{lib/entity → entity}/shared/state.d.ts +0 -0
- /package/{lib/entity → entity}/shared/store.d.ts +0 -0
- /package/{lib/entity → entity}/shared/strategies/filter-custom-function.d.ts +0 -0
- /package/{lib/entity → entity}/shared/strategies/filter-selection.d.ts +0 -0
- /package/{lib/entity → entity}/shared/strategies/index.d.ts +0 -0
- /package/{lib/entity → entity}/shared/strategies/strategy.d.ts +0 -0
- /package/{lib/entity → entity}/shared/view.d.ts +0 -0
- /package/{lib/entity → entity}/shared/watcher.d.ts +0 -0
- /package/{lib/environment → environment}/environment.interface.d.ts +0 -0
- /package/{lib/environment/index.d.ts → environment/public_api.d.ts} +0 -0
- /package/{lib/flexible → flexible}/flexible.type.d.ts +0 -0
- /package/{lib → form}/form-dialog/form-dialog.service.d.ts +0 -0
- /package/{lib/form → form}/shared/form-field-component.d.ts +0 -0
- /package/{lib/form → form}/shared/form-field.service.d.ts +0 -0
- /package/{lib/form → form}/shared/form.interfaces.d.ts +0 -0
- /package/{lib/form → form}/shared/form.service.d.ts +0 -0
- /package/{lib/form → form}/shared/form.utils.d.ts +0 -0
- /package/{lib/form → form}/shared/index.d.ts +0 -0
- /package/{lib/interactive-tour → interactive-tour}/interactive-tour.interface.d.ts +0 -0
- /package/{lib/json-dialog → json-dialog}/json-dialog.service.d.ts +0 -0
- /package/{lib/select-value-dialog → select-value-dialog}/select-value-dialog.enums.d.ts +0 -0
- /package/{lib/select-value-dialog → select-value-dialog}/select-value-dialog.interface.d.ts +0 -0
- /package/{lib/select-value-dialog → select-value-dialog}/select-value-dialog.service.d.ts +0 -0
- /package/{lib/table → table}/table-action-color.enum.d.ts +0 -0
- /package/{lib/table → table}/table-database.d.ts +0 -0
- /package/{lib/table → table}/table-datasource.d.ts +0 -0
- /package/{lib/table → table}/table-model.interface.d.ts +0 -0
- /package/{lib/tool → tool}/shared/index.d.ts +0 -0
- /package/{lib/tool → tool}/shared/tool-component.d.ts +0 -0
- /package/{lib/tool → tool}/shared/tool.service.d.ts +0 -0
- /package/{lib/tool → tool}/toolbox/toolbox.animation.d.ts +0 -0
- /package/{lib/widget → widget}/shared/index.d.ts +0 -0
- /package/{lib/widget → widget}/shared/widget.interfaces.d.ts +0 -0
- /package/{lib/workspace → workspace}/shared/index.d.ts +0 -0
|
@@ -0,0 +1,3036 @@
|
|
|
1
|
+
import { t } from 'typy';
|
|
2
|
+
import { ReplaySubject, BehaviorSubject, combineLatest, of, Observable } from 'rxjs';
|
|
3
|
+
import { uuid, ObjectUtils, StringUtils } from '@igo2/utils';
|
|
4
|
+
import { map, skip, debounceTime, catchError, tap } from 'rxjs/operators';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, Input, Output, NgModule, ViewChild, Directive, HostListener, Optional, Self } from '@angular/core';
|
|
7
|
+
import { NgIf, NgFor, AsyncPipe, NgClass, NgStyle } from '@angular/common';
|
|
8
|
+
import * as i3 from '@angular/material/core';
|
|
9
|
+
import { MatOptionModule, MatNativeDateModule } from '@angular/material/core';
|
|
10
|
+
import * as i1 from '@angular/material/form-field';
|
|
11
|
+
import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
|
|
12
|
+
import * as i2 from '@angular/material/select';
|
|
13
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
14
|
+
import * as i2$2 from '@angular/cdk/a11y';
|
|
15
|
+
import * as i1$2 from '@angular/forms';
|
|
16
|
+
import { UntypedFormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
17
|
+
import { provideMomentDateAdapter } from '@angular/material-moment-adapter';
|
|
18
|
+
import * as i4 from '@angular/material/autocomplete';
|
|
19
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
20
|
+
import * as i5 from '@angular/material/button';
|
|
21
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
22
|
+
import * as i6 from '@angular/material/checkbox';
|
|
23
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
24
|
+
import * as i7 from '@angular/material/datepicker';
|
|
25
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
26
|
+
import * as i9 from '@angular/material/icon';
|
|
27
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
28
|
+
import * as i10 from '@angular/material/input';
|
|
29
|
+
import { MatInputModule } from '@angular/material/input';
|
|
30
|
+
import * as i3$1 from '@angular/material/paginator';
|
|
31
|
+
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
32
|
+
import * as i12 from '@angular/material/sort';
|
|
33
|
+
import { MatSortModule } from '@angular/material/sort';
|
|
34
|
+
import * as i13 from '@angular/material/table';
|
|
35
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
36
|
+
import * as i14 from '@angular/material/tooltip';
|
|
37
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
38
|
+
import { SanitizeHtmlPipe } from '@igo2/common/custom-html';
|
|
39
|
+
import { ImageErrorDirective, SecureImagePipe } from '@igo2/common/image';
|
|
40
|
+
import { StopPropagationDirective } from '@igo2/common/stop-propagation';
|
|
41
|
+
import * as i1$1 from '@igo2/core/language';
|
|
42
|
+
import { IgoLanguageModule } from '@igo2/core/language';
|
|
43
|
+
import moment from 'moment';
|
|
44
|
+
import * as i2$1 from '@igo2/core/media';
|
|
45
|
+
import scrollIntoView from 'scroll-into-view-if-needed';
|
|
46
|
+
import * as i15 from '@ngx-translate/core';
|
|
47
|
+
|
|
48
|
+
var EntityOperationType;
|
|
49
|
+
(function (EntityOperationType) {
|
|
50
|
+
EntityOperationType["Insert"] = "Insert";
|
|
51
|
+
EntityOperationType["Update"] = "Update";
|
|
52
|
+
EntityOperationType["Delete"] = "Delete";
|
|
53
|
+
})(EntityOperationType || (EntityOperationType = {}));
|
|
54
|
+
var EntityTableColumnRenderer;
|
|
55
|
+
(function (EntityTableColumnRenderer) {
|
|
56
|
+
EntityTableColumnRenderer["Default"] = "Default";
|
|
57
|
+
EntityTableColumnRenderer["HTML"] = "HTML";
|
|
58
|
+
EntityTableColumnRenderer["UnsanitizedHTML"] = "UnsanitizedHTML";
|
|
59
|
+
EntityTableColumnRenderer["Editable"] = "Editable";
|
|
60
|
+
EntityTableColumnRenderer["Icon"] = "Icon";
|
|
61
|
+
EntityTableColumnRenderer["ButtonGroup"] = "ButtonGroup";
|
|
62
|
+
})(EntityTableColumnRenderer || (EntityTableColumnRenderer = {}));
|
|
63
|
+
var EntityTableScrollBehavior;
|
|
64
|
+
(function (EntityTableScrollBehavior) {
|
|
65
|
+
EntityTableScrollBehavior["Auto"] = "auto";
|
|
66
|
+
EntityTableScrollBehavior["Instant"] = "instant";
|
|
67
|
+
EntityTableScrollBehavior["Smooth"] = "smooth";
|
|
68
|
+
})(EntityTableScrollBehavior || (EntityTableScrollBehavior = {}));
|
|
69
|
+
var EntityTableSelectionState;
|
|
70
|
+
(function (EntityTableSelectionState) {
|
|
71
|
+
EntityTableSelectionState["None"] = "None";
|
|
72
|
+
EntityTableSelectionState["All"] = "All";
|
|
73
|
+
EntityTableSelectionState["Some"] = "Some";
|
|
74
|
+
})(EntityTableSelectionState || (EntityTableSelectionState = {}));
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Get an entity's named property. Nested properties are supported
|
|
78
|
+
* with the dotted notation. (i.e 'author.name')
|
|
79
|
+
*
|
|
80
|
+
* Note: this method is a 'best attempt' at getting an entity's property.
|
|
81
|
+
* It fits the most common cases but you might need to explicitely define
|
|
82
|
+
* a property getter when using an EntityStore, for example.
|
|
83
|
+
* @param entity Entity
|
|
84
|
+
* @param property Property name
|
|
85
|
+
* @returns Property value
|
|
86
|
+
*/
|
|
87
|
+
function getEntityProperty(entity, property) {
|
|
88
|
+
return t(entity, property).safeObject;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get an entity's id. An entity's id can be one of:
|
|
92
|
+
* 'entity.meta.id', 'entity.meta.idProperty' or 'entity.id'.
|
|
93
|
+
*
|
|
94
|
+
* Note: See the note in the 'getEntityProperty' documentation.
|
|
95
|
+
* @param entity Entity
|
|
96
|
+
* @returns Entity id
|
|
97
|
+
*/
|
|
98
|
+
function getEntityId(entity) {
|
|
99
|
+
const meta = entity.meta || {};
|
|
100
|
+
return meta.id ? meta.id : getEntityProperty(entity, meta.idProperty || 'id');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get an entity's title. An entity's title can be one of:
|
|
104
|
+
* 'entity.meta.title', 'entity.meta.titleProperty' or 'entity.title'.
|
|
105
|
+
* @param entity Entity
|
|
106
|
+
* @returns Entity title
|
|
107
|
+
*/
|
|
108
|
+
function getEntityTitle(entity) {
|
|
109
|
+
const meta = entity.meta || {};
|
|
110
|
+
return meta.title
|
|
111
|
+
? meta.title
|
|
112
|
+
: getEntityProperty(entity, meta.titleProperty || 'title');
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get an entity's HTML title. An entity's HTML title can be one of:
|
|
116
|
+
* 'entity.meta.titleHtml', 'entity.meta.titleHtmlProperty' or 'entity.titleHtml'.
|
|
117
|
+
* @param entity Entity
|
|
118
|
+
* @returns Entity HTML title
|
|
119
|
+
*/
|
|
120
|
+
function getEntityTitleHtml(entity) {
|
|
121
|
+
const meta = entity.meta || {};
|
|
122
|
+
return meta.titleHtml
|
|
123
|
+
? meta.titleHtml
|
|
124
|
+
: getEntityProperty(entity, meta.titleHtmlProperty || 'titleHtml');
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get an entity's icon. An entity's icon can be one of:
|
|
128
|
+
* 'entity.meta.icon', 'entity.meta.iconProperty' or 'entity.icon'.
|
|
129
|
+
* @param entity Entity
|
|
130
|
+
* @returns Entity icon
|
|
131
|
+
*/
|
|
132
|
+
function getEntityIcon(entity) {
|
|
133
|
+
const meta = entity.meta || {};
|
|
134
|
+
return meta.icon
|
|
135
|
+
? meta.icon
|
|
136
|
+
: getEntityProperty(entity, meta.iconProperty || 'icon');
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get an entity's revision.
|
|
140
|
+
* @param entity Entity
|
|
141
|
+
* @returns Entity revision
|
|
142
|
+
*/
|
|
143
|
+
function getEntityRevision(entity) {
|
|
144
|
+
const meta = entity.meta || {};
|
|
145
|
+
return meta.revision || 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* This class is used to track a store's entities state
|
|
150
|
+
*/
|
|
151
|
+
class EntityStateManager {
|
|
152
|
+
options;
|
|
153
|
+
/**
|
|
154
|
+
* State index
|
|
155
|
+
*/
|
|
156
|
+
index = new Map();
|
|
157
|
+
/**
|
|
158
|
+
* Change emitter
|
|
159
|
+
*/
|
|
160
|
+
change$ = new ReplaySubject(1);
|
|
161
|
+
/**
|
|
162
|
+
* Method to get an entity's id
|
|
163
|
+
*/
|
|
164
|
+
getKey;
|
|
165
|
+
constructor(options = {}) {
|
|
166
|
+
this.options = options;
|
|
167
|
+
this.getKey = options.getKey ? options.getKey : getEntityId;
|
|
168
|
+
this.next();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Clear state
|
|
172
|
+
*/
|
|
173
|
+
clear() {
|
|
174
|
+
if (this.index.size > 0) {
|
|
175
|
+
this.index.clear();
|
|
176
|
+
this.next();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get an entity's state
|
|
181
|
+
* @param entity Entity
|
|
182
|
+
* @returns State
|
|
183
|
+
*/
|
|
184
|
+
get(entity) {
|
|
185
|
+
return (this.index.get(this.getKey(entity)) || {});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Set an entity's state
|
|
189
|
+
* @param entity Entity
|
|
190
|
+
* @param state State
|
|
191
|
+
*/
|
|
192
|
+
set(entity, state) {
|
|
193
|
+
this.setMany([entity], state);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Set many entitie's state
|
|
197
|
+
* @param entitie Entities
|
|
198
|
+
* @param state State
|
|
199
|
+
*/
|
|
200
|
+
setMany(entities, state) {
|
|
201
|
+
entities.forEach((entity) => {
|
|
202
|
+
this.index.set(this.getKey(entity), Object.assign({}, state));
|
|
203
|
+
});
|
|
204
|
+
this.next();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Set state of all entities that already have a state. This is not
|
|
208
|
+
* the same as setting the state of all the store's entities.
|
|
209
|
+
* @param state State
|
|
210
|
+
*/
|
|
211
|
+
setAll(state) {
|
|
212
|
+
Array.from(this.index.keys()).forEach((key) => {
|
|
213
|
+
this.index.set(key, Object.assign({}, state));
|
|
214
|
+
});
|
|
215
|
+
this.next();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Update an entity's state
|
|
219
|
+
* @param entity Entity
|
|
220
|
+
* @param changes State changes
|
|
221
|
+
*/
|
|
222
|
+
update(entity, changes, exclusive = false) {
|
|
223
|
+
this.updateMany([entity], changes, exclusive);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Update many entitie's state
|
|
227
|
+
* @param entitie Entities
|
|
228
|
+
* @param changes State changes
|
|
229
|
+
*/
|
|
230
|
+
updateMany(entities, changes, exclusive = false) {
|
|
231
|
+
if (exclusive === true) {
|
|
232
|
+
return this.updateManyExclusive(entities, changes);
|
|
233
|
+
}
|
|
234
|
+
entities.forEach((entity) => {
|
|
235
|
+
const state = Object.assign({}, this.get(entity), changes);
|
|
236
|
+
this.index.set(this.getKey(entity), state);
|
|
237
|
+
});
|
|
238
|
+
this.next();
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Reversee an entity's state
|
|
242
|
+
* @param entity Entity
|
|
243
|
+
* @param keys State keys to reverse
|
|
244
|
+
*/
|
|
245
|
+
reverse(entity, keys) {
|
|
246
|
+
this.reverseMany([entity], keys);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Reverse many entitie's state
|
|
250
|
+
* @param entitie Entities
|
|
251
|
+
* @param keys State keys to reverse
|
|
252
|
+
*/
|
|
253
|
+
reverseMany(entities, keys) {
|
|
254
|
+
entities.forEach((entity) => {
|
|
255
|
+
const currentState = this.get(entity);
|
|
256
|
+
const changes = keys.reduce((acc, key) => {
|
|
257
|
+
acc[key] = currentState[key] || false;
|
|
258
|
+
return acc;
|
|
259
|
+
}, {});
|
|
260
|
+
const reversedChanges = this.reverseChanges(changes);
|
|
261
|
+
const state = Object.assign({}, currentState, reversedChanges);
|
|
262
|
+
this.index.set(this.getKey(entity), state);
|
|
263
|
+
});
|
|
264
|
+
this.next();
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Update state of all entities that already have a state. This is not
|
|
268
|
+
* the same as updating the state of all the store's entities.
|
|
269
|
+
* @param changes State
|
|
270
|
+
*/
|
|
271
|
+
updateAll(changes) {
|
|
272
|
+
const allKeys = this.getAllKeys();
|
|
273
|
+
Array.from(allKeys).forEach((key) => {
|
|
274
|
+
const state = Object.assign({}, this.index.get(key), changes);
|
|
275
|
+
this.index.set(key, state);
|
|
276
|
+
});
|
|
277
|
+
this.next();
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* When some state changes are flagged as 'exclusive', reverse
|
|
281
|
+
* the state of all other entities. Changes are reversable when
|
|
282
|
+
* they are boolean.
|
|
283
|
+
* @param entitie Entities
|
|
284
|
+
* @param changes State changes
|
|
285
|
+
*/
|
|
286
|
+
updateManyExclusive(entities, changes) {
|
|
287
|
+
const reverseChanges = this.reverseChanges(changes);
|
|
288
|
+
const keys = entities.map((entity) => this.getKey(entity));
|
|
289
|
+
const allKeys = new Set(keys.concat(Array.from(this.getAllKeys())));
|
|
290
|
+
allKeys.forEach((key) => {
|
|
291
|
+
const state = this.index.get(key) || {};
|
|
292
|
+
if (keys.indexOf(key) >= 0) {
|
|
293
|
+
this.index.set(key, Object.assign({}, state, changes));
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
// Update only if the reverse changes would modify
|
|
297
|
+
// a key already present in the current state
|
|
298
|
+
const shouldUpdate = Object.keys(reverseChanges).some((changeKey) => {
|
|
299
|
+
return (state[changeKey] !== undefined &&
|
|
300
|
+
state[changeKey] !== reverseChanges[changeKey]);
|
|
301
|
+
});
|
|
302
|
+
if (shouldUpdate === true) {
|
|
303
|
+
this.index.set(key, Object.assign({}, state, reverseChanges));
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
this.next();
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Compute a 'reversed' version of some state changes.
|
|
311
|
+
* Changes are reversable when they are boolean.
|
|
312
|
+
* @param changes State changes
|
|
313
|
+
* @returns Reversed state changes
|
|
314
|
+
*/
|
|
315
|
+
reverseChanges(changes) {
|
|
316
|
+
return Object.entries(changes).reduce((reverseChanges, bunch) => {
|
|
317
|
+
const [changeKey, value] = bunch;
|
|
318
|
+
if (typeof value === typeof true) {
|
|
319
|
+
reverseChanges[changeKey] = !value;
|
|
320
|
+
}
|
|
321
|
+
return reverseChanges;
|
|
322
|
+
}, {});
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Return all the keys in that state and in the store it's bound to, if any.
|
|
326
|
+
* @returns Set of keys
|
|
327
|
+
*/
|
|
328
|
+
getAllKeys() {
|
|
329
|
+
const storeKeys = Array.from(this.options?.index?.keys() ?? []);
|
|
330
|
+
return new Set(Array.from(this.index.keys()).concat(storeKeys));
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Emit 'change' event
|
|
334
|
+
*/
|
|
335
|
+
next() {
|
|
336
|
+
this.change$.next();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* An entity view streams entities from an observable source. These entities
|
|
342
|
+
* can be filtered or sorted without affecting the source. A view can also
|
|
343
|
+
* combine data from multiple sources, joined together.
|
|
344
|
+
*/
|
|
345
|
+
class EntityView {
|
|
346
|
+
source$;
|
|
347
|
+
/**
|
|
348
|
+
* Observable stream of values
|
|
349
|
+
*/
|
|
350
|
+
values$ = new BehaviorSubject([]);
|
|
351
|
+
/**
|
|
352
|
+
* Subscription to the source (and joined sources) values
|
|
353
|
+
*/
|
|
354
|
+
values$$;
|
|
355
|
+
/**
|
|
356
|
+
* Whether this view has been lifted
|
|
357
|
+
*/
|
|
358
|
+
lifted = false;
|
|
359
|
+
/**
|
|
360
|
+
* Join clauses
|
|
361
|
+
*/
|
|
362
|
+
joins = [];
|
|
363
|
+
/**
|
|
364
|
+
* Observable of a filter clause
|
|
365
|
+
*/
|
|
366
|
+
filter$ = new BehaviorSubject(undefined);
|
|
367
|
+
/**
|
|
368
|
+
* Observable of filter clauses
|
|
369
|
+
*/
|
|
370
|
+
filters$ = new BehaviorSubject([]);
|
|
371
|
+
/**
|
|
372
|
+
* Filters index
|
|
373
|
+
*/
|
|
374
|
+
filterIndex = new Map();
|
|
375
|
+
/**
|
|
376
|
+
* Observable of a sort clause
|
|
377
|
+
*/
|
|
378
|
+
sort$ = new BehaviorSubject(undefined);
|
|
379
|
+
/**
|
|
380
|
+
* Method for indexing
|
|
381
|
+
*/
|
|
382
|
+
get getKey() {
|
|
383
|
+
return this.getKey$.value;
|
|
384
|
+
}
|
|
385
|
+
getKey$ = new BehaviorSubject(undefined);
|
|
386
|
+
/**
|
|
387
|
+
* Number of entities
|
|
388
|
+
*/
|
|
389
|
+
count$ = new BehaviorSubject(0);
|
|
390
|
+
get count() {
|
|
391
|
+
return this.count$.value;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Whether the store is empty
|
|
395
|
+
*/
|
|
396
|
+
empty$ = new BehaviorSubject(true);
|
|
397
|
+
get empty() {
|
|
398
|
+
return this.empty$.value;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Store index
|
|
402
|
+
*/
|
|
403
|
+
get index() {
|
|
404
|
+
return this._index;
|
|
405
|
+
}
|
|
406
|
+
_index;
|
|
407
|
+
constructor(source$) {
|
|
408
|
+
this.source$ = source$;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Get a value from the view by key
|
|
412
|
+
* @param key Key
|
|
413
|
+
* @returns Value
|
|
414
|
+
*/
|
|
415
|
+
get(key) {
|
|
416
|
+
if (this._index === undefined) {
|
|
417
|
+
throw new Error('This view has no index, therefore, this method is unavailable.');
|
|
418
|
+
}
|
|
419
|
+
return this.index.get(key);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Get all the values
|
|
423
|
+
* @returns Array of values
|
|
424
|
+
*/
|
|
425
|
+
all() {
|
|
426
|
+
return this.values$.value;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Observe all the values
|
|
430
|
+
* @returns Observable of values
|
|
431
|
+
*/
|
|
432
|
+
all$() {
|
|
433
|
+
return this.values$;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Get the first value that respects a criteria
|
|
437
|
+
* @returns A value
|
|
438
|
+
*/
|
|
439
|
+
firstBy(clause) {
|
|
440
|
+
return this.values$.value.find(clause);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Observe the first value that respects a criteria
|
|
444
|
+
* @returns Observable of a value
|
|
445
|
+
*/
|
|
446
|
+
firstBy$(clause) {
|
|
447
|
+
return this.values$.pipe(map((values) => values.find(clause)));
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Get all the values that respect a criteria
|
|
451
|
+
* @returns Array of values
|
|
452
|
+
*/
|
|
453
|
+
manyBy(clause) {
|
|
454
|
+
return this.values$.value.filter(clause);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Observe all the values that respect a criteria
|
|
458
|
+
* @returns Observable of values
|
|
459
|
+
*/
|
|
460
|
+
manyBy$(clause) {
|
|
461
|
+
return this.values$.pipe(map((values) => values.filter(clause)));
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Clear the filter and sort and unsubscribe from the source
|
|
465
|
+
*/
|
|
466
|
+
clear() {
|
|
467
|
+
this.filter(undefined);
|
|
468
|
+
this.sort(undefined);
|
|
469
|
+
}
|
|
470
|
+
destroy() {
|
|
471
|
+
if (this.values$$ !== undefined) {
|
|
472
|
+
this.values$$.unsubscribe();
|
|
473
|
+
}
|
|
474
|
+
this.clear();
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Create an index
|
|
478
|
+
* @param getKey Method to get a value's id
|
|
479
|
+
* @returns The view
|
|
480
|
+
*/
|
|
481
|
+
createIndex(getKey) {
|
|
482
|
+
this._index = new Map();
|
|
483
|
+
this.getKey$.next(getKey);
|
|
484
|
+
return this;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Join another source to the stream (chainable)
|
|
488
|
+
* @param clause Join clause
|
|
489
|
+
* @returns The view
|
|
490
|
+
*/
|
|
491
|
+
join(clause) {
|
|
492
|
+
if (this.lifted === true) {
|
|
493
|
+
throw new Error('This view has already been lifted, therefore, no join is allowed.');
|
|
494
|
+
}
|
|
495
|
+
this.joins.push(clause);
|
|
496
|
+
return this;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Filter values (chainable)
|
|
500
|
+
* @param clause Filter clause
|
|
501
|
+
* @returns The view
|
|
502
|
+
*/
|
|
503
|
+
filter(clause) {
|
|
504
|
+
this.filter$.next(clause);
|
|
505
|
+
return this;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @param clause Filter clause
|
|
509
|
+
* @returns The filter id
|
|
510
|
+
*/
|
|
511
|
+
addFilter(clause) {
|
|
512
|
+
const id = uuid();
|
|
513
|
+
this.filterIndex.set(id, clause);
|
|
514
|
+
this.filters$.next(Array.from(this.filterIndex.values()));
|
|
515
|
+
return id;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Remove a filter by id
|
|
519
|
+
* @param clause Filter clause
|
|
520
|
+
*/
|
|
521
|
+
removeFilter(id) {
|
|
522
|
+
this.filterIndex.delete(id);
|
|
523
|
+
this.filters$.next(Array.from(this.filterIndex.values()));
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Sort values (chainable)
|
|
527
|
+
* @param clauseSort clause
|
|
528
|
+
* @returns The view
|
|
529
|
+
*/
|
|
530
|
+
sort(clause) {
|
|
531
|
+
this.sort$.next(clause);
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Create the final observable
|
|
536
|
+
* @returns Observable
|
|
537
|
+
*/
|
|
538
|
+
lift() {
|
|
539
|
+
this.lifted = true;
|
|
540
|
+
const source$ = this.joins.length > 0 ? this.liftJoinedSource() : this.liftSource();
|
|
541
|
+
const observables$ = [
|
|
542
|
+
source$,
|
|
543
|
+
this.filters$,
|
|
544
|
+
this.filter$,
|
|
545
|
+
this.sort$,
|
|
546
|
+
this.getKey$
|
|
547
|
+
];
|
|
548
|
+
this.values$$ = combineLatest(observables$)
|
|
549
|
+
.pipe(skip(1), debounceTime(5))
|
|
550
|
+
.subscribe((bunch) => {
|
|
551
|
+
const [_values, filters, filter, sort, getKey] = bunch;
|
|
552
|
+
const values = this.processValues(_values, filters, filter, sort);
|
|
553
|
+
const generateIndex = getKey !== undefined;
|
|
554
|
+
this.setValues(values, generateIndex);
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Create the source observable when no joins are defined
|
|
559
|
+
* @returns Observable
|
|
560
|
+
*/
|
|
561
|
+
liftSource() {
|
|
562
|
+
return this.source$;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Create the source observable when joins are defined
|
|
566
|
+
* @returns Observable
|
|
567
|
+
*/
|
|
568
|
+
liftJoinedSource() {
|
|
569
|
+
const sources$ = [
|
|
570
|
+
this.source$,
|
|
571
|
+
combineLatest(this.joins.map((join) => join.source))
|
|
572
|
+
];
|
|
573
|
+
return combineLatest(sources$).pipe(map((bunch) => {
|
|
574
|
+
const [entities, joinData] = bunch;
|
|
575
|
+
return entities.reduce((values, entity) => {
|
|
576
|
+
const value = this.computeJoinedValue(entity, joinData);
|
|
577
|
+
if (value !== undefined) {
|
|
578
|
+
values.push(value);
|
|
579
|
+
}
|
|
580
|
+
return values;
|
|
581
|
+
}, []);
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Apply joins to a source's entity and return the final value
|
|
586
|
+
* @returns Final value
|
|
587
|
+
*/
|
|
588
|
+
computeJoinedValue(entity, joinData) {
|
|
589
|
+
let value = entity;
|
|
590
|
+
let joinIndex = 0;
|
|
591
|
+
while (value !== undefined && joinIndex < this.joins.length) {
|
|
592
|
+
value = this.joins[joinIndex].reduce(value, joinData[joinIndex]);
|
|
593
|
+
joinIndex += 1;
|
|
594
|
+
}
|
|
595
|
+
return value;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Filter and sort values before streaming them
|
|
599
|
+
* @param values Values
|
|
600
|
+
* @param filters Filter clauses
|
|
601
|
+
* @param filter Filter clause
|
|
602
|
+
* @param sort Sort clause
|
|
603
|
+
* @returns Filtered and sorted values
|
|
604
|
+
*/
|
|
605
|
+
processValues(values, filters, filter, sort) {
|
|
606
|
+
values = values.slice(0);
|
|
607
|
+
values = this.filterValues(values, filters.concat([filter]));
|
|
608
|
+
values = this.sortValues(values, sort);
|
|
609
|
+
return values;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Filter values
|
|
613
|
+
* @param values Values
|
|
614
|
+
* @param filters Filter clauses
|
|
615
|
+
* @returns Filtered values
|
|
616
|
+
*/
|
|
617
|
+
filterValues(values, clauses) {
|
|
618
|
+
if (clauses.length === 0) {
|
|
619
|
+
return values;
|
|
620
|
+
}
|
|
621
|
+
return values.filter((value) => {
|
|
622
|
+
return clauses
|
|
623
|
+
.filter((clause) => clause !== undefined)
|
|
624
|
+
.every((clause) => clause(value));
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Sort values
|
|
629
|
+
* @param values Values
|
|
630
|
+
* @param sort Sort clause
|
|
631
|
+
* @returns Sorted values
|
|
632
|
+
*/
|
|
633
|
+
sortValues(values, clause) {
|
|
634
|
+
if (clause === undefined) {
|
|
635
|
+
return values;
|
|
636
|
+
}
|
|
637
|
+
return values.sort((v1, v2) => {
|
|
638
|
+
return ObjectUtils.naturalCompare(clause.valueAccessor(v1), clause.valueAccessor(v2), clause.direction, clause.nullsFirst);
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Set value and optionally generate an index
|
|
643
|
+
* @param values Values
|
|
644
|
+
* @param generateIndex boolean
|
|
645
|
+
*/
|
|
646
|
+
setValues(values, generateIndex) {
|
|
647
|
+
if (generateIndex === true) {
|
|
648
|
+
this._index = this.generateIndex(values);
|
|
649
|
+
}
|
|
650
|
+
this.values$.next(values);
|
|
651
|
+
const count = values.length;
|
|
652
|
+
const empty = count === 0;
|
|
653
|
+
this.count$.next(count);
|
|
654
|
+
this.empty$.next(empty);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Generate a complete index of all the values
|
|
658
|
+
* @param entities Entities
|
|
659
|
+
* @returns Index
|
|
660
|
+
*/
|
|
661
|
+
generateIndex(values) {
|
|
662
|
+
const entries = values.map((value) => [this.getKey(value), value]);
|
|
663
|
+
return new Map(entries);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* An entity store class holds any number of entities
|
|
669
|
+
* as well as their state. It can be observed, filtered and sorted and
|
|
670
|
+
* provides methods to insert, update or delete entities.
|
|
671
|
+
*/
|
|
672
|
+
class EntityStore {
|
|
673
|
+
/**
|
|
674
|
+
* Observable of the raw entities
|
|
675
|
+
*/
|
|
676
|
+
entities$ = new BehaviorSubject([]);
|
|
677
|
+
/**
|
|
678
|
+
* Number of entities
|
|
679
|
+
*/
|
|
680
|
+
count$ = new BehaviorSubject(0);
|
|
681
|
+
get count() {
|
|
682
|
+
return this.count$.value;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Whether the store is empty
|
|
686
|
+
*/
|
|
687
|
+
empty$ = new BehaviorSubject(true);
|
|
688
|
+
get empty() {
|
|
689
|
+
return this.empty$.value;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Entity store state
|
|
693
|
+
*/
|
|
694
|
+
state;
|
|
695
|
+
/**
|
|
696
|
+
* View of all the entities
|
|
697
|
+
*/
|
|
698
|
+
view;
|
|
699
|
+
/**
|
|
700
|
+
* View of all the entities and their state
|
|
701
|
+
*/
|
|
702
|
+
stateView;
|
|
703
|
+
/**
|
|
704
|
+
* Method to get an entity's id
|
|
705
|
+
*/
|
|
706
|
+
getKey;
|
|
707
|
+
/**
|
|
708
|
+
* Method to get an entity's named property
|
|
709
|
+
*/
|
|
710
|
+
getProperty;
|
|
711
|
+
/**
|
|
712
|
+
* Store index
|
|
713
|
+
*/
|
|
714
|
+
get index() {
|
|
715
|
+
return this._index;
|
|
716
|
+
}
|
|
717
|
+
_index;
|
|
718
|
+
/**
|
|
719
|
+
* Store index
|
|
720
|
+
*/
|
|
721
|
+
get pristine() {
|
|
722
|
+
return this._pristine;
|
|
723
|
+
}
|
|
724
|
+
_pristine = true;
|
|
725
|
+
/**
|
|
726
|
+
* Strategies
|
|
727
|
+
*/
|
|
728
|
+
strategies = [];
|
|
729
|
+
constructor(entities, options = {}) {
|
|
730
|
+
this.getKey = options.getKey ? options.getKey : getEntityId;
|
|
731
|
+
this.getProperty = options.getProperty
|
|
732
|
+
? options.getProperty
|
|
733
|
+
: getEntityProperty;
|
|
734
|
+
this.state = this.createStateManager();
|
|
735
|
+
this.view = this.createDataView();
|
|
736
|
+
this.stateView = this.createStateView();
|
|
737
|
+
this.view.lift();
|
|
738
|
+
this.stateView.lift();
|
|
739
|
+
if (entities.length > 0) {
|
|
740
|
+
this.load(entities);
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
this._index = this.generateIndex(entities);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Get an entity from the store by key
|
|
748
|
+
* @param key Key
|
|
749
|
+
* @returns Entity
|
|
750
|
+
*/
|
|
751
|
+
get(key) {
|
|
752
|
+
return this.index.get(key);
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Get all entities in the store
|
|
756
|
+
* @returns Array of entities
|
|
757
|
+
*/
|
|
758
|
+
all() {
|
|
759
|
+
return this.entities$.value;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Set this store's entities
|
|
763
|
+
* @param entities Entities
|
|
764
|
+
*/
|
|
765
|
+
load(entities, pristine = true) {
|
|
766
|
+
this._index = this.generateIndex(entities);
|
|
767
|
+
this._pristine = pristine;
|
|
768
|
+
this.next();
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Clear the store's entities but keep the state and views intact.
|
|
772
|
+
* Views won't return any data but future data will be subject to the
|
|
773
|
+
* current views filter and sort
|
|
774
|
+
*/
|
|
775
|
+
softClear() {
|
|
776
|
+
if (this.index && this.index.size > 0) {
|
|
777
|
+
this.index.clear();
|
|
778
|
+
this._pristine = true;
|
|
779
|
+
this.next();
|
|
780
|
+
}
|
|
781
|
+
else if (this.index) {
|
|
782
|
+
this.updateCount();
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Clear the store's entities, state and views
|
|
787
|
+
*/
|
|
788
|
+
clear() {
|
|
789
|
+
this.stateView.clear();
|
|
790
|
+
this.view.clear();
|
|
791
|
+
this.state.clear();
|
|
792
|
+
this.softClear();
|
|
793
|
+
}
|
|
794
|
+
destroy() {
|
|
795
|
+
this.stateView.destroy();
|
|
796
|
+
this.view.destroy();
|
|
797
|
+
this.clear();
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Insert an entity into the store
|
|
801
|
+
* @param entity Entity
|
|
802
|
+
*/
|
|
803
|
+
insert(entity) {
|
|
804
|
+
this.insertMany([entity]);
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Insert many entities into the store
|
|
808
|
+
* @param entities Entities
|
|
809
|
+
*/
|
|
810
|
+
insertMany(entities) {
|
|
811
|
+
entities.forEach((entity) => this.index.set(this.getKey(entity), entity));
|
|
812
|
+
this._pristine = false;
|
|
813
|
+
this.next();
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Update or insert an entity into the store
|
|
817
|
+
* @param entity Entity
|
|
818
|
+
*/
|
|
819
|
+
update(entity) {
|
|
820
|
+
this.updateMany([entity]);
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Update or insert many entities into the store
|
|
824
|
+
* @param entities Entities
|
|
825
|
+
*/
|
|
826
|
+
updateMany(entities) {
|
|
827
|
+
entities.forEach((entity) => this.index.set(this.getKey(entity), entity));
|
|
828
|
+
this._pristine = false;
|
|
829
|
+
this.next();
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Add a strategy to this store
|
|
833
|
+
* @param strategy Entity store strategy
|
|
834
|
+
* @returns Entity store
|
|
835
|
+
*/
|
|
836
|
+
addStrategy(strategy, activate = false) {
|
|
837
|
+
const existingStrategy = this.strategies.find((_strategy) => {
|
|
838
|
+
return strategy.constructor === _strategy.constructor;
|
|
839
|
+
});
|
|
840
|
+
if (existingStrategy !== undefined) {
|
|
841
|
+
throw new Error('A strategy of this type already exists on that EntityStore.');
|
|
842
|
+
}
|
|
843
|
+
this.strategies.push(strategy);
|
|
844
|
+
strategy.bindStore(this);
|
|
845
|
+
if (activate === true) {
|
|
846
|
+
strategy.activate();
|
|
847
|
+
}
|
|
848
|
+
return this;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Remove a strategy from this store
|
|
852
|
+
* @param strategy Entity store strategy
|
|
853
|
+
* @returns Entity store
|
|
854
|
+
*/
|
|
855
|
+
removeStrategy(strategy) {
|
|
856
|
+
const index = this.strategies.indexOf(strategy);
|
|
857
|
+
if (index >= 0) {
|
|
858
|
+
this.strategies.splice(index, 1);
|
|
859
|
+
strategy.unbindStore(this);
|
|
860
|
+
}
|
|
861
|
+
return this;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Return strategies of a given type
|
|
865
|
+
* @param type Entity store strategy class
|
|
866
|
+
* @returns Strategies
|
|
867
|
+
*/
|
|
868
|
+
getStrategyOfType(type) {
|
|
869
|
+
return this.strategies.find((strategy) => {
|
|
870
|
+
return strategy instanceof type;
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Activate strategies of a given type
|
|
875
|
+
* @param type Entity store strategy class
|
|
876
|
+
*/
|
|
877
|
+
activateStrategyOfType(type) {
|
|
878
|
+
const strategy = this.getStrategyOfType(type);
|
|
879
|
+
if (strategy !== undefined) {
|
|
880
|
+
strategy.activate();
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Deactivate strategies of a given type
|
|
885
|
+
* @param type Entity store strategy class
|
|
886
|
+
*/
|
|
887
|
+
deactivateStrategyOfType(type) {
|
|
888
|
+
const strategy = this.getStrategyOfType(type);
|
|
889
|
+
if (strategy !== undefined) {
|
|
890
|
+
strategy.deactivate();
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Delete an entity from the store
|
|
895
|
+
* @param entity Entity
|
|
896
|
+
*/
|
|
897
|
+
delete(entity) {
|
|
898
|
+
this.deleteMany([entity]);
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Delete many entities from the store
|
|
902
|
+
* @param entities Entities
|
|
903
|
+
*/
|
|
904
|
+
deleteMany(entities) {
|
|
905
|
+
entities.forEach((entity) => this.index.delete(this.getKey(entity)));
|
|
906
|
+
this._pristine = false;
|
|
907
|
+
this.next();
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Generate a complete index of all the entities
|
|
911
|
+
* @param entities Entities
|
|
912
|
+
* @returns Index
|
|
913
|
+
*/
|
|
914
|
+
generateIndex(entities) {
|
|
915
|
+
const entries = entities.map((entity) => [this.getKey(entity), entity]);
|
|
916
|
+
return new Map(entries);
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Push the index's entities into the entities$ observable
|
|
920
|
+
*/
|
|
921
|
+
next() {
|
|
922
|
+
this.entities$.next(Array.from(this.index.values()));
|
|
923
|
+
this.updateCount();
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Update the store's count and empty
|
|
927
|
+
*/
|
|
928
|
+
updateCount() {
|
|
929
|
+
const count = this.index.size;
|
|
930
|
+
const empty = count === 0;
|
|
931
|
+
this.count$.next(count);
|
|
932
|
+
this.empty$.next(empty);
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Create the entity state manager
|
|
936
|
+
* @returns EntityStateManager
|
|
937
|
+
*/
|
|
938
|
+
createStateManager() {
|
|
939
|
+
return new EntityStateManager({
|
|
940
|
+
getKey: this.getKey,
|
|
941
|
+
index: this.index
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Create the data view
|
|
946
|
+
* @returns EntityView<E>
|
|
947
|
+
*/
|
|
948
|
+
createDataView() {
|
|
949
|
+
return new EntityView(this.entities$);
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Create the state view
|
|
953
|
+
* @returns EntityView<EntityRecord<E>>
|
|
954
|
+
*/
|
|
955
|
+
createStateView() {
|
|
956
|
+
return new EntityView(this.view.all$())
|
|
957
|
+
.join({
|
|
958
|
+
source: this.state.change$,
|
|
959
|
+
reduce: (entity) => {
|
|
960
|
+
const key = this.getKey(entity);
|
|
961
|
+
const state = this.state.get(entity);
|
|
962
|
+
const currentRecord = this.stateView.get(key);
|
|
963
|
+
if (currentRecord !== undefined &&
|
|
964
|
+
currentRecord.entity === entity &&
|
|
965
|
+
this.statesAreTheSame(currentRecord.state, state)) {
|
|
966
|
+
return currentRecord;
|
|
967
|
+
}
|
|
968
|
+
const revision = currentRecord ? currentRecord.revision + 1 : 1;
|
|
969
|
+
const ref = `${key}-${revision}`;
|
|
970
|
+
return { entity, state, revision, ref };
|
|
971
|
+
}
|
|
972
|
+
})
|
|
973
|
+
.createIndex((record) => this.getKey(record.entity));
|
|
974
|
+
}
|
|
975
|
+
statesAreTheSame(currentState, newState) {
|
|
976
|
+
if (currentState === newState) {
|
|
977
|
+
return true;
|
|
978
|
+
}
|
|
979
|
+
const currentStateIsEmpty = Object.keys(currentState).length === 0;
|
|
980
|
+
const newStateIsEmpty = Object.keys(newState).length === 0;
|
|
981
|
+
return currentStateIsEmpty && newStateIsEmpty;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* This class is used to synchronize a component's changes
|
|
987
|
+
* detection with an EntityStore changes. For example, it is frequent
|
|
988
|
+
* to have a component subscribe to a store's selected entity and, at the same time,
|
|
989
|
+
* this component provides a way to select an entity with, let's say, a click.
|
|
990
|
+
*
|
|
991
|
+
* This class automatically handles those case and triggers the compoent's
|
|
992
|
+
* change detection when needed.
|
|
993
|
+
*
|
|
994
|
+
* Note: If the component observes the store's stateView, a workspace is
|
|
995
|
+
* probably not required because the stateView catches any changes to the
|
|
996
|
+
* entities and their state.
|
|
997
|
+
*/
|
|
998
|
+
class EntityStoreWatcher {
|
|
999
|
+
/**
|
|
1000
|
+
* Component change detector
|
|
1001
|
+
*/
|
|
1002
|
+
cdRef;
|
|
1003
|
+
/**
|
|
1004
|
+
* Entity store
|
|
1005
|
+
*/
|
|
1006
|
+
store;
|
|
1007
|
+
/**
|
|
1008
|
+
* Component inner state
|
|
1009
|
+
*/
|
|
1010
|
+
innerStateIndex = new Map();
|
|
1011
|
+
/**
|
|
1012
|
+
* Subscription to the store's entities
|
|
1013
|
+
*/
|
|
1014
|
+
entities$$;
|
|
1015
|
+
/**
|
|
1016
|
+
* Subscription to the store's state
|
|
1017
|
+
*/
|
|
1018
|
+
state$$;
|
|
1019
|
+
constructor(store, cdRef) {
|
|
1020
|
+
this.setChangeDetector(cdRef);
|
|
1021
|
+
this.setStore(store);
|
|
1022
|
+
}
|
|
1023
|
+
destroy() {
|
|
1024
|
+
this.setChangeDetector(undefined);
|
|
1025
|
+
this.setStore(undefined);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Bind this workspace to a store and start watching for changes
|
|
1029
|
+
* @param store Entity store
|
|
1030
|
+
*/
|
|
1031
|
+
setStore(store) {
|
|
1032
|
+
if (store === undefined) {
|
|
1033
|
+
this.teardownObservers();
|
|
1034
|
+
this.innerStateIndex.clear();
|
|
1035
|
+
this.store = undefined;
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
this.setStore(undefined);
|
|
1039
|
+
this.store = store;
|
|
1040
|
+
this.setupObservers();
|
|
1041
|
+
this.detectChanges();
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Bind this workspace to a component's change detector
|
|
1045
|
+
* @param cdRef Change detector
|
|
1046
|
+
*/
|
|
1047
|
+
setChangeDetector(cdRef) {
|
|
1048
|
+
this.cdRef = cdRef;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Set up observers on a store's entities and their state
|
|
1052
|
+
* @param store Entity store
|
|
1053
|
+
*/
|
|
1054
|
+
setupObservers() {
|
|
1055
|
+
this.teardownObservers();
|
|
1056
|
+
this.entities$$ = this.store.entities$.subscribe((entities) => this.onEntitiesChange(entities));
|
|
1057
|
+
this.state$$ = this.store.state.change$
|
|
1058
|
+
.pipe(skip(1))
|
|
1059
|
+
.subscribe(() => this.onStateChange());
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Teardown store observers
|
|
1063
|
+
*/
|
|
1064
|
+
teardownObservers() {
|
|
1065
|
+
if (this.entities$$ !== undefined) {
|
|
1066
|
+
this.entities$$.unsubscribe();
|
|
1067
|
+
}
|
|
1068
|
+
if (this.state$$ !== undefined) {
|
|
1069
|
+
this.state$$.unsubscribe();
|
|
1070
|
+
}
|
|
1071
|
+
this.entities$$ = undefined;
|
|
1072
|
+
this.state$$ = undefined;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* When the entities change, always trigger the changes detection
|
|
1076
|
+
*/
|
|
1077
|
+
onEntitiesChange(entities) {
|
|
1078
|
+
this.detectChanges();
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* When the entities state change, trigger the change detection
|
|
1082
|
+
* only if the component has not handled these changes yet. For example,
|
|
1083
|
+
* the component might have initiated thoses changes itself.
|
|
1084
|
+
*/
|
|
1085
|
+
onStateChange() {
|
|
1086
|
+
let changesDetected = false;
|
|
1087
|
+
const storeIndex = this.store.state.index;
|
|
1088
|
+
const innerIndex = this.innerStateIndex;
|
|
1089
|
+
if (storeIndex.size !== innerIndex.size) {
|
|
1090
|
+
changesDetected = this.detectChanges();
|
|
1091
|
+
}
|
|
1092
|
+
const storeKeys = Array.from(storeIndex.keys());
|
|
1093
|
+
for (const key of storeKeys) {
|
|
1094
|
+
const storeValue = storeIndex.get(key);
|
|
1095
|
+
const innerValue = innerIndex.get(key);
|
|
1096
|
+
if (changesDetected === false) {
|
|
1097
|
+
if (innerValue === undefined) {
|
|
1098
|
+
changesDetected = this.detectChanges();
|
|
1099
|
+
}
|
|
1100
|
+
else if (!ObjectUtils.objectsAreEquivalent(storeValue, innerValue)) {
|
|
1101
|
+
changesDetected = this.detectChanges();
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
this.innerStateIndex.set(key, Object.assign({}, storeValue));
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Trigger the change detection of the workspace is bound to a change detector
|
|
1109
|
+
*/
|
|
1110
|
+
detectChanges() {
|
|
1111
|
+
if (this.cdRef !== undefined) {
|
|
1112
|
+
this.cdRef.detectChanges();
|
|
1113
|
+
}
|
|
1114
|
+
return true;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* This class holds a reference to the insert, update and delete
|
|
1120
|
+
* operations performed on a store. This is useful to commit
|
|
1121
|
+
* these operations in a single pass or to cancel them.
|
|
1122
|
+
*/
|
|
1123
|
+
class EntityTransaction {
|
|
1124
|
+
/**
|
|
1125
|
+
* Store holding the operations on another store
|
|
1126
|
+
*/
|
|
1127
|
+
operations;
|
|
1128
|
+
/**
|
|
1129
|
+
* Method to get an entity's id
|
|
1130
|
+
*/
|
|
1131
|
+
getKey;
|
|
1132
|
+
/**
|
|
1133
|
+
* Whether there are pending operations
|
|
1134
|
+
*/
|
|
1135
|
+
get empty$() {
|
|
1136
|
+
return this.operations.empty$;
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Whether there are pending operations
|
|
1140
|
+
*/
|
|
1141
|
+
get empty() {
|
|
1142
|
+
return this.empty$.value;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Whether thise store is in commit phase
|
|
1146
|
+
*/
|
|
1147
|
+
get inCommitPhase() {
|
|
1148
|
+
return this.inCommitPhase$.value;
|
|
1149
|
+
}
|
|
1150
|
+
inCommitPhase$ = new BehaviorSubject(false);
|
|
1151
|
+
constructor(options = {}) {
|
|
1152
|
+
this.getKey = options.getKey ? options.getKey : getEntityId;
|
|
1153
|
+
this.operations = new EntityStore([], {
|
|
1154
|
+
getKey: (operation) => operation.key
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
destroy() {
|
|
1158
|
+
this.operations.destroy();
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Insert an entity into a store. If no store is specified, an insert
|
|
1162
|
+
* operation is still created but the transaction won't add the new
|
|
1163
|
+
* entity to the store.
|
|
1164
|
+
* @param current The entity to insert
|
|
1165
|
+
* @param store Optional: The store to insert the entity into
|
|
1166
|
+
* @param meta Optional: Any metadata on the operation
|
|
1167
|
+
*/
|
|
1168
|
+
insert(current, store, meta) {
|
|
1169
|
+
const existingOperation = this.getOperationByEntity(current);
|
|
1170
|
+
if (existingOperation !== undefined) {
|
|
1171
|
+
this.removeOperation(existingOperation);
|
|
1172
|
+
}
|
|
1173
|
+
this.doInsert(current, store, meta);
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Update an entity in a store. If no store is specified, an update
|
|
1177
|
+
* operation is still created but the transaction won't update the
|
|
1178
|
+
* entity into the store.
|
|
1179
|
+
* @param previous The entity before update
|
|
1180
|
+
* @param current The entity after update
|
|
1181
|
+
* @param store Optional: The store to update the entity into
|
|
1182
|
+
* @param meta Optional: Any metadata on the operation
|
|
1183
|
+
*/
|
|
1184
|
+
update(previous, current, store, meta) {
|
|
1185
|
+
const existingOperation = this.getOperationByEntity(current);
|
|
1186
|
+
if (existingOperation !== undefined) {
|
|
1187
|
+
this.removeOperation(existingOperation);
|
|
1188
|
+
if (existingOperation.type === EntityOperationType.Insert) {
|
|
1189
|
+
this.doInsert(current, store, meta);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
else if (existingOperation.type === EntityOperationType.Update) {
|
|
1193
|
+
previous = existingOperation.previous;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
this.doUpdate(previous, current, store, meta);
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Delete an entity from a store. If no store is specified, a delete
|
|
1200
|
+
* operation is still created but the transaction won't remove the
|
|
1201
|
+
* entity from the store.
|
|
1202
|
+
* @param previous The entity before delete
|
|
1203
|
+
* @param store Optional: The store to delete the entity from
|
|
1204
|
+
* @param meta Optional: Any metadata on the operation
|
|
1205
|
+
*/
|
|
1206
|
+
delete(previous, store, meta) {
|
|
1207
|
+
const existingOperation = this.getOperationByEntity(previous);
|
|
1208
|
+
if (existingOperation !== undefined) {
|
|
1209
|
+
this.removeOperation(existingOperation);
|
|
1210
|
+
if (existingOperation.type === EntityOperationType.Insert) {
|
|
1211
|
+
if (store !== undefined) {
|
|
1212
|
+
store.delete(previous);
|
|
1213
|
+
}
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
this.doDelete(previous, store, meta);
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Commit operations the transaction. This method doesn't do much
|
|
1221
|
+
* in itself. The handler it receives does the hard work and it's
|
|
1222
|
+
* implementation is left to the caller. This method simply wraps
|
|
1223
|
+
* the handler into an error catching mechanism to update
|
|
1224
|
+
* the transaction afterward. The caller needs to subscribe to this
|
|
1225
|
+
* method's output (observable) for the commit to be performed.
|
|
1226
|
+
* @param operations Operations to commit
|
|
1227
|
+
* @param handler Function that handles the commit operation
|
|
1228
|
+
* @returns The handler output (observable)
|
|
1229
|
+
*/
|
|
1230
|
+
commit(operations, handler) {
|
|
1231
|
+
this.inCommitPhase$.next(true);
|
|
1232
|
+
return handler(this, operations).pipe(catchError(() => of(new Error())), tap((result) => {
|
|
1233
|
+
if (result instanceof Error) {
|
|
1234
|
+
this.onCommitError(operations);
|
|
1235
|
+
}
|
|
1236
|
+
else {
|
|
1237
|
+
this.onCommitSuccess(operations);
|
|
1238
|
+
}
|
|
1239
|
+
}));
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Commit all the operations of the transaction.
|
|
1243
|
+
* @param handler Function that handles the commit operation
|
|
1244
|
+
* @returns The handler output (observable)
|
|
1245
|
+
*/
|
|
1246
|
+
commitAll(handler) {
|
|
1247
|
+
const operations = this.getOperationsInCommit();
|
|
1248
|
+
return this.commit(operations, handler);
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Rollback this transaction
|
|
1252
|
+
*/
|
|
1253
|
+
rollback() {
|
|
1254
|
+
this.rollbackOperations(this.operations.all());
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Rollback specific operations
|
|
1258
|
+
*/
|
|
1259
|
+
rollbackOperations(operations) {
|
|
1260
|
+
this.checkInCommitPhase();
|
|
1261
|
+
const operationsFactory = () => new Map([
|
|
1262
|
+
[EntityOperationType.Delete, []],
|
|
1263
|
+
[EntityOperationType.Update, []],
|
|
1264
|
+
[EntityOperationType.Insert, []]
|
|
1265
|
+
]);
|
|
1266
|
+
const storesOperations = new Map();
|
|
1267
|
+
// Group operations by store and by operation type.
|
|
1268
|
+
// Grouping operations allows us to revert them in bacth, thus, triggering
|
|
1269
|
+
// observables only one per operation type.
|
|
1270
|
+
for (const operation of operations) {
|
|
1271
|
+
const store = operation.store;
|
|
1272
|
+
if (operation.store === undefined) {
|
|
1273
|
+
continue;
|
|
1274
|
+
}
|
|
1275
|
+
let storeOperations = storesOperations.get(store);
|
|
1276
|
+
if (storeOperations === undefined) {
|
|
1277
|
+
storeOperations = operationsFactory();
|
|
1278
|
+
storesOperations.set(store, storeOperations);
|
|
1279
|
+
}
|
|
1280
|
+
storeOperations.get(operation.type).push(operation);
|
|
1281
|
+
}
|
|
1282
|
+
Array.from(storesOperations.keys()).forEach((store) => {
|
|
1283
|
+
const storeOperations = storesOperations.get(store);
|
|
1284
|
+
const deletes = storeOperations.get(EntityOperationType.Delete);
|
|
1285
|
+
store.insertMany(deletes.map((_delete) => _delete.previous));
|
|
1286
|
+
const updates = storeOperations.get(EntityOperationType.Update);
|
|
1287
|
+
store.updateMany(updates.map((_update) => _update.previous));
|
|
1288
|
+
const inserts = storeOperations.get(EntityOperationType.Insert);
|
|
1289
|
+
store.deleteMany(inserts.map((_insert) => _insert.current));
|
|
1290
|
+
});
|
|
1291
|
+
this.operations.deleteMany(operations);
|
|
1292
|
+
this.inCommitPhase$.next(false);
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Clear this transaction
|
|
1296
|
+
* @todo Raise event and synchronize stores?
|
|
1297
|
+
*/
|
|
1298
|
+
clear() {
|
|
1299
|
+
this.operations.clear();
|
|
1300
|
+
this.inCommitPhase$.next(false);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Get any existing operation on an entity
|
|
1304
|
+
* @param entity Entity
|
|
1305
|
+
* @returns Either an insert, update or delete operation
|
|
1306
|
+
*/
|
|
1307
|
+
getOperationByEntity(entity) {
|
|
1308
|
+
return this.operations.get(this.getKey(entity));
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Merge another transaction in this one
|
|
1312
|
+
* @param transaction Another transaction
|
|
1313
|
+
*/
|
|
1314
|
+
mergeTransaction(transaction) {
|
|
1315
|
+
this.checkInCommitPhase();
|
|
1316
|
+
const operations = transaction.operations.all();
|
|
1317
|
+
operations.forEach((operation) => {
|
|
1318
|
+
this.addOperation(operation);
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Create an insert operation and add an entity to the store
|
|
1323
|
+
* @param current The entity to insert
|
|
1324
|
+
* @param store Optional: The store to insert the entity into
|
|
1325
|
+
* @param meta Optional: Any metadata on the operation
|
|
1326
|
+
*/
|
|
1327
|
+
doInsert(current, store, meta) {
|
|
1328
|
+
this.addOperation({
|
|
1329
|
+
key: this.getKey(current),
|
|
1330
|
+
type: EntityOperationType.Insert,
|
|
1331
|
+
previous: undefined,
|
|
1332
|
+
current,
|
|
1333
|
+
store,
|
|
1334
|
+
meta
|
|
1335
|
+
});
|
|
1336
|
+
if (store !== undefined) {
|
|
1337
|
+
store.insert(current);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Create an update operation and update an entity into the store
|
|
1342
|
+
* @param previous The entity before update
|
|
1343
|
+
* @param current The entity after update
|
|
1344
|
+
* @param store Optional: The store to update the entity into
|
|
1345
|
+
* @param meta Optional: Any metadata on the operation
|
|
1346
|
+
*/
|
|
1347
|
+
doUpdate(previous, current, store, meta) {
|
|
1348
|
+
this.addOperation({
|
|
1349
|
+
key: this.getKey(current),
|
|
1350
|
+
type: EntityOperationType.Update,
|
|
1351
|
+
previous,
|
|
1352
|
+
current,
|
|
1353
|
+
store,
|
|
1354
|
+
meta
|
|
1355
|
+
});
|
|
1356
|
+
if (store !== undefined) {
|
|
1357
|
+
store.update(current);
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Create a delete operation and delete an entity from the store
|
|
1362
|
+
* @param previous The entity before delete
|
|
1363
|
+
* @param store Optional: The store to delete the entity from
|
|
1364
|
+
* @param meta Optional: Any metadata on the operation
|
|
1365
|
+
*/
|
|
1366
|
+
doDelete(previous, store, meta) {
|
|
1367
|
+
this.addOperation({
|
|
1368
|
+
key: this.getKey(previous),
|
|
1369
|
+
type: EntityOperationType.Delete,
|
|
1370
|
+
previous,
|
|
1371
|
+
current: undefined,
|
|
1372
|
+
store,
|
|
1373
|
+
meta
|
|
1374
|
+
});
|
|
1375
|
+
if (store !== undefined) {
|
|
1376
|
+
store.delete(previous);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Remove committed operations from store
|
|
1381
|
+
* @param operations Commited operations
|
|
1382
|
+
* @todo Raise event and synchronize stores?
|
|
1383
|
+
*/
|
|
1384
|
+
resolveOperations(operations) {
|
|
1385
|
+
this.operations.deleteMany(operations);
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* On commit success, resolve commited operations and exit commit phase
|
|
1389
|
+
* @param operations Commited operations
|
|
1390
|
+
*/
|
|
1391
|
+
onCommitSuccess(operations) {
|
|
1392
|
+
this.resolveOperations(operations);
|
|
1393
|
+
this.inCommitPhase$.next(false);
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* On commit error, abort transaction
|
|
1397
|
+
* @param operations Commited operations
|
|
1398
|
+
*/
|
|
1399
|
+
onCommitError(operations) {
|
|
1400
|
+
this.inCommitPhase$.next(false);
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Add an operation to the operations store
|
|
1404
|
+
* @param operation Operation to add
|
|
1405
|
+
*/
|
|
1406
|
+
addOperation(operation) {
|
|
1407
|
+
this.checkInCommitPhase();
|
|
1408
|
+
this.operations.insert(operation);
|
|
1409
|
+
this.operations.state.update(operation, { added: true });
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Remove an operation from the operations store
|
|
1413
|
+
* @param operation Operation to remove
|
|
1414
|
+
*/
|
|
1415
|
+
removeOperation(operation) {
|
|
1416
|
+
this.checkInCommitPhase();
|
|
1417
|
+
this.operations.delete(operation);
|
|
1418
|
+
this.operations.state.update(operation, { added: false });
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Get all the operations to commit
|
|
1422
|
+
* @returns Operations to commit
|
|
1423
|
+
*/
|
|
1424
|
+
getOperationsInCommit() {
|
|
1425
|
+
return this.operations.stateView
|
|
1426
|
+
.manyBy((value) => {
|
|
1427
|
+
return value.state.added === true;
|
|
1428
|
+
})
|
|
1429
|
+
.map((value) => value.entity);
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Check if the transaction is in the commit phase and throw an error if it is
|
|
1433
|
+
*/
|
|
1434
|
+
checkInCommitPhase() {
|
|
1435
|
+
if (this.inCommitPhase === true) {
|
|
1436
|
+
throw new Error('This transaction is in the commit phase. Cannot complete this operation.');
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* Entity store strategies. They can do pretty much anything during a store's
|
|
1443
|
+
* lifetime. For example, they may act as triggers when something happens.
|
|
1444
|
+
* Sharing a strategy is a good idea when multiple strategies would have
|
|
1445
|
+
* on cancelling effect on each other.
|
|
1446
|
+
*
|
|
1447
|
+
* At creation, strategy is inactive and needs to be manually activated.
|
|
1448
|
+
*/
|
|
1449
|
+
class EntityStoreStrategy {
|
|
1450
|
+
options;
|
|
1451
|
+
/**
|
|
1452
|
+
* Feature store
|
|
1453
|
+
* @internal
|
|
1454
|
+
*/
|
|
1455
|
+
stores = [];
|
|
1456
|
+
/**
|
|
1457
|
+
* Whether this strategy is active
|
|
1458
|
+
* @internal
|
|
1459
|
+
*/
|
|
1460
|
+
get active() {
|
|
1461
|
+
return this.active$.value;
|
|
1462
|
+
}
|
|
1463
|
+
active$ = new BehaviorSubject(false);
|
|
1464
|
+
constructor(options = {}) {
|
|
1465
|
+
this.options = options;
|
|
1466
|
+
this.options = options;
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Activate the strategy. If it's already active, it'll be deactivated
|
|
1470
|
+
* and activated again.
|
|
1471
|
+
*/
|
|
1472
|
+
activate() {
|
|
1473
|
+
if (this.active === true) {
|
|
1474
|
+
this.doDeactivate();
|
|
1475
|
+
}
|
|
1476
|
+
this.active$.next(true);
|
|
1477
|
+
this.doActivate();
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Activate the strategy. If it's already active, it'll be deactivated
|
|
1481
|
+
* and activated again.
|
|
1482
|
+
*/
|
|
1483
|
+
deactivate() {
|
|
1484
|
+
this.active$.next(false);
|
|
1485
|
+
this.doDeactivate();
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Bind this strategy to a store
|
|
1489
|
+
* @param store Feature store
|
|
1490
|
+
*/
|
|
1491
|
+
bindStore(store) {
|
|
1492
|
+
if (this.stores.indexOf(store) < 0) {
|
|
1493
|
+
this.stores.push(store);
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Unbind this strategy from store
|
|
1498
|
+
* @param store Feature store
|
|
1499
|
+
*/
|
|
1500
|
+
unbindStore(store) {
|
|
1501
|
+
const index = this.stores.indexOf(store);
|
|
1502
|
+
if (index >= 0) {
|
|
1503
|
+
this.stores.splice(index, 1);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* Do the stataegy activation
|
|
1508
|
+
* @internal
|
|
1509
|
+
*/
|
|
1510
|
+
doActivate() { }
|
|
1511
|
+
/**
|
|
1512
|
+
* Do the strategy deactivation
|
|
1513
|
+
* @internal
|
|
1514
|
+
*/
|
|
1515
|
+
doDeactivate() { }
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* When active, this strategy filters a store's stateView to return
|
|
1520
|
+
* selected entities only.
|
|
1521
|
+
*/
|
|
1522
|
+
class EntityStoreFilterCustomFuncStrategy extends EntityStoreStrategy {
|
|
1523
|
+
options;
|
|
1524
|
+
constructor(options) {
|
|
1525
|
+
super(options);
|
|
1526
|
+
this.options = options;
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Store / filter ids map
|
|
1530
|
+
*/
|
|
1531
|
+
filters = new Map();
|
|
1532
|
+
/**
|
|
1533
|
+
* Bind this strategy to a store and start filtering it
|
|
1534
|
+
* @param store Entity store
|
|
1535
|
+
*/
|
|
1536
|
+
bindStore(store) {
|
|
1537
|
+
super.bindStore(store);
|
|
1538
|
+
if (this.active === true) {
|
|
1539
|
+
this.filterStore(store);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Unbind this strategy from a store and stop filtering it
|
|
1544
|
+
* @param store Entity store
|
|
1545
|
+
*/
|
|
1546
|
+
unbindStore(store) {
|
|
1547
|
+
super.unbindStore(store);
|
|
1548
|
+
if (this.active === true) {
|
|
1549
|
+
this.unfilterStore(store);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Start filtering all stores
|
|
1554
|
+
* @internal
|
|
1555
|
+
*/
|
|
1556
|
+
doActivate() {
|
|
1557
|
+
this.filterAll();
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Stop filtering all stores
|
|
1561
|
+
* @internal
|
|
1562
|
+
*/
|
|
1563
|
+
doDeactivate() {
|
|
1564
|
+
this.unfilterAll();
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Filter all stores
|
|
1568
|
+
*/
|
|
1569
|
+
filterAll() {
|
|
1570
|
+
this.stores.forEach((store) => this.filterStore(store));
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Unfilter all stores
|
|
1574
|
+
*/
|
|
1575
|
+
unfilterAll() {
|
|
1576
|
+
this.stores.forEach((store) => this.unfilterStore(store));
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Filter a store and add it to the filters map
|
|
1580
|
+
*/
|
|
1581
|
+
filterStore(store) {
|
|
1582
|
+
this.filters.set(store, store.stateView.addFilter(this.options.filterClauseFunc));
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Unfilter a store and delete it from the filters map
|
|
1586
|
+
*/
|
|
1587
|
+
unfilterStore(store) {
|
|
1588
|
+
const filterId = this.filters.get(store);
|
|
1589
|
+
if (filterId === undefined) {
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
store.stateView.removeFilter(filterId);
|
|
1593
|
+
this.filters.delete(store);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* When active, this strategy filters a store's stateView to return
|
|
1599
|
+
* selected entities only.
|
|
1600
|
+
*/
|
|
1601
|
+
class EntityStoreFilterSelectionStrategy extends EntityStoreStrategy {
|
|
1602
|
+
/**
|
|
1603
|
+
* Store / filter ids map
|
|
1604
|
+
*/
|
|
1605
|
+
filters = new Map();
|
|
1606
|
+
/**
|
|
1607
|
+
* Bind this strategy to a store and start filtering it
|
|
1608
|
+
* @param store Entity store
|
|
1609
|
+
*/
|
|
1610
|
+
bindStore(store) {
|
|
1611
|
+
super.bindStore(store);
|
|
1612
|
+
if (this.active === true) {
|
|
1613
|
+
this.filterStore(store);
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Unbind this strategy from a store and stop filtering it
|
|
1618
|
+
* @param store Entity store
|
|
1619
|
+
*/
|
|
1620
|
+
unbindStore(store) {
|
|
1621
|
+
super.unbindStore(store);
|
|
1622
|
+
if (this.active === true) {
|
|
1623
|
+
this.unfilterStore(store);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Start filtering all stores
|
|
1628
|
+
* @internal
|
|
1629
|
+
*/
|
|
1630
|
+
doActivate() {
|
|
1631
|
+
this.filterAll();
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Stop filtering all stores
|
|
1635
|
+
* @internal
|
|
1636
|
+
*/
|
|
1637
|
+
doDeactivate() {
|
|
1638
|
+
this.unfilterAll();
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Filter all stores
|
|
1642
|
+
*/
|
|
1643
|
+
filterAll() {
|
|
1644
|
+
this.stores.forEach((store) => this.filterStore(store));
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Unfilter all stores
|
|
1648
|
+
*/
|
|
1649
|
+
unfilterAll() {
|
|
1650
|
+
this.stores.forEach((store) => this.unfilterStore(store));
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Filter a store and add it to the filters map
|
|
1654
|
+
*/
|
|
1655
|
+
filterStore(store) {
|
|
1656
|
+
if (this.filters.has(store)) {
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
const filter = (record) => {
|
|
1660
|
+
return record.state.selected === true;
|
|
1661
|
+
};
|
|
1662
|
+
this.filters.set(store, store.stateView.addFilter(filter));
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Unfilter a store and delete it from the filters map
|
|
1666
|
+
*/
|
|
1667
|
+
unfilterStore(store) {
|
|
1668
|
+
const filterId = this.filters.get(store);
|
|
1669
|
+
if (filterId === undefined) {
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
store.stateView.removeFilter(filterId);
|
|
1673
|
+
this.filters.delete(store);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
class EntitySelectorComponent {
|
|
1678
|
+
cdRef;
|
|
1679
|
+
/**
|
|
1680
|
+
* The selected entity
|
|
1681
|
+
* @internal
|
|
1682
|
+
*/
|
|
1683
|
+
selected$ = new BehaviorSubject(undefined);
|
|
1684
|
+
/**
|
|
1685
|
+
* The current multi select option text
|
|
1686
|
+
* @internal
|
|
1687
|
+
*/
|
|
1688
|
+
multiText$ = new BehaviorSubject(undefined);
|
|
1689
|
+
multiSelectValue = { id: 'IGO_MULTI_SELECT' };
|
|
1690
|
+
emptyValue = { id: 'IGO_EMPTY_SELECT' };
|
|
1691
|
+
/**
|
|
1692
|
+
* Subscription to the selected entity
|
|
1693
|
+
*/
|
|
1694
|
+
selected$$;
|
|
1695
|
+
/**
|
|
1696
|
+
* Store watcher
|
|
1697
|
+
*/
|
|
1698
|
+
watcher;
|
|
1699
|
+
/**
|
|
1700
|
+
* Entity store
|
|
1701
|
+
*/
|
|
1702
|
+
store;
|
|
1703
|
+
/**
|
|
1704
|
+
* Title accessor
|
|
1705
|
+
*/
|
|
1706
|
+
titleAccessor = getEntityTitle;
|
|
1707
|
+
/**
|
|
1708
|
+
* Text to display when nothing is selected
|
|
1709
|
+
*/
|
|
1710
|
+
emptyText = undefined;
|
|
1711
|
+
/**
|
|
1712
|
+
* Wheter selecting many entities is allowed
|
|
1713
|
+
*/
|
|
1714
|
+
multi = false;
|
|
1715
|
+
/**
|
|
1716
|
+
* Text to display for the select all option
|
|
1717
|
+
*/
|
|
1718
|
+
multiAllText = 'All';
|
|
1719
|
+
/**
|
|
1720
|
+
* Text to display for the select none option
|
|
1721
|
+
*/
|
|
1722
|
+
multiNoneText = 'None';
|
|
1723
|
+
/**
|
|
1724
|
+
* Field placeholder
|
|
1725
|
+
*/
|
|
1726
|
+
placeholder;
|
|
1727
|
+
/**
|
|
1728
|
+
* Wheter the selector is disabled or not
|
|
1729
|
+
*/
|
|
1730
|
+
disabled = false;
|
|
1731
|
+
/**
|
|
1732
|
+
* Event emitted when the selection changes
|
|
1733
|
+
*/
|
|
1734
|
+
selectedChange = new EventEmitter();
|
|
1735
|
+
constructor(cdRef) {
|
|
1736
|
+
this.cdRef = cdRef;
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Create a store watcher and subscribe to the selected entity
|
|
1740
|
+
* @internal
|
|
1741
|
+
*/
|
|
1742
|
+
ngOnInit() {
|
|
1743
|
+
this.watcher = new EntityStoreWatcher(this.store, this.cdRef);
|
|
1744
|
+
this.selected$$ = this.store.stateView
|
|
1745
|
+
.manyBy$((record) => record.state.selected === true)
|
|
1746
|
+
.subscribe((records) => {
|
|
1747
|
+
const entities = records.map((record) => record.entity);
|
|
1748
|
+
this.onSelectFromStore(entities);
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Unsubscribe to the selected entity and destroy the store watcher
|
|
1753
|
+
* @internal
|
|
1754
|
+
*/
|
|
1755
|
+
ngOnDestroy() {
|
|
1756
|
+
this.watcher.destroy();
|
|
1757
|
+
this.selected$$.unsubscribe();
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* On selection change, update the store's state and emit an event
|
|
1761
|
+
* @internal
|
|
1762
|
+
*/
|
|
1763
|
+
onSelectionChange(event) {
|
|
1764
|
+
const values = event.value instanceof Array ? event.value : [event.value];
|
|
1765
|
+
const multiSelect = values.find((_value) => _value === this.multiSelectValue);
|
|
1766
|
+
let entities = values.filter((_value) => _value !== this.multiSelectValue);
|
|
1767
|
+
if (multiSelect !== undefined) {
|
|
1768
|
+
if (entities.length === this.store.count) {
|
|
1769
|
+
entities = [];
|
|
1770
|
+
}
|
|
1771
|
+
else if (entities.length < this.store.count) {
|
|
1772
|
+
entities = this.store.all();
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
entities = entities.filter((entity) => entity !== this.emptyValue);
|
|
1776
|
+
if (entities.length === 0) {
|
|
1777
|
+
this.store.state.updateAll({ selected: false });
|
|
1778
|
+
}
|
|
1779
|
+
else {
|
|
1780
|
+
this.store.state.updateMany(entities, { selected: true }, true);
|
|
1781
|
+
}
|
|
1782
|
+
const value = this.multi ? entities : event.value;
|
|
1783
|
+
this.selectedChange.emit({ selected: true, value });
|
|
1784
|
+
}
|
|
1785
|
+
onSelectFromStore(entities) {
|
|
1786
|
+
if (this.multi === true) {
|
|
1787
|
+
this.selected$.next(entities);
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
const entity = entities.length > 0 ? entities[0] : undefined;
|
|
1791
|
+
this.selected$.next(entity);
|
|
1792
|
+
}
|
|
1793
|
+
this.updateMultiToggleWithEntities(entities);
|
|
1794
|
+
}
|
|
1795
|
+
updateMultiToggleWithEntities(entities) {
|
|
1796
|
+
if (entities.length === this.store.count &&
|
|
1797
|
+
this.multiText$.value !== this.multiNoneText) {
|
|
1798
|
+
this.multiText$.next(this.multiNoneText);
|
|
1799
|
+
}
|
|
1800
|
+
else if (entities.length < this.store.count &&
|
|
1801
|
+
this.multiText$.value !== this.multiAllText) {
|
|
1802
|
+
this.multiText$.next(this.multiAllText);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntitySelectorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1806
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: EntitySelectorComponent, isStandalone: true, selector: "igo-entity-selector", inputs: { store: "store", titleAccessor: "titleAccessor", emptyText: "emptyText", multi: "multi", multiAllText: "multiAllText", multiNoneText: "multiNoneText", placeholder: "placeholder", disabled: "disabled" }, outputs: { selectedChange: "selectedChange" }, ngImport: i0, template: "<mat-form-field class=\"igo-entity-selector\" subscriptSizing=\"dynamic\">\n <mat-select\n [disabled]=\"disabled\"\n [value]=\"selected$ | async\"\n [multiple]=\"multi\"\n [placeholder]=\"placeholder\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n <mat-option\n *ngIf=\"emptyText !== undefined && multi === false\"\n [value]=\"emptyValue\"\n >{{ emptyText }}</mat-option\n >\n <mat-option *ngIf=\"multi === true\" [value]=\"multiSelectValue\">{{\n multiText$ | async\n }}</mat-option>\n <ng-template ngFor let-record [ngForOf]=\"store.stateView.all$() | async\">\n <mat-option [value]=\"record.entity\">\n {{ titleAccessor(record.entity) }}\n </mat-option>\n </ng-template>\n </mat-select>\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatOptionModule }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1807
|
+
}
|
|
1808
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntitySelectorComponent, decorators: [{
|
|
1809
|
+
type: Component,
|
|
1810
|
+
args: [{ selector: 'igo-entity-selector', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
1811
|
+
MatFormFieldModule,
|
|
1812
|
+
MatSelectModule,
|
|
1813
|
+
NgIf,
|
|
1814
|
+
MatOptionModule,
|
|
1815
|
+
NgFor,
|
|
1816
|
+
AsyncPipe
|
|
1817
|
+
], template: "<mat-form-field class=\"igo-entity-selector\" subscriptSizing=\"dynamic\">\n <mat-select\n [disabled]=\"disabled\"\n [value]=\"selected$ | async\"\n [multiple]=\"multi\"\n [placeholder]=\"placeholder\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n <mat-option\n *ngIf=\"emptyText !== undefined && multi === false\"\n [value]=\"emptyValue\"\n >{{ emptyText }}</mat-option\n >\n <mat-option *ngIf=\"multi === true\" [value]=\"multiSelectValue\">{{\n multiText$ | async\n }}</mat-option>\n <ng-template ngFor let-record [ngForOf]=\"store.stateView.all$() | async\">\n <mat-option [value]=\"record.entity\">\n {{ titleAccessor(record.entity) }}\n </mat-option>\n </ng-template>\n </mat-select>\n</mat-form-field>\n", styles: ["mat-form-field{width:100%}\n"] }]
|
|
1818
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { store: [{
|
|
1819
|
+
type: Input
|
|
1820
|
+
}], titleAccessor: [{
|
|
1821
|
+
type: Input
|
|
1822
|
+
}], emptyText: [{
|
|
1823
|
+
type: Input
|
|
1824
|
+
}], multi: [{
|
|
1825
|
+
type: Input
|
|
1826
|
+
}], multiAllText: [{
|
|
1827
|
+
type: Input
|
|
1828
|
+
}], multiNoneText: [{
|
|
1829
|
+
type: Input
|
|
1830
|
+
}], placeholder: [{
|
|
1831
|
+
type: Input
|
|
1832
|
+
}], disabled: [{
|
|
1833
|
+
type: Input
|
|
1834
|
+
}], selectedChange: [{
|
|
1835
|
+
type: Output
|
|
1836
|
+
}] } });
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* @deprecated import the EntitySelectorComponent directly
|
|
1840
|
+
*/
|
|
1841
|
+
class IgoEntitySelectorModule {
|
|
1842
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntitySelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1843
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: IgoEntitySelectorModule, imports: [EntitySelectorComponent], exports: [EntitySelectorComponent] });
|
|
1844
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntitySelectorModule, imports: [EntitySelectorComponent] });
|
|
1845
|
+
}
|
|
1846
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntitySelectorModule, decorators: [{
|
|
1847
|
+
type: NgModule,
|
|
1848
|
+
args: [{
|
|
1849
|
+
imports: [EntitySelectorComponent],
|
|
1850
|
+
exports: [EntitySelectorComponent]
|
|
1851
|
+
}]
|
|
1852
|
+
}] });
|
|
1853
|
+
|
|
1854
|
+
class EntityTablePaginatorComponent {
|
|
1855
|
+
languageService;
|
|
1856
|
+
mediaService;
|
|
1857
|
+
disabled = false;
|
|
1858
|
+
hidePageSize = false;
|
|
1859
|
+
pageIndex = 0;
|
|
1860
|
+
pageSize = 50;
|
|
1861
|
+
pageSizeOptions = [5, 10, 20, 50, 100, 200];
|
|
1862
|
+
showFirstLastButtons = true;
|
|
1863
|
+
count$$;
|
|
1864
|
+
entitySortChange$$;
|
|
1865
|
+
paginationLabelTranslation$$ = [];
|
|
1866
|
+
entitySortChange$ = new BehaviorSubject(false);
|
|
1867
|
+
/**
|
|
1868
|
+
* Entity store
|
|
1869
|
+
*/
|
|
1870
|
+
store;
|
|
1871
|
+
/**
|
|
1872
|
+
* Paginator options
|
|
1873
|
+
*/
|
|
1874
|
+
paginatorOptions;
|
|
1875
|
+
/**
|
|
1876
|
+
* Event emitted when the paginator changes the page size or page index.
|
|
1877
|
+
*/
|
|
1878
|
+
page;
|
|
1879
|
+
length = 0;
|
|
1880
|
+
/**
|
|
1881
|
+
* Paginator emitted.
|
|
1882
|
+
*/
|
|
1883
|
+
paginatorChange = new EventEmitter();
|
|
1884
|
+
constructor(languageService, mediaService) {
|
|
1885
|
+
this.languageService = languageService;
|
|
1886
|
+
this.mediaService = mediaService;
|
|
1887
|
+
}
|
|
1888
|
+
paginator;
|
|
1889
|
+
ngOnChanges() {
|
|
1890
|
+
this.unsubscribeAll();
|
|
1891
|
+
this.count$$ = this.store.stateView.count$.subscribe((count) => {
|
|
1892
|
+
this.length = count;
|
|
1893
|
+
this.emitPaginator();
|
|
1894
|
+
});
|
|
1895
|
+
this.entitySortChange$$ = this.entitySortChange$.subscribe(() => {
|
|
1896
|
+
if (this.paginator) {
|
|
1897
|
+
this.paginator.firstPage();
|
|
1898
|
+
}
|
|
1899
|
+
});
|
|
1900
|
+
this.initPaginatorOptions();
|
|
1901
|
+
this.translateLabels();
|
|
1902
|
+
}
|
|
1903
|
+
initPaginatorOptions() {
|
|
1904
|
+
this.disabled = this.paginatorOptions?.disabled || this.disabled;
|
|
1905
|
+
this.pageIndex = this.paginatorOptions?.pageIndex || this.pageIndex;
|
|
1906
|
+
this.pageSize = this.paginatorOptions?.pageSize || this.pageSize;
|
|
1907
|
+
this.pageSizeOptions =
|
|
1908
|
+
this.paginatorOptions?.pageSizeOptions || this.pageSizeOptions;
|
|
1909
|
+
if (this.mediaService.isMobile()) {
|
|
1910
|
+
this.showFirstLastButtons = false;
|
|
1911
|
+
this.hidePageSize = true;
|
|
1912
|
+
}
|
|
1913
|
+
else {
|
|
1914
|
+
this.showFirstLastButtons =
|
|
1915
|
+
this.paginatorOptions?.showFirstLastButtons ||
|
|
1916
|
+
this.showFirstLastButtons;
|
|
1917
|
+
this.hidePageSize =
|
|
1918
|
+
this.paginatorOptions?.hidePageSize || this.hidePageSize;
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
translateLabels() {
|
|
1922
|
+
this.paginationLabelTranslation$$.push(this.languageService.translate
|
|
1923
|
+
.get('igo.common.paginator.firstPageLabel')
|
|
1924
|
+
.subscribe((label) => {
|
|
1925
|
+
this.paginator._intl.firstPageLabel = label;
|
|
1926
|
+
}));
|
|
1927
|
+
this.paginator._intl.getRangeLabel = this.rangeLabel;
|
|
1928
|
+
this.paginationLabelTranslation$$.push(this.languageService.translate
|
|
1929
|
+
.get('igo.common.paginator.itemsPerPageLabel')
|
|
1930
|
+
.subscribe((label) => {
|
|
1931
|
+
this.paginator._intl.itemsPerPageLabel = label;
|
|
1932
|
+
}));
|
|
1933
|
+
this.paginationLabelTranslation$$.push(this.languageService.translate
|
|
1934
|
+
.get('igo.common.paginator.lastPageLabel')
|
|
1935
|
+
.subscribe((label) => {
|
|
1936
|
+
this.paginator._intl.lastPageLabel = label;
|
|
1937
|
+
}));
|
|
1938
|
+
this.paginationLabelTranslation$$.push(this.languageService.translate
|
|
1939
|
+
.get('igo.common.paginator.nextPageLabel')
|
|
1940
|
+
.subscribe((label) => {
|
|
1941
|
+
this.paginator._intl.nextPageLabel = label;
|
|
1942
|
+
}));
|
|
1943
|
+
this.paginationLabelTranslation$$.push(this.languageService.translate
|
|
1944
|
+
.get('igo.common.paginator.previousPageLabel')
|
|
1945
|
+
.subscribe((label) => {
|
|
1946
|
+
this.paginator._intl.previousPageLabel = label;
|
|
1947
|
+
}));
|
|
1948
|
+
}
|
|
1949
|
+
rangeLabel = (page, pageSize, length) => {
|
|
1950
|
+
const of = new BehaviorSubject('');
|
|
1951
|
+
this.paginationLabelTranslation$$.push(this.languageService.translate
|
|
1952
|
+
.get('igo.common.paginator.of')
|
|
1953
|
+
.subscribe((label) => {
|
|
1954
|
+
of.next(label);
|
|
1955
|
+
}));
|
|
1956
|
+
if (length === 0 || pageSize === 0) {
|
|
1957
|
+
return `0 ${of.value} ${length}`;
|
|
1958
|
+
}
|
|
1959
|
+
length = Math.max(length, 0);
|
|
1960
|
+
const startIndex = page * pageSize;
|
|
1961
|
+
const endIndex = startIndex < length
|
|
1962
|
+
? Math.min(startIndex + pageSize, length)
|
|
1963
|
+
: startIndex + pageSize;
|
|
1964
|
+
return `${startIndex + 1} - ${endIndex} ${of.value} ${length}`;
|
|
1965
|
+
};
|
|
1966
|
+
unsubscribeAll() {
|
|
1967
|
+
this.paginationLabelTranslation$$.map((sub) => sub.unsubscribe());
|
|
1968
|
+
if (this.count$$) {
|
|
1969
|
+
this.count$$.unsubscribe();
|
|
1970
|
+
}
|
|
1971
|
+
if (this.entitySortChange$$) {
|
|
1972
|
+
this.entitySortChange$$.unsubscribe();
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
ngOnDestroy() {
|
|
1976
|
+
this.unsubscribeAll();
|
|
1977
|
+
}
|
|
1978
|
+
emitPaginator() {
|
|
1979
|
+
this.paginatorChange.emit(this.paginator);
|
|
1980
|
+
}
|
|
1981
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntityTablePaginatorComponent, deps: [{ token: i1$1.LanguageService }, { token: i2$1.MediaService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1982
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: EntityTablePaginatorComponent, isStandalone: true, selector: "igo-entity-table-paginator", inputs: { entitySortChange$: "entitySortChange$", store: "store", paginatorOptions: "paginatorOptions" }, outputs: { page: "page", paginatorChange: "paginatorChange" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<mat-paginator\n [disabled]=\"disabled\"\n [hidePageSize]=\"hidePageSize\"\n [length]=\"length\"\n [pageIndex]=\"pageIndex\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"emitPaginator()\"\n>\n</mat-paginator>\n", styles: [":host ::ng-deep .mat-mdc-paginator-container{min-height:unset}\n"], dependencies: [{ kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i3$1.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1983
|
+
}
|
|
1984
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntityTablePaginatorComponent, decorators: [{
|
|
1985
|
+
type: Component,
|
|
1986
|
+
args: [{ selector: 'igo-entity-table-paginator', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatPaginatorModule], template: "<mat-paginator\n [disabled]=\"disabled\"\n [hidePageSize]=\"hidePageSize\"\n [length]=\"length\"\n [pageIndex]=\"pageIndex\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"emitPaginator()\"\n>\n</mat-paginator>\n", styles: [":host ::ng-deep .mat-mdc-paginator-container{min-height:unset}\n"] }]
|
|
1987
|
+
}], ctorParameters: () => [{ type: i1$1.LanguageService }, { type: i2$1.MediaService }], propDecorators: { entitySortChange$: [{
|
|
1988
|
+
type: Input
|
|
1989
|
+
}], store: [{
|
|
1990
|
+
type: Input
|
|
1991
|
+
}], paginatorOptions: [{
|
|
1992
|
+
type: Input
|
|
1993
|
+
}], page: [{
|
|
1994
|
+
type: Output
|
|
1995
|
+
}], paginatorChange: [{
|
|
1996
|
+
type: Output
|
|
1997
|
+
}], paginator: [{
|
|
1998
|
+
type: ViewChild,
|
|
1999
|
+
args: [MatPaginator, { static: true }]
|
|
2000
|
+
}] } });
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Directive that handles an entity table row click and selection.
|
|
2004
|
+
*/
|
|
2005
|
+
class EntityTableRowDirective {
|
|
2006
|
+
renderer;
|
|
2007
|
+
el;
|
|
2008
|
+
/**
|
|
2009
|
+
* Class added to a selected row
|
|
2010
|
+
*/
|
|
2011
|
+
static selectedCls = 'igo-entity-table-row-selected';
|
|
2012
|
+
/**
|
|
2013
|
+
* Class added to a highlighted row
|
|
2014
|
+
*/
|
|
2015
|
+
static highlightedCls = 'igo-entity-table-row-highlighted';
|
|
2016
|
+
/**
|
|
2017
|
+
* Whether a row supports selection
|
|
2018
|
+
*/
|
|
2019
|
+
selection = false;
|
|
2020
|
+
/**
|
|
2021
|
+
* Whether clicking a row should select it (if selection is true)
|
|
2022
|
+
*/
|
|
2023
|
+
selectOnClick = true;
|
|
2024
|
+
/**
|
|
2025
|
+
* Whether the selected row should be highlighted
|
|
2026
|
+
*/
|
|
2027
|
+
highlightSelection = true;
|
|
2028
|
+
/**
|
|
2029
|
+
* Whether a row is selected
|
|
2030
|
+
*/
|
|
2031
|
+
set selected(value) {
|
|
2032
|
+
if (this.selection === false) {
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
if (value === this._selected) {
|
|
2036
|
+
return;
|
|
2037
|
+
}
|
|
2038
|
+
this.toggleSelected(value);
|
|
2039
|
+
this.scroll();
|
|
2040
|
+
}
|
|
2041
|
+
get selected() {
|
|
2042
|
+
return this._selected;
|
|
2043
|
+
}
|
|
2044
|
+
_selected = false;
|
|
2045
|
+
/**
|
|
2046
|
+
* Scroll behavior on selection
|
|
2047
|
+
*/
|
|
2048
|
+
scrollBehavior = EntityTableScrollBehavior.Auto;
|
|
2049
|
+
/**
|
|
2050
|
+
* Event emitted when a row is selected
|
|
2051
|
+
*/
|
|
2052
|
+
select = new EventEmitter();
|
|
2053
|
+
/**
|
|
2054
|
+
* When a row is clicked, select it if it's supported
|
|
2055
|
+
* @ignore
|
|
2056
|
+
*/
|
|
2057
|
+
onClick() {
|
|
2058
|
+
if (this.selection === false || this.selectOnClick === false) {
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
this.toggleSelected(true);
|
|
2062
|
+
this.select.emit(this);
|
|
2063
|
+
}
|
|
2064
|
+
constructor(renderer, el) {
|
|
2065
|
+
this.renderer = renderer;
|
|
2066
|
+
this.el = el;
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Select a row and add or remove the selected class from it
|
|
2070
|
+
* @param selected Whether the row should be selected
|
|
2071
|
+
*/
|
|
2072
|
+
toggleSelected(selected) {
|
|
2073
|
+
this._selected = selected;
|
|
2074
|
+
if (selected === true) {
|
|
2075
|
+
this.addCls(EntityTableRowDirective.selectedCls);
|
|
2076
|
+
if (this.highlightSelection === true) {
|
|
2077
|
+
this.addCls(EntityTableRowDirective.highlightedCls);
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
else {
|
|
2081
|
+
this.removeCls(EntityTableRowDirective.selectedCls);
|
|
2082
|
+
this.removeCls(EntityTableRowDirective.highlightedCls);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Scroll to the selected row
|
|
2087
|
+
*/
|
|
2088
|
+
scroll() {
|
|
2089
|
+
if (this._selected === true) {
|
|
2090
|
+
scrollIntoView(this.el.nativeElement, {
|
|
2091
|
+
scrollMode: 'if-needed',
|
|
2092
|
+
behavior: 'smooth',
|
|
2093
|
+
block: 'end',
|
|
2094
|
+
inline: 'nearest'
|
|
2095
|
+
});
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Add the selected CSS class
|
|
2100
|
+
*/
|
|
2101
|
+
addCls(cls) {
|
|
2102
|
+
this.renderer.addClass(this.el.nativeElement, cls);
|
|
2103
|
+
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Remove the selected CSS class
|
|
2106
|
+
*/
|
|
2107
|
+
removeCls(cls) {
|
|
2108
|
+
this.renderer.removeClass(this.el.nativeElement, cls);
|
|
2109
|
+
}
|
|
2110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntityTableRowDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2111
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.9", type: EntityTableRowDirective, isStandalone: true, selector: "[igoEntityTableRow]", inputs: { selection: "selection", selectOnClick: "selectOnClick", highlightSelection: "highlightSelection", selected: "selected", scrollBehavior: "scrollBehavior" }, outputs: { select: "select" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 });
|
|
2112
|
+
}
|
|
2113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntityTableRowDirective, decorators: [{
|
|
2114
|
+
type: Directive,
|
|
2115
|
+
args: [{
|
|
2116
|
+
selector: '[igoEntityTableRow]',
|
|
2117
|
+
standalone: true
|
|
2118
|
+
}]
|
|
2119
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { selection: [{
|
|
2120
|
+
type: Input
|
|
2121
|
+
}], selectOnClick: [{
|
|
2122
|
+
type: Input
|
|
2123
|
+
}], highlightSelection: [{
|
|
2124
|
+
type: Input
|
|
2125
|
+
}], selected: [{
|
|
2126
|
+
type: Input
|
|
2127
|
+
}], scrollBehavior: [{
|
|
2128
|
+
type: Input
|
|
2129
|
+
}], select: [{
|
|
2130
|
+
type: Output
|
|
2131
|
+
}], onClick: [{
|
|
2132
|
+
type: HostListener,
|
|
2133
|
+
args: ['click']
|
|
2134
|
+
}] } });
|
|
2135
|
+
|
|
2136
|
+
class EntityTableComponent {
|
|
2137
|
+
cdRef;
|
|
2138
|
+
formBuilder;
|
|
2139
|
+
_focusMonitor;
|
|
2140
|
+
_elementRef;
|
|
2141
|
+
ngControl;
|
|
2142
|
+
_parentForm;
|
|
2143
|
+
_controlName;
|
|
2144
|
+
_defaultErrorStateMatcher;
|
|
2145
|
+
dateAdapter;
|
|
2146
|
+
entitySortChange$ = new BehaviorSubject(false);
|
|
2147
|
+
formGroup = new UntypedFormGroup({});
|
|
2148
|
+
filteredOptions = {};
|
|
2149
|
+
/**
|
|
2150
|
+
* Reference to the column renderer types
|
|
2151
|
+
* @internal
|
|
2152
|
+
*/
|
|
2153
|
+
entityTableColumnRenderer = EntityTableColumnRenderer;
|
|
2154
|
+
/**
|
|
2155
|
+
* Reference to the selection's state
|
|
2156
|
+
* @internal
|
|
2157
|
+
*/
|
|
2158
|
+
entityTableSelectionState = EntityTableSelectionState;
|
|
2159
|
+
/**
|
|
2160
|
+
* Observable of the selection,s state
|
|
2161
|
+
* @internal
|
|
2162
|
+
*/
|
|
2163
|
+
selectionState$ = new BehaviorSubject(undefined);
|
|
2164
|
+
/**
|
|
2165
|
+
* Subscription to the store's selection
|
|
2166
|
+
*/
|
|
2167
|
+
selection$$;
|
|
2168
|
+
/**
|
|
2169
|
+
* Subscription to the dataSource
|
|
2170
|
+
*/
|
|
2171
|
+
dataSource$$;
|
|
2172
|
+
/**
|
|
2173
|
+
* The last record checked. Useful for selecting
|
|
2174
|
+
* multiple records by holding the shift key and checking
|
|
2175
|
+
* checkboxes.
|
|
2176
|
+
*/
|
|
2177
|
+
lastRecordCheckedKey;
|
|
2178
|
+
/**
|
|
2179
|
+
* Entity store
|
|
2180
|
+
*/
|
|
2181
|
+
store;
|
|
2182
|
+
/**
|
|
2183
|
+
* Table paginator
|
|
2184
|
+
*/
|
|
2185
|
+
set paginator(value) {
|
|
2186
|
+
this._paginator = value;
|
|
2187
|
+
this.dataSource.paginator = value;
|
|
2188
|
+
}
|
|
2189
|
+
get paginator() {
|
|
2190
|
+
return this._paginator;
|
|
2191
|
+
}
|
|
2192
|
+
_paginator;
|
|
2193
|
+
/**
|
|
2194
|
+
* Table template
|
|
2195
|
+
*/
|
|
2196
|
+
template;
|
|
2197
|
+
/**
|
|
2198
|
+
* Scroll behavior on selection
|
|
2199
|
+
*/
|
|
2200
|
+
scrollBehavior = EntityTableScrollBehavior.Auto;
|
|
2201
|
+
/**
|
|
2202
|
+
* Whether nulls should be first when sorting
|
|
2203
|
+
*/
|
|
2204
|
+
sortNullsFirst = false;
|
|
2205
|
+
/**
|
|
2206
|
+
* Show the table paginator or not. False by default.
|
|
2207
|
+
*/
|
|
2208
|
+
withPaginator = false;
|
|
2209
|
+
/**
|
|
2210
|
+
* Paginator options
|
|
2211
|
+
*/
|
|
2212
|
+
paginatorOptions;
|
|
2213
|
+
/**
|
|
2214
|
+
* Event emitted when an entity (row) is clicked
|
|
2215
|
+
*/
|
|
2216
|
+
entityClick = new EventEmitter();
|
|
2217
|
+
/**
|
|
2218
|
+
* Event emitted when an entity (row) is selected
|
|
2219
|
+
*/
|
|
2220
|
+
entitySelectChange = new EventEmitter();
|
|
2221
|
+
/**
|
|
2222
|
+
* Event emitted when the table sort is changed.
|
|
2223
|
+
*/
|
|
2224
|
+
entitySortChange = new EventEmitter(undefined);
|
|
2225
|
+
/**
|
|
2226
|
+
* Table headers
|
|
2227
|
+
* @internal
|
|
2228
|
+
*/
|
|
2229
|
+
get headers() {
|
|
2230
|
+
let columns = this.template.columns
|
|
2231
|
+
.filter((column) => column.visible !== false)
|
|
2232
|
+
.map((column) => column.name);
|
|
2233
|
+
if (this.selectionCheckbox === true) {
|
|
2234
|
+
columns = ['selectionCheckbox'].concat(columns);
|
|
2235
|
+
}
|
|
2236
|
+
return columns;
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Data source consumable by the underlying material table
|
|
2240
|
+
* @internal
|
|
2241
|
+
*/
|
|
2242
|
+
dataSource = new MatTableDataSource();
|
|
2243
|
+
/**
|
|
2244
|
+
* Whether selection is supported
|
|
2245
|
+
* @internal
|
|
2246
|
+
*/
|
|
2247
|
+
get selection() {
|
|
2248
|
+
return this.template.selection || false;
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Whether a selection checkbox should be displayed
|
|
2252
|
+
* @internal
|
|
2253
|
+
*/
|
|
2254
|
+
get selectionCheckbox() {
|
|
2255
|
+
return this.template.selectionCheckbox || false;
|
|
2256
|
+
}
|
|
2257
|
+
/**
|
|
2258
|
+
* Whether selection many entities should eb supported
|
|
2259
|
+
* @internal
|
|
2260
|
+
*/
|
|
2261
|
+
get selectMany() {
|
|
2262
|
+
return this.template.selectMany || false;
|
|
2263
|
+
}
|
|
2264
|
+
/**
|
|
2265
|
+
* Whether selection many entities should eb supported
|
|
2266
|
+
* @internal
|
|
2267
|
+
*/
|
|
2268
|
+
get fixedHeader() {
|
|
2269
|
+
return this.template.fixedHeader === undefined
|
|
2270
|
+
? true
|
|
2271
|
+
: this.template.fixedHeader;
|
|
2272
|
+
}
|
|
2273
|
+
get tableHeight() {
|
|
2274
|
+
return this.template.tableHeight ? this.template.tableHeight : 'auto';
|
|
2275
|
+
}
|
|
2276
|
+
constructor(cdRef, formBuilder, _focusMonitor, _elementRef, ngControl, _parentForm, _controlName, _defaultErrorStateMatcher, dateAdapter) {
|
|
2277
|
+
this.cdRef = cdRef;
|
|
2278
|
+
this.formBuilder = formBuilder;
|
|
2279
|
+
this._focusMonitor = _focusMonitor;
|
|
2280
|
+
this._elementRef = _elementRef;
|
|
2281
|
+
this.ngControl = ngControl;
|
|
2282
|
+
this._parentForm = _parentForm;
|
|
2283
|
+
this._controlName = _controlName;
|
|
2284
|
+
this._defaultErrorStateMatcher = _defaultErrorStateMatcher;
|
|
2285
|
+
this.dateAdapter = dateAdapter;
|
|
2286
|
+
this.dateAdapter.setLocale('fr-CA');
|
|
2287
|
+
}
|
|
2288
|
+
/**
|
|
2289
|
+
* Track the selection state to properly display the selection checkboxes
|
|
2290
|
+
* @internal
|
|
2291
|
+
*/
|
|
2292
|
+
ngOnInit() {
|
|
2293
|
+
this.handleDatasource();
|
|
2294
|
+
this.dataSource.paginator = this.paginator;
|
|
2295
|
+
this.store.state.change$.pipe(debounceTime(100)).subscribe(() => {
|
|
2296
|
+
this.handleDatasource();
|
|
2297
|
+
this.refresh();
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* @internal
|
|
2302
|
+
*/
|
|
2303
|
+
ngOnChanges(changes) {
|
|
2304
|
+
const store = changes.store;
|
|
2305
|
+
if (store && store.currentValue !== store.previousValue) {
|
|
2306
|
+
this.handleDatasource();
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Process text or number value change (edition)
|
|
2311
|
+
*/
|
|
2312
|
+
onValueChange(column, record, event) {
|
|
2313
|
+
const key = this.getColumnKeyWithoutPropertiesTag(column);
|
|
2314
|
+
record.entity.properties[key] = event.target.value;
|
|
2315
|
+
}
|
|
2316
|
+
/**
|
|
2317
|
+
* Process boolean value change (edition)
|
|
2318
|
+
*/
|
|
2319
|
+
onBooleanValueChange(column, record, event) {
|
|
2320
|
+
const key = this.getColumnKeyWithoutPropertiesTag(column);
|
|
2321
|
+
record.entity.properties[key] = event.checked;
|
|
2322
|
+
}
|
|
2323
|
+
/**
|
|
2324
|
+
* Process select value change (edition)
|
|
2325
|
+
*/
|
|
2326
|
+
onSelectValueChange(column, record, event) {
|
|
2327
|
+
const key = this.getColumnKeyWithoutPropertiesTag(column);
|
|
2328
|
+
record.entity.properties[key] = event.value;
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Process autocomplete value change (edition)
|
|
2332
|
+
*/
|
|
2333
|
+
onAutocompleteValueChange(column, record, event) {
|
|
2334
|
+
this.formGroup.controls[column.name].setValue(event.option.viewValue);
|
|
2335
|
+
const key = this.getColumnKeyWithoutPropertiesTag(column.name);
|
|
2336
|
+
record.entity.properties[key] = event.option.value;
|
|
2337
|
+
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Process date value change (edition)
|
|
2340
|
+
*/
|
|
2341
|
+
onDateChange(column, record, event) {
|
|
2342
|
+
const format = 'YYYY-MM-DD';
|
|
2343
|
+
const value = moment(event.value).format(format);
|
|
2344
|
+
const key = this.getColumnKeyWithoutPropertiesTag(column);
|
|
2345
|
+
record.entity.properties[key] = value;
|
|
2346
|
+
}
|
|
2347
|
+
/**
|
|
2348
|
+
* Enable edition mode for one row
|
|
2349
|
+
* More than one row can be edited at the same time
|
|
2350
|
+
*/
|
|
2351
|
+
enableEdit(record) {
|
|
2352
|
+
const item = record.entity.properties || record.entity;
|
|
2353
|
+
this.template.columns.forEach((column) => {
|
|
2354
|
+
column.title =
|
|
2355
|
+
column.validation?.mandatory && !column.title.includes('*')
|
|
2356
|
+
? column.title + ' *'
|
|
2357
|
+
: column.title;
|
|
2358
|
+
const key = this.getColumnKeyWithoutPropertiesTag(column.name);
|
|
2359
|
+
if (column.type === 'boolean') {
|
|
2360
|
+
if (!item[key] || item[key] === null) {
|
|
2361
|
+
item[key] = false;
|
|
2362
|
+
}
|
|
2363
|
+
else if (typeof item[key] === 'string') {
|
|
2364
|
+
item[key] = JSON.parse(item[key].toLowerCase());
|
|
2365
|
+
}
|
|
2366
|
+
this.formGroup.setControl(column.name, this.formBuilder.control(item[key]));
|
|
2367
|
+
}
|
|
2368
|
+
else if (column.type === 'list') {
|
|
2369
|
+
if (column.multiple) {
|
|
2370
|
+
this.formGroup.setControl(column.name, this.formBuilder.control([item[key]]));
|
|
2371
|
+
}
|
|
2372
|
+
else {
|
|
2373
|
+
this.formGroup.setControl(column.name, this.formBuilder.control(item[key]));
|
|
2374
|
+
typeof item[key] === 'string'
|
|
2375
|
+
? this.formGroup.controls[column.name].setValue(parseInt(item[key]))
|
|
2376
|
+
: this.formGroup.controls[column.name].setValue(item[key]);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
else if (column.type === 'autocomplete') {
|
|
2380
|
+
this.formGroup.setControl(column.name, this.formBuilder.control(item[key]));
|
|
2381
|
+
this.filteredOptions[column.name] = new Observable();
|
|
2382
|
+
this.filteredOptions[column.name] = this.formGroup.controls[column.name].valueChanges.pipe(map((value) => {
|
|
2383
|
+
if (value?.length) {
|
|
2384
|
+
return column.domainValues?.filter((option) => {
|
|
2385
|
+
const filterNormalized = value
|
|
2386
|
+
? value
|
|
2387
|
+
.toLowerCase()
|
|
2388
|
+
.normalize('NFD')
|
|
2389
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
2390
|
+
: '';
|
|
2391
|
+
const featureNameNormalized = option.value
|
|
2392
|
+
.toLowerCase()
|
|
2393
|
+
.normalize('NFD')
|
|
2394
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
2395
|
+
return featureNameNormalized.includes(filterNormalized);
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
}));
|
|
2399
|
+
let formControlValue = item[key];
|
|
2400
|
+
column.domainValues.forEach((option) => {
|
|
2401
|
+
if (typeof formControlValue === 'string' &&
|
|
2402
|
+
StringUtils.isValidNumber(formControlValue) &&
|
|
2403
|
+
!StringUtils.isOctalNumber(formControlValue)) {
|
|
2404
|
+
formControlValue = parseInt(formControlValue);
|
|
2405
|
+
}
|
|
2406
|
+
if (option.value === formControlValue ||
|
|
2407
|
+
option.id === formControlValue) {
|
|
2408
|
+
formControlValue = option.value;
|
|
2409
|
+
}
|
|
2410
|
+
});
|
|
2411
|
+
this.formGroup.controls[column.name].setValue(formControlValue);
|
|
2412
|
+
if (this.isEdition(record) && column.linkColumnForce) {
|
|
2413
|
+
const entity = record.entity;
|
|
2414
|
+
this.formGroup.controls[column.name].setValue(entity?.properties[this.getColumnKeyWithoutPropertiesTag(column.linkColumnForce)]);
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
else if (column.type === 'date') {
|
|
2418
|
+
if (column.visible !== false) {
|
|
2419
|
+
if (item[key]) {
|
|
2420
|
+
let date = moment(item[key]);
|
|
2421
|
+
item[key] = date.utc().format('YYYY-MM-DD');
|
|
2422
|
+
this.formGroup.setControl(column.name, this.formBuilder.control(item[key]));
|
|
2423
|
+
}
|
|
2424
|
+
else {
|
|
2425
|
+
const newKey = this.getColumnKeyWithoutPropertiesTag(column.name);
|
|
2426
|
+
record.entity.properties[newKey] = null;
|
|
2427
|
+
this.formGroup.setControl(column.name, this.formBuilder.control(null));
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
else {
|
|
2432
|
+
this.formGroup.setControl(column.name, this.formBuilder.control(item[key]));
|
|
2433
|
+
}
|
|
2434
|
+
if (this.formGroup.controls[column.name] &&
|
|
2435
|
+
this.getValidationAttributeValue(column, 'readonly')) {
|
|
2436
|
+
this.formGroup.controls[column.name].disable();
|
|
2437
|
+
}
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
handleDatasource() {
|
|
2441
|
+
this.unsubscribeStore();
|
|
2442
|
+
this.selection$$ = this.store.stateView
|
|
2443
|
+
.manyBy$((record) => record.state.selected === true)
|
|
2444
|
+
.subscribe((records) => {
|
|
2445
|
+
const firstSelected = records[0];
|
|
2446
|
+
const firstSelectedStateviewPosition = this.store.stateView
|
|
2447
|
+
.all()
|
|
2448
|
+
.indexOf(firstSelected);
|
|
2449
|
+
const pageMax = this.paginator
|
|
2450
|
+
? this.paginator.pageSize * (this.paginator.pageIndex + 1)
|
|
2451
|
+
: 0;
|
|
2452
|
+
const pageMin = this.paginator ? pageMax - this.paginator.pageSize : 0;
|
|
2453
|
+
if (this.paginator &&
|
|
2454
|
+
(firstSelectedStateviewPosition < pageMin ||
|
|
2455
|
+
firstSelectedStateviewPosition >= pageMax)) {
|
|
2456
|
+
const pageToReach = Math.floor(firstSelectedStateviewPosition / this.paginator.pageSize);
|
|
2457
|
+
this.dataSource.paginator.pageIndex = pageToReach;
|
|
2458
|
+
}
|
|
2459
|
+
this.selectionState$.next(this.computeSelectionState(records));
|
|
2460
|
+
});
|
|
2461
|
+
this.dataSource$$ = this.store.stateView.all$().subscribe((all) => {
|
|
2462
|
+
if (all[0]) {
|
|
2463
|
+
this.enableEdit(all[0]);
|
|
2464
|
+
}
|
|
2465
|
+
this.dataSource.data = all.map((record) => {
|
|
2466
|
+
return {
|
|
2467
|
+
record,
|
|
2468
|
+
cellData: this.template.columns.reduce((cellData, column) => {
|
|
2469
|
+
const value = this.getValue(record, column);
|
|
2470
|
+
cellData[column.name] = {
|
|
2471
|
+
class: this.getCellClass(record, column),
|
|
2472
|
+
value,
|
|
2473
|
+
isUrl: this.isUrl(value),
|
|
2474
|
+
isImg: this.isImg(value)
|
|
2475
|
+
};
|
|
2476
|
+
return cellData;
|
|
2477
|
+
}, {})
|
|
2478
|
+
};
|
|
2479
|
+
});
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
/**
|
|
2483
|
+
* Unbind the store watcher
|
|
2484
|
+
* @internal
|
|
2485
|
+
*/
|
|
2486
|
+
ngOnDestroy() {
|
|
2487
|
+
this.unsubscribeStore();
|
|
2488
|
+
}
|
|
2489
|
+
unsubscribeStore() {
|
|
2490
|
+
if (this.selection$$) {
|
|
2491
|
+
this.selection$$.unsubscribe();
|
|
2492
|
+
}
|
|
2493
|
+
if (this.dataSource$$) {
|
|
2494
|
+
this.dataSource$$.unsubscribe();
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Trackby function
|
|
2499
|
+
* @param record Record
|
|
2500
|
+
* @param index Record index
|
|
2501
|
+
* @internal
|
|
2502
|
+
*/
|
|
2503
|
+
getTrackByFunction() {
|
|
2504
|
+
return (_index, row) => row.record.ref;
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Trigger a refresh of the table. This can be useful when
|
|
2508
|
+
* the data source doesn't emit a new value but for some reason
|
|
2509
|
+
* the records need an update.
|
|
2510
|
+
* @internal
|
|
2511
|
+
*/
|
|
2512
|
+
refresh() {
|
|
2513
|
+
this.cdRef.detectChanges();
|
|
2514
|
+
}
|
|
2515
|
+
paginatorChange(event) {
|
|
2516
|
+
this.paginator = event;
|
|
2517
|
+
}
|
|
2518
|
+
/**
|
|
2519
|
+
* On sort, sort the store
|
|
2520
|
+
* @param event Sort event
|
|
2521
|
+
* @internal
|
|
2522
|
+
*/
|
|
2523
|
+
onSort(event) {
|
|
2524
|
+
const direction = event.direction;
|
|
2525
|
+
const column = this.template.columns.find((c) => c.name === event.active);
|
|
2526
|
+
if (direction === 'asc' || direction === 'desc') {
|
|
2527
|
+
this.store.stateView.sort({
|
|
2528
|
+
valueAccessor: (record) => this.getValue(record, column),
|
|
2529
|
+
direction,
|
|
2530
|
+
nullsFirst: this.sortNullsFirst
|
|
2531
|
+
});
|
|
2532
|
+
this.entitySortChange.emit({ column, direction });
|
|
2533
|
+
this.entitySortChange$.next(true);
|
|
2534
|
+
}
|
|
2535
|
+
else {
|
|
2536
|
+
this.store.stateView.sort(undefined);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* When an entity is clicked, emit an event
|
|
2541
|
+
* @param record Record
|
|
2542
|
+
* @internal
|
|
2543
|
+
*/
|
|
2544
|
+
onRowClick(record) {
|
|
2545
|
+
this.lastRecordCheckedKey = this.store.stateView.getKey(record);
|
|
2546
|
+
this.entityClick.emit(record.entity);
|
|
2547
|
+
}
|
|
2548
|
+
/**
|
|
2549
|
+
* When an entity is selected, select it in the store and emit an event. Even if
|
|
2550
|
+
* "many" is set to true, this method always select a single, exclusive row. Selecting
|
|
2551
|
+
* multiple rows should be achieved by using the checkboxes.
|
|
2552
|
+
* @param record Record
|
|
2553
|
+
* @internal
|
|
2554
|
+
*/
|
|
2555
|
+
onRowSelect(record) {
|
|
2556
|
+
if (this.selection === false) {
|
|
2557
|
+
return;
|
|
2558
|
+
}
|
|
2559
|
+
const entity = record.entity;
|
|
2560
|
+
this.store.state.update(entity, { selected: true }, true);
|
|
2561
|
+
this.entitySelectChange.emit({ added: [entity] });
|
|
2562
|
+
}
|
|
2563
|
+
/**
|
|
2564
|
+
* Select or unselect all rows at once. On select, emit an event.
|
|
2565
|
+
* @param toggle Select or unselect
|
|
2566
|
+
* @internal
|
|
2567
|
+
*/
|
|
2568
|
+
onToggleRows(toggle) {
|
|
2569
|
+
if (this.selection === false) {
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
const entities = this.store.view.all();
|
|
2573
|
+
this.entitySelectChange.emit({ added: [entities] });
|
|
2574
|
+
this.store.state.updateMany(entities, { selected: toggle });
|
|
2575
|
+
}
|
|
2576
|
+
/**
|
|
2577
|
+
* When an entity is toggled, select or unselect it in the store. On select,
|
|
2578
|
+
* emit an event.
|
|
2579
|
+
* @param toggle Select or unselect
|
|
2580
|
+
* @param record Record
|
|
2581
|
+
* @internal
|
|
2582
|
+
*/
|
|
2583
|
+
onToggleRow(toggle, record) {
|
|
2584
|
+
if (this.selection === false) {
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
const entity = record.entity;
|
|
2588
|
+
const exclusive = toggle === true && !this.selectMany;
|
|
2589
|
+
this.store.state.update(entity, { selected: toggle }, exclusive);
|
|
2590
|
+
if (toggle === true) {
|
|
2591
|
+
this.entitySelectChange.emit({ added: [entity] });
|
|
2592
|
+
}
|
|
2593
|
+
this.lastRecordCheckedKey = this.store.stateView.getKey(record);
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* When an entity is toggled, select or unselect it in the store. On select,
|
|
2597
|
+
* emit an event.
|
|
2598
|
+
* @param toggle Select or unselect
|
|
2599
|
+
* @param record Record
|
|
2600
|
+
* @internal
|
|
2601
|
+
*/
|
|
2602
|
+
onShiftToggleRow(toggle, record, event) {
|
|
2603
|
+
if (this.selection === false) {
|
|
2604
|
+
return;
|
|
2605
|
+
}
|
|
2606
|
+
if (this.selectMany === false || this.lastRecordCheckedKey === undefined) {
|
|
2607
|
+
this.onToggleRow(toggle, record);
|
|
2608
|
+
return;
|
|
2609
|
+
}
|
|
2610
|
+
// This is a workaround mat checkbox wrong behavior
|
|
2611
|
+
// when the shift key is held.
|
|
2612
|
+
// See https://github.com/angular/components/issues/6232
|
|
2613
|
+
const range = window.document.createRange();
|
|
2614
|
+
range.selectNode(event.target);
|
|
2615
|
+
window.getSelection().removeAllRanges();
|
|
2616
|
+
window.getSelection().addRange(range);
|
|
2617
|
+
event.stopImmediatePropagation();
|
|
2618
|
+
const records = this.store.stateView.all();
|
|
2619
|
+
const recordIndex = records.indexOf(record);
|
|
2620
|
+
const lastRecordChecked = this.store.stateView.get(this.lastRecordCheckedKey);
|
|
2621
|
+
const lastRecordIndex = records.indexOf(lastRecordChecked);
|
|
2622
|
+
const indexes = [recordIndex, lastRecordIndex];
|
|
2623
|
+
const selectRecords = records.slice(Math.min(...indexes), Math.max(...indexes) + 1);
|
|
2624
|
+
const entities = selectRecords.map((_record) => _record.entity);
|
|
2625
|
+
this.store.state.updateMany(entities, { selected: toggle });
|
|
2626
|
+
if (toggle === true) {
|
|
2627
|
+
this.entitySelectChange.emit({ added: entities });
|
|
2628
|
+
}
|
|
2629
|
+
this.lastRecordCheckedKey = this.store.stateView.getKey(record);
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* Compute the selection state
|
|
2633
|
+
* @returns Whether all, some or no rows are selected
|
|
2634
|
+
* @internal
|
|
2635
|
+
*/
|
|
2636
|
+
computeSelectionState(selectedRecords) {
|
|
2637
|
+
const states = EntityTableSelectionState;
|
|
2638
|
+
const selectionCount = selectedRecords.length;
|
|
2639
|
+
return selectionCount === 0
|
|
2640
|
+
? states.None
|
|
2641
|
+
: selectionCount === this.store.stateView.count
|
|
2642
|
+
? states.All
|
|
2643
|
+
: states.Some;
|
|
2644
|
+
}
|
|
2645
|
+
/**
|
|
2646
|
+
* Whether a column is sortable
|
|
2647
|
+
* @param column Column
|
|
2648
|
+
* @returns True if a column is sortable
|
|
2649
|
+
* @internal
|
|
2650
|
+
*/
|
|
2651
|
+
columnIsSortable(column) {
|
|
2652
|
+
let sortable = column.sort;
|
|
2653
|
+
if (sortable === undefined) {
|
|
2654
|
+
sortable = this.template.sort === undefined ? false : this.template.sort;
|
|
2655
|
+
}
|
|
2656
|
+
return sortable;
|
|
2657
|
+
}
|
|
2658
|
+
/**
|
|
2659
|
+
* Whether a row is should be selected based on the underlying entity state
|
|
2660
|
+
* @param record Record
|
|
2661
|
+
* @returns True if a row should be selected
|
|
2662
|
+
* @internal
|
|
2663
|
+
*/
|
|
2664
|
+
rowIsSelected(record) {
|
|
2665
|
+
const state = record.state;
|
|
2666
|
+
return state.selected ? state.selected : false;
|
|
2667
|
+
}
|
|
2668
|
+
isImg(value) {
|
|
2669
|
+
if (this.isUrl(value)) {
|
|
2670
|
+
return (['jpg', 'png', 'gif'].indexOf(value.split('.').pop().toLowerCase()) !==
|
|
2671
|
+
-1);
|
|
2672
|
+
}
|
|
2673
|
+
else {
|
|
2674
|
+
return false;
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
isUrl(value) {
|
|
2678
|
+
if (typeof value === 'string') {
|
|
2679
|
+
return (value.slice(0, 8) === 'https://' || value.slice(0, 7) === 'http://');
|
|
2680
|
+
}
|
|
2681
|
+
else {
|
|
2682
|
+
return false;
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
/**
|
|
2686
|
+
* Method to access an entity's values
|
|
2687
|
+
* @param record Record
|
|
2688
|
+
* @param column Column
|
|
2689
|
+
* @returns Any value
|
|
2690
|
+
* @internal
|
|
2691
|
+
*/
|
|
2692
|
+
getValue(record, column) {
|
|
2693
|
+
const entity = record.entity;
|
|
2694
|
+
let value;
|
|
2695
|
+
if (column.valueAccessor !== undefined) {
|
|
2696
|
+
return column.valueAccessor(entity, record);
|
|
2697
|
+
}
|
|
2698
|
+
if (this.template.valueAccessor !== undefined) {
|
|
2699
|
+
return this.template.valueAccessor(entity, column.name, record);
|
|
2700
|
+
}
|
|
2701
|
+
value = this.store.getProperty(entity, column.name);
|
|
2702
|
+
if (column.type === 'boolean') {
|
|
2703
|
+
if (value === undefined || value === null || value === '') {
|
|
2704
|
+
value = false;
|
|
2705
|
+
}
|
|
2706
|
+
else if (typeof value !== 'boolean' && value !== undefined) {
|
|
2707
|
+
if (typeof value === 'number') {
|
|
2708
|
+
value = Boolean(value);
|
|
2709
|
+
}
|
|
2710
|
+
else {
|
|
2711
|
+
value = JSON.parse(value.toLowerCase());
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
if (!this.isEdition(record)) {
|
|
2715
|
+
value = value ? '✓' : ''; // check mark
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
else if (column.type === 'list' && value && column.domainValues) {
|
|
2719
|
+
const entity = record.entity;
|
|
2720
|
+
if (column.multiple) {
|
|
2721
|
+
let list_id;
|
|
2722
|
+
typeof value === 'string'
|
|
2723
|
+
? (list_id = value.match(/[\w.-]+/g).map(Number))
|
|
2724
|
+
: (list_id = value);
|
|
2725
|
+
let list_option = [];
|
|
2726
|
+
column.domainValues.forEach((option) => {
|
|
2727
|
+
if (list_id.includes(option.id)) {
|
|
2728
|
+
if (record.edition) {
|
|
2729
|
+
list_option.push(option.id);
|
|
2730
|
+
}
|
|
2731
|
+
else {
|
|
2732
|
+
list_option.push(option.value);
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
});
|
|
2736
|
+
this.isEdition(record) ? (value = list_id) : (value = list_option);
|
|
2737
|
+
}
|
|
2738
|
+
else {
|
|
2739
|
+
if (!this.isEdition(record) && column.linkColumnForce) {
|
|
2740
|
+
value =
|
|
2741
|
+
entity?.properties[this.getColumnKeyWithoutPropertiesTag(column.linkColumnForce)];
|
|
2742
|
+
}
|
|
2743
|
+
else {
|
|
2744
|
+
column.domainValues.forEach((option) => {
|
|
2745
|
+
if (typeof value === 'string' &&
|
|
2746
|
+
StringUtils.isValidNumber(value) &&
|
|
2747
|
+
!StringUtils.isOctalNumber(value)) {
|
|
2748
|
+
value = parseInt(value);
|
|
2749
|
+
}
|
|
2750
|
+
if (option.value === value || option.id === value) {
|
|
2751
|
+
this.isEdition(record)
|
|
2752
|
+
? (value = option.id)
|
|
2753
|
+
: (value = option.value);
|
|
2754
|
+
}
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
else if (column.type === 'autocomplete' && value && column.domainValues) {
|
|
2760
|
+
const entity = record.entity;
|
|
2761
|
+
if (!this.isEdition(record) && column.linkColumnForce) {
|
|
2762
|
+
value =
|
|
2763
|
+
entity?.properties[this.getColumnKeyWithoutPropertiesTag(column.linkColumnForce)];
|
|
2764
|
+
}
|
|
2765
|
+
else {
|
|
2766
|
+
column.domainValues.forEach((option) => {
|
|
2767
|
+
if (typeof value === 'string' &&
|
|
2768
|
+
StringUtils.isValidNumber(value) &&
|
|
2769
|
+
!StringUtils.isOctalNumber(value)) {
|
|
2770
|
+
value = parseInt(value);
|
|
2771
|
+
}
|
|
2772
|
+
if (option.value === value || option.id === value) {
|
|
2773
|
+
value = option.value;
|
|
2774
|
+
}
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
else if (column.type === 'date') {
|
|
2779
|
+
if (this.isEdition(record)) {
|
|
2780
|
+
if (value) {
|
|
2781
|
+
let date = moment(value);
|
|
2782
|
+
value = date.format();
|
|
2783
|
+
this.formGroup.controls[column.name].setValue(value);
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
else if (!this.isEdition(record) && value === null) {
|
|
2787
|
+
value = '';
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
if (value === undefined) {
|
|
2791
|
+
value = '';
|
|
2792
|
+
}
|
|
2793
|
+
return value;
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* Method to access an entity's validation values
|
|
2797
|
+
* @param column Column
|
|
2798
|
+
* @param validationType string
|
|
2799
|
+
* @returns Any value (false if no validation or not the one concerned)
|
|
2800
|
+
* @internal
|
|
2801
|
+
*/
|
|
2802
|
+
getValidationAttributeValue(column, validationType) {
|
|
2803
|
+
if (column.validation !== undefined &&
|
|
2804
|
+
column.validation[validationType] !== undefined) {
|
|
2805
|
+
return column.validation[validationType];
|
|
2806
|
+
}
|
|
2807
|
+
else {
|
|
2808
|
+
return false;
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
isEdition(record) {
|
|
2812
|
+
return record.entity.edition ? true : false;
|
|
2813
|
+
}
|
|
2814
|
+
/**
|
|
2815
|
+
* Return the type of renderer of a column
|
|
2816
|
+
* @param column Column
|
|
2817
|
+
* @returns Renderer type
|
|
2818
|
+
* @internal
|
|
2819
|
+
*/
|
|
2820
|
+
getColumnRenderer(column) {
|
|
2821
|
+
if (column.renderer !== undefined) {
|
|
2822
|
+
return column.renderer;
|
|
2823
|
+
}
|
|
2824
|
+
return EntityTableColumnRenderer.Default;
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* Return the table ngClass
|
|
2828
|
+
* @returns ngClass
|
|
2829
|
+
* @internal
|
|
2830
|
+
*/
|
|
2831
|
+
getTableClass() {
|
|
2832
|
+
return {
|
|
2833
|
+
'igo-entity-table-with-selection': this.selection
|
|
2834
|
+
};
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* Return a header ngClass
|
|
2838
|
+
* @returns ngClass
|
|
2839
|
+
* @internal
|
|
2840
|
+
*/
|
|
2841
|
+
getHeaderClass() {
|
|
2842
|
+
const func = this.template.headerClassFunc;
|
|
2843
|
+
if (func instanceof Function) {
|
|
2844
|
+
return func();
|
|
2845
|
+
}
|
|
2846
|
+
return {};
|
|
2847
|
+
}
|
|
2848
|
+
/**
|
|
2849
|
+
* Return a row ngClass
|
|
2850
|
+
* @param record Record
|
|
2851
|
+
* @returns ngClass
|
|
2852
|
+
* @internal
|
|
2853
|
+
*/
|
|
2854
|
+
getRowClass(record) {
|
|
2855
|
+
const entity = record.entity;
|
|
2856
|
+
const func = this.template.rowClassFunc;
|
|
2857
|
+
if (func instanceof Function) {
|
|
2858
|
+
return func(entity, record);
|
|
2859
|
+
}
|
|
2860
|
+
return {};
|
|
2861
|
+
}
|
|
2862
|
+
/**
|
|
2863
|
+
* Return a row ngClass
|
|
2864
|
+
* @param record Record
|
|
2865
|
+
* @param column Column
|
|
2866
|
+
* @returns ngClass
|
|
2867
|
+
* @internal
|
|
2868
|
+
*/
|
|
2869
|
+
getCellClass(record, column) {
|
|
2870
|
+
const entity = record.entity;
|
|
2871
|
+
const cls = {};
|
|
2872
|
+
const tableFunc = this.template.cellClassFunc;
|
|
2873
|
+
if (tableFunc instanceof Function) {
|
|
2874
|
+
Object.assign(cls, tableFunc(entity, column, record));
|
|
2875
|
+
}
|
|
2876
|
+
const columnFunc = column.cellClassFunc;
|
|
2877
|
+
if (columnFunc instanceof Function) {
|
|
2878
|
+
Object.assign(cls, columnFunc(entity, record));
|
|
2879
|
+
}
|
|
2880
|
+
return cls;
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* When a button is clicked
|
|
2884
|
+
* @param func Function
|
|
2885
|
+
* @param record Record
|
|
2886
|
+
* @internal
|
|
2887
|
+
*/
|
|
2888
|
+
onButtonClick(clickFunc, record) {
|
|
2889
|
+
this.enableEdit(record);
|
|
2890
|
+
if (typeof clickFunc === 'function') {
|
|
2891
|
+
clickFunc(record.entity, record);
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
/**
|
|
2895
|
+
* Retrieve column name without his "properties" tag (useful for edition workspace properties)
|
|
2896
|
+
*/
|
|
2897
|
+
getColumnKeyWithoutPropertiesTag(column) {
|
|
2898
|
+
if (column.includes('properties.')) {
|
|
2899
|
+
return column.split('.')[1];
|
|
2900
|
+
}
|
|
2901
|
+
return column;
|
|
2902
|
+
}
|
|
2903
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntityTableComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$2.UntypedFormBuilder }, { token: i2$2.FocusMonitor }, { token: i0.ElementRef }, { token: i1$2.NgControl, optional: true, self: true }, { token: i1$2.NgForm, optional: true }, { token: i1$2.FormControlName, optional: true }, { token: i3.ErrorStateMatcher }, { token: i3.DateAdapter }], target: i0.ɵɵFactoryTarget.Component });
|
|
2904
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.9", type: EntityTableComponent, isStandalone: true, selector: "igo-entity-table", inputs: { store: "store", paginator: "paginator", template: "template", scrollBehavior: "scrollBehavior", sortNullsFirst: "sortNullsFirst", withPaginator: "withPaginator", paginatorOptions: "paginatorOptions" }, outputs: { entityClick: "entityClick", entitySelectChange: "entitySelectChange", entitySortChange: "entitySortChange" }, providers: [
|
|
2905
|
+
{ provide: MatFormFieldControl, useExisting: EntityTableComponent },
|
|
2906
|
+
provideMomentDateAdapter()
|
|
2907
|
+
], usesOnChanges: true, ngImport: i0, template: "<div class=\"table-container\" [ngStyle]=\"{ height: tableHeight }\">\n <table\n id=\"currentWorkspaceTable\"\n mat-table\n matSort\n [ngClass]=\"getTableClass()\"\n [dataSource]=\"dataSource\"\n [trackBy]=\"getTrackByFunction()\"\n (matSortChange)=\"onSort($event)\"\n >\n <ng-container matColumnDef=\"selectionCheckbox\" class=\"mat-cell-checkbox\">\n <th mat-header-cell *matHeaderCellDef>\n <ng-container *ngIf=\"selectMany\">\n <ng-container *ngIf=\"selectionState$ | async as selectionState\">\n <mat-checkbox\n (change)=\"onToggleRows($event.checked)\"\n [checked]=\"selectionState === entityTableSelectionState.All\"\n [indeterminate]=\"\n selectionState === entityTableSelectionState.Some\n \"\n >\n </mat-checkbox>\n </ng-container>\n </ng-container>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <mat-checkbox\n (mousedown)=\"$event.shiftKey ? $event.preventDefault() : null\"\n (click)=\"\n $event.shiftKey\n ? onShiftToggleRow(!rowIsSelected(row.record), row.record, $event)\n : $event.stopPropagation()\n \"\n (change)=\"onToggleRow($event.checked, row.record)\"\n [checked]=\"rowIsSelected(row.record)\"\n >\n </mat-checkbox>\n </td>\n </ng-container>\n\n <ng-container\n [matColumnDef]=\"column.name\"\n *ngFor=\"let column of template.columns\"\n >\n <ng-container *ngIf=\"columnIsSortable(column)\">\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header\n [matTooltip]=\"column.tooltip ? column.tooltip : undefined\"\n >\n {{ column.title }}\n </th>\n </ng-container>\n\n <ng-container *ngIf=\"!columnIsSortable(column)\">\n <th\n mat-header-cell\n *matHeaderCellDef\n [matTooltip]=\"column.tooltip ? column.tooltip : undefined\"\n >\n {{ column.title }}\n </th>\n </ng-container>\n\n <ng-container *ngIf=\"getColumnRenderer(column) as columnRenderer\">\n <ng-container\n *ngIf=\"columnRenderer === entityTableColumnRenderer.Default\"\n >\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text\"\n *ngIf=\"!row.cellData[column.name].isUrl; else isAnUrlDefault\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n {{ row.cellData[column.name].value }}\n </td>\n <ng-template #isAnUrlDefault>\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <a\n href=\"{{ row.cellData[column.name].value }}\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n (click)=\"$event.stopPropagation()\"\n >\n <img\n igoImageError\n *ngIf=\"row.cellData[column.name].isImg; else notImg\"\n src=\"{{\n row.cellData[column.name].value | secureImage | async\n }}\"\n width=\"50\"\n heigth=\"auto\"\n />\n <ng-template #notImg\n ><span\n >{{ 'igo.common.entity-table.targetHtmlUrl' | translate }}\n </span></ng-template\n >\n </a>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"columnRenderer === entityTableColumnRenderer.HTML\">\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text\"\n *ngIf=\"!row.cellData[column.name].isUrl; else isAnUrlHTML\"\n [ngClass]=\"row.cellData[column.name].class\"\n [innerHTML]=\"row.cellData[column.name].value\"\n ></td>\n <ng-template #isAnUrlHTML>\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <a\n href=\"{{ row.cellData[column.name].value }}\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n (click)=\"$event.stopPropagation()\"\n >\n <img\n igoImageError\n *ngIf=\"row.cellData[column.name].isImg; else notImg\"\n src=\"{{\n row.cellData[column.name].value | secureImage | async\n }}\"\n width=\"50\"\n heigth=\"auto\"\n />\n <ng-template #notImg\n ><span\n >{{ 'igo.geo.targetHtmlUrl' | translate }}\n </span></ng-template\n >\n </a>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container\n *ngIf=\"columnRenderer === entityTableColumnRenderer.UnsanitizedHTML\"\n >\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text edition\"\n [formGroup]=\"formGroup\"\n *ngIf=\"isEdition(row.record); else isUnsanitizedHTML\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <div class=\"date-picker\" *ngIf=\"column.type === 'date'\">\n <mat-datepicker-toggle\n matSuffix\n [for]=\"picker\"\n ></mat-datepicker-toggle>\n <input\n matInput\n [matDatepicker]=\"picker\"\n [formControlName]=\"column.name\"\n value=\"{{ row.cellData[column.name].value }}\"\n (dateChange)=\"onDateChange(column.name, row.record, $event)\"\n />\n <mat-datepicker #picker></mat-datepicker>\n </div>\n <input\n matInput\n type=\"time\"\n *ngIf=\"column.type === 'time'\"\n [formControlName]=\"column.name\"\n step=\"900\"\n (focus)=\"column.onFocus($event)\"\n (keypress)=\"column.onChange($event)\"\n (blur)=\"column.onBlur($event)\"\n />\n <input\n matInput\n type=\"number\"\n class=\"class_number_edition\"\n *ngIf=\"column.type === 'number'\"\n [formControlName]=\"column.name\"\n step=\"{{ column.step }}\"\n value=\"{{ row.cellData[column.name].value }}\"\n (input)=\"onValueChange(column.name, row.record, $event)\"\n readonly=\"{{ getValidationAttributeValue(column, 'readonly') }}\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n min=\"{{ getValidationAttributeValue(column, 'minValue') }}\"\n max=\"{{ getValidationAttributeValue(column, 'maxValue') }}\"\n />\n <input\n matInput\n type=\"text\"\n *ngIf=\"!column.type || column.type === 'string'\"\n [formControlName]=\"column.name\"\n value=\"{{ row.cellData[column.name].value }}\"\n (input)=\"onValueChange(column.name, row.record, $event)\"\n readonly=\"{{ getValidationAttributeValue(column, 'readonly') }}\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n />\n <mat-checkbox\n *ngIf=\"column.type === 'boolean'\"\n [formControlName]=\"column.name\"\n [checked]=\"row.cellData[column.name].value\"\n (change)=\"onBooleanValueChange(column.name, row.record, $event)\"\n ></mat-checkbox>\n <mat-select\n *ngIf=\"column.type === 'list'\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n [formControlName]=\"column.name\"\n [multiple]=\"column.multiple\"\n (selectionChange)=\"\n onSelectValueChange(column.name, row.record, $event)\n \"\n [value]=\"row.cellData[column.name].value\"\n >\n <mat-option\n *ngFor=\"let option of column.domainValues\"\n [value]=\"option.id\"\n [disabled]=\"option.disabled\"\n >\n {{ option.value }}\n </mat-option>\n </mat-select>\n <input\n matInput\n type=\"text\"\n [formControlName]=\"column.name\"\n *ngIf=\"column.type === 'autocomplete'\"\n [matAutocomplete]=\"auto\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n value=\"{{ row.cellData[column.name].value }}\"\n readonly=\"{{ getValidationAttributeValue(column, 'readonly') }}\"\n />\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n (optionSelected)=\"\n onAutocompleteValueChange(column, row.record, $event)\n \"\n panelWidth=\"430px\"\n >\n <mat-option\n *ngFor=\"let option of filteredOptions[column.name] | async\"\n [value]=\"option.id\"\n >\n {{ option.value }}\n </mat-option>\n </mat-autocomplete>\n </td>\n <ng-template #isUnsanitizedHTML>\n <td\n mat-cell\n class=\"mat-cell-text\"\n *ngIf=\"\n !row.cellData[column.name].isUrl;\n else isAnUrlUnsanitizedHTML\n \"\n [ngClass]=\"row.cellData[column.name].class\"\n [innerHTML]=\"row.cellData[column.name].value | sanitizeHtml\"\n ></td>\n <ng-template #isAnUrlUnsanitizedHTML>\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <a\n href=\"{{ row.cellData[column.name].value }}\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n (click)=\"$event.stopPropagation()\"\n >\n <img\n igoImageError\n *ngIf=\"row.cellData[column.name].isImg; else notImg\"\n src=\"{{\n row.cellData[column.name].value | secureImage | async\n }}\"\n width=\"50\"\n heigth=\"auto\"\n />\n <ng-template #notImg\n ><span\n >{{ 'igo.geo.targetHtmlUrl' | translate }}\n </span></ng-template\n >\n </a>\n </td>\n </ng-template>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"columnRenderer === entityTableColumnRenderer.Icon\">\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <mat-icon *ngIf=\"column.onClick\" (click)=\"column.onClick($event)\">{{\n row.cellData[column.name].value || column.icon\n }}</mat-icon>\n <mat-icon *ngIf=\"!column.onClick\">{{\n row.cellData[column.name].value || column.icon\n }}</mat-icon>\n </td>\n </ng-container>\n <ng-container\n *ngIf=\"columnRenderer === entityTableColumnRenderer.ButtonGroup\"\n >\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <span *ngFor=\"let button of row.cellData[column.name].value\">\n <ng-container\n *ngIf=\"\n isEdition(row.record) === button.editMode ||\n button.editMode === undefined\n \"\n >\n <button\n *ngIf=\"button.style === 'mat-icon-button'\"\n igoStopPropagation\n mat-icon-button\n [color]=\"button.color\"\n (mousedown)=\"onButtonClick(button.click, row.record)\"\n [disabled]=\"button.disabled\"\n >\n <mat-icon>{{ button.icon }}</mat-icon>\n </button>\n <button\n *ngIf=\"button.style !== 'mat-icon-button'\"\n igoStopPropagation\n mat-mini-fab\n [color]=\"button.color\"\n (mousedown)=\"onButtonClick(button.click, row.record)\"\n [disabled]=\"button.disabled\"\n >\n <mat-icon>{{ button.icon }}</mat-icon>\n </button>\n </ng-container>\n </span>\n </td>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <tr\n mat-header-row\n *matHeaderRowDef=\"headers; sticky: fixedHeader\"\n [ngClass]=\"getHeaderClass()\"\n ></tr>\n <tr\n mat-row\n igoEntityTableRow\n *matRowDef=\"let row; columns: headers\"\n [scrollBehavior]=\"scrollBehavior\"\n [ngClass]=\"getRowClass(row.record)\"\n [selection]=\"selection\"\n [selected]=\"rowIsSelected(row.record)\"\n (select)=\"onRowSelect(row.record)\"\n (click)=\"onRowClick(row.record)\"\n ></tr>\n </table>\n <igo-entity-table-paginator\n *ngIf=\"withPaginator\"\n [store]=\"store\"\n [paginatorOptions]=\"paginatorOptions\"\n [entitySortChange$]=\"entitySortChange$\"\n (paginatorChange)=\"paginatorChange($event)\"\n >\n </igo-entity-table-paginator>\n</div>\n", styles: [":host{width:100%;height:100%;display:block}:host.table-compact tr.mat-mdc-header-row,:host.table-compact ::ng-deep mat-checkbox .mat-ripple{height:36px}:host.table-compact tr.mat-mdc-row,:host.table-compact ::ng-deep mat-checkbox .mat-ripple{height:28px}:host .table-container{display:flex;flex-direction:column;height:100%;overflow:auto;flex:1 1 auto}:host .mat-cell-text{overflow:hidden;word-wrap:break-word}:host entity-table table.igo-entity-table-with-selection tr:hover{-moz-box-shadow:2px 0px 2px 0px #dddddd;-webkit-box-shadow:2px 0px 2px 0px #dddddd;-o-box-shadow:2px 0px 2px 0px #dddddd;box-shadow:2px 0 2px #ddd;cursor:pointer}:host table button{margin:7px}:host .class_hidden{visibility:hidden}:host .class_display_none{display:none}:host .class_boolean,:host .class_icon,:host .class_number{text-align:center;padding-right:35px!important}:host .class_string,:host .class_text,:host .class_number_edition{text-align:left}:host td.edition{background:#a6a6a633}:host input{border-bottom:1px solid darkgrey}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: EntityTablePaginatorComponent, selector: "igo-entity-table-paginator", inputs: ["entitySortChange$", "store", "paginatorOptions"], outputs: ["page", "paginatorChange"] }, { kind: "directive", type: EntityTableRowDirective, selector: "[igoEntityTableRow]", inputs: ["selection", "selectOnClick", "highlightSelection", "selected", "scrollBehavior"], outputs: ["select"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1$2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: ImageErrorDirective, selector: "[igoImageError]", inputs: ["errorImageUrl", "hideError"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i4.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i3.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i4.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: i5.MatMiniFabButton, selector: "button[mat-mini-fab]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i6.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i7.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i7.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i7.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i9.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatNativeDateModule }, { kind: "ngmodule", type: // For the DateAdapter provider
|
|
2908
|
+
MatOptionModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i12.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i12.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i13.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i13.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i13.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i13.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i13.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i13.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i13.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i13.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i13.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i13.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i14.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: SanitizeHtmlPipe, name: "sanitizeHtml" }, { kind: "pipe", type: SecureImagePipe, name: "secureImage" }, { kind: "directive", type: StopPropagationDirective, selector: "[igoStopPropagation]" }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "pipe", type: i15.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2909
|
+
}
|
|
2910
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: EntityTableComponent, decorators: [{
|
|
2911
|
+
type: Component,
|
|
2912
|
+
args: [{ selector: 'igo-entity-table', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
2913
|
+
{ provide: MatFormFieldControl, useExisting: EntityTableComponent },
|
|
2914
|
+
provideMomentDateAdapter()
|
|
2915
|
+
], standalone: true, imports: [
|
|
2916
|
+
AsyncPipe,
|
|
2917
|
+
EntityTablePaginatorComponent,
|
|
2918
|
+
EntityTableRowDirective,
|
|
2919
|
+
FormsModule,
|
|
2920
|
+
ImageErrorDirective,
|
|
2921
|
+
MatAutocompleteModule,
|
|
2922
|
+
MatButtonModule,
|
|
2923
|
+
MatCheckboxModule,
|
|
2924
|
+
MatDatepickerModule,
|
|
2925
|
+
MatFormFieldModule,
|
|
2926
|
+
MatIconModule,
|
|
2927
|
+
MatInputModule,
|
|
2928
|
+
MatNativeDateModule, // For the DateAdapter provider
|
|
2929
|
+
MatOptionModule,
|
|
2930
|
+
MatSelectModule,
|
|
2931
|
+
MatSortModule,
|
|
2932
|
+
MatTableModule,
|
|
2933
|
+
MatTooltipModule,
|
|
2934
|
+
NgClass,
|
|
2935
|
+
NgFor,
|
|
2936
|
+
NgIf,
|
|
2937
|
+
NgStyle,
|
|
2938
|
+
ReactiveFormsModule,
|
|
2939
|
+
SanitizeHtmlPipe,
|
|
2940
|
+
SecureImagePipe,
|
|
2941
|
+
StopPropagationDirective,
|
|
2942
|
+
IgoLanguageModule
|
|
2943
|
+
], template: "<div class=\"table-container\" [ngStyle]=\"{ height: tableHeight }\">\n <table\n id=\"currentWorkspaceTable\"\n mat-table\n matSort\n [ngClass]=\"getTableClass()\"\n [dataSource]=\"dataSource\"\n [trackBy]=\"getTrackByFunction()\"\n (matSortChange)=\"onSort($event)\"\n >\n <ng-container matColumnDef=\"selectionCheckbox\" class=\"mat-cell-checkbox\">\n <th mat-header-cell *matHeaderCellDef>\n <ng-container *ngIf=\"selectMany\">\n <ng-container *ngIf=\"selectionState$ | async as selectionState\">\n <mat-checkbox\n (change)=\"onToggleRows($event.checked)\"\n [checked]=\"selectionState === entityTableSelectionState.All\"\n [indeterminate]=\"\n selectionState === entityTableSelectionState.Some\n \"\n >\n </mat-checkbox>\n </ng-container>\n </ng-container>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <mat-checkbox\n (mousedown)=\"$event.shiftKey ? $event.preventDefault() : null\"\n (click)=\"\n $event.shiftKey\n ? onShiftToggleRow(!rowIsSelected(row.record), row.record, $event)\n : $event.stopPropagation()\n \"\n (change)=\"onToggleRow($event.checked, row.record)\"\n [checked]=\"rowIsSelected(row.record)\"\n >\n </mat-checkbox>\n </td>\n </ng-container>\n\n <ng-container\n [matColumnDef]=\"column.name\"\n *ngFor=\"let column of template.columns\"\n >\n <ng-container *ngIf=\"columnIsSortable(column)\">\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header\n [matTooltip]=\"column.tooltip ? column.tooltip : undefined\"\n >\n {{ column.title }}\n </th>\n </ng-container>\n\n <ng-container *ngIf=\"!columnIsSortable(column)\">\n <th\n mat-header-cell\n *matHeaderCellDef\n [matTooltip]=\"column.tooltip ? column.tooltip : undefined\"\n >\n {{ column.title }}\n </th>\n </ng-container>\n\n <ng-container *ngIf=\"getColumnRenderer(column) as columnRenderer\">\n <ng-container\n *ngIf=\"columnRenderer === entityTableColumnRenderer.Default\"\n >\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text\"\n *ngIf=\"!row.cellData[column.name].isUrl; else isAnUrlDefault\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n {{ row.cellData[column.name].value }}\n </td>\n <ng-template #isAnUrlDefault>\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <a\n href=\"{{ row.cellData[column.name].value }}\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n (click)=\"$event.stopPropagation()\"\n >\n <img\n igoImageError\n *ngIf=\"row.cellData[column.name].isImg; else notImg\"\n src=\"{{\n row.cellData[column.name].value | secureImage | async\n }}\"\n width=\"50\"\n heigth=\"auto\"\n />\n <ng-template #notImg\n ><span\n >{{ 'igo.common.entity-table.targetHtmlUrl' | translate }}\n </span></ng-template\n >\n </a>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"columnRenderer === entityTableColumnRenderer.HTML\">\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text\"\n *ngIf=\"!row.cellData[column.name].isUrl; else isAnUrlHTML\"\n [ngClass]=\"row.cellData[column.name].class\"\n [innerHTML]=\"row.cellData[column.name].value\"\n ></td>\n <ng-template #isAnUrlHTML>\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <a\n href=\"{{ row.cellData[column.name].value }}\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n (click)=\"$event.stopPropagation()\"\n >\n <img\n igoImageError\n *ngIf=\"row.cellData[column.name].isImg; else notImg\"\n src=\"{{\n row.cellData[column.name].value | secureImage | async\n }}\"\n width=\"50\"\n heigth=\"auto\"\n />\n <ng-template #notImg\n ><span\n >{{ 'igo.geo.targetHtmlUrl' | translate }}\n </span></ng-template\n >\n </a>\n </td>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container\n *ngIf=\"columnRenderer === entityTableColumnRenderer.UnsanitizedHTML\"\n >\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text edition\"\n [formGroup]=\"formGroup\"\n *ngIf=\"isEdition(row.record); else isUnsanitizedHTML\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <div class=\"date-picker\" *ngIf=\"column.type === 'date'\">\n <mat-datepicker-toggle\n matSuffix\n [for]=\"picker\"\n ></mat-datepicker-toggle>\n <input\n matInput\n [matDatepicker]=\"picker\"\n [formControlName]=\"column.name\"\n value=\"{{ row.cellData[column.name].value }}\"\n (dateChange)=\"onDateChange(column.name, row.record, $event)\"\n />\n <mat-datepicker #picker></mat-datepicker>\n </div>\n <input\n matInput\n type=\"time\"\n *ngIf=\"column.type === 'time'\"\n [formControlName]=\"column.name\"\n step=\"900\"\n (focus)=\"column.onFocus($event)\"\n (keypress)=\"column.onChange($event)\"\n (blur)=\"column.onBlur($event)\"\n />\n <input\n matInput\n type=\"number\"\n class=\"class_number_edition\"\n *ngIf=\"column.type === 'number'\"\n [formControlName]=\"column.name\"\n step=\"{{ column.step }}\"\n value=\"{{ row.cellData[column.name].value }}\"\n (input)=\"onValueChange(column.name, row.record, $event)\"\n readonly=\"{{ getValidationAttributeValue(column, 'readonly') }}\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n min=\"{{ getValidationAttributeValue(column, 'minValue') }}\"\n max=\"{{ getValidationAttributeValue(column, 'maxValue') }}\"\n />\n <input\n matInput\n type=\"text\"\n *ngIf=\"!column.type || column.type === 'string'\"\n [formControlName]=\"column.name\"\n value=\"{{ row.cellData[column.name].value }}\"\n (input)=\"onValueChange(column.name, row.record, $event)\"\n readonly=\"{{ getValidationAttributeValue(column, 'readonly') }}\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n />\n <mat-checkbox\n *ngIf=\"column.type === 'boolean'\"\n [formControlName]=\"column.name\"\n [checked]=\"row.cellData[column.name].value\"\n (change)=\"onBooleanValueChange(column.name, row.record, $event)\"\n ></mat-checkbox>\n <mat-select\n *ngIf=\"column.type === 'list'\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n [formControlName]=\"column.name\"\n [multiple]=\"column.multiple\"\n (selectionChange)=\"\n onSelectValueChange(column.name, row.record, $event)\n \"\n [value]=\"row.cellData[column.name].value\"\n >\n <mat-option\n *ngFor=\"let option of column.domainValues\"\n [value]=\"option.id\"\n [disabled]=\"option.disabled\"\n >\n {{ option.value }}\n </mat-option>\n </mat-select>\n <input\n matInput\n type=\"text\"\n [formControlName]=\"column.name\"\n *ngIf=\"column.type === 'autocomplete'\"\n [matAutocomplete]=\"auto\"\n required=\"{{\n getValidationAttributeValue(column, 'mandatory')\n }}\"\n value=\"{{ row.cellData[column.name].value }}\"\n readonly=\"{{ getValidationAttributeValue(column, 'readonly') }}\"\n />\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n (optionSelected)=\"\n onAutocompleteValueChange(column, row.record, $event)\n \"\n panelWidth=\"430px\"\n >\n <mat-option\n *ngFor=\"let option of filteredOptions[column.name] | async\"\n [value]=\"option.id\"\n >\n {{ option.value }}\n </mat-option>\n </mat-autocomplete>\n </td>\n <ng-template #isUnsanitizedHTML>\n <td\n mat-cell\n class=\"mat-cell-text\"\n *ngIf=\"\n !row.cellData[column.name].isUrl;\n else isAnUrlUnsanitizedHTML\n \"\n [ngClass]=\"row.cellData[column.name].class\"\n [innerHTML]=\"row.cellData[column.name].value | sanitizeHtml\"\n ></td>\n <ng-template #isAnUrlUnsanitizedHTML>\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <a\n href=\"{{ row.cellData[column.name].value }}\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n (click)=\"$event.stopPropagation()\"\n >\n <img\n igoImageError\n *ngIf=\"row.cellData[column.name].isImg; else notImg\"\n src=\"{{\n row.cellData[column.name].value | secureImage | async\n }}\"\n width=\"50\"\n heigth=\"auto\"\n />\n <ng-template #notImg\n ><span\n >{{ 'igo.geo.targetHtmlUrl' | translate }}\n </span></ng-template\n >\n </a>\n </td>\n </ng-template>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"columnRenderer === entityTableColumnRenderer.Icon\">\n <td\n mat-cell\n *matCellDef=\"let row\"\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <mat-icon *ngIf=\"column.onClick\" (click)=\"column.onClick($event)\">{{\n row.cellData[column.name].value || column.icon\n }}</mat-icon>\n <mat-icon *ngIf=\"!column.onClick\">{{\n row.cellData[column.name].value || column.icon\n }}</mat-icon>\n </td>\n </ng-container>\n <ng-container\n *ngIf=\"columnRenderer === entityTableColumnRenderer.ButtonGroup\"\n >\n <ng-container *matCellDef=\"let row\">\n <td\n mat-cell\n class=\"mat-cell-text\"\n [ngClass]=\"row.cellData[column.name].class\"\n >\n <span *ngFor=\"let button of row.cellData[column.name].value\">\n <ng-container\n *ngIf=\"\n isEdition(row.record) === button.editMode ||\n button.editMode === undefined\n \"\n >\n <button\n *ngIf=\"button.style === 'mat-icon-button'\"\n igoStopPropagation\n mat-icon-button\n [color]=\"button.color\"\n (mousedown)=\"onButtonClick(button.click, row.record)\"\n [disabled]=\"button.disabled\"\n >\n <mat-icon>{{ button.icon }}</mat-icon>\n </button>\n <button\n *ngIf=\"button.style !== 'mat-icon-button'\"\n igoStopPropagation\n mat-mini-fab\n [color]=\"button.color\"\n (mousedown)=\"onButtonClick(button.click, row.record)\"\n [disabled]=\"button.disabled\"\n >\n <mat-icon>{{ button.icon }}</mat-icon>\n </button>\n </ng-container>\n </span>\n </td>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <tr\n mat-header-row\n *matHeaderRowDef=\"headers; sticky: fixedHeader\"\n [ngClass]=\"getHeaderClass()\"\n ></tr>\n <tr\n mat-row\n igoEntityTableRow\n *matRowDef=\"let row; columns: headers\"\n [scrollBehavior]=\"scrollBehavior\"\n [ngClass]=\"getRowClass(row.record)\"\n [selection]=\"selection\"\n [selected]=\"rowIsSelected(row.record)\"\n (select)=\"onRowSelect(row.record)\"\n (click)=\"onRowClick(row.record)\"\n ></tr>\n </table>\n <igo-entity-table-paginator\n *ngIf=\"withPaginator\"\n [store]=\"store\"\n [paginatorOptions]=\"paginatorOptions\"\n [entitySortChange$]=\"entitySortChange$\"\n (paginatorChange)=\"paginatorChange($event)\"\n >\n </igo-entity-table-paginator>\n</div>\n", styles: [":host{width:100%;height:100%;display:block}:host.table-compact tr.mat-mdc-header-row,:host.table-compact ::ng-deep mat-checkbox .mat-ripple{height:36px}:host.table-compact tr.mat-mdc-row,:host.table-compact ::ng-deep mat-checkbox .mat-ripple{height:28px}:host .table-container{display:flex;flex-direction:column;height:100%;overflow:auto;flex:1 1 auto}:host .mat-cell-text{overflow:hidden;word-wrap:break-word}:host entity-table table.igo-entity-table-with-selection tr:hover{-moz-box-shadow:2px 0px 2px 0px #dddddd;-webkit-box-shadow:2px 0px 2px 0px #dddddd;-o-box-shadow:2px 0px 2px 0px #dddddd;box-shadow:2px 0 2px #ddd;cursor:pointer}:host table button{margin:7px}:host .class_hidden{visibility:hidden}:host .class_display_none{display:none}:host .class_boolean,:host .class_icon,:host .class_number{text-align:center;padding-right:35px!important}:host .class_string,:host .class_text,:host .class_number_edition{text-align:left}:host td.edition{background:#a6a6a633}:host input{border-bottom:1px solid darkgrey}\n"] }]
|
|
2944
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1$2.UntypedFormBuilder }, { type: i2$2.FocusMonitor }, { type: i0.ElementRef }, { type: i1$2.NgControl, decorators: [{
|
|
2945
|
+
type: Optional
|
|
2946
|
+
}, {
|
|
2947
|
+
type: Self
|
|
2948
|
+
}] }, { type: i1$2.NgForm, decorators: [{
|
|
2949
|
+
type: Optional
|
|
2950
|
+
}] }, { type: i1$2.FormControlName, decorators: [{
|
|
2951
|
+
type: Optional
|
|
2952
|
+
}] }, { type: i3.ErrorStateMatcher }, { type: i3.DateAdapter }], propDecorators: { store: [{
|
|
2953
|
+
type: Input
|
|
2954
|
+
}], paginator: [{
|
|
2955
|
+
type: Input
|
|
2956
|
+
}], template: [{
|
|
2957
|
+
type: Input
|
|
2958
|
+
}], scrollBehavior: [{
|
|
2959
|
+
type: Input
|
|
2960
|
+
}], sortNullsFirst: [{
|
|
2961
|
+
type: Input
|
|
2962
|
+
}], withPaginator: [{
|
|
2963
|
+
type: Input
|
|
2964
|
+
}], paginatorOptions: [{
|
|
2965
|
+
type: Input
|
|
2966
|
+
}], entityClick: [{
|
|
2967
|
+
type: Output
|
|
2968
|
+
}], entitySelectChange: [{
|
|
2969
|
+
type: Output
|
|
2970
|
+
}], entitySortChange: [{
|
|
2971
|
+
type: Output
|
|
2972
|
+
}] } });
|
|
2973
|
+
|
|
2974
|
+
/**
|
|
2975
|
+
* @deprecated import the EntityTableComponent directly
|
|
2976
|
+
*/
|
|
2977
|
+
class IgoEntityTableModule {
|
|
2978
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2979
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTableModule, imports: [EntityTableComponent], exports: [EntityTableComponent] });
|
|
2980
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTableModule, imports: [EntityTableComponent] });
|
|
2981
|
+
}
|
|
2982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTableModule, decorators: [{
|
|
2983
|
+
type: NgModule,
|
|
2984
|
+
args: [{
|
|
2985
|
+
imports: [EntityTableComponent],
|
|
2986
|
+
exports: [EntityTableComponent]
|
|
2987
|
+
}]
|
|
2988
|
+
}] });
|
|
2989
|
+
|
|
2990
|
+
/**
|
|
2991
|
+
* @deprecated import the EntityTablePaginatorComponent directly
|
|
2992
|
+
*/
|
|
2993
|
+
class IgoEntityTablePaginatorModule {
|
|
2994
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTablePaginatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2995
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTablePaginatorModule, imports: [EntityTablePaginatorComponent], exports: [EntityTablePaginatorComponent] });
|
|
2996
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTablePaginatorModule, imports: [EntityTablePaginatorComponent] });
|
|
2997
|
+
}
|
|
2998
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityTablePaginatorModule, decorators: [{
|
|
2999
|
+
type: NgModule,
|
|
3000
|
+
args: [{
|
|
3001
|
+
imports: [EntityTablePaginatorComponent],
|
|
3002
|
+
exports: [EntityTablePaginatorComponent]
|
|
3003
|
+
}]
|
|
3004
|
+
}] });
|
|
3005
|
+
|
|
3006
|
+
const ENTITY_DIRECTIVES = [
|
|
3007
|
+
EntitySelectorComponent,
|
|
3008
|
+
EntityTableComponent,
|
|
3009
|
+
EntityTablePaginatorComponent
|
|
3010
|
+
];
|
|
3011
|
+
/**
|
|
3012
|
+
* @deprecated import the components directly or ENTITY_DIRECTIVES for every components/directives
|
|
3013
|
+
*/
|
|
3014
|
+
class IgoEntityModule {
|
|
3015
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3016
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityModule, imports: [EntitySelectorComponent,
|
|
3017
|
+
EntityTableComponent,
|
|
3018
|
+
EntityTablePaginatorComponent], exports: [EntitySelectorComponent,
|
|
3019
|
+
EntityTableComponent,
|
|
3020
|
+
EntityTablePaginatorComponent] });
|
|
3021
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityModule, imports: [ENTITY_DIRECTIVES] });
|
|
3022
|
+
}
|
|
3023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.9", ngImport: i0, type: IgoEntityModule, decorators: [{
|
|
3024
|
+
type: NgModule,
|
|
3025
|
+
args: [{
|
|
3026
|
+
imports: [...ENTITY_DIRECTIVES],
|
|
3027
|
+
exports: [...ENTITY_DIRECTIVES]
|
|
3028
|
+
}]
|
|
3029
|
+
}] });
|
|
3030
|
+
|
|
3031
|
+
/**
|
|
3032
|
+
* Generated bundle index. Do not edit.
|
|
3033
|
+
*/
|
|
3034
|
+
|
|
3035
|
+
export { ENTITY_DIRECTIVES, EntityOperationType, EntitySelectorComponent, EntityStateManager, EntityStore, EntityStoreFilterCustomFuncStrategy, EntityStoreFilterSelectionStrategy, EntityStoreStrategy, EntityStoreWatcher, EntityTableColumnRenderer, EntityTableComponent, EntityTablePaginatorComponent, EntityTableScrollBehavior, EntityTableSelectionState, EntityTransaction, EntityView, IgoEntityModule, IgoEntitySelectorModule, IgoEntityTableModule, IgoEntityTablePaginatorModule, getEntityIcon, getEntityId, getEntityProperty, getEntityRevision, getEntityTitle, getEntityTitleHtml };
|
|
3036
|
+
//# sourceMappingURL=igo2-common-entity.mjs.map
|