inventory-items-2 #44
@ -10,6 +10,8 @@ const CharacterLoader_1 = require("./CharacterLoader");
|
|||||||
const ItemLoader_1 = require("./ItemLoader");
|
const ItemLoader_1 = require("./ItemLoader");
|
||||||
class GameModelLoader {
|
class GameModelLoader {
|
||||||
constructor(gameModelDir) {
|
constructor(gameModelDir) {
|
||||||
|
this.loadedItemgroups = [];
|
||||||
|
this.loadedItems = [];
|
||||||
this.gameModelDir = gameModelDir;
|
this.gameModelDir = gameModelDir;
|
||||||
}
|
}
|
||||||
loadGameModel() {
|
loadGameModel() {
|
||||||
@ -17,8 +19,8 @@ class GameModelLoader {
|
|||||||
const storedScriptAccounts = this.loadScriptAccountComponents();
|
const storedScriptAccounts = this.loadScriptAccountComponents();
|
||||||
const storedGamesystems = this.loadGamesystems();
|
const storedGamesystems = this.loadGamesystems();
|
||||||
const storedCharacters = this.loadCharacters();
|
const storedCharacters = this.loadCharacters();
|
||||||
const storedItemgroups = this.loadItemgroups();
|
this.loadItemsAndItemgroups();
|
||||||
return new StoredGameModel_1.StoredGameModel(gameModelName, storedScriptAccounts, storedGamesystems, storedCharacters, storedItemgroups, []);
|
return new StoredGameModel_1.StoredGameModel(gameModelName, storedScriptAccounts, storedGamesystems, storedCharacters, this.loadedItemgroups, this.loadedItems);
|
||||||
}
|
}
|
||||||
loadScriptAccountComponents() {
|
loadScriptAccountComponents() {
|
||||||
const scriptAccountDir = path.join(this.gameModelDir, ModelComponentFileDirectory_1.ModelComponentFileDirectory.SCRIPTACCOUNT_DIR_NAME);
|
const scriptAccountDir = path.join(this.gameModelDir, ModelComponentFileDirectory_1.ModelComponentFileDirectory.SCRIPTACCOUNT_DIR_NAME);
|
||||||
@ -35,10 +37,12 @@ class GameModelLoader {
|
|||||||
const characterLoader = new CharacterLoader_1.CharacterLoader(characterDir);
|
const characterLoader = new CharacterLoader_1.CharacterLoader(characterDir);
|
||||||
return characterLoader.loadCharacters();
|
return characterLoader.loadCharacters();
|
||||||
}
|
}
|
||||||
loadItemgroups() {
|
loadItemsAndItemgroups() {
|
||||||
const itemgroupDir = path.join(this.gameModelDir, ModelComponentFileDirectory_1.ModelComponentFileDirectory.ITEMGROUP_DIR_NAME);
|
const itemgroupDir = path.join(this.gameModelDir, ModelComponentFileDirectory_1.ModelComponentFileDirectory.ITEMGROUP_DIR_NAME);
|
||||||
const itemgroupLoader = new ItemLoader_1.ItemLoader(itemgroupDir);
|
const itemgroupLoader = new ItemLoader_1.ItemLoader(itemgroupDir);
|
||||||
return itemgroupLoader.loadItemgroups();
|
itemgroupLoader.loadItemgroups();
|
||||||
|
this.loadedItems = itemgroupLoader.loadedItems;
|
||||||
|
this.loadedItemgroups = itemgroupLoader.loadedItemgroups;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.GameModelLoader = GameModelLoader;
|
exports.GameModelLoader = GameModelLoader;
|
||||||
|
@ -11,6 +11,9 @@ import {ItemLoader} from "./ItemLoader";
|
|||||||
export class GameModelLoader {
|
export class GameModelLoader {
|
||||||
gameModelDir: string
|
gameModelDir: string
|
||||||
|
|
||||||
|
loadedItemgroups: StoreComponent[] = []
|
||||||
|
loadedItems: StoreComponent[] = []
|
||||||
|
|
||||||
|
|
||||||
constructor(gameModelDir: string) {
|
constructor(gameModelDir: string) {
|
||||||
this.gameModelDir = gameModelDir;
|
this.gameModelDir = gameModelDir;
|
||||||
@ -22,9 +25,9 @@ export class GameModelLoader {
|
|||||||
const storedScriptAccounts = this.loadScriptAccountComponents();
|
const storedScriptAccounts = this.loadScriptAccountComponents();
|
||||||
const storedGamesystems = this.loadGamesystems();
|
const storedGamesystems = this.loadGamesystems();
|
||||||
const storedCharacters = this.loadCharacters()
|
const storedCharacters = this.loadCharacters()
|
||||||
const storedItemgroups = this.loadItemgroups()
|
this.loadItemsAndItemgroups();
|
||||||
|
|
||||||
return new StoredGameModel(gameModelName, storedScriptAccounts, storedGamesystems, storedCharacters, storedItemgroups, []);
|
return new StoredGameModel(gameModelName, storedScriptAccounts, storedGamesystems, storedCharacters, this.loadedItemgroups, this.loadedItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadScriptAccountComponents() {
|
private loadScriptAccountComponents() {
|
||||||
@ -46,9 +49,12 @@ export class GameModelLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private loadItemgroups() {
|
private loadItemsAndItemgroups() {
|
||||||
const itemgroupDir = path.join(this.gameModelDir, ModelComponentFileDirectory.ITEMGROUP_DIR_NAME);
|
const itemgroupDir = path.join(this.gameModelDir, ModelComponentFileDirectory.ITEMGROUP_DIR_NAME);
|
||||||
const itemgroupLoader = new ItemLoader(itemgroupDir);
|
const itemgroupLoader = new ItemLoader(itemgroupDir);
|
||||||
return itemgroupLoader.loadItemgroups();
|
itemgroupLoader.loadItemgroups();
|
||||||
|
|
||||||
|
this.loadedItems = itemgroupLoader.loadedItems;
|
||||||
|
this.loadedItemgroups = itemgroupLoader.loadedItemgroups;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,30 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.ItemLoader = void 0;
|
exports.ItemLoader = void 0;
|
||||||
const StoreComponent_1 = require("../StoreComponent");
|
const StoreComponent_1 = require("../StoreComponent");
|
||||||
const FileUtils_1 = require("../FileUtils");
|
const FileUtils_1 = require("../FileUtils");
|
||||||
const fs = require("node:fs");
|
|
||||||
const path = require("node:path");
|
const path = require("node:path");
|
||||||
const ModelComponentType_1 = require("../../../src/app/project/game-model/ModelComponentType");
|
const ModelComponentType_1 = require("../../../src/app/project/game-model/ModelComponentType");
|
||||||
|
const fs = require("node:fs");
|
||||||
class ItemLoader {
|
class ItemLoader {
|
||||||
constructor(itemDir) {
|
constructor(itemDir) {
|
||||||
|
this._loadedItemgroups = [];
|
||||||
|
this._loadedItems = [];
|
||||||
this.itemDir = itemDir;
|
this.itemDir = itemDir;
|
||||||
}
|
}
|
||||||
loadItemgroups() {
|
loadItemgroups() {
|
||||||
return this.loadItemgroupsRecursively(this.itemDir);
|
this.loadItemgroupsRecursively(this.itemDir);
|
||||||
|
}
|
||||||
|
get loadedItemgroups() {
|
||||||
|
return this._loadedItemgroups;
|
||||||
|
}
|
||||||
|
get loadedItems() {
|
||||||
|
return this._loadedItems;
|
||||||
}
|
}
|
||||||
loadItemgroupsRecursively(currentDir) {
|
loadItemgroupsRecursively(currentDir) {
|
||||||
let loadedItemgroups = [];
|
|
||||||
const itemgroupFiles = FileUtils_1.FileUtils.listFilesInDirectory(currentDir);
|
const itemgroupFiles = FileUtils_1.FileUtils.listFilesInDirectory(currentDir);
|
||||||
itemgroupFiles.forEach(itemgroupFile => {
|
itemgroupFiles.forEach(itemgroupFile => {
|
||||||
if (fs.lstatSync(itemgroupFile).isDirectory()) {
|
if (fs.lstatSync(itemgroupFile).isDirectory()) {
|
||||||
const childgroup = this.loadItemgroupsRecursively(itemgroupFile);
|
this.loadItemgroupsRecursively(itemgroupFile);
|
||||||
loadedItemgroups = loadedItemgroups.concat(childgroup);
|
|
||||||
}
|
}
|
||||||
else if (path.basename(itemgroupFile).endsWith(".json") && this.fileRepresentsItemgroup(itemgroupFile)) {
|
else if (path.basename(itemgroupFile).endsWith(".json") && this.fileRepresentsItemgroup(itemgroupFile)) {
|
||||||
const loadedItemgroup = this.loadSingleItemgroup(itemgroupFile);
|
const loadedItemgroup = this.loadSingleItemgroup(itemgroupFile);
|
||||||
loadedItemgroups.push(loadedItemgroup);
|
this._loadedItemgroups.push(loadedItemgroup);
|
||||||
|
}
|
||||||
|
else if (path.basename(itemgroupFile).endsWith(".json")) {
|
||||||
|
const loadedItem = this.loadSingleItem(itemgroupFile);
|
||||||
|
this._loadedItems.push(loadedItem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return loadedItemgroups;
|
|
||||||
}
|
}
|
||||||
loadSingleItemgroup(itemgroupFile) {
|
loadSingleItemgroup(itemgroupFile) {
|
||||||
if (itemgroupFile.endsWith(".json")) {
|
if (itemgroupFile.endsWith(".json")) {
|
||||||
@ -35,6 +44,13 @@ class ItemLoader {
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
loadSingleItem(itemFile) {
|
||||||
|
if (itemFile.endsWith(".json")) {
|
||||||
|
const data = fs.readFileSync(itemFile, "utf-8");
|
||||||
|
return new StoreComponent_1.StoreComponent(data, itemFile, ModelComponentType_1.ModelComponentType.ITEM);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
fileRepresentsItemgroup(file) {
|
fileRepresentsItemgroup(file) {
|
||||||
return path.basename(path.dirname(file)) === path.parse(path.basename(file)).name;
|
return path.basename(path.dirname(file)) === path.parse(path.basename(file)).name;
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,46 @@
|
|||||||
import {StoreComponent} from "../StoreComponent";
|
import {StoreComponent} from "../StoreComponent";
|
||||||
import {FileUtils} from "../FileUtils";
|
import {FileUtils} from "../FileUtils";
|
||||||
import * as fs from "node:fs";
|
|
||||||
import * as path from "node:path";
|
import * as path from "node:path";
|
||||||
import {ModelComponentType} from "../../../src/app/project/game-model/ModelComponentType";
|
import {ModelComponentType} from "../../../src/app/project/game-model/ModelComponentType";
|
||||||
|
import * as fs from "node:fs";
|
||||||
|
|
||||||
export class ItemLoader {
|
export class ItemLoader {
|
||||||
|
|
||||||
itemDir: string
|
itemDir: string
|
||||||
|
private _loadedItemgroups: StoreComponent[] = []
|
||||||
|
private _loadedItems: StoreComponent[] = []
|
||||||
|
|
||||||
constructor(itemDir: string) {
|
constructor(itemDir: string) {
|
||||||
this.itemDir = itemDir;
|
this.itemDir = itemDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadItemgroups(): StoreComponent[] {
|
loadItemgroups(){
|
||||||
return this.loadItemgroupsRecursively(this.itemDir);
|
this.loadItemgroupsRecursively(this.itemDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadItemgroupsRecursively(currentDir: string): StoreComponent[] {
|
|
||||||
let loadedItemgroups : StoreComponent[] = []
|
get loadedItemgroups(): StoreComponent[] {
|
||||||
|
return this._loadedItemgroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
get loadedItems(): StoreComponent[] {
|
||||||
|
return this._loadedItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadItemgroupsRecursively(currentDir: string) {
|
||||||
const itemgroupFiles = FileUtils.listFilesInDirectory(currentDir);
|
const itemgroupFiles = FileUtils.listFilesInDirectory(currentDir);
|
||||||
|
|
||||||
itemgroupFiles.forEach(itemgroupFile => {
|
itemgroupFiles.forEach(itemgroupFile => {
|
||||||
if(fs.lstatSync(itemgroupFile).isDirectory()) {
|
if(fs.lstatSync(itemgroupFile).isDirectory()) {
|
||||||
const childgroup = this.loadItemgroupsRecursively(itemgroupFile);
|
this.loadItemgroupsRecursively(itemgroupFile);
|
||||||
loadedItemgroups = loadedItemgroups.concat(childgroup);
|
|
||||||
} else if(path.basename(itemgroupFile).endsWith(".json") && this.fileRepresentsItemgroup(itemgroupFile)){
|
} else if(path.basename(itemgroupFile).endsWith(".json") && this.fileRepresentsItemgroup(itemgroupFile)){
|
||||||
const loadedItemgroup = this.loadSingleItemgroup(itemgroupFile)!;
|
const loadedItemgroup = this.loadSingleItemgroup(itemgroupFile)!;
|
||||||
loadedItemgroups.push(loadedItemgroup)
|
this._loadedItemgroups.push(loadedItemgroup)
|
||||||
|
} else if(path.basename(itemgroupFile).endsWith(".json")) {
|
||||||
|
const loadedItem = this.loadSingleItem(itemgroupFile)!;
|
||||||
|
this._loadedItems.push(loadedItem);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return loadedItemgroups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadSingleItemgroup(itemgroupFile: string): StoreComponent | undefined {
|
private loadSingleItemgroup(itemgroupFile: string): StoreComponent | undefined {
|
||||||
@ -40,6 +51,14 @@ export class ItemLoader {
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private loadSingleItem(itemFile: string) {
|
||||||
|
if(itemFile.endsWith(".json")) {
|
||||||
|
const data = fs.readFileSync(itemFile, "utf-8");
|
||||||
|
return new StoreComponent(data, itemFile, ModelComponentType.ITEM);
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
private fileRepresentsItemgroup(file: string): boolean {
|
private fileRepresentsItemgroup(file: string): boolean {
|
||||||
return path.basename(path.dirname(file)) === path.parse(path.basename(file)).name;
|
return path.basename(path.dirname(file)) === path.parse(path.basename(file)).name;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import {TemplateTypeUtilities} from "./project/game-model/templates/TemplateType
|
|||||||
import {SimpleTemplateGamesystem} from "./project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem";
|
import {SimpleTemplateGamesystem} from "./project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem";
|
||||||
import {ItemSerializer} from "./project/serializer/ItemSerializer";
|
import {ItemSerializer} from "./project/serializer/ItemSerializer";
|
||||||
import {ItemgroupParser} from "./project/parser/itemParser/ItemgroupParser";
|
import {ItemgroupParser} from "./project/parser/itemParser/ItemgroupParser";
|
||||||
|
import {ItemParser} from "./project/parser/itemParser/ItemParser";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -227,9 +228,11 @@ export class AppComponent implements OnInit{
|
|||||||
|
|
||||||
const itemgroupParser = new ItemgroupParser();
|
const itemgroupParser = new ItemgroupParser();
|
||||||
itemgroupParser.parseItemgroups(storedGameModel.storedItemgroups);
|
itemgroupParser.parseItemgroups(storedGameModel.storedItemgroups);
|
||||||
|
|
||||||
gameModel.itemgroups = itemgroupParser.getParsedTopItemgroups();
|
gameModel.itemgroups = itemgroupParser.getParsedTopItemgroups();
|
||||||
|
|
||||||
|
const itemParser = new ItemParser(itemgroupParser.getParsedItemgroups())
|
||||||
|
itemParser.parseItems(storedGameModel.storedItems);
|
||||||
|
|
||||||
this.gameModel = gameModel;
|
this.gameModel = gameModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
87
src/app/project/parser/itemParser/ItemParser.ts
Normal file
87
src/app/project/parser/itemParser/ItemParser.ts
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import {ItemGroup} from "../../game-model/inventory/ItemGroup";
|
||||||
|
import {StoreComponent} from "../../../../../app/storage/StoreComponent";
|
||||||
|
import {Item} from "../../game-model/inventory/Item";
|
||||||
|
import {ModelComponentType} from "../../game-model/ModelComponentType";
|
||||||
|
import {ConcreteItemGroup} from "../../game-model/inventory/ConcreteItemGroup";
|
||||||
|
import {ItemgroupCharacteristicValue} from "../../game-model/inventory/ItemgroupCharacteristicValue";
|
||||||
|
|
||||||
|
export class ItemParser {
|
||||||
|
parsedItemgroups: ItemGroup[] = []
|
||||||
|
|
||||||
|
constructor(itemgroups: ItemGroup[] = []) {
|
||||||
|
this.parsedItemgroups = itemgroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
parseItems(storeComponents: StoreComponent[]): Item[] {
|
||||||
|
const parsedItems: Item[] = []
|
||||||
|
storeComponents.forEach(storeComponent => parsedItems.push(this.parseSingleItem(storeComponent)));
|
||||||
|
return parsedItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseSingleItem(storeComponent: StoreComponent) {
|
||||||
|
const parsedData = JSON.parse(storeComponent.jsonString);
|
||||||
|
|
||||||
|
const componentName = parsedData.componentName;
|
||||||
|
const componentDescription = parsedData.componentDescription;
|
||||||
|
|
||||||
|
const manuallyInheritedGroups = this.parseInheritedGroups(parsedData.manuallyInheritedGroups);
|
||||||
|
const hierarchyInheritedGroups = this.parseInheritedGroups(parsedData.hierarchyInheritedGroups);
|
||||||
|
|
||||||
|
const item = new Item(componentName, componentDescription, ModelComponentType.ITEM);
|
||||||
|
item.manuallyInheritedGroups = manuallyInheritedGroups;
|
||||||
|
item.hierarchyInheritedGroups = hierarchyInheritedGroups;
|
||||||
|
|
||||||
|
const owningGroup = hierarchyInheritedGroups.find(itemgroup => itemgroup instanceof ConcreteItemGroup);
|
||||||
|
if (owningGroup) {
|
||||||
|
(owningGroup as ConcreteItemGroup).items.push(item);
|
||||||
|
} else {
|
||||||
|
console.log("[ERROR] No group found for item: ", item.componentName)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
item.itemCharacteristicValues = this.parseItemCharacteristicValues(parsedData.itemCharacteristicValues);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseInheritedGroups(inheritedGroupsData: any) {
|
||||||
|
const inheritedGroups: ItemGroup[] = []
|
||||||
|
for(let i=0; i<inheritedGroupsData.length; i++) {
|
||||||
|
const inheritedGroupName = inheritedGroupsData[i];
|
||||||
|
|
||||||
|
const matchedGroup = this.parsedItemgroups.find(group => group.componentName === inheritedGroupName);
|
||||||
|
if (matchedGroup) {
|
||||||
|
inheritedGroups.push(matchedGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return inheritedGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseItemCharacteristicValues(data: any): ItemgroupCharacteristicValue[] {
|
||||||
|
const values: ItemgroupCharacteristicValue[] = []
|
||||||
|
for(let i=0; i<data.length; i++) {
|
||||||
|
const key = this.findItemCharacteristic(data[i].key);
|
||||||
|
if (key) {
|
||||||
|
const characteristicValue = new ItemgroupCharacteristicValue(key!, data[i].value)
|
||||||
|
values.push(characteristicValue)
|
||||||
|
} else {
|
||||||
|
console.log("[ERROR] Characteristic not found: ", data[i].key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private findItemCharacteristic(itemCharacteristicName: string) {
|
||||||
|
for(let i=0; i<this.parsedItemgroups.length; i++) {
|
||||||
|
const characteristic = this.parsedItemgroups[i].itemGroupCharacteristics
|
||||||
|
.find(characteristic=> characteristic.characteristicName === itemCharacteristicName);
|
||||||
|
|
||||||
|
if(characteristic != undefined) {
|
||||||
|
return characteristic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -58,6 +58,7 @@ export class ItemgroupParser {
|
|||||||
if(parentgroup != undefined) {
|
if(parentgroup != undefined) {
|
||||||
const abstractParentgroup = parentgroup as AbstractItemGroup;
|
const abstractParentgroup = parentgroup as AbstractItemGroup;
|
||||||
abstractParentgroup.addChildItemgroup(itemgroup)
|
abstractParentgroup.addChildItemgroup(itemgroup)
|
||||||
|
this.parsedItemgroups.push(itemgroup)
|
||||||
} else {
|
} else {
|
||||||
this.parsedItemgroups.push(itemgroup);
|
this.parsedItemgroups.push(itemgroup);
|
||||||
this.topParsedItemgroups.push(itemgroup);
|
this.topParsedItemgroups.push(itemgroup);
|
||||||
@ -78,11 +79,16 @@ export class ItemgroupParser {
|
|||||||
const name = itemgroupCharacteristicData.characteristicName;
|
const name = itemgroupCharacteristicData.characteristicName;
|
||||||
const description = itemgroupCharacteristicData.characteristicDescription;
|
const description = itemgroupCharacteristicData.characteristicDescription;
|
||||||
|
|
||||||
return new ItemGroupCharacteristic(name, description, itemgroup);
|
const characteristic = new ItemGroupCharacteristic(name, description, itemgroup);
|
||||||
|
characteristic.itemgroup.addItemgroupCharacteristic(characteristic);
|
||||||
|
return characteristic;
|
||||||
}
|
}
|
||||||
|
|
||||||
getParsedTopItemgroups() {
|
getParsedTopItemgroups() {
|
||||||
return this.topParsedItemgroups;
|
return this.topParsedItemgroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getParsedItemgroups() {
|
||||||
|
return this.parsedItemgroups;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ export class ItemSerializer {
|
|||||||
private serializedItemgroups: StoreComponent[] = []
|
private serializedItemgroups: StoreComponent[] = []
|
||||||
private serializedItems: StoreComponent[] = []
|
private serializedItems: StoreComponent[] = []
|
||||||
private static ignoredGroupKeys: string[] = ['type', 'unsaved', "itemgroup", "manuallyInheritedGroups", "hierarchyInheritedGroups", "items"]
|
private static ignoredGroupKeys: string[] = ['type', 'unsaved', "itemgroup", "manuallyInheritedGroups", "hierarchyInheritedGroups", "items"]
|
||||||
private static ignoredItemKeys: string[] = ['type', 'unsaved', 'hierarchyInheritedGroups']
|
private static ignoredItemKeys: string[] = ['type', 'unsaved']
|
||||||
|
|
||||||
public serializeItemgroups(itemgroups: ItemGroup[]): StoreComponent[] {
|
public serializeItemgroups(itemgroups: ItemGroup[]): StoreComponent[] {
|
||||||
itemgroups.forEach(itemgroup => {
|
itemgroups.forEach(itemgroup => {
|
||||||
|
10
src/app/shared/Tupel.ts
Normal file
10
src/app/shared/Tupel.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export class Tupel<A, B> {
|
||||||
|
value00: A
|
||||||
|
value01: B
|
||||||
|
|
||||||
|
|
||||||
|
constructor(value00: A, value01: B) {
|
||||||
|
this.value00 = value00;
|
||||||
|
this.value01 = value01;
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,10 @@
|
|||||||
"manuallyInheritedGroups": [
|
"manuallyInheritedGroups": [
|
||||||
"Inventory"
|
"Inventory"
|
||||||
],
|
],
|
||||||
|
"hierarchyInheritedGroups": [
|
||||||
|
"Clothing",
|
||||||
|
"Hose"
|
||||||
|
],
|
||||||
"itemCharacteristicValues": [
|
"itemCharacteristicValues": [
|
||||||
{
|
{
|
||||||
"key": "Test0",
|
"key": "Test0",
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
"componentName": "Hose 2",
|
"componentName": "Hose 2",
|
||||||
"componentDescription": "",
|
"componentDescription": "",
|
||||||
"manuallyInheritedGroups": [],
|
"manuallyInheritedGroups": [],
|
||||||
|
"hierarchyInheritedGroups": [
|
||||||
|
"Clothing",
|
||||||
|
"Hose"
|
||||||
|
],
|
||||||
"itemCharacteristicValues": [
|
"itemCharacteristicValues": [
|
||||||
{
|
{
|
||||||
"key": "Test0",
|
"key": "Test0",
|
||||||
|
Loading…
Reference in New Issue
Block a user