@omnia/fx-models 8.0.196-dev → 8.0.198-dev

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserSortColumn = exports.DocumentDirectionSettings = exports.UserAccessibilitySettings = exports.UserPropertyBagModel = exports.ResolvedUserIdentity = exports.UserIdentity = void 0;
4
4
  const models_1 = require("@omnia/fx-models/internal-do-not-import-from-here/shared/models");
5
+ const Enums_1 = require("../Enums");
5
6
  const ManifestIds_1 = require("../ManifestIds");
6
7
  const NamedProperty_1 = require("../NamedProperty");
7
8
  const BuiltInIdentityProvider_1 = require("./BuiltInIdentityProvider");
@@ -62,7 +63,7 @@ class ResolvedUserIdentity extends UserIdentity {
62
63
  return resolvedUser.uiLanguage ?? resolvedUser.preferredLanguage;
63
64
  }
64
65
  static isAnonymousUser(resolvedUser) {
65
- return resolvedUser.id == o$.enums.securityIdentities.AnonymousIdentity;
66
+ return resolvedUser.id === Enums_1.SecurityIdentities.AnonymousIdentity;
66
67
  }
67
68
  }
68
69
  exports.ResolvedUserIdentity = ResolvedUserIdentity;
@@ -1,31 +1,5 @@
1
1
  import "./Equals";
2
- import { IEquals } from "./Equals";
3
2
  import { Id } from "./Id";
4
- type VersionChar = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f";
5
- type Char = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f";
6
- type Prev<X extends number> = [
7
- never,
8
- 0,
9
- 1,
10
- 2,
11
- 3,
12
- 4,
13
- 5,
14
- 6,
15
- 7,
16
- 8,
17
- 9,
18
- 10,
19
- 11,
20
- ...never[]
21
- ][X];
22
- type HasLength<S extends string, Len extends number> = [Len] extends [0] ? (S extends "" ? true : never) : (S extends `${infer C}${infer Rest}` ? (Lowercase<C> extends Char ? HasLength<Rest, Prev<Len>> : never) : never);
23
- type Char4<S extends string> = true extends HasLength<S, 4> ? S : never;
24
- type Char8<S extends string> = true extends HasLength<S, 8> ? S : never;
25
- type Char12<S extends string> = true extends HasLength<S, 12> ? S : never;
26
- type VersionGroup<S extends string> = S extends `${infer Version}${infer Rest}` ? (Version extends VersionChar ? (true extends HasLength<Rest, 3> ? S : never) : never) : never;
27
- type NilUUID = "00000000-0000-0000-0000-000000000000";
28
- type GuidValidator<S extends string> = S extends NilUUID ? S : (S extends `${infer S8}-${infer S4_1}-${infer S4_2}-${infer S4_3}-${infer S12}` ? (S8 extends Lowercase<Char8<S8>> ? (S4_1 extends Lowercase<Char4<S4_1>> ? (S4_2 extends Lowercase<VersionGroup<S4_2>> ? (S4_3 extends Lowercase<Char4<S4_3>> ? (S12 extends Lowercase<Char12<S12>> ? S : never) : never) : never) : never) : never) : never);
29
3
  export declare const emptyGuid: guid;
30
4
  declare const guidSymbol: unique symbol;
31
5
  /**
@@ -71,28 +45,52 @@ export declare function guid<S extends string>(id?: GuidValidator<S>): guid;
71
45
  * const specificGuid = maybeGuid("123e4567-e89b-12d3-a456-426614174000");
72
46
  */
73
47
  export declare function maybeGuid(id: string): guid;
74
- export declare function isValidGuid(guid: guid): boolean;
75
- export interface GuidValue extends Partial<IEquals<{
76
- GUID(value: GuidValue): boolean;
77
- }>> {
78
- toString: () => string;
79
- }
80
48
  /**
81
- * Class to create a guid
49
+ * Checks if the provided string is a valid GUID/UUID
50
+ *
51
+ * A GUID (Globally Unique Identifier) or UUID (Universally Unique Identifier)
52
+ * is typically a 128-bit number used to uniquely identify information in computer systems.
53
+ * The function validates whether the input string conforms to a standard GUID format,
54
+ * which is commonly represented as a 32-character hexadecimal string formatted in five groups,
55
+ * separated by hyphens. The GUID must be entirely in lowercase, without braces.
56
+ *
57
+ * The accepted format is strictly:
58
+ * - 8-4-4-4-12 (32 hexadecimal characters split by hyphens, all in lowercase)
59
+ *
60
+ * Examples of valid GUIDs:
61
+ * - "09489573-3b89-47e4-b809-69fa6394bf0b"
62
+ *
63
+ * @param {guid} guid - The GUID string to validate.
64
+ * @returns {boolean} Returns true if the input string is a valid and lowercase GUID, otherwise false.
65
+ *
66
+ * @example
67
+ * isValidGuid("09489573-3b89-47e4-b809-69fa6394bf0b"); // returns true
68
+ * isValidGuid("09489573-3B89-47E4-B809-69FA6394BF0B"); // returns false
82
69
  */
83
- export declare class Guid implements GuidValue {
84
- private static _empty;
85
- private value;
86
- equals: {
87
- GUID: (value: GuidValue) => boolean;
88
- };
89
- static newGuid(): GuidValue;
90
- static get empty(): GuidValue;
91
- static isValid(guid: string | GuidValue): boolean;
92
- constructor(guid: string);
93
- toString(): string;
94
- toJSON: () => string;
95
- valueOf(): string;
96
- }
97
- export declare function GUID(value: string): GuidValue;
70
+ export declare function isValidGuid(guid: guid): boolean;
71
+ type VersionChar = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f";
72
+ type Char = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f";
73
+ type Prev<X extends number> = [
74
+ never,
75
+ 0,
76
+ 1,
77
+ 2,
78
+ 3,
79
+ 4,
80
+ 5,
81
+ 6,
82
+ 7,
83
+ 8,
84
+ 9,
85
+ 10,
86
+ 11,
87
+ ...never[]
88
+ ][X];
89
+ type HasLength<S extends string, Len extends number> = [Len] extends [0] ? (S extends "" ? true : never) : (S extends `${infer C}${infer Rest}` ? (Lowercase<C> extends Char ? HasLength<Rest, Prev<Len>> : never) : never);
90
+ type Char4<S extends string> = true extends HasLength<S, 4> ? S : never;
91
+ type Char8<S extends string> = true extends HasLength<S, 8> ? S : never;
92
+ type Char12<S extends string> = true extends HasLength<S, 12> ? S : never;
93
+ type VersionGroup<S extends string> = S extends `${infer Version}${infer Rest}` ? (Version extends VersionChar ? (true extends HasLength<Rest, 3> ? S : never) : never) : never;
94
+ type NilUUID = "00000000-0000-0000-0000-000000000000";
95
+ type GuidValidator<S extends string> = S extends NilUUID ? S : (S extends `${infer S8}-${infer S4_1}-${infer S4_2}-${infer S4_3}-${infer S12}` ? (S8 extends Lowercase<Char8<S8>> ? (S4_1 extends Lowercase<Char4<S4_1>> ? (S4_2 extends Lowercase<VersionGroup<S4_2>> ? (S4_3 extends Lowercase<Char4<S4_3>> ? (S12 extends Lowercase<Char12<S12>> ? S : never) : never) : never) : never) : never) : never);
98
96
  export {};
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GUID = exports.Guid = exports.isValidGuid = exports.maybeGuid = exports.guid = exports.emptyGuid = void 0;
3
+ exports.isValidGuid = exports.maybeGuid = exports.guid = exports.emptyGuid = void 0;
4
4
  require("./Equals"); // ensure execute code in equals first
5
5
  exports.emptyGuid = guid("00000000-0000-0000-0000-000000000000");
6
- //This is the new modern implementation of guid not requiring a class
7
6
  const guidSymbol = Symbol("guid");
8
7
  /**
9
8
  * Generates a globally unique identifier (GUID) or converts a provided string into a GUID.
@@ -46,94 +45,47 @@ exports.guid = guid;
46
45
  * const specificGuid = maybeGuid("123e4567-e89b-12d3-a456-426614174000");
47
46
  */
48
47
  function maybeGuid(id) {
48
+ //return id?.toLowerCase() as guid;
49
49
  return defineGuid(id);
50
50
  }
51
51
  exports.maybeGuid = maybeGuid;
52
- function defineGuid(id) {
53
- if (!id) {
54
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
55
- const r = Math.random() * 16 | 0;
56
- const v = c === "x" ? r : (r & 0x3 | 0x8);
57
- return v.toString(16);
58
- });
59
- }
60
- return id;
61
- }
52
+ /**
53
+ * Checks if the provided string is a valid GUID/UUID
54
+ *
55
+ * A GUID (Globally Unique Identifier) or UUID (Universally Unique Identifier)
56
+ * is typically a 128-bit number used to uniquely identify information in computer systems.
57
+ * The function validates whether the input string conforms to a standard GUID format,
58
+ * which is commonly represented as a 32-character hexadecimal string formatted in five groups,
59
+ * separated by hyphens. The GUID must be entirely in lowercase, without braces.
60
+ *
61
+ * The accepted format is strictly:
62
+ * - 8-4-4-4-12 (32 hexadecimal characters split by hyphens, all in lowercase)
63
+ *
64
+ * Examples of valid GUIDs:
65
+ * - "09489573-3b89-47e4-b809-69fa6394bf0b"
66
+ *
67
+ * @param {guid} guid - The GUID string to validate.
68
+ * @returns {boolean} Returns true if the input string is a valid and lowercase GUID, otherwise false.
69
+ *
70
+ * @example
71
+ * isValidGuid("09489573-3b89-47e4-b809-69fa6394bf0b"); // returns true
72
+ * isValidGuid("09489573-3B89-47E4-B809-69FA6394BF0B"); // returns false
73
+ */
62
74
  function isValidGuid(guid) {
63
75
  if (guid === undefined || guid === null) {
64
76
  return false;
65
77
  }
66
- const validRegex = /^[{]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[}]?$/;
67
- return validRegex.test(guid.toString());
78
+ const validRegex = /^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/;
79
+ return validRegex.test(guid);
68
80
  }
69
81
  exports.isValidGuid = isValidGuid;
70
- /**
71
- * Class to create a guid
72
- */
73
- class Guid {
74
- static { this._empty = guid("00000000-0000-0000-0000-000000000000"); }
75
- static newGuid() {
76
- return new Guid("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
82
+ function defineGuid(id) {
83
+ if (!id) {
84
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
77
85
  const r = Math.random() * 16 | 0;
78
- const v = (c == "x") ? r : (r & 0x3 | 0x8);
86
+ const v = c === "x" ? r : (r & 0x3 | 0x8);
79
87
  return v.toString(16);
80
- }));
81
- }
82
- static get empty() {
83
- return this._empty;
84
- }
85
- static isValid(guid) {
86
- if (guid === undefined || guid === null) {
87
- return false;
88
- }
89
- const validRegex = /^[{]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[}]?$/;
90
- return validRegex.test(guid.toString());
91
- }
92
- constructor(guid) {
93
- this.value = "";
94
- this.equals = {
95
- GUID: (value) => {
96
- return this.toString() === value.toString();
97
- }
98
- };
99
- //We serialize as string value
100
- this.toJSON = () => {
101
- return this.value.toLowerCase();
102
- };
103
- if (guid) {
104
- if (Guid.isValid(guid)) {
105
- this.value = guid;
106
- }
107
- else {
108
- throw `The string '${guid}' is not a valid Guid`;
109
- }
110
- }
111
- }
112
- toString() {
113
- return this.value.toLowerCase();
114
- }
115
- valueOf() {
116
- return this.value.toLowerCase();
117
- }
118
- }
119
- exports.Guid = Guid;
120
- // only add extension methods when running in browser, not in node.js
121
- if (globalThis.omnia) {
122
- Object.defineProperty(String.prototype["equals"], "guid", {
123
- value: function (value) {
124
- return this["_this_value"].toString() === value.toString();
125
- },
126
- writable: false,
127
- configurable: false,
128
- enumerable: false
129
- });
130
- }
131
- // will make Guid class to static class to prevent new Guid instance later on
132
- // now expose new function to create guid
133
- function GUID(value) {
134
- if (!Guid.isValid(value)) {
135
- throw `The string '${value}' is not a valid Guid`;
88
+ });
136
89
  }
137
- return value;
90
+ return id;
138
91
  }
139
- exports.GUID = GUID;
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PhotoWall = void 0;
4
- const ManifestIds_1 = require("../../ManifestIds");
5
4
  class PhotoWall {
6
5
  /**
7
6
  *
8
7
  */
9
8
  constructor() {
10
- this.id = ManifestIds_1.OmniaWebComponentManifests.FxPhotoWallProvider;
9
+ this.id = o$.enums.omniaWebComponentManifests.FxPhotoWallProvider;
11
10
  this.name = "WCM.Media.Gallery.PhotoWall.Title";
12
11
  }
13
12
  }
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SliderDialogProvider = void 0;
4
- const ManifestIds_1 = require("../../ManifestIds");
5
4
  // import { OmniaWebComponentManifests } from "@omnia/fx-models";
6
5
  class SliderDialogProvider {
7
6
  /**
8
7
  *
9
8
  */
10
9
  constructor() {
11
- this.id = ManifestIds_1.OmniaWebComponentManifests.FxSliderDialogProvider;
10
+ this.id = o$.enums.omniaWebComponentManifests.FxSliderDialogProvider;
12
11
  this.name = "Omnia.Fx.Media.Gallery.SliderDialog.Title";
13
12
  }
14
13
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/fx-models",
3
3
  "license": "MIT",
4
- "version": "8.0.196-dev",
4
+ "version": "8.0.198-dev",
5
5
  "description": "Provide Omnia Fx Models Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -8,6 +8,7 @@ export interface IPropertyDisplayRenderer<TPropertyDef extends PropertyDefinitio
8
8
  displaySettings: PropertyDisplaySettingsType<TPropertyDef>;
9
9
  setupSettings?: PropertySetupSettingsType<TPropertyDef>;
10
10
  renderTextOnly?: boolean;
11
+ persistentLabels?: boolean;
11
12
  }
12
13
  export interface IPropertyEditorRenderer<TPropertyDef extends PropertyDefinition<any, any, any>> {
13
14
  modelValue: PropertyValueType<TPropertyDef>;