@coolon/angular-ui-powerups 12.4.0-alpha.32 → 12.4.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js +23 -9
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.js +35 -5
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
- package/cypress/package.json +1 -1
- package/cypress/page.d.ts +3 -0
- package/esm2015/cypress/page.js +23 -9
- package/esm2015/cypress/page.js.map +1 -1
- package/esm2015/cypress/page.metadata.json +1 -1
- package/esm2015/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.js +1 -1
- package/esm2015/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.js.map +1 -1
- package/esm2015/lib/place/place-component.js +31 -4
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-component.metadata.json +1 -1
- package/esm2015/lib/place/visit.js +5 -1
- package/esm2015/lib/place/visit.js.map +1 -1
- package/esm2015/lib/place/visit.metadata.json +1 -1
- package/fesm2015/coolon-angular-ui-powerups-cypress.js +23 -9
- package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +36 -6
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/place-component.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"exports":[{"from":"./components/types"}],"metadata":{"ComponentBuilder":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"}]}],"find":[{"__symbolic":"method"}],"section":[{"__symbolic":"method"}],"contains":[{"__symbolic":"method"}],"button":[{"__symbolic":"method"}],"matCheckbox":[{"__symbolic":"method"}],"aupStringInput":[{"__symbolic":"method"}],"aupTextInput":[{"__symbolic":"method"}],"aupPasswordInput":[{"__symbolic":"method"}],"aupNumberInput":[{"__symbolic":"method"}],"aupCommand":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"aupTabbedNavigation":[{"__symbolic":"method"}],"aupSideNavigation":[{"__symbolic":"method"}],"aupMoreMenu":[{"__symbolic":"method"}],"aupTable":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"aupTreeTable":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"aupEmptyState":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"component":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}]}},"ElementLocator":{"__symbolic":"interface"},"PageBuilder":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ComponentBuilder"},"members":{"aupModalActivity":[{"__symbolic":"method"}],"aupModalAlert":[{"__symbolic":"method"}],"aupModelConfirm":[{"__symbolic":"method"}]}},"PageElement":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":10,"character":22,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"string"}]},{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":11,"character":22,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"ElementLocator"}]},{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":12,"character":22,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"string"}]},{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":31,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"string"}]}],"getDefaultElementLocator":[{"__symbolic":"method"}],"getDefaultElementSelector":[{"__symbolic":"method"}],"dom":[{"__symbolic":"method"}],"find":[{"__symbolic":"method"}],"click":[{"__symbolic":"method"}],"getShoulder":[{"__symbolic":"method"}],"getShouldElement":[{"__symbolic":"method"}],"shouldBeVisible":[{"__symbolic":"method"}],"shouldNotBeVisible":[{"__symbolic":"method"}],"shouldExist":[{"__symbolic":"method"}],"shouldNotExist":[{"__symbolic":"method"}]}},"Page":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Path"}]}],"dom":[{"__symbolic":"method"}],"visit":[{"__symbolic":"method"}],"tryAndVisit":[{"__symbolic":"method"}],"shouldHaveActivityIds":[{"__symbolic":"method"}],"shouldNotHaveActivityIds":[{"__symbolic":"method"}],"shouldHaveTitle":[{"__symbolic":"method"}],"shouldBeActive":[{"__symbolic":"method"}]}},"Path":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Path"},"member":"Segment"}]}]}],"toUrl":[{"__symbolic":"method"}]}},"AupAbstractActivity":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":5,"character":41,"module":"./components/aup-abstract-activity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupAbstractTable":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"row":[{"__symbolic":"method"}],"rowNumber":[{"__symbolic":"method"}],"column":[{"__symbolic":"method"}],"selectionColumn":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":27,"character":3}}]}],"createRow":[{"__symbolic":"method"}]}},"AupActivity":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractActivity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupAlertDialog":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":5,"character":36,"module":"./components/aup-alert-dialog"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupAlert":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractActivity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}],"clickClose":[{"__symbolic":"method"}]}},"AupCommandFace":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ɵa"},"member":"CommandFace"}]}]}},"AupCommandGroup":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{}},"AupCommand":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ɵa"},"member":"CommandFace"}]}],"click":[{"__symbolic":"method"}],"getShouldElement":[{"__symbolic":"method"}],"shouldBeDisabled":[{"__symbolic":"method"}],"shouldBeEnabled":[{"__symbolic":"method"}],"getButton":[{"__symbolic":"method"}]}},"AupConfirmDialog":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":6,"character":38,"module":"./components/aup-confirm-dialog"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupConfirm":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractActivity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}],"clickConfirm":[{"__symbolic":"method"}],"clickCancel":[{"__symbolic":"method"}]}},"AupEmptyState":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"shouldContainText":[{"__symbolic":"method"}]}},"AupInput":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"label":[{"__symbolic":"method"}],"hint":[{"__symbolic":"method"}],"error":[{"__symbolic":"method"}],"labelShouldBe":[{"__symbolic":"method"}],"hintShouldBe":[{"__symbolic":"method"}],"errorShouldBe":[{"__symbolic":"method"}],"shouldBeFocused":[{"__symbolic":"method"}],"shouldNotBeFocused":[{"__symbolic":"method"}],"type":[{"__symbolic":"method"}],"hitEnter":[{"__symbolic":"method"}],"input":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"setValue":[{"__symbolic":"method"}]}},"AupModalActivity":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":3,"character":38,"module":"./components/aup-modal-activity"},"members":{}},"AupModalMixin":{"__symbolic":"function","parameters":["Base"],"value":{"__symbolic":"class"}},"AupNavigation":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"click":[{"__symbolic":"method"}],"face":[{"__symbolic":"method"}],"shouldHaveLink":[{"__symbolic":"method"}],"shouldNotHaveLink":[{"__symbolic":"method"}]}},"AupTable":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractTable"},"members":{"createRow":[{"__symbolic":"method"}]}},"AupToolBar":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{}},"AupTreeTable":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractTable"},"members":{"treeControlColumn":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":9,"character":3}}]}],"createRow":[{"__symbolic":"method"}]}},"Button":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":4,"character":28,"module":"./components/button"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"FormElementMixin":{"__symbolic":"function","parameters":["Base"],"value":{"__symbolic":"class"}},"MatCheckbox":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":4,"character":33,"module":"./components/mat-checkbox"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}],"shouldBeChecked":[{"__symbolic":"method"}],"shouldNotBeChecked":[{"__symbolic":"method"}],"hiddenCheckBoxElement":[{"__symbolic":"method"}],"check":[{"__symbolic":"method"}],"uncheck":[{"__symbolic":"method"}]}},"AupAbstractPopupMenu":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"ElementLocator"}]}],"findPopupIn":[{"__symbolic":"method"}],"getOverlay":[{"__symbolic":"method"}],"getBackdrop":[{"__symbolic":"method"}],"openPopup":[{"__symbolic":"method"}],"closePopup":[{"__symbolic":"method"}],"shouldBeOpen":[{"__symbolic":"method"}],"shouldNotBeOpen":[{"__symbolic":"method"}]}},"AupMoreMenu":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractPopupMenu"},"members":{},"statics":{"create":{"__symbolic":"function","parameters":["parent","selector"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"AupMoreMenu"},"arguments":[{"__symbolic":"reference","name":"parent"},{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ElementLocator"},"member":"findByCssSelector"},"arguments":[{"__symbolic":"binop","operator":"??","left":{"__symbolic":"reference","name":"selector"},"right":"aup-more-menu"}]}]}}}},"AupPopupMenuPanel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{}},"AupPopupMenu":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractPopupMenu"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ɵa"},"member":"CommandFace"}]}]},"statics":{"create":{"__symbolic":"function","parameters":["parent","face"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"AupPopupMenu"},"arguments":[{"__symbolic":"reference","name":"parent"},{"__symbolic":"reference","name":"face"}]}}}},"AupTableCell":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"rowId":[{"__symbolic":"method"}],"row":[{"__symbolic":"method"}]}},"AupTableColumn":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"AupAbstractTable"},{"__symbolic":"reference","name":"string"}]}],"cellContaining":[{"__symbolic":"method"}],"rowContaining":[{"__symbolic":"method"}]}},"AupTableRow":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"rowId":[{"__symbolic":"method"}],"shouldHaveRowId":[{"__symbolic":"method"}],"cell":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"shouldBeSelected":[{"__symbolic":"method"}],"shouldNotBeSelected":[{"__symbolic":"method"}]}},"AupTableSelectionCell":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"AupTableCell"},"members":{"selectAll":[{"__symbolic":"method"}]}},"AupTableSelectionColumn":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"AupTableColumn"},"members":{"selectAll":[{"__symbolic":"method"}]}}},"origins":{"ComponentBuilder":"./component-builder","ElementLocator":"./element-locator","PageBuilder":"./page-builder","PageElement":"./page-element","Page":"./page","Path":"./path","AupAbstractActivity":"./components/aup-abstract-activity","AupAbstractTable":"./components/aup-abstract-table","AupActivity":"./components/aup-activity","AupAlertDialog":"./components/aup-alert-dialog","AupAlert":"./components/aup-alert","AupCommandFace":"./components/aup-command-face","AupCommandGroup":"./components/aup-command-group","AupCommand":"./components/aup-command","AupConfirmDialog":"./components/aup-confirm-dialog","AupConfirm":"./components/aup-confirm","AupEmptyState":"./components/aup-empty-state","AupInput":"./components/aup-input","AupModalActivity":"./components/aup-modal-activity","AupModalMixin":"./components/aup-modal-mixin","AupNavigation":"./components/aup-navigation","AupTable":"./components/aup-table","AupToolBar":"./components/aup-tool-bar","AupTreeTable":"./components/aup-tree-table","Button":"./components/button","FormElementMixin":"./components/form-element-mixin","MatCheckbox":"./components/mat-checkbox","AupAbstractPopupMenu":"./components/popup/aup-abstract-popup-menu","AupMoreMenu":"./components/popup/aup-more-menu","AupPopupMenuPanel":"./components/popup/aup-popup-menu-panel","AupPopupMenu":"./components/popup/aup-popup-menu","AupTableCell":"./components/table/aup-table-cell","AupTableColumn":"./components/table/aup-table-column","AupTableRow":"./components/table/aup-table-row","AupTableSelectionCell":"./components/table/aup-table-selection-cell","AupTableSelectionColumn":"./components/table/aup-table-selection-column","ɵa":"./components/types"},"importAs":"@coolon/angular-ui-powerups/cypress"}
|
|
1
|
+
{"__symbolic":"module","version":4,"exports":[{"from":"./components/types"}],"metadata":{"ComponentBuilder":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"}]}],"find":[{"__symbolic":"method"}],"section":[{"__symbolic":"method"}],"contains":[{"__symbolic":"method"}],"button":[{"__symbolic":"method"}],"matCheckbox":[{"__symbolic":"method"}],"aupStringInput":[{"__symbolic":"method"}],"aupTextInput":[{"__symbolic":"method"}],"aupPasswordInput":[{"__symbolic":"method"}],"aupNumberInput":[{"__symbolic":"method"}],"aupCommand":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"aupTabbedNavigation":[{"__symbolic":"method"}],"aupSideNavigation":[{"__symbolic":"method"}],"aupMoreMenu":[{"__symbolic":"method"}],"aupTable":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"aupTreeTable":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"aupEmptyState":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"component":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}]}},"ElementLocator":{"__symbolic":"interface"},"PageBuilder":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"ComponentBuilder"},"members":{"aupModalActivity":[{"__symbolic":"method"}],"aupModalAlert":[{"__symbolic":"method"}],"aupModelConfirm":[{"__symbolic":"method"}]}},"PageElement":{"__symbolic":"class","arity":1,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":10,"character":22,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"string"}]},{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":11,"character":22,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"ElementLocator"}]},{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":12,"character":22,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"string"}]},{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":31,"context":{"typeName":"P"},"module":"./page-element"},{"__symbolic":"reference","name":"string"}]}],"getDefaultElementLocator":[{"__symbolic":"method"}],"getDefaultElementSelector":[{"__symbolic":"method"}],"dom":[{"__symbolic":"method"}],"find":[{"__symbolic":"method"}],"click":[{"__symbolic":"method"}],"getShoulder":[{"__symbolic":"method"}],"getShouldElement":[{"__symbolic":"method"}],"shouldBeVisible":[{"__symbolic":"method"}],"shouldNotBeVisible":[{"__symbolic":"method"}],"shouldExist":[{"__symbolic":"method"}],"shouldNotExist":[{"__symbolic":"method"}]}},"Page":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Path"}]}],"dom":[{"__symbolic":"method"}],"visit":[{"__symbolic":"method"}],"tryAndVisit":[{"__symbolic":"method"}],"shouldHaveActivityIds":[{"__symbolic":"method"}],"shouldNotHaveActivityIds":[{"__symbolic":"method"}],"shouldHaveTitle":[{"__symbolic":"method"}],"shouldBeActive":[{"__symbolic":"method"}],"shouldIncludeParameters":[{"__symbolic":"method"}],"shouldNotHaveParameter":[{"__symbolic":"method"}],"getUrlParameters":[{"__symbolic":"method"}]}},"Path":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Path"},"member":"Segment"}]}]}],"toUrl":[{"__symbolic":"method"}]}},"AupAbstractActivity":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":5,"character":41,"module":"./components/aup-abstract-activity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupAbstractTable":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"row":[{"__symbolic":"method"}],"rowNumber":[{"__symbolic":"method"}],"column":[{"__symbolic":"method"}],"selectionColumn":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":27,"character":3}}]}],"createRow":[{"__symbolic":"method"}]}},"AupActivity":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractActivity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupAlertDialog":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":5,"character":36,"module":"./components/aup-alert-dialog"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupAlert":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractActivity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}],"clickClose":[{"__symbolic":"method"}]}},"AupCommandFace":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ɵa"},"member":"CommandFace"}]}]}},"AupCommandGroup":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{}},"AupCommand":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ɵa"},"member":"CommandFace"}]}],"click":[{"__symbolic":"method"}],"getShouldElement":[{"__symbolic":"method"}],"shouldBeDisabled":[{"__symbolic":"method"}],"shouldBeEnabled":[{"__symbolic":"method"}],"getButton":[{"__symbolic":"method"}]}},"AupConfirmDialog":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":6,"character":38,"module":"./components/aup-confirm-dialog"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"AupConfirm":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractActivity"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}],"clickConfirm":[{"__symbolic":"method"}],"clickCancel":[{"__symbolic":"method"}]}},"AupEmptyState":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"shouldContainText":[{"__symbolic":"method"}]}},"AupInput":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"label":[{"__symbolic":"method"}],"hint":[{"__symbolic":"method"}],"error":[{"__symbolic":"method"}],"labelShouldBe":[{"__symbolic":"method"}],"hintShouldBe":[{"__symbolic":"method"}],"errorShouldBe":[{"__symbolic":"method"}],"shouldBeFocused":[{"__symbolic":"method"}],"shouldNotBeFocused":[{"__symbolic":"method"}],"type":[{"__symbolic":"method"}],"hitEnter":[{"__symbolic":"method"}],"input":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"setValue":[{"__symbolic":"method"}]}},"AupModalActivity":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":3,"character":38,"module":"./components/aup-modal-activity"},"members":{}},"AupModalMixin":{"__symbolic":"function","parameters":["Base"],"value":{"__symbolic":"class"}},"AupNavigation":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"click":[{"__symbolic":"method"}],"face":[{"__symbolic":"method"}],"shouldHaveLink":[{"__symbolic":"method"}],"shouldNotHaveLink":[{"__symbolic":"method"}]}},"AupTable":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractTable"},"members":{"createRow":[{"__symbolic":"method"}]}},"AupToolBar":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{}},"AupTreeTable":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractTable"},"members":{"treeControlColumn":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":9,"character":3}}]}],"createRow":[{"__symbolic":"method"}]}},"Button":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":4,"character":28,"module":"./components/button"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}]}},"FormElementMixin":{"__symbolic":"function","parameters":["Base"],"value":{"__symbolic":"class"}},"MatCheckbox":{"__symbolic":"class","extends":{"__symbolic":"error","message":"Symbol reference expected","line":4,"character":33,"module":"./components/mat-checkbox"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"string"}]}],"shouldBeChecked":[{"__symbolic":"method"}],"shouldNotBeChecked":[{"__symbolic":"method"}],"hiddenCheckBoxElement":[{"__symbolic":"method"}],"check":[{"__symbolic":"method"}],"uncheck":[{"__symbolic":"method"}]}},"AupAbstractPopupMenu":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"reference","name":"ElementLocator"}]}],"findPopupIn":[{"__symbolic":"method"}],"getOverlay":[{"__symbolic":"method"}],"getBackdrop":[{"__symbolic":"method"}],"openPopup":[{"__symbolic":"method"}],"closePopup":[{"__symbolic":"method"}],"shouldBeOpen":[{"__symbolic":"method"}],"shouldNotBeOpen":[{"__symbolic":"method"}]}},"AupMoreMenu":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractPopupMenu"},"members":{},"statics":{"create":{"__symbolic":"function","parameters":["parent","selector"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"AupMoreMenu"},"arguments":[{"__symbolic":"reference","name":"parent"},{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ElementLocator"},"member":"findByCssSelector"},"arguments":[{"__symbolic":"binop","operator":"??","left":{"__symbolic":"reference","name":"selector"},"right":"aup-more-menu"}]}]}}}},"AupPopupMenuPanel":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{}},"AupPopupMenu":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"AupAbstractPopupMenu"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"PageElement"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ɵa"},"member":"CommandFace"}]}]},"statics":{"create":{"__symbolic":"function","parameters":["parent","face"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"AupPopupMenu"},"arguments":[{"__symbolic":"reference","name":"parent"},{"__symbolic":"reference","name":"face"}]}}}},"AupTableCell":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"rowId":[{"__symbolic":"method"}],"row":[{"__symbolic":"method"}]}},"AupTableColumn":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"PageElement"},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"AupAbstractTable"},{"__symbolic":"reference","name":"string"}]}],"cellContaining":[{"__symbolic":"method"}],"rowContaining":[{"__symbolic":"method"}]}},"AupTableRow":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"PageElement"},"members":{"rowId":[{"__symbolic":"method"}],"shouldHaveRowId":[{"__symbolic":"method"}],"cell":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"shouldBeSelected":[{"__symbolic":"method"}],"shouldNotBeSelected":[{"__symbolic":"method"}]}},"AupTableSelectionCell":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"AupTableCell"},"members":{"selectAll":[{"__symbolic":"method"}]}},"AupTableSelectionColumn":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"AupTableColumn"},"members":{"selectAll":[{"__symbolic":"method"}]}}},"origins":{"ComponentBuilder":"./component-builder","ElementLocator":"./element-locator","PageBuilder":"./page-builder","PageElement":"./page-element","Page":"./page","Path":"./path","AupAbstractActivity":"./components/aup-abstract-activity","AupAbstractTable":"./components/aup-abstract-table","AupActivity":"./components/aup-activity","AupAlertDialog":"./components/aup-alert-dialog","AupAlert":"./components/aup-alert","AupCommandFace":"./components/aup-command-face","AupCommandGroup":"./components/aup-command-group","AupCommand":"./components/aup-command","AupConfirmDialog":"./components/aup-confirm-dialog","AupConfirm":"./components/aup-confirm","AupEmptyState":"./components/aup-empty-state","AupInput":"./components/aup-input","AupModalActivity":"./components/aup-modal-activity","AupModalMixin":"./components/aup-modal-mixin","AupNavigation":"./components/aup-navigation","AupTable":"./components/aup-table","AupToolBar":"./components/aup-tool-bar","AupTreeTable":"./components/aup-tree-table","Button":"./components/button","FormElementMixin":"./components/form-element-mixin","MatCheckbox":"./components/mat-checkbox","AupAbstractPopupMenu":"./components/popup/aup-abstract-popup-menu","AupMoreMenu":"./components/popup/aup-more-menu","AupPopupMenuPanel":"./components/popup/aup-popup-menu-panel","AupPopupMenu":"./components/popup/aup-popup-menu","AupTableCell":"./components/table/aup-table-cell","AupTableColumn":"./components/table/aup-table-column","AupTableRow":"./components/table/aup-table-row","AupTableSelectionCell":"./components/table/aup-table-selection-cell","AupTableSelectionColumn":"./components/table/aup-table-selection-column","ɵa":"./components/types"},"importAs":"@coolon/angular-ui-powerups/cypress"}
|
package/cypress/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"peerDependencies": {
|
|
3
3
|
"cypress": "^5.6.0",
|
|
4
4
|
"@coolon/typescript-utilities": "^2.2.0",
|
|
5
|
-
"cypress-wait-until": "^1.
|
|
5
|
+
"cypress-wait-until": "^1.7.1"
|
|
6
6
|
},
|
|
7
7
|
"main": "../bundles/coolon-angular-ui-powerups-cypress.umd.js",
|
|
8
8
|
"module": "../fesm2015/coolon-angular-ui-powerups-cypress.js",
|
package/cypress/page.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export declare class Page extends PageElement {
|
|
|
18
18
|
shouldNotHaveActivityIds(): void;
|
|
19
19
|
shouldHaveTitle(title: string): void;
|
|
20
20
|
shouldBeActive(withParameters?: object): void;
|
|
21
|
+
shouldIncludeParameters(parameters: object): void;
|
|
22
|
+
shouldNotHaveParameter(name: string): void;
|
|
23
|
+
getUrlParameters(): Cypress.Chainable<object>;
|
|
21
24
|
}
|
|
22
25
|
export declare namespace Page {
|
|
23
26
|
function create<T extends object>(path: string, builder: ComponentBuilder.ContainerCallback<T, Page, PageBuilder>): T & Page;
|
package/esm2015/cypress/page.js
CHANGED
|
@@ -19,7 +19,9 @@ export class Page extends PageElement {
|
|
|
19
19
|
tryAndVisit(params, queryParams) {
|
|
20
20
|
const path = this.path.toUrl(params !== null && params !== void 0 ? params : {});
|
|
21
21
|
const queryString = queryParams ? `?${new URLSearchParams(queryParams).toString()}` : '';
|
|
22
|
-
|
|
22
|
+
const fullPath = `/${path}${queryString}`;
|
|
23
|
+
cy.log(`Visiting -> ${fullPath}`);
|
|
24
|
+
cy.visit(fullPath);
|
|
23
25
|
}
|
|
24
26
|
shouldHaveActivityIds(...ids) {
|
|
25
27
|
cy.location('search').should('contain', `?aup-interactions=${ids.join('--')}`);
|
|
@@ -38,16 +40,28 @@ export class Page extends PageElement {
|
|
|
38
40
|
});
|
|
39
41
|
});
|
|
40
42
|
if (withParameters) {
|
|
41
|
-
|
|
42
|
-
const urlParams = Path.extractVisitParameters(path);
|
|
43
|
-
Object.keys(withParameters).forEach(param => {
|
|
44
|
-
const expected = withParameters[param];
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
expect(urlParams[param]).to.equal(expected);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
43
|
+
this.shouldIncludeParameters(withParameters);
|
|
49
44
|
}
|
|
50
45
|
}
|
|
46
|
+
shouldIncludeParameters(parameters) {
|
|
47
|
+
cy.location('pathname').then(path => {
|
|
48
|
+
const urlParams = Path.extractVisitParameters(path);
|
|
49
|
+
Object.keys(parameters).forEach(param => {
|
|
50
|
+
const expected = parameters[param];
|
|
51
|
+
const actual = urlParams[param];
|
|
52
|
+
// cy.log(`${actual} - ${expected}`);
|
|
53
|
+
expect(urlParams[param]).to.equal(expected);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
shouldNotHaveParameter(name) {
|
|
58
|
+
this.getUrlParameters().then(params => {
|
|
59
|
+
expect(params[name]).to.be.undefined;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
getUrlParameters() {
|
|
63
|
+
return cy.location('pathname').then(path => Path.extractVisitParameters(path));
|
|
64
|
+
}
|
|
51
65
|
}
|
|
52
66
|
(function (Page) {
|
|
53
67
|
function create(pathOrPathBuilder, builder) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/cypress/src/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,OAAO,IAAK,SAAQ,WAAW;IAInC,YAAqB,IAAU;QAC7B,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QADT,SAAI,GAAJ,IAAI,CAAM;QAFrB,wBAAmB,GAAG,MAAM,CAAC;IAIvC,CAAC;IAED,GAAG;QACD,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,WAAoB,EAAE,WAAuC;QACjE,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAC3C,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAED,WAAW,CAAC,MAAe,EAAE,WAAuC;QAClE,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AC,WAAW,CAAC,CAAC;SAChC;QACD,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClE,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAa,CAAC;IAC1D,CAAC;IAVe,WAAM,SAUrB,CAAA;AACH,CAAC,EAhBgB,IAAI,KAAJ,IAAI,QAgBpB","sourcesContent":["import { Mixin } from '@coolon/typescript-utilities';\nimport * as _ from 'lodash';\nimport { ComponentBuilder } from './component-builder';\nimport { PageBuilder } from './page-builder';\nimport { PageElement } from './page-element';\nimport { Path } from './path';\n\nexport class Page extends PageElement {\n\n protected rootElementSelector = 'body';\n\n constructor(readonly path: Path) {\n super(undefined, undefined);\n }\n\n dom(): Cypress.Chainable<JQuery<HTMLElement>> {\n return cy.get(this.rootElementSelector);\n }\n\n visit(visitParams?: object, queryParams?: { [key: string]: string }) {\n this.tryAndVisit(visitParams, queryParams);\n this.shouldBeActive(visitParams);\n }\n\n tryAndVisit(params?: object, queryParams?: { [key: string]: string }) {\n const path = this.path.toUrl(params ?? {});\n const queryString = queryParams ? `?${new URLSearchParams(queryParams).toString()}` : '';\n const fullPath = `/${path}${queryString}`;\n cy.log(`Visiting -> ${fullPath}`);\n cy.visit(fullPath);\n }\n\n shouldHaveActivityIds(...ids: string[]) {\n cy.location('search').should('contain', `?aup-interactions=${ids.join('--')}`);\n }\n\n shouldNotHaveActivityIds() {\n cy.location('search').should('not.contain', `?aup-interactions`);\n }\n\n shouldHaveTitle(title: string) {\n cy.title().should('eq', title);\n }\n\n shouldBeActive(withParameters?: object) {\n // Note: cy.window() doesn't return a promise... it's a chainable.\n cy['waitUntil'](() => {\n return cy.window().then(window => {\n return window['aup.PlaceRouter'] && !window['aup.PlaceRouter'].isNavigating();\n });\n });\n\n if (withParameters) {\n this.shouldIncludeParameters(withParameters);\n }\n }\n\n shouldIncludeParameters(parameters: object) {\n cy.location('pathname').then(path => {\n const urlParams = Path.extractVisitParameters(path);\n Object.keys(parameters).forEach(param => {\n const expected = parameters[param];\n const actual = urlParams[param];\n // cy.log(`${actual} - ${expected}`);\n expect(urlParams[param]).to.equal(expected);\n });\n });\n }\n\n shouldNotHaveParameter(name: string) {\n this.getUrlParameters().then(params => {\n expect(params[name]).to.be.undefined;\n });\n }\n\n getUrlParameters() {\n return cy.location('pathname').then(path => Path.extractVisitParameters(path));\n }\n\n}\n\n\nexport namespace Page {\n\n export function create<T extends object>(path: string, builder: ComponentBuilder.ContainerCallback<T, Page, PageBuilder>): T & Page\n // tslint:disable-next-line:unified-signatures\n export function create<T extends object>(pathBuilder: ((pathBuilder: Path.Builder) => void), builder: ComponentBuilder.ContainerCallback<T, Page, PageBuilder>): T & Page\n export function create<T extends object>(pathOrPathBuilder: string | ((pathBuilder: Path.Builder) => void), builder: ComponentBuilder.ContainerCallback<T, Page, PageBuilder>): T & Page {\n const pathBuilder = new Path.Builder();\n if (_.isString(pathOrPathBuilder)) {\n pathOrPathBuilder.split('/').filter(p => !_.isEmpty(p)).forEach(p => pathBuilder.segment(p));\n } else {\n pathOrPathBuilder(pathBuilder);\n }\n const instance = new Page(pathBuilder.getPath());\n const content = builder.call(instance, new PageBuilder(instance));\n return Mixin.createProxy(content, instance) as T & Page;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"Page":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./page-element","name":"PageElement","line":7,"character":26},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./path","name":"Path","line":11,"character":29}]}],"dom":[{"__symbolic":"method"}],"visit":[{"__symbolic":"method"}],"tryAndVisit":[{"__symbolic":"method"}],"shouldHaveActivityIds":[{"__symbolic":"method"}],"shouldNotHaveActivityIds":[{"__symbolic":"method"}],"shouldHaveTitle":[{"__symbolic":"method"}],"shouldBeActive":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"Page":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./page-element","name":"PageElement","line":7,"character":26},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./path","name":"Path","line":11,"character":29}]}],"dom":[{"__symbolic":"method"}],"visit":[{"__symbolic":"method"}],"tryAndVisit":[{"__symbolic":"method"}],"shouldHaveActivityIds":[{"__symbolic":"method"}],"shouldNotHaveActivityIds":[{"__symbolic":"method"}],"shouldHaveTitle":[{"__symbolic":"method"}],"shouldBeActive":[{"__symbolic":"method"}],"shouldIncludeParameters":[{"__symbolic":"method"}],"shouldNotHaveParameter":[{"__symbolic":"method"}],"getUrlParameters":[{"__symbolic":"method"}]}}}}]
|
|
@@ -45,7 +45,7 @@ export class InlineStringEditorComponent extends DisposableComponent {
|
|
|
45
45
|
yield this.interactionContext.startActivity(StringInputActivity, this.createInputActivityData());
|
|
46
46
|
}
|
|
47
47
|
catch (e) {
|
|
48
|
-
// don't care, just hiding the console errors
|
|
48
|
+
// don't care if they cancelled, just hiding the console errors
|
|
49
49
|
}
|
|
50
50
|
finally {
|
|
51
51
|
this.editorModel.editing.value = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-string-editor.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/angular-ui-powerups/src/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,SAAS,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAEL,OAAO,EACP,GAAG,EACH,iBAAiB,EACjB,aAAa,EACb,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,C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Q,EAAE,CAAC;IAC5C,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1B,CAAC;;;YAvIF,SAAS,SAAC;gBACT,QAAQ,EAAE,0BAA0B;gBACpC,uiBAAoD;aAErD;;;YA5BQ,kBAAkB;;;0BA+BxB,KAAK;yBAIL,KAAK;oBAIL,KAAK;iCAIL,SAAS,SAAC,kCAAkC;oBAG5C,KAAK;0BAGL,KAAK;+BAIL,KAAK;;AApBN;IADC,aAAa,EAAE;8BACH,iBAAiB;gEAAS;AAIvC;IADC,aAAa,EAAE;8BACJ,UAAU;+DAAoC;AAI1D;IADC,iBAAiB,CAAC,YAAY,CAAC;;0DACS;AAUzC;IADC,iBAAiB,CAAC,kBAAkB,CAAC;;gEAClB;AAIpB;IADC,aAAa,EAAE;8BACE,UAAU;qEAAS;AA6GvC,WAAiB,2BAA2B;IAQ7B,yCAAa,GAAU;QAClC,IAAI,EAAE;YACJ,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU;SACvB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW;SACxB;QACD,MAAM,EAAE;YACN,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW;SACxB;KACF,CAAC;AAEJ,CAAC,EApBgB,2BAA2B,KAA3B,2BAA2B,QAoB3C","sourcesContent":["import { Component, Input, OnInit, ViewChild } from '@angular/core';\nimport {\n BooleanValueModelChain,\n Command,\n Dsl,\n StoreInValueModel,\n TrackExternal,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport { lang } from '@coolon/typescript-utilities';\nimport * as _ from 'lodash';\nimport { CommandFace } from '../../../../components/commands/command-face';\nimport { DisposableComponent } from '../../../../components/disposable-component';\nimport { InteractionService } from '../../../services/interaction.service';\nimport { InPlaceInteractionContextComponent } from '../../inplace-interaction-context/in-place-interaction-context.component';\nimport { InputActivity } from '../../input-activities/input-activity';\nimport { StringInputActivity } from '../../input-activities/string-input-activity';\nimport { InlineEditorModel } from './inline-editor-model';\n\n/**\n * @example\n * const source: ValueModel<string> = ...;\n * const model = InlineEditorModel.create(source, {\n * save(updated:string, context: EditContext) => {\n * try {\n * try and save the thing...\n * } catch(error) {\n * context.injectError(error)\n * }\n * }).validateUsing(Validator.present(\"We'll need a value\");\n *\n * # in the view\n * <aup-inline-string-editor\n * label=\"My field\"\n * placeHolder=\"I'm ready for a string...\"\n * [editorModel]=\"model\"></aup-inline-string-editor>\n */\n@Component({\n selector: 'aup-inline-string-editor',\n templateUrl: './inline-string-editor.component.html',\n styleUrls: [] // See assets/interaction/editor/inline-string-editor.scss\n})\nexport class InlineStringEditorComponent extends DisposableComponent implements OnInit {\n\n @Input()\n @TrackExternal()\n editorModel: InlineEditorModel<string>;\n\n @Input()\n @TrackExternal()\n facesModel: ValueModel<InlineStringEditorComponent.Faces>;\n\n @Input()\n @StoreInValueModel('facesModel')\n faces: InlineStringEditorComponent.Faces;\n\n @ViewChild(InPlaceInteractionContextComponent)\n interactionContext: InPlaceInteractionContextComponent<any, any, any>;\n\n @Input()\n label: string;\n\n @Input()\n @StoreInValueModel('placeHolderModel')\n placeHolder: string;\n\n @Input()\n @TrackExternal()\n placeHolderModel: ValueModel<string>;\n\n readonly description: ValueModelChain<string>;\n empty: BooleanValueModelChain;\n readonly editCommand: Command<void>;\n\n displayValue: ValueModelChain<string>;\n readonly editFaceModel: ValueModelChain<CommandFace>;\n readonly saveFace: ValueModelChain<CommandFace>;\n readonly cancelFace: ValueModelChain<CommandFace>;\n\n constructor(interactionService: InteractionService) {\n super();\n const { chain, when, valueOf } = Dsl.disposeWith(this);\n const modalIC = interactionService.createModalInteractionContextDisposedWith(this);\n\n const resolvedFacesModel = chain(this.facesModel).map(userFaces => {\n return {\n ...InlineStringEditorComponent.DEFAULT_FACES, // todo: should really inject app wide defaults as well\n ...userFaces\n };\n }, { allowNil: true });\n\n this.editFaceModel = resolvedFacesModel.pluck('edit');\n this.saveFace = resolvedFacesModel.pluck('save');\n this.cancelFace = resolvedFacesModel.pluck('cancel');\n\n const self = this;\n this.editCommand = Command.create(async () => {\n this.editorModel.editing.value = true;\n try {\n await this.interactionContext.startActivity(StringInputActivity, this.createInputActivityData());\n } catch (e) {\n // don't care, just hiding the console errors\n } finally {\n this.editorModel.editing.value = false;\n }\n });\n\n this.onDispose(() => this.cancelEdit());\n\n }\n\n\n ngOnInit(): void {\n // our editor model is a one time binding without delegates so we can only\n // use it once we've been initialised\n const { chain, when, valueOf } = Dsl.disposeWith(this);\n\n if (!this.editorModel) {\n lang.illegalState('editorModel is required');\n }\n\n when(this.editorModel.editing).becomesTruthy(() => {\n this.editCommand.execute();\n }, { asLongAs: this.editCommand.enabled });\n\n when(this.editorModel.editing).becomesFalsey(() => this.cancelEdit());\n\n this.empty = valueOf.any(\n chain.stringValue(this.editorModel.valueModel).isBlank()\n // deviceDescription.isNil()\n ).areTruthy();\n\n this.displayValue = chain(this.editorModel.valueModel).map(v => {\n return _.isEmpty(v) ? this.placeHolderModel.value : v;\n }, { dependsOn: this.placeHolderModel, allowNil: true });\n\n\n }\n\n private createInputActivityData(): InputActivity.Data<string> {\n const self = this;\n return {\n initialValue: self.editorModel.valueModel.value,\n buttonStyle: { confirm: self.saveFace.value, cancel: self.cancelFace.value },\n placeholder: self.placeHolderModel.value,\n label: self.label,\n layout: InputActivity.Layout.INLINE,\n validators: self.editorModel.validators.value,\n async save(value: string, inputContext: InputActivity.Context): Promise<void> {\n await self.editorModel.saveCallback(value, inputContext);\n }\n };\n }\n\n cancelEdit() {\n if (this.isEditing()) {\n this.interactionContext.cancelActiveActivity();\n }\n }\n\n startEdit() {\n if (!this.isEditing() && this.editCommand.enabled.value) {\n this.editCommand.execute();\n }\n }\n\n private isEditing() {\n return this.interactionContext.isActive();\n }\n\n isEmpty(): boolean {\n return this.empty.value;\n }\n\n\n}\n\nexport namespace InlineStringEditorComponent {\n\n export interface Faces {\n edit?: CommandFace;\n save?: CommandFace;\n cancel?: CommandFace;\n }\n\n export const DEFAULT_FACES: Faces = {\n edit: {\n icon: () => 'mat:edit'\n },\n save: {\n icon: () => 'mat:check'\n },\n cancel: {\n icon: () => 'mat:clear'\n }\n };\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"inline-string-editor.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/angular-ui-powerups/src/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,SAAS,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAEL,OAAO,EACP,GAAG,EACH,iBAAiB,EACjB,aAAa,EACb,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,kCAAkC,EAAE,MAAM,0EAA0E,CAAC;AAC9H,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AAMH,MAAM,OAAO,2BAA4B,SAAQ,mBAAmB;IAqClE,YAAY,kBAAsC;QAChD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,kBAAkB,CAAC,yCAAyC,CAAC,IAAI,CAAC,CAAC;QAEnF,MAAM,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,SAAS,C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;YACN,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW;SACxB;KACF,CAAC;AAEJ,CAAC,EApBgB,2BAA2B,KAA3B,2BAA2B,QAoB3C","sourcesContent":["import { Component, Input, OnInit, ViewChild } from '@angular/core';\nimport {\n BooleanValueModelChain,\n Command,\n Dsl,\n StoreInValueModel,\n TrackExternal,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport { lang } from '@coolon/typescript-utilities';\nimport * as _ from 'lodash';\nimport { CommandFace } from '../../../../components/commands/command-face';\nimport { DisposableComponent } from '../../../../components/disposable-component';\nimport { InteractionService } from '../../../services/interaction.service';\nimport { InPlaceInteractionContextComponent } from '../../inplace-interaction-context/in-place-interaction-context.component';\nimport { InputActivity } from '../../input-activities/input-activity';\nimport { StringInputActivity } from '../../input-activities/string-input-activity';\nimport { InlineEditorModel } from './inline-editor-model';\n\n/**\n * @example\n * const source: ValueModel<string> = ...;\n * const model = InlineEditorModel.create(source, {\n * save(updated:string, context: EditContext) => {\n * try {\n * try and save the thing...\n * } catch(error) {\n * context.injectError(error)\n * }\n * }).validateUsing(Validator.present(\"We'll need a value\");\n *\n * # in the view\n * <aup-inline-string-editor\n * label=\"My field\"\n * placeHolder=\"I'm ready for a string...\"\n * [editorModel]=\"model\"></aup-inline-string-editor>\n */\n@Component({\n selector: 'aup-inline-string-editor',\n templateUrl: './inline-string-editor.component.html',\n styleUrls: [] // See assets/interaction/editor/inline-string-editor.scss\n})\nexport class InlineStringEditorComponent extends DisposableComponent implements OnInit {\n\n @Input()\n @TrackExternal()\n editorModel: InlineEditorModel<string>;\n\n @Input()\n @TrackExternal()\n facesModel: ValueModel<InlineStringEditorComponent.Faces>;\n\n @Input()\n @StoreInValueModel('facesModel')\n faces: InlineStringEditorComponent.Faces;\n\n @ViewChild(InPlaceInteractionContextComponent)\n interactionContext: InPlaceInteractionContextComponent<any, any, any>;\n\n @Input()\n label: string;\n\n @Input()\n @StoreInValueModel('placeHolderModel')\n placeHolder: string;\n\n @Input()\n @TrackExternal()\n placeHolderModel: ValueModel<string>;\n\n readonly description: ValueModelChain<string>;\n empty: BooleanValueModelChain;\n readonly editCommand: Command<void>;\n\n displayValue: ValueModelChain<string>;\n readonly editFaceModel: ValueModelChain<CommandFace>;\n readonly saveFace: ValueModelChain<CommandFace>;\n readonly cancelFace: ValueModelChain<CommandFace>;\n\n constructor(interactionService: InteractionService) {\n super();\n const { chain, when, valueOf } = Dsl.disposeWith(this);\n const modalIC = interactionService.createModalInteractionContextDisposedWith(this);\n\n const resolvedFacesModel = chain(this.facesModel).map(userFaces => {\n return {\n ...InlineStringEditorComponent.DEFAULT_FACES, // todo: should really inject app wide defaults as well\n ...userFaces\n };\n }, { allowNil: true });\n\n this.editFaceModel = resolvedFacesModel.pluck('edit');\n this.saveFace = resolvedFacesModel.pluck('save');\n this.cancelFace = resolvedFacesModel.pluck('cancel');\n\n const self = this;\n this.editCommand = Command.create(async () => {\n this.editorModel.editing.value = true;\n try {\n await this.interactionContext.startActivity(StringInputActivity, this.createInputActivityData());\n } catch (e) {\n // don't care if they cancelled, just hiding the console errors\n } finally {\n this.editorModel.editing.value = false;\n }\n });\n\n this.onDispose(() => this.cancelEdit());\n\n }\n\n\n ngOnInit(): void {\n // our editor model is a one time binding without delegates so we can only\n // use it once we've been initialised\n const { chain, when, valueOf } = Dsl.disposeWith(this);\n\n if (!this.editorModel) {\n lang.illegalState('editorModel is required');\n }\n\n when(this.editorModel.editing).becomesTruthy(() => {\n this.editCommand.execute();\n }, { asLongAs: this.editCommand.enabled });\n\n when(this.editorModel.editing).becomesFalsey(() => this.cancelEdit());\n\n this.empty = valueOf.any(\n chain.stringValue(this.editorModel.valueModel).isBlank()\n // deviceDescription.isNil()\n ).areTruthy();\n\n this.displayValue = chain(this.editorModel.valueModel).map(v => {\n return _.isEmpty(v) ? this.placeHolderModel.value : v;\n }, { dependsOn: this.placeHolderModel, allowNil: true });\n\n\n }\n\n private createInputActivityData(): InputActivity.Data<string> {\n const self = this;\n return {\n initialValue: self.editorModel.valueModel.value,\n buttonStyle: { confirm: self.saveFace.value, cancel: self.cancelFace.value },\n placeholder: self.placeHolderModel.value,\n label: self.label,\n layout: InputActivity.Layout.INLINE,\n validators: self.editorModel.validators.value,\n async save(value: string, inputContext: InputActivity.Context): Promise<void> {\n await self.editorModel.saveCallback(value, inputContext);\n }\n };\n }\n\n cancelEdit() {\n if (this.isEditing()) {\n this.interactionContext.cancelActiveActivity();\n }\n }\n\n startEdit() {\n if (!this.isEditing() && this.editCommand.enabled.value) {\n this.editCommand.execute();\n }\n }\n\n private isEditing() {\n return this.interactionContext.isActive();\n }\n\n isEmpty(): boolean {\n return this.empty.value;\n }\n\n\n}\n\nexport namespace InlineStringEditorComponent {\n\n export interface Faces {\n edit?: CommandFace;\n save?: CommandFace;\n cancel?: CommandFace;\n }\n\n export const DEFAULT_FACES: Faces = {\n edit: {\n icon: () => 'mat:edit'\n },\n save: {\n icon: () => 'mat:check'\n },\n cancel: {\n icon: () => 'mat:clear'\n }\n };\n\n}\n"]}
|
|
@@ -8,6 +8,7 @@ import 'reflect-metadata';
|
|
|
8
8
|
import { DisposableComponent } from '../components/disposable-component';
|
|
9
9
|
import { PlaceDefinition } from './place-definition';
|
|
10
10
|
import { ParameterDefinition } from './route/parameter-definition';
|
|
11
|
+
import * as _ from 'lodash';
|
|
11
12
|
// RAKE: making this Symbol(...) broke things.
|
|
12
13
|
export const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
|
|
13
14
|
// this one seems ok.
|
|
@@ -33,16 +34,27 @@ export class PlaceComponent extends DisposableComponent {
|
|
|
33
34
|
when(this._active).becomesTruthy(() => this._notifyPlaceReady());
|
|
34
35
|
this.childPlaces = this.placeDefinition.children.map(d => d.component);
|
|
35
36
|
}
|
|
36
|
-
// @Trace()
|
|
37
37
|
initialiseVisit(visit, notifyVisitChanged) {
|
|
38
38
|
assert.isNil(this.visitModel.value);
|
|
39
39
|
const { when } = Dsl.disposeWith(this);
|
|
40
40
|
this.visitModel.value = visit;
|
|
41
41
|
DebugContext.getOrCreate(this.visitModel).tag(`${this.placeDefinition.component.name}.visitModel`);
|
|
42
|
-
|
|
42
|
+
// we track if the any of the bindings updated the route. If so we remember it and update the
|
|
43
|
+
// route in one go at the end.
|
|
44
|
+
this.placeDefinition
|
|
45
|
+
.getVisitParameterDefs()
|
|
46
|
+
.forEach(parameterDef => this.installAndInitialiseBinding(visit, parameterDef));
|
|
43
47
|
when(this.visitModel).changes((current, previous) => {
|
|
44
48
|
notifyVisitChanged(current, previous);
|
|
45
49
|
}, { unless: this._inVisitUpdate });
|
|
50
|
+
// TODO: this needs to do a replace url option so that the new url isn't put in the history.... for
|
|
51
|
+
// now we're not doing it as it's a fair bit of effort and will only affect people if they're
|
|
52
|
+
// cutting and pasting urls to each other.
|
|
53
|
+
// // the binding process can update the visit (e.g. if a selection model has already selected during
|
|
54
|
+
// // component construction) and there was no value specified in the route
|
|
55
|
+
// if (visit.hasRoutingChangedFrom(this.visitModel.value)) {
|
|
56
|
+
// notifyVisitChanged(this.visitModel.value, visit)
|
|
57
|
+
// }
|
|
46
58
|
}
|
|
47
59
|
updateVisit(visit) {
|
|
48
60
|
assert.isTruthy(this.isInitialised());
|
|
@@ -55,7 +67,12 @@ export class PlaceComponent extends DisposableComponent {
|
|
|
55
67
|
return !!this.visitModel.value;
|
|
56
68
|
}
|
|
57
69
|
// @Trace()
|
|
58
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Initialised the component bindings. If any binding has an initial model value (e.g. a selection model
|
|
72
|
+
* initialised during the constructor) and the route has nothing, then the visit will be udpated and this
|
|
73
|
+
* method will return ture to nofiy the the visit has changed.
|
|
74
|
+
*/
|
|
75
|
+
installAndInitialiseBinding(initialVisit, parameterDef) {
|
|
59
76
|
const model = this[parameterDef.propertyName];
|
|
60
77
|
DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);
|
|
61
78
|
const binding = this.registerDisposable(new Binding(this.visitModel, model, {
|
|
@@ -69,7 +86,17 @@ export class PlaceComponent extends DisposableComponent {
|
|
|
69
86
|
return currentVisit.replace(parameterDef, value);
|
|
70
87
|
}
|
|
71
88
|
}));
|
|
72
|
-
binding.
|
|
89
|
+
// Now we need to initialise the binding direction. If we have a value in the Url then we should always push
|
|
90
|
+
// that to the view. If we don't and the view already has a value (e.g. a selection model has already initialised in the
|
|
91
|
+
// component constructor) then we should push that to the route.
|
|
92
|
+
const isInVisit = !_.isNil(initialVisit.getParameterValue(parameterDef));
|
|
93
|
+
const isInModel = !_.isNil(model.value);
|
|
94
|
+
if (!isInVisit && isInModel) {
|
|
95
|
+
binding.writeLeft(); // push it to the route
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
binding.writeRight(); // push it to the model
|
|
99
|
+
}
|
|
73
100
|
}
|
|
74
101
|
get placeDefinition() {
|
|
75
102
|
const definition = PlaceComponent.getDefinition(this.constructor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-component.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,MAAM,EACN,OAAO,EAEP,YAAY,EACZ,GAAG,EACH,KAAK,EAEL,IAAI,EACJ,iBAAiB,EAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAInE,8CAA8C;AAC9C,MA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0CAA2B,8BAE1C,CAAA;IAED,SAAgB,kBAAkB,CAAC,KAAoC;QACrE,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,wBAAwB,CAA+B,CAAC;IAClG,CAAC;IAFe,iCAAkB,qBAEjC,CAAA;IAED,SAAgB,aAAa,CAAC,qBAA6E;QACzG,IAAI,qBAAqB,YAAY,sBAAsB,EAAE;YAC3D,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC;YAClD,IAAI,CAAC,2BAA2B,CAAC,SAAS,CAAC,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,iEAAiE,SAAS,EAAE,CAAC,CAAC;aAC/F;YACD,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;SACjE;aAAM;YACL,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAAC;SAC7E;IACH,CAAC;IAVe,4BAAa,gBAU5B,CAAA;IAED,SAAgB,gBAAgB,CAAC,KAAoC,EAAE,UAA2B;QAChG,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAFe,+BAAgB,mBAE/B,CAAA;AASH,CAAC,EAjCgB,cAAc,KAAd,cAAc,QAiC9B","sourcesContent":["import { Directive } from '@angular/core';\nimport { ActivatedRouteSnapshot } from '@angular/router';\nimport {\n assert,\n Binding,\n Constructable,\n DebugContext,\n Dsl,\n Guard,\n IMutableHasValue,\n lang,\n MutableValueModel,\n ValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\n\nclass ParameterChangeInterceptor<T> {\n constructor(parameterDef: ParameterDefinition<T>, model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options: PlaceComponent.InterceptOptions) {\n }\n\n async canProceed(nextState: Visit, interactionContext: InteractionContext) {\n return true;\n }\n}\n\n@Directive()\nexport class PlaceComponent extends DisposableComponent {\n\n private readonly _placeReadyCallbacks: Function[] = [];\n private visitModel = new MutableValueModel<Visit>();\n private _inVisitUpdate = new Guard();\n private _active = new MutableValueModel<boolean>(false);\n\n interactionContext?: InteractionContext;\n readonly childPlaces: ReadonlyArray<Constructable<PlaceComponent>>;\n private readonly _parameterChangeInterceptors: ParameterChangeInterceptor<any>[] = [];\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n when(this._active).becomesTruthy(() => this._notifyPlaceReady());\n this.childPlaces = this.placeDefinition.children.map(d => d.component);\n }\n\n // @Trace()\n public initialiseVisit(visit: Visit, notifyVisitChanged: (current: Visit, previous: Visit) => void) {\n assert.isNil(this.visitModel.value);\n\n const { when } = Dsl.disposeWith(this);\n\n this.visitModel.value = visit;\n DebugContext.getOrCreate(this.visitModel).tag(`${this.placeDefinition.component.name}.visitModel`);\n this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => this.installBinding(parameterDef));\n when(this.visitModel).changes((current, previous) => {\n notifyVisitChanged(current, previous);\n }, { unless: this._inVisitUpdate });\n }\n\n public updateVisit(visit: Visit) {\n assert.isTruthy(this.isInitialised());\n assert.notNil(visit);\n this._inVisitUpdate.whileTrue(() => {\n this.visitModel.value = visit;\n });\n }\n\n isInitialised() {\n return !!this.visitModel.value;\n }\n\n // @Trace()\n private installBinding<T, S>(parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<T>;\n DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);\n const binding = this.registerDisposable(new Binding(this.visitModel, model, {\n toRight(visit: Visit): T {\n const value = visit.getParameterValue(parameterDef);\n // console.log('push to component', { name: parameterDef.name, value, visit });\n return value;\n },\n toLeft(value: T, currentVisit?: Visit): Visit {\n // console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n\n binding.writeRight();\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n const definition = PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n if (!definition) {\n lang.illegalState(`${this.constructor.name} extends PlaceComponent but doesn't have @Place({..}) decorator.`)\n }\n return definition;\n }\n\n get active() {\n return this._active.readonly;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n */\n async _canLeavePlace(interactionContext: InteractionContext): Promise<boolean> {\n return this.canDeactivate ? this.canDeactivate(interactionContext) : true;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n * @param nextState\n */\n async _canChangeRouteParameters(interactionContext: InteractionContext, nextState: UrlSnapshot): Promise<boolean> {\n if (this._parameterChangeInterceptors.length > 0) {\n const visit = nextState.createVisitFor(this.placeDefinition);\n for (let i = 0; i < this._parameterChangeInterceptors.length; i++) {\n const interceptor = this._parameterChangeInterceptors[i];\n const keepGoing = await interceptor.canProceed(visit, interactionContext);\n if (!keepGoing) {\n return false;\n }\n }\n }\n return true;\n }\n\n\n /**\n * Called by the router when the place is ready to interact after any animations have run.\n */\n _notifyActive(active: boolean) {\n this._active.value = active;\n }\n\n /**\n * Called by the router when the place is ready to interact after any animations have run.\n */\n _notifyPlaceReady() {\n if (this.onPlaceReady.length === 1) {\n this._placeReadyCallbacks.forEach(callback => callback());\n } else {\n console.warn('Overriding PlaceComponent.onPlaceReady has been deprecated. Use PlaceComponent.onPlaceReady(() => {... do stuff...}) instead.');\n this.onPlaceReady(undefined);\n }\n }\n\n onPlaceReady(callback: () => void) {\n this._placeReadyCallbacks.push(callback);\n }\n\n interceptVisitParameterChange<T>(model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options?: PlaceComponent.InterceptOptions) {\n const parameterDef = ParameterDefinition.get(model);\n this._parameterChangeInterceptors.push(new ParameterChangeInterceptor(parameterDef, model, callback, options));\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY) as ParameterDefinition<any>[];\n }\n\n export function getDefinition(snapshotOrConstructor: ActivatedRouteSnapshot | Constructable<PlaceComponent>): PlaceDefinition {\n if (snapshotOrConstructor instanceof ActivatedRouteSnapshot) {\n const component = snapshotOrConstructor.component;\n if (!isPlaceComponentConstructor(component)) {\n throw new Error(`ActivatedRouteSnapshot component is not a PlaceComponent, got ${component}`);\n }\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, component);\n } else {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, snapshotOrConstructor);\n }\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n export type InterceptCallback<T> = (is: T, was: T, interactionContext: InteractionContext) => boolean | Promise<boolean>;\n\n export interface InterceptOptions {\n initialValue: 'evaluationUnlessNil' | 'evaluate'\n }\n\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"place-component.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-component.ts"],"names":[],"mappings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AAC,eAAe,CAAC,wBAAwB,CAA+B,CAAC;IAClG,CAAC;IAFe,iCAAkB,qBAEjC,CAAA;IAED,SAAgB,aAAa,CAAC,qBAA6E;QACzG,IAAI,qBAAqB,YAAY,sBAAsB,EAAE;YAC3D,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC;YAClD,IAAI,CAAC,2BAA2B,CAAC,SAAS,CAAC,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,iEAAiE,SAAS,EAAE,CAAC,CAAC;aAC/F;YACD,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;SACjE;aAAM;YACL,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAAC;SAC7E;IACH,CAAC;IAVe,4BAAa,gBAU5B,CAAA;IAED,SAAgB,gBAAgB,CAAC,KAAoC,EAAE,UAA2B;QAChG,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAFe,+BAAgB,mBAE/B,CAAA;AASH,CAAC,EAjCgB,cAAc,KAAd,cAAc,QAiC9B","sourcesContent":["import { Directive } from '@angular/core';\nimport { ActivatedRouteSnapshot } from '@angular/router';\nimport {\n assert,\n Binding,\n Constructable,\n DebugContext,\n Dsl,\n Guard,\n IMutableHasValue,\n lang,\n MutableValueModel,\n ValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\nimport * as _ from 'lodash';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\n\nclass ParameterChangeInterceptor<T> {\n constructor(parameterDef: ParameterDefinition<T>, model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options: PlaceComponent.InterceptOptions) {\n }\n\n async canProceed(nextState: Visit, interactionContext: InteractionContext) {\n return true;\n }\n}\n\n@Directive()\nexport class PlaceComponent extends DisposableComponent {\n\n private readonly _placeReadyCallbacks: Function[] = [];\n private visitModel = new MutableValueModel<Visit>();\n private _inVisitUpdate = new Guard();\n private _active = new MutableValueModel<boolean>(false);\n\n interactionContext?: InteractionContext;\n readonly childPlaces: ReadonlyArray<Constructable<PlaceComponent>>;\n private readonly _parameterChangeInterceptors: ParameterChangeInterceptor<any>[] = [];\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n when(this._active).becomesTruthy(() => this._notifyPlaceReady());\n this.childPlaces = this.placeDefinition.children.map(d => d.component);\n }\n\n public initialiseVisit(visit: Visit, notifyVisitChanged: (current: Visit, previous: Visit) => void) {\n assert.isNil(this.visitModel.value);\n\n const { when } = Dsl.disposeWith(this);\n\n this.visitModel.value = visit;\n DebugContext.getOrCreate(this.visitModel).tag(`${this.placeDefinition.component.name}.visitModel`);\n\n // we track if the any of the bindings updated the route. If so we remember it and update the\n // route in one go at the end.\n this.placeDefinition\n .getVisitParameterDefs()\n .forEach(parameterDef => this.installAndInitialiseBinding(visit, parameterDef));\n\n when(this.visitModel).changes((current, previous) => {\n notifyVisitChanged(current, previous);\n }, { unless: this._inVisitUpdate });\n\n // TODO: this needs to do a replace url option so that the new url isn't put in the history.... for\n // now we're not doing it as it's a fair bit of effort and will only affect people if they're\n // cutting and pasting urls to each other.\n // // the binding process can update the visit (e.g. if a selection model has already selected during\n // // component construction) and there was no value specified in the route\n // if (visit.hasRoutingChangedFrom(this.visitModel.value)) {\n // notifyVisitChanged(this.visitModel.value, visit)\n // }\n }\n\n public updateVisit(visit: Visit) {\n assert.isTruthy(this.isInitialised());\n assert.notNil(visit);\n this._inVisitUpdate.whileTrue(() => {\n this.visitModel.value = visit;\n });\n }\n\n isInitialised() {\n return !!this.visitModel.value;\n }\n\n // @Trace()\n /**\n * Initialised the component bindings. If any binding has an initial model value (e.g. a selection model\n * initialised during the constructor) and the route has nothing, then the visit will be udpated and this\n * method will return ture to nofiy the the visit has changed.\n */\n private installAndInitialiseBinding<T, S>(initialVisit: Visit, parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<T>;\n DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);\n const binding = this.registerDisposable(new Binding(this.visitModel, model, {\n toRight(visit: Visit): T {\n const value = visit.getParameterValue(parameterDef);\n // console.log('push to component', { name: parameterDef.name, value, visit });\n return value;\n },\n toLeft(value: T, currentVisit?: Visit): Visit {\n // console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n\n // Now we need to initialise the binding direction. If we have a value in the Url then we should always push\n // that to the view. If we don't and the view already has a value (e.g. a selection model has already initialised in the\n // component constructor) then we should push that to the route.\n const isInVisit = !_.isNil(initialVisit.getParameterValue(parameterDef));\n const isInModel = !_.isNil(model.value);\n if (!isInVisit && isInModel) {\n binding.writeLeft(); // push it to the route\n } else {\n binding.writeRight(); // push it to the model\n }\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n const definition = PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n if (!definition) {\n lang.illegalState(`${this.constructor.name} extends PlaceComponent but doesn't have @Place({..}) decorator.`)\n }\n return definition;\n }\n\n get active() {\n return this._active.readonly;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n */\n async _canLeavePlace(interactionContext: InteractionContext): Promise<boolean> {\n return this.canDeactivate ? this.canDeactivate(interactionContext) : true;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n * @param nextState\n */\n async _canChangeRouteParameters(interactionContext: InteractionContext, nextState: UrlSnapshot): Promise<boolean> {\n if (this._parameterChangeInterceptors.length > 0) {\n const visit = nextState.createVisitFor(this.placeDefinition);\n for (let i = 0; i < this._parameterChangeInterceptors.length; i++) {\n const interceptor = this._parameterChangeInterceptors[i];\n const keepGoing = await interceptor.canProceed(visit, interactionContext);\n if (!keepGoing) {\n return false;\n }\n }\n }\n return true;\n }\n\n\n /**\n * Called by the router when the place is ready to interact after any animations have run.\n */\n _notifyActive(active: boolean) {\n this._active.value = active;\n }\n\n /**\n * Called by the router when the place is ready to interact after any animations have run.\n */\n _notifyPlaceReady() {\n if (this.onPlaceReady.length === 1) {\n this._placeReadyCallbacks.forEach(callback => callback());\n } else {\n console.warn('Overriding PlaceComponent.onPlaceReady has been deprecated. Use PlaceComponent.onPlaceReady(() => {... do stuff...}) instead.');\n this.onPlaceReady(undefined);\n }\n }\n\n onPlaceReady(callback: () => void) {\n this._placeReadyCallbacks.push(callback);\n }\n\n interceptVisitParameterChange<T>(model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options?: PlaceComponent.InterceptOptions) {\n const parameterDef = ParameterDefinition.get(model);\n this._parameterChangeInterceptors.push(new ParameterChangeInterceptor(parameterDef, model, callback, options));\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY) as ParameterDefinition<any>[];\n }\n\n export function getDefinition(snapshotOrConstructor: ActivatedRouteSnapshot | Constructable<PlaceComponent>): PlaceDefinition {\n if (snapshotOrConstructor instanceof ActivatedRouteSnapshot) {\n const component = snapshotOrConstructor.component;\n if (!isPlaceComponentConstructor(component)) {\n throw new Error(`ActivatedRouteSnapshot component is not a PlaceComponent, got ${component}`);\n }\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, component);\n } else {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, snapshotOrConstructor);\n }\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n export type InterceptCallback<T> = (is: T, was: T, interactionContext: InteractionContext) => boolean | Promise<boolean>;\n\n export interface InterceptOptions {\n initialValue: 'evaluationUnlessNil' | 'evaluate'\n }\n\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"DEFINITION_META_DATA_KEY":"PLACE_DEFINITION_OPTIONS","ROUTE_PARAMETER_LIST_KEY":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["place:route:parameters"]},"PlaceComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"DEFINITION_META_DATA_KEY":"PLACE_DEFINITION_OPTIONS","ROUTE_PARAMETER_LIST_KEY":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["place:route:parameters"]},"PlaceComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":41,"character":36},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":40,"character":1}}],"members":{"canDeactivate":[{"__symbolic":"method"}],"__ctor__":[{"__symbolic":"constructor"}],"initialiseVisit":[{"__symbolic":"method"}],"updateVisit":[{"__symbolic":"method"}],"isInitialised":[{"__symbolic":"method"}],"installAndInitialiseBinding":[{"__symbolic":"method"}],"placeDefinition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator","name":"Memoize","line":134,"character":3}}]}],"_canLeavePlace":[{"__symbolic":"method"}],"_canChangeRouteParameters":[{"__symbolic":"method"}],"_notifyActive":[{"__symbolic":"method"}],"_notifyPlaceReady":[{"__symbolic":"method"}],"onPlaceReady":[{"__symbolic":"method"}],"interceptVisitParameterChange":[{"__symbolic":"method"}]}}}}]
|
|
@@ -49,9 +49,13 @@ export class Visit {
|
|
|
49
49
|
});
|
|
50
50
|
return new Visit(this.placeDefinition, params);
|
|
51
51
|
}
|
|
52
|
+
// @Trace()
|
|
52
53
|
hasRoutingChangedFrom(other) {
|
|
53
54
|
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
54
|
-
const
|
|
55
|
+
const currentParams = this.placeDefinition.getFormattedRouteParameters(this, true);
|
|
56
|
+
const otherParams = this.placeDefinition.getFormattedRouteParameters(other, true);
|
|
57
|
+
// console.log({currentParams, otherParams});
|
|
58
|
+
const sameRouteParameters = _.isEqual(currentParams, otherParams);
|
|
55
59
|
return !samePlace || !sameRouteParameters;
|
|
56
60
|
}
|
|
57
61
|
hasChangedFrom(other) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visit.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/visit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"visit.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/visit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAS5B,MAAM,OAAO,KAAK;IAEhB,YAAqB,eAAgC,EAAmB,kBAA0B,EAAE;QAA/E,oBAAe,GAAf,eAAe,CAAiB;QAAmB,oBAAe,GAAf,eAAe,CAAa;IACpG,CAAC;IAED,WAAW;IACX,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CAAC,CAA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,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;iBAC1B;aACF;QACH,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAED,WAAW;IACX,qBAAqB,CAAC,KAAY;QAChC,MAAM,SAAS,GAAG,KAAK,CAAC,eAAe,KAAK,IAAI,CAAC,eAAe,CAAC;QACjE,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,2BAA2B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnF,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAClF,6CAA6C;QAC7C,MAAM,mBAAmB,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAClE,OAAO,CAAC,SAAS,IAAI,CAAC,mBAAmB,CAAC;IAC5C,CAAC;IAED,cAAc,CAAC,KAAY;QACzB,MAAM,sBAAsB,GAAG,CAAC,CAAC,OAAO,CACtC,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAChD,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAClD,CAAC;QACF,OAAO,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;IAED,aAAa;QACX,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjG,CAAC;CAEF","sourcesContent":["import { Trace } from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition';\n\ninterface Params {\n [p: string]: any;\n}\n\n\nexport class Visit {\n\n constructor(readonly placeDefinition: PlaceDefinition, private readonly visitParameters: Params = {}) {\n }\n\n // @Trace()\n getRouteId(): any {\n return this.placeDefinition.getRouteIdFrom(this);\n }\n\n // @Trace()\n hasRouteId(): boolean {\n return !_.isNil(this.getRouteId());\n }\n\n /**\n * Returns the value of the place parameter with the specified name. The parameter\n * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the\n * same as the the ValueModel property name.\n * @param parameterDef the visit parameter definition\n */\n getParameterValue<T, S>(parameterDef: ParameterDefinition<T, S>): T {\n return this.visitParameters[parameterDef.name];\n }\n\n // @Trace()\n hasParameter(parameterDef: ParameterDefinition<any>): boolean {\n return Object.keys(this.visitParameters).includes(parameterDef.name);\n }\n\n replace<T>(parameter: ParameterDefinition<T, any>, value: T): Visit {\n return new Visit(this.placeDefinition, { ...this.visitParameters, [parameter.name]: value });\n }\n\n mergeRouteParameters<S>(routeParams: { [p: string]: any }): Visit {\n // todo: whitelist parameters.\n const routeParameterKeys = Object.keys(routeParams);\n const params = {};\n this.placeDefinition.getVisitParameterDefs().forEach(def => {\n if (def.isRouteId || def.isRouteParameter) {\n if (routeParameterKeys.includes(def.name)) {\n params[def.name] = routeParams[def.name];\n }\n } else {\n // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the\n // defaults and remember sanitisation process.\n const value = this.getParameterValue(def);\n if (this.hasParameter(def)) {\n params[def.name] = value;\n }\n }\n });\n return new Visit(this.placeDefinition, params);\n }\n\n // @Trace()\n hasRoutingChangedFrom(other: Visit): boolean {\n const samePlace = other.placeDefinition === this.placeDefinition;\n const currentParams = this.placeDefinition.getFormattedRouteParameters(this, true);\n const otherParams = this.placeDefinition.getFormattedRouteParameters(other, true);\n // console.log({currentParams, otherParams});\n const sameRouteParameters = _.isEqual(currentParams, otherParams);\n return !samePlace || !sameRouteParameters;\n }\n\n hasChangedFrom(other: Visit) {\n const sameNonRouteParameters = _.isEqual(\n this.placeDefinition.getNonRouteParameters(this),\n this.placeDefinition.getNonRouteParameters(other)\n );\n return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);\n }\n\n toDebugString() {\n return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(',');\n }\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"Visit":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./place-definition","name":"PlaceDefinition","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"Visit":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./place-definition","name":"PlaceDefinition","line":12,"character":40},{"__symbolic":"reference","name":"any"}]}],"getRouteId":[{"__symbolic":"method"}],"hasRouteId":[{"__symbolic":"method"}],"getParameterValue":[{"__symbolic":"method"}],"hasParameter":[{"__symbolic":"method"}],"replace":[{"__symbolic":"method"}],"mergeRouteParameters":[{"__symbolic":"method"}],"hasRoutingChangedFrom":[{"__symbolic":"method"}],"hasChangedFrom":[{"__symbolic":"method"}],"toDebugString":[{"__symbolic":"method"}]}}}}]
|
|
@@ -690,7 +690,9 @@ class Page extends PageElement {
|
|
|
690
690
|
tryAndVisit(params, queryParams) {
|
|
691
691
|
const path = this.path.toUrl(params !== null && params !== void 0 ? params : {});
|
|
692
692
|
const queryString = queryParams ? `?${new URLSearchParams(queryParams).toString()}` : '';
|
|
693
|
-
|
|
693
|
+
const fullPath = `/${path}${queryString}`;
|
|
694
|
+
cy.log(`Visiting -> ${fullPath}`);
|
|
695
|
+
cy.visit(fullPath);
|
|
694
696
|
}
|
|
695
697
|
shouldHaveActivityIds(...ids) {
|
|
696
698
|
cy.location('search').should('contain', `?aup-interactions=${ids.join('--')}`);
|
|
@@ -709,16 +711,28 @@ class Page extends PageElement {
|
|
|
709
711
|
});
|
|
710
712
|
});
|
|
711
713
|
if (withParameters) {
|
|
712
|
-
|
|
713
|
-
const urlParams = Path.extractVisitParameters(path);
|
|
714
|
-
Object.keys(withParameters).forEach(param => {
|
|
715
|
-
const expected = withParameters[param];
|
|
716
|
-
// @ts-ignore
|
|
717
|
-
expect(urlParams[param]).to.equal(expected);
|
|
718
|
-
});
|
|
719
|
-
});
|
|
714
|
+
this.shouldIncludeParameters(withParameters);
|
|
720
715
|
}
|
|
721
716
|
}
|
|
717
|
+
shouldIncludeParameters(parameters) {
|
|
718
|
+
cy.location('pathname').then(path => {
|
|
719
|
+
const urlParams = Path.extractVisitParameters(path);
|
|
720
|
+
Object.keys(parameters).forEach(param => {
|
|
721
|
+
const expected = parameters[param];
|
|
722
|
+
const actual = urlParams[param];
|
|
723
|
+
// cy.log(`${actual} - ${expected}`);
|
|
724
|
+
expect(urlParams[param]).to.equal(expected);
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
shouldNotHaveParameter(name) {
|
|
729
|
+
this.getUrlParameters().then(params => {
|
|
730
|
+
expect(params[name]).to.be.undefined;
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
getUrlParameters() {
|
|
734
|
+
return cy.location('pathname').then(path => Path.extractVisitParameters(path));
|
|
735
|
+
}
|
|
722
736
|
}
|
|
723
737
|
(function (Page) {
|
|
724
738
|
function create(pathOrPathBuilder, builder) {
|