@golemui/core 1.0.3 → 1.1.1-rc.0

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,19 +1,26 @@
1
- import { NonFunctionWidget } from '../form-widget';
1
+ import { FormWidget, NonFunctionWidget } from '../form-widget';
2
2
  import { Uid } from '../shared';
3
3
  /**
4
- * Derives a concrete widget config for a specific repeater item by stamping
5
- * the provided indexes into the widget's `uid` (and `path` for input widgets).
4
+ * Derives a concrete widget config for a specific repeater item by materializing the provided indexes into the
5
+ * widget's `uid` (and `path` for input widgets).
6
+ *
7
+ * Function widgets are wrapped in a new function that delegates to the original, so they stay callable while
8
+ * carrying the materialized `uid` and `path`.
6
9
  *
7
10
  * @param widget - The base widget config defined on the repeater template.
8
- * @param repeaterIndexes - Ordered list of indexes for each nesting level,
9
- * e.g. `[2, 0]` for the first item of a nested repeater inside the third
10
- * item of an outer repeater.
11
- * @returns A new widget config with the indexes baked in; the original is not mutated.
11
+ * @param repeaterIndexes - Ordered list of indexes for each nesting level
12
+ * e.g. `[2, 0]` for the first item of a nested repeater inside the third item of an outer repeater.
13
+ * @returns A new widget config with the indexes baked in. The original is not mutated.
12
14
  *
13
15
  * @example
14
16
  * makeRepeaterItemConfig(widget, [1]) // { uid: 'user-name[1]', path: 'users.1.name' }
17
+ *
18
+ * @example
19
+ * // Nested repeater: the first item of an inner repeater inside the third item of the outer one.
20
+ * makeRepeaterItemConfig(widget, [2, 0]) // { uid: 'dev-name[2][0]', path: 'teams.2.devs.0.name' }
15
21
  */
16
22
  export declare function makeRepeaterItemConfig(widget: NonFunctionWidget<string>, repeaterIndexes: number[]): NonFunctionWidget<string>;
23
+ export declare function makeRepeaterItemConfig(widget: FormWidget<string>, repeaterIndexes: number[]): FormWidget<string>;
17
24
  export declare function toRepeaterItemUid(uid: Uid, repeaterIndexes: number[]): Uid;
18
25
  /**
19
26
  * Replaces `.items.` and `.items?.` tokens in a `when` expression with the
@@ -30,3 +37,20 @@ export declare function toRepeaterItemUid(uid: Uid, repeaterIndexes: number[]):
30
37
  * // "$form.reptr.teams.items?.devs?.items?.firstName?.length > 0" -> "$form.reptr.teams.1?.devs?.0?.firstName?.length > 0"
31
38
  */
32
39
  export declare function transformRepeaterItemWhenExpression(expression: string, repeaterIndexes: number[]): string;
40
+ /**
41
+ * Returns a copy of a repeater item widget whose reactive flag conditions
42
+ * (`include.when`, `exclude.when`, `disabled.when`, `readonly.when`) are rewritten
43
+ * for a concrete item via {@link transformRepeaterItemWhenExpression}.
44
+ *
45
+ * State-based flags (`include.in`, `exclude.from`) carry no expression and are left untouched.
46
+ *
47
+ * @param widget - A widget already materialized for a repeater item (see {@link makeRepeaterItemConfig}).
48
+ * @param repeaterIndexes - Ordered list of indexes for each nesting level.
49
+ * @returns A new widget config with item-concrete `when` expressions. The original is not mutated.
50
+ *
51
+ * @example
52
+ * // repeaterIndexes = [1]
53
+ * // { include: { when: '$form.lineItems.items.active' } }
54
+ * // -> { include: { when: '$form.lineItems.1.active' } }
55
+ */
56
+ export declare function transformWidgetWhenExpressions(widget: NonFunctionWidget<string>, repeaterIndexes: number[]): NonFunctionWidget<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemui/core",
3
- "version": "1.0.3",
3
+ "version": "1.1.1-rc.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./index.umd.cjs",