UNPKG

@bitbybit-dev/base

Version:

Bit By Bit Developers Base CAD Library to Program Geometry

620 lines (619 loc) 20.4 kB
/* eslint-disable @typescript-eslint/no-namespace */ // tslint:disable-next-line: no-namespace export var Lists; (function (Lists) { let firstLastEnum; (function (firstLastEnum) { firstLastEnum["first"] = "first"; firstLastEnum["last"] = "last"; })(firstLastEnum = Lists.firstLastEnum || (Lists.firstLastEnum = {})); class ListItemDto { constructor(list, index, clone) { /** * Index of the item in the list - 0 means first. * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.index = 0; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (index !== undefined) { this.index = index; } if (clone !== undefined) { this.clone = clone; } } } Lists.ListItemDto = ListItemDto; class SubListDto { constructor(list, indexStart, indexEnd, clone) { /** * Index from which to start the sublist - 0 means first. * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.indexStart = 0; /** * Index to which to end the sublist - 0 means first. * @default 1 * @minimum 0 * @maximum Infinity * @step 1 */ this.indexEnd = 1; /** * Tries to clone the data in the component, sometimes it may not be possible if structure is circular * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (indexStart !== undefined) { this.indexStart = indexStart; } if (indexEnd !== undefined) { this.indexEnd = indexEnd; } if (clone !== undefined) { this.clone = clone; } } } Lists.SubListDto = SubListDto; class ListCloneDto { constructor(list, clone) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (clone !== undefined) { this.clone = clone; } } } Lists.ListCloneDto = ListCloneDto; class RepeatInPatternDto { constructor(list) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; /** * The limit of the length of the list * @default 100 * @minimum 1 * @maximum Infinity * @step 1 */ this.lengthLimit = 100; if (list !== undefined) { this.list = list; } } } Lists.RepeatInPatternDto = RepeatInPatternDto; class SortDto { constructor(list, clone, orderAsc) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; /** * If true, the list will be sorted in ascending order, otherwise in descending order * @default true */ this.orderAsc = true; if (list !== undefined) { this.list = list; } if (clone !== undefined) { this.clone = clone; } if (orderAsc !== undefined) { this.orderAsc = orderAsc; } } } Lists.SortDto = SortDto; class SortJsonDto { constructor(list, clone, orderAsc) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; /** * If true, the list will be sorted in ascending order, otherwise in descending order * @default true */ this.orderAsc = true; /** * The property to sort by * @default propName */ this.property = "propName"; if (list !== undefined) { this.list = list; } if (clone !== undefined) { this.clone = clone; } if (orderAsc !== undefined) { this.orderAsc = orderAsc; } } } Lists.SortJsonDto = SortJsonDto; class ListDto { constructor(list) { if (list !== undefined) { this.list = list; } } } Lists.ListDto = ListDto; class GroupListDto { constructor(list, nrElements, keepRemainder) { /** * The number of elements in each group * @default 2 * @minimum 1 * @maximum Infinity * @step 1 */ this.nrElements = 2; /** * If true, the remainder of the list will be added as a separate group * @default false */ this.keepRemainder = false; if (list !== undefined) { this.list = list; } if (nrElements !== undefined) { this.nrElements = nrElements; } if (keepRemainder !== undefined) { this.keepRemainder = keepRemainder; } } } Lists.GroupListDto = GroupListDto; class MultiplyItemDto { constructor(item, times) { if (item !== undefined) { this.item = item; } if (times !== undefined) { this.times = times; } } } Lists.MultiplyItemDto = MultiplyItemDto; class AddItemAtIndexDto { constructor(list, item, index, clone) { /** * The index to add the item at * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.index = 0; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (item !== undefined) { this.item = item; } if (index !== undefined) { this.index = index; } if (clone !== undefined) { this.clone = clone; } } } Lists.AddItemAtIndexDto = AddItemAtIndexDto; class AddItemAtIndexesDto { constructor(list, item, indexes, clone) { /** * The index to add the item at * @default [0] */ this.indexes = [0]; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (item !== undefined) { this.item = item; } if (indexes !== undefined) { this.indexes = indexes; } if (clone !== undefined) { this.clone = clone; } } } Lists.AddItemAtIndexesDto = AddItemAtIndexesDto; class AddItemsAtIndexesDto { constructor(list, items, indexes, clone) { /** * The index to add the item at * @default [0] */ this.indexes = [0]; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (items !== undefined) { this.items = items; } if (indexes !== undefined) { this.indexes = indexes; } if (clone !== undefined) { this.clone = clone; } } } Lists.AddItemsAtIndexesDto = AddItemsAtIndexesDto; class RemoveItemAtIndexDto { constructor(list, index, clone) { /** * The index to on which remove item * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.index = 0; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (index !== undefined) { this.index = index; } if (clone !== undefined) { this.clone = clone; } } } Lists.RemoveItemAtIndexDto = RemoveItemAtIndexDto; class RemoveItemsAtIndexesDto { constructor(list, indexes, clone) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (indexes !== undefined) { this.indexes = indexes; } if (clone !== undefined) { this.clone = clone; } } } Lists.RemoveItemsAtIndexesDto = RemoveItemsAtIndexesDto; class RemoveNthItemDto { constructor(list, nth, offset, clone) { /** * The nth item to remove * @default 2 * @minimum 1 * @maximum Infinity * @step 1 */ this.nth = 2; /** * The offset from which to start counting * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.offset = 0; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (nth !== undefined) { this.nth = nth; } if (offset !== undefined) { this.offset = offset; } if (clone !== undefined) { this.clone = clone; } } } Lists.RemoveNthItemDto = RemoveNthItemDto; class RandomThresholdDto { constructor(list, threshold, clone) { /** * Threshold for items * @default 0.5 * @minimum 0 * @maximum 1 * @step 1 */ this.threshold = 1; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (threshold !== undefined) { this.threshold = threshold; } if (clone !== undefined) { this.clone = clone; } } } Lists.RandomThresholdDto = RandomThresholdDto; class RemoveDuplicatesDto { constructor(list, clone) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (clone !== undefined) { this.clone = clone; } } } Lists.RemoveDuplicatesDto = RemoveDuplicatesDto; class RemoveDuplicatesToleranceDto { constructor(list, clone, tolerance) { /** * The tolerance to apply * @default 1e-7 * @minimum 0 * @maximum Infinity * @step 1e-7 */ this.tolerance = 1e-7; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (tolerance !== undefined) { this.tolerance = tolerance; } if (clone !== undefined) { this.clone = clone; } } } Lists.RemoveDuplicatesToleranceDto = RemoveDuplicatesToleranceDto; class GetByPatternDto { constructor(list, pattern) { /** * The list of booleans to be used as a pattern (true means get, false means skip) * @default [true, true, false] */ this.pattern = [true, true, false]; if (list !== undefined) { this.list = list; } if (pattern !== undefined) { this.pattern = pattern; } } } Lists.GetByPatternDto = GetByPatternDto; class GetNthItemDto { constructor(list, nth, offset, clone) { /** * The nth item to get * @default 2 * @minimum 1 * @maximum Infinity * @step 1 */ this.nth = 2; /** * The offset from which to start counting * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.offset = 0; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (nth !== undefined) { this.nth = nth; } if (offset !== undefined) { this.offset = offset; } if (clone !== undefined) { this.clone = clone; } } } Lists.GetNthItemDto = GetNthItemDto; class GetLongestListLength { constructor(lists) { if (lists !== undefined) { this.lists = lists; } } } Lists.GetLongestListLength = GetLongestListLength; class MergeElementsOfLists { constructor(lists, level) { /** * The level on which to merge the elements. 0 means first level * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.level = 0; if (lists !== undefined) { this.lists = lists; } if (level !== undefined) { this.level = level; } } } Lists.MergeElementsOfLists = MergeElementsOfLists; class AddItemDto { constructor(list, item, clone) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (item !== undefined) { this.item = item; } if (clone !== undefined) { this.clone = clone; } } } Lists.AddItemDto = AddItemDto; class AddItemFirstLastDto { constructor(list, item, position, clone) { /** * The option if the item needs to be added at the beginning or the end of the list * @default last */ this.position = firstLastEnum.last; /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (list !== undefined) { this.list = list; } if (item !== undefined) { this.item = item; } if (position !== undefined) { this.position = position; } if (clone !== undefined) { this.clone = clone; } } } Lists.AddItemFirstLastDto = AddItemFirstLastDto; class ConcatenateDto { constructor(lists, clone) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (lists !== undefined) { this.lists = lists; } if (clone !== undefined) { this.clone = clone; } } } Lists.ConcatenateDto = ConcatenateDto; class IncludesDto { constructor(list, item) { if (list !== undefined) { this.list = list; } if (item !== undefined) { this.item = item; } } } Lists.IncludesDto = IncludesDto; class InterleaveDto { constructor(lists, clone) { /** * Tries to make structured clone of the incoming list data in the component, sometimes it may not be possible due to circular structures or other types of error * @default true */ this.clone = true; if (lists !== undefined) { this.lists = lists; } if (clone !== undefined) { this.clone = clone; } } } Lists.InterleaveDto = InterleaveDto; })(Lists || (Lists = {}));