@astroapps/forms-core 1.1.0 → 1.1.1
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/lib/formState.d.ts +1 -0
- package/lib/index.cjs +10 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +8 -9
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/formState.ts +22 -28
package/package.json
CHANGED
package/src/formState.ts
CHANGED
|
@@ -48,6 +48,7 @@ export interface ControlState {
|
|
|
48
48
|
definition: ControlDefinition;
|
|
49
49
|
schemaInterface: SchemaInterface;
|
|
50
50
|
dataNode?: SchemaDataNode | undefined;
|
|
51
|
+
display?: string;
|
|
51
52
|
stateId?: string;
|
|
52
53
|
style?: object;
|
|
53
54
|
layoutStyle?: object;
|
|
@@ -199,34 +200,6 @@ export function createFormState(
|
|
|
199
200
|
Control<any>
|
|
200
201
|
>;
|
|
201
202
|
|
|
202
|
-
createScopedEffect((c) => {
|
|
203
|
-
const textDisplay =
|
|
204
|
-
isDisplayControl(def) && isTextDisplay(def.displayData)
|
|
205
|
-
? def.displayData
|
|
206
|
-
: undefined;
|
|
207
|
-
evalExpr(
|
|
208
|
-
c,
|
|
209
|
-
textDisplay?.text,
|
|
210
|
-
df.text,
|
|
211
|
-
textDisplay && firstExpr(formNode, DynamicPropertyType.Display),
|
|
212
|
-
coerceString,
|
|
213
|
-
);
|
|
214
|
-
}, displayOverrides);
|
|
215
|
-
|
|
216
|
-
createScopedEffect((c) => {
|
|
217
|
-
const htmlDisplay =
|
|
218
|
-
isDisplayControl(def) && isHtmlDisplay(def.displayData)
|
|
219
|
-
? def.displayData
|
|
220
|
-
: undefined;
|
|
221
|
-
evalExpr(
|
|
222
|
-
c,
|
|
223
|
-
htmlDisplay?.html,
|
|
224
|
-
df.html,
|
|
225
|
-
htmlDisplay && firstExpr(formNode, DynamicPropertyType.Display),
|
|
226
|
-
coerceString,
|
|
227
|
-
);
|
|
228
|
-
}, displayOverrides);
|
|
229
|
-
|
|
230
203
|
updateComputedValue(of.displayData, () =>
|
|
231
204
|
isDisplayControl(def)
|
|
232
205
|
? createOverrideProxy(def.displayData, displayOverrides)
|
|
@@ -319,6 +292,7 @@ export function createFormState(
|
|
|
319
292
|
allowedOptions,
|
|
320
293
|
disabled,
|
|
321
294
|
variables,
|
|
295
|
+
display,
|
|
322
296
|
} = control.fields;
|
|
323
297
|
|
|
324
298
|
createScopedEffect(
|
|
@@ -357,6 +331,18 @@ export function createFormState(
|
|
|
357
331
|
scope,
|
|
358
332
|
);
|
|
359
333
|
|
|
334
|
+
createScopedEffect(
|
|
335
|
+
(c) =>
|
|
336
|
+
evalExpr(
|
|
337
|
+
c,
|
|
338
|
+
undefined,
|
|
339
|
+
display,
|
|
340
|
+
firstExpr(formNode, DynamicPropertyType.Display),
|
|
341
|
+
coerceString,
|
|
342
|
+
),
|
|
343
|
+
scope,
|
|
344
|
+
);
|
|
345
|
+
|
|
360
346
|
updateComputedValue(dataNode, () => lookupDataNode(definition, parent));
|
|
361
347
|
updateComputedValue(
|
|
362
348
|
hidden,
|
|
@@ -388,6 +374,14 @@ export function createFormState(
|
|
|
388
374
|
}
|
|
389
375
|
}, scope);
|
|
390
376
|
|
|
377
|
+
createSyncEffect(() => {
|
|
378
|
+
if (isDisplayControl(def)) {
|
|
379
|
+
if (isTextDisplay(def.displayData)) df.text.value = display.value;
|
|
380
|
+
else if (isHtmlDisplay(def.displayData))
|
|
381
|
+
df.html.value = display.value;
|
|
382
|
+
}
|
|
383
|
+
}, displayOverrides);
|
|
384
|
+
|
|
391
385
|
setupValidation(
|
|
392
386
|
controlImpl,
|
|
393
387
|
definition,
|