@acorex-platform/framework-shared 2.0.0-next.16 → 2.0.0-next.18

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.
@@ -1,5 +1,12 @@
1
1
  import type { AXPExpression, AXPValidationRule, AXPValidationRules } from '../core/core.types';
2
2
  export type { AXPValidationRule, AXPValidationRules };
3
+ /** Copies a rule onto a widget node, including `disabled` (boolean or expression). */
4
+ export declare function copyValidationRule(rule: AXPValidationRule): AXPValidationRule;
5
+ /**
6
+ * Prefixes `context.eval('field')` paths inside a validation `disabled` expression
7
+ * when the field lives under a parent data path.
8
+ */
9
+ export declare function prefixContextEvalPaths(source: string, dataPath: string): string;
3
10
  export interface AXPRequiredValidationRule extends AXPValidationRule {
4
11
  rule: 'required';
5
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validation.types.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/framework/shared/core/src/lib/property/validation.types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;AAEtD,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC;KACnC,CAAC;CACH;AAED,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC;KACnC,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,CAAE,SAAQ,iBAAiB;IAClE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,MAAM,wBAAwB,GAAG,CACnC,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,sBAAsB,CAAC,MAAM,CAAC,GAC9B,sBAAsB,CACzB,EAAE,CAAC"}
1
+ {"version":3,"file":"validation.types.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/framework/shared/core/src/lib/property/validation.types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE/F,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC;AAItD,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB,CAY7E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU/E;AAED,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC;KACnC,CAAC;CACH;AAED,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB;IACnE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC;KACnC,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,CAAE,SAAQ,iBAAiB;IAClE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,MAAM,wBAAwB,GAAG,CACnC,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,sBAAsB,CAAC,MAAM,CAAC,GAC9B,sBAAsB,CACzB,EAAE,CAAC"}
@@ -1,5 +1,37 @@
1
1
  "use strict";
2
2
  //#region ---- Validation types ----
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.copyValidationRule = copyValidationRule;
5
+ exports.prefixContextEvalPaths = prefixContextEvalPaths;
6
+ const CONTEXT_EVAL_PATTERN = /context\.eval\(["']([^"']+)["']\)/g;
7
+ /** Copies a rule onto a widget node, including `disabled` (boolean or expression). */
8
+ function copyValidationRule(rule) {
9
+ const copy = { rule: rule.rule };
10
+ if (rule.message !== undefined) {
11
+ copy.message = rule.message;
12
+ }
13
+ if (rule.options !== undefined) {
14
+ copy.options = rule.options;
15
+ }
16
+ if (rule.disabled !== undefined) {
17
+ copy.disabled = rule.disabled;
18
+ }
19
+ return copy;
20
+ }
21
+ /**
22
+ * Prefixes `context.eval('field')` paths inside a validation `disabled` expression
23
+ * when the field lives under a parent data path.
24
+ */
25
+ function prefixContextEvalPaths(source, dataPath) {
26
+ if (!dataPath) {
27
+ return source;
28
+ }
29
+ return source.replace(CONTEXT_EVAL_PATTERN, (match, path) => {
30
+ if (path.startsWith(`${dataPath}.`) || path.startsWith('$') || path.startsWith('>')) {
31
+ return match;
32
+ }
33
+ return `context.eval("${dataPath}.${path}")`;
34
+ });
35
+ }
4
36
  //#endregion
5
37
  //# sourceMappingURL=validation.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.types.js","sourceRoot":"","sources":["../../../../../../../../libs/framework/shared/core/src/lib/property/validation.types.ts"],"names":[],"mappings":";AAAA,oCAAoC;;AA8CpC,YAAY"}
1
+ {"version":3,"file":"validation.types.js","sourceRoot":"","sources":["../../../../../../../../libs/framework/shared/core/src/lib/property/validation.types.ts"],"names":[],"mappings":";AAAA,oCAAoC;;AASpC,gDAYC;AAMD,wDAUC;AA/BD,MAAM,oBAAoB,GAAG,oCAAoC,CAAC;AAElE,sFAAsF;AACtF,SAAgB,kBAAkB,CAAC,IAAuB;IACxD,MAAM,IAAI,GAAsB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACpD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,MAAc,EAAE,QAAgB;IACrE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAClE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACpF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,iBAAiB,QAAQ,IAAI,IAAI,IAAI,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC;AA0CD,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acorex-platform/framework-shared",
3
- "version": "2.0.0-next.16",
3
+ "version": "2.0.0-next.18",
4
4
  "type": "commonjs",
5
5
  "sideEffects": false,
6
6
  "exports": {