@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.
- package/CHANGELOG.md +21 -0
- package/index.d.ts +2 -1
- package/index.js +1106 -1061
- package/index.umd.cjs +7 -7
- package/internals.d.ts +1 -2
- package/lib/context/form.context.d.ts +2 -2
- package/lib/context/widget-registry.d.ts +3 -1
- package/lib/context/with-widget.type.d.ts +4 -1
- package/lib/form-store.d.ts +2 -2
- package/lib/form.d.ts +9 -1
- package/lib/shared.d.ts +43 -2
- package/lib/store/model.d.ts +31 -1
- package/lib/store/reducer.d.ts +3 -2
- package/lib/store/reducers/calculate-current-state.d.ts +2 -1
- package/lib/store/reducers/calculate-widget-flags.d.ts +2 -1
- package/lib/store/reducers/calculate-widget-props.d.ts +2 -1
- package/lib/store/reducers/index.d.ts +1 -0
- package/lib/store/reducers/materialize-repeater-items.d.ts +10 -0
- package/lib/utils/deterministic-uids.d.ts +19 -0
- package/lib/utils/justin.d.ts +15 -2
- package/lib/utils/repeater.d.ts +31 -7
- package/package.json +1 -1
package/lib/utils/repeater.d.ts
CHANGED
|
@@ -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
|
|
5
|
-
*
|
|
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
|
-
*
|
|
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>;
|