@thatopen/components 2.4.3 → 2.4.4

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.
@@ -6,7 +6,7 @@ export declare class Components implements Disposable {
6
6
  /**
7
7
  * The version of the @thatopen/components library.
8
8
  */
9
- static readonly release = "2.4.3";
9
+ static readonly release = "2.4.4";
10
10
  /** {@link Disposable.onDisposed} */
11
11
  readonly onDisposed: Event<void>;
12
12
  /**
@@ -284,6 +284,6 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
284
284
  handle: WEBIFC.Handle<unknown>;
285
285
  }>;
286
286
  registerChange(model: FragmentsGroup, ...expressID: number[]): void;
287
- private newSingleProperty;
287
+ newSingleProperty(model: FragmentsGroup, type: string, name: string, value: string | number | boolean): Promise<WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
288
288
  }
289
289
  export * from "./src";
package/dist/index.cjs CHANGED
@@ -6312,7 +6312,7 @@ const _Components = class _Components {
6312
6312
  /**
6313
6313
  * The version of the @thatopen/components library.
6314
6314
  */
6315
- __publicField(_Components, "release", "2.4.3");
6315
+ __publicField(_Components, "release", "2.4.4");
6316
6316
  let Components = _Components;
6317
6317
  class SimpleWorld extends Base {
6318
6318
  constructor() {
@@ -21106,10 +21106,8 @@ function readDocType$1(xmlData, i) {
21106
21106
  i += 8;
21107
21107
  else if (hasBody && isNotation(xmlData, i))
21108
21108
  i += 9;
21109
- else if (isComment)
21110
- comment = true;
21111
21109
  else
21112
- throw new Error("Invalid DOCTYPE");
21110
+ comment = true;
21113
21111
  angleBracketsCount++;
21114
21112
  exp = "";
21115
21113
  } else if (xmlData[i] === ">") {
@@ -21153,11 +21151,6 @@ function readEntityExp(xmlData, i) {
21153
21151
  }
21154
21152
  return [entityName2, val2, i];
21155
21153
  }
21156
- function isComment(xmlData, i) {
21157
- if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-")
21158
- return true;
21159
- return false;
21160
- }
21161
21154
  function isEntity(xmlData, i) {
21162
21155
  if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y")
21163
21156
  return true;
@@ -23198,7 +23191,7 @@ ${users}
23198
23191
  Comment: CommentText,
23199
23192
  Viewpoint: Viewpoint2
23200
23193
  } = markupComment;
23201
- if (!(Guid && CommentDate && Author && (Comment || Viewpoint2)))
23194
+ if (!(Guid && CommentDate && Author && Comment))
23202
23195
  return null;
23203
23196
  const viewpoints = this.components.get(Viewpoints);
23204
23197
  const comment = new Comment(this.components, CommentText ?? "");
@@ -27248,10 +27241,10 @@ class IDSFacet {
27248
27241
  let minPass = true;
27249
27242
  let maxPass = true;
27250
27243
  if (min !== void 0) {
27251
- minPass = minInclusive ? value <= min : value < min;
27244
+ minPass = minInclusive ? value >= min : value > min;
27252
27245
  }
27253
27246
  if (max !== void 0) {
27254
- maxPass = maxInclusive ? value >= max : value > max;
27247
+ maxPass = maxInclusive ? value <= max : value < max;
27255
27248
  }
27256
27249
  pass = minPass && maxPass;
27257
27250
  }
@@ -27976,16 +27969,15 @@ class IDSProperty extends IDSFacet {
27976
27969
  this.testResult.push(result2);
27977
27970
  const sets = await this.getPsets(model, expressID);
27978
27971
  const matchingSets = sets.filter((set) => {
27979
- var _a2;
27980
27972
  const result3 = this.evalRequirement(
27981
- ((_a2 = set.Name) == null ? void 0 : _a2.value) ?? null,
27973
+ set.Name ?? null,
27982
27974
  this.propertySet,
27983
27975
  "PropertySet"
27984
27976
  );
27985
27977
  if (!result3)
27986
27978
  return false;
27987
27979
  checks.push({
27988
- currentValue: set.Name.value,
27980
+ currentValue: set.Name,
27989
27981
  parameter: "PropertySet",
27990
27982
  pass: true,
27991
27983
  requiredValue: this.propertySet.parameter
@@ -28002,8 +27994,7 @@ class IDSProperty extends IDSFacet {
28002
27994
  continue;
28003
27995
  }
28004
27996
  for (const set of matchingSets) {
28005
- const itemsAttrName = this.getItemsAttrName(set.type);
28006
- if (!itemsAttrName) {
27997
+ if (!("Properties" in set)) {
28007
27998
  checks.push({
28008
27999
  currentValue: null,
28009
28000
  parameter: "BaseName",
@@ -28012,7 +28003,7 @@ class IDSProperty extends IDSFacet {
28012
28003
  });
28013
28004
  continue;
28014
28005
  }
28015
- const items = set[itemsAttrName];
28006
+ const items = set.Properties;
28016
28007
  const matchingItems = items.filter((item) => {
28017
28008
  var _a2;
28018
28009
  if (this._unsupportedTypes.includes(item.type)) {
@@ -28067,18 +28058,22 @@ class IDSProperty extends IDSFacet {
28067
28058
  (name) => name.endsWith("Value") || name.endsWith("Values")
28068
28059
  );
28069
28060
  }
28070
- async getPsetProps(model, attrs, propsListName) {
28071
- const attrsClone = structuredClone(attrs);
28061
+ async simplifyPset(model, attrs, propsListName) {
28062
+ var _a;
28072
28063
  const props = [];
28073
- const list = attrsClone[propsListName];
28064
+ const list = attrs[propsListName];
28074
28065
  if (!list)
28075
- return props;
28066
+ return attrs;
28076
28067
  for (const { value } of list) {
28077
28068
  const propAttrs = await model.getProperties(value);
28078
28069
  if (propAttrs)
28079
28070
  props.push(propAttrs);
28080
28071
  }
28081
- attrsClone[propsListName] = props;
28072
+ const attrsClone = {
28073
+ Name: (_a = attrs.Name) == null ? void 0 : _a.value,
28074
+ Properties: props,
28075
+ type: attrs.type
28076
+ };
28082
28077
  return attrsClone;
28083
28078
  }
28084
28079
  async getTypePsets(model, expressID) {
@@ -28096,13 +28091,14 @@ class IDSProperty extends IDSFacet {
28096
28091
  if (!(psetAttrs && "HasProperties" in psetAttrs && Array.isArray(psetAttrs.HasProperties))) {
28097
28092
  continue;
28098
28093
  }
28099
- const pset = await this.getPsetProps(model, psetAttrs, "HasProperties");
28094
+ const pset = await this.simplifyPset(model, psetAttrs, "HasProperties");
28100
28095
  sets.push(pset);
28101
28096
  }
28102
28097
  return sets;
28103
28098
  }
28104
28099
  async getPsets(model, expressID) {
28105
- const sets = await this.getTypePsets(model, expressID);
28100
+ var _a;
28101
+ const typePsets = await this.getTypePsets(model, expressID);
28106
28102
  const indexer = this.components.get(IfcRelationsIndexer);
28107
28103
  const definitions = indexer.getEntityRelations(
28108
28104
  model,
@@ -28110,7 +28106,8 @@ class IDSProperty extends IDSFacet {
28110
28106
  "IsDefinedBy"
28111
28107
  );
28112
28108
  if (!definitions)
28113
- return sets;
28109
+ return typePsets;
28110
+ const sets = [];
28114
28111
  for (const definitionID of definitions) {
28115
28112
  const attrs = await model.getProperties(definitionID);
28116
28113
  if (!attrs)
@@ -28118,8 +28115,25 @@ class IDSProperty extends IDSFacet {
28118
28115
  const propsListName = this.getItemsAttrName(attrs.type);
28119
28116
  if (!propsListName)
28120
28117
  continue;
28121
- const pset = await this.getPsetProps(model, attrs, propsListName);
28122
- sets.push(pset);
28118
+ const occurencePset = await this.simplifyPset(
28119
+ model,
28120
+ attrs,
28121
+ propsListName
28122
+ );
28123
+ const typePset = typePsets.find(
28124
+ ({ Name }) => Name === occurencePset.Name
28125
+ );
28126
+ if (typePset) {
28127
+ for (const prop of typePset.Properties) {
28128
+ const name = (_a = prop.Name) == null ? void 0 : _a.value;
28129
+ const existingProp = occurencePset.Properties.find(
28130
+ ({ Name }) => Name.value === name
28131
+ );
28132
+ if (!existingProp)
28133
+ occurencePset.Properties.push(prop);
28134
+ }
28135
+ }
28136
+ sets.push(occurencePset);
28123
28137
  }
28124
28138
  return sets;
28125
28139
  }