How to use tangy-form - 6 common examples

To help you get started, we’ve selected a few tangy-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tangerine-Community / Tangerine / editor / src / app / groups / location-list-editor / location-list-editor.component.ts View on Github external
async ngOnInit() {
    this.route.params.subscribe(params => {
      this.groupName = params.groupName;
    });
    try {
      const data: any = await this.http.get(`/editor/${this.groupName}/content/${this.locationListFileName}`).toPromise();
      const flatLocationList = Loc.flatten(data);
      // TODO Why do we need zoneLevelLocations???
      const zoneLevelLocations = flatLocationList.locations.filter(location => location.level === 'zone');
      this.locationsLevels = data.locationsLevels;
      this.locationsLevelsLength = data.locationsLevels.length;
      await this.setLocationList(data);
    } catch (error) {
      this.errorHandler.handleError('Could Not Load Location List Data');
    }
  }
github Tangerine-Community / Tangerine / editor / src / app / groups / location-list-editor / location-list-editor.component.ts View on Github external
async calculateDescendants() {
    // Check if the item being added or moved is at the last level of the hierarchy. 
    // The descendentsCount needs update ony when the last level has a new item or an item is moved
    if (this.locationsLevelsLength === this.breadcrumbs.length) {
      this.locationList = Loc.calculateDescendantCounts(this.locationList);
    }
  }
  async saveLocationListToDisk() {
github Tangerine-Community / Tangerine / editor / src / app / groups / location-list-editor / location-list-editor.component.ts View on Github external
async editItem() {
    const flatLocationList = Loc.flatten(this.locationList);
    const index = flatLocationList.locations.findIndex(location => location.id === this.form.id);
    flatLocationList.locations[index] = { ...flatLocationList.locations[index], ...this.form };
    this.locationList = Loc.unflatten(flatLocationList);
    await this.setLocationList(this.locationList);
    await this.saveLocationListToDisk();
    this.isItemMarkedForUpdate = false;
    this.hideLocationForm();
  }
  hideLocationForm() {
github Tangerine-Community / Tangerine / editor / src / app / groups / services / groups.service.ts View on Github external
generateLocationIDs(locations) {
    const flatLocationList = Loc.flatten(locations);
    const ID = this.generateID();
    const index = flatLocationList.locations.findIndex(location => location.id === ID);
    if (index < 0) {
      return ID;
    } else {
      return this.generateLocationIDs(locations);
    }
  }
github Tangerine-Community / Tangerine / editor / src / app / groups / location-list-editor / location-list-editor.component.ts View on Github external
async editItem() {
    const flatLocationList = Loc.flatten(this.locationList);
    const index = flatLocationList.locations.findIndex(location => location.id === this.form.id);
    flatLocationList.locations[index] = { ...flatLocationList.locations[index], ...this.form };
    this.locationList = Loc.unflatten(flatLocationList);
    await this.setLocationList(this.locationList);
    await this.saveLocationListToDisk();
    this.isItemMarkedForUpdate = false;
    this.hideLocationForm();
  }
  hideLocationForm() {