@coolon/angular-ui-powerups 12.4.0-alpha.31 → 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.
Files changed (28) hide show
  1. package/assets/forms/mixins.scss +6 -0
  2. package/assets/interaction/editor/inline-string-editor.scss +47 -0
  3. package/assets/interaction/input-activity.scss +12 -0
  4. package/bundles/coolon-angular-ui-powerups-cypress.umd.js +23 -9
  5. package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
  6. package/bundles/coolon-angular-ui-powerups.umd.js +35 -5
  7. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  8. package/coolon-angular-ui-powerups.metadata.json +1 -1
  9. package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
  10. package/cypress/package.json +1 -1
  11. package/cypress/page.d.ts +3 -0
  12. package/esm2015/cypress/page.js +23 -9
  13. package/esm2015/cypress/page.js.map +1 -1
  14. package/esm2015/cypress/page.metadata.json +1 -1
  15. package/esm2015/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.js +1 -1
  16. package/esm2015/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.js.map +1 -1
  17. package/esm2015/lib/place/place-component.js +31 -4
  18. package/esm2015/lib/place/place-component.js.map +1 -1
  19. package/esm2015/lib/place/place-component.metadata.json +1 -1
  20. package/esm2015/lib/place/visit.js +5 -1
  21. package/esm2015/lib/place/visit.js.map +1 -1
  22. package/esm2015/lib/place/visit.metadata.json +1 -1
  23. package/fesm2015/coolon-angular-ui-powerups-cypress.js +23 -9
  24. package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
  25. package/fesm2015/coolon-angular-ui-powerups.js +36 -6
  26. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  27. package/lib/place/place-component.d.ts +6 -1
  28. package/package.json +1 -1
@@ -7321,17 +7321,28 @@
7321
7321
  _this.childPlaces = _this.placeDefinition.children.map(function (d) { return d.component; });
7322
7322
  return _this;
7323
7323
  }
7324
- // @Trace()
7325
7324
  PlaceComponent.prototype.initialiseVisit = function (visit, notifyVisitChanged) {
7326
7325
  var _this = this;
7327
7326
  pectin.assert.isNil(this.visitModel.value);
7328
7327
  var when = pectin.Dsl.disposeWith(this).when;
7329
7328
  this.visitModel.value = visit;
7330
7329
  pectin.DebugContext.getOrCreate(this.visitModel).tag(this.placeDefinition.component.name + ".visitModel");
7331
- this.placeDefinition.getVisitParameterDefs().forEach(function (parameterDef) { return _this.installBinding(parameterDef); });
7330
+ // we track if the any of the bindings updated the route. If so we remember it and update the
7331
+ // route in one go at the end.
7332
+ this.placeDefinition
7333
+ .getVisitParameterDefs()
7334
+ .forEach(function (parameterDef) { return _this.installAndInitialiseBinding(visit, parameterDef); });
7332
7335
  when(this.visitModel).changes(function (current, previous) {
7333
7336
  notifyVisitChanged(current, previous);
7334
7337
  }, { unless: this._inVisitUpdate });
7338
+ // TODO: this needs to do a replace url option so that the new url isn't put in the history.... for
7339
+ // now we're not doing it as it's a fair bit of effort and will only affect people if they're
7340
+ // cutting and pasting urls to each other.
7341
+ // // the binding process can update the visit (e.g. if a selection model has already selected during
7342
+ // // component construction) and there was no value specified in the route
7343
+ // if (visit.hasRoutingChangedFrom(this.visitModel.value)) {
7344
+ // notifyVisitChanged(this.visitModel.value, visit)
7345
+ // }
7335
7346
  };
7336
7347
  PlaceComponent.prototype.updateVisit = function (visit) {
7337
7348
  var _this = this;
@@ -7345,7 +7356,12 @@
7345
7356
  return !!this.visitModel.value;
7346
7357
  };
7347
7358
  // @Trace()
7348
- PlaceComponent.prototype.installBinding = function (parameterDef) {
7359
+ /**
7360
+ * Initialised the component bindings. If any binding has an initial model value (e.g. a selection model
7361
+ * initialised during the constructor) and the route has nothing, then the visit will be udpated and this
7362
+ * method will return ture to nofiy the the visit has changed.
7363
+ */
7364
+ PlaceComponent.prototype.installAndInitialiseBinding = function (initialVisit, parameterDef) {
7349
7365
  var model = this[parameterDef.propertyName];
7350
7366
  pectin.DebugContext.tag(model, this.placeDefinition.component.name + "." + parameterDef.propertyName);
7351
7367
  var binding = this.registerDisposable(new pectin.Binding(this.visitModel, model, {
@@ -7359,7 +7375,17 @@
7359
7375
  return currentVisit.replace(parameterDef, value);
7360
7376
  }
7361
7377
  }));
7362
- binding.writeRight();
7378
+ // Now we need to initialise the binding direction. If we have a value in the Url then we should always push
7379
+ // 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
7380
+ // component constructor) then we should push that to the route.
7381
+ var isInVisit = !___namespace.isNil(initialVisit.getParameterValue(parameterDef));
7382
+ var isInModel = !___namespace.isNil(model.value);
7383
+ if (!isInVisit && isInModel) {
7384
+ binding.writeLeft(); // push it to the route
7385
+ }
7386
+ else {
7387
+ binding.writeRight(); // push it to the model
7388
+ }
7363
7389
  };
7364
7390
  Object.defineProperty(PlaceComponent.prototype, "placeDefinition", {
7365
7391
  get: function () {
@@ -8620,9 +8646,13 @@
8620
8646
  });
8621
8647
  return new Visit(this.placeDefinition, params);
8622
8648
  };
8649
+ // @Trace()
8623
8650
  Visit.prototype.hasRoutingChangedFrom = function (other) {
8624
8651
  var samePlace = other.placeDefinition === this.placeDefinition;
8625
- var sameRouteParameters = ___namespace.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
8652
+ var currentParams = this.placeDefinition.getFormattedRouteParameters(this, true);
8653
+ var otherParams = this.placeDefinition.getFormattedRouteParameters(other, true);
8654
+ // console.log({currentParams, otherParams});
8655
+ var sameRouteParameters = ___namespace.isEqual(currentParams, otherParams);
8626
8656
  return !samePlace || !sameRouteParameters;
8627
8657
  };
8628
8658
  Visit.prototype.hasChangedFrom = function (other) {