tuain-ng-forms-lib 15.2.0 → 15.2.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.
|
@@ -2179,14 +2179,17 @@ class FormStructureAndData {
|
|
|
2179
2179
|
}
|
|
2180
2180
|
if (definitionReceived.actions) {
|
|
2181
2181
|
const formActions = definitionReceived.actions.map(objDef => {
|
|
2182
|
-
let visibleStates = objDef.visibleStates
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
enabledStates = [...visibleStates];
|
|
2182
|
+
let visibleStates = objDef.visibleStates
|
|
2183
|
+
?? (objDef.actionModes?.split(',')?.map(state => state.trim())?.filter(state => state))
|
|
2184
|
+
?? [];
|
|
2185
|
+
let enabledStates = objDef.enabledStates ?? objDef.editableStates ?? [];
|
|
2186
|
+
if (!Array.isArray(visibleStates) && typeof visibleStates === 'string') {
|
|
2187
|
+
visibleStates = (visibleStates === neverVisible) ? [] : allStates;
|
|
2189
2188
|
}
|
|
2189
|
+
if (!Array.isArray(enabledStates) && typeof enabledStates === 'string') {
|
|
2190
|
+
enabledStates = (enabledStates === neverVisible) ? [] : visibleStates;
|
|
2191
|
+
}
|
|
2192
|
+
enabledStates = enabledStates.filter(state => visibleStates.includes(state));
|
|
2190
2193
|
return { ...objDef, visibleStates, enabledStates };
|
|
2191
2194
|
});
|
|
2192
2195
|
for (const actionReceived of formActions) {
|
|
@@ -2201,9 +2204,9 @@ class FormStructureAndData {
|
|
|
2201
2204
|
if (definitionReceived.fields) {
|
|
2202
2205
|
const formFields = definitionReceived.fields.map(objDef => {
|
|
2203
2206
|
let visibleStates = objDef.visibleStates
|
|
2204
|
-
?? (objDef.fieldModes?.map(state => state.trim())?.filter(state => state))
|
|
2207
|
+
?? (objDef.fieldModes?.split(',')?.map(state => state.trim())?.filter(state => state))
|
|
2205
2208
|
?? [];
|
|
2206
|
-
let enabledStates = objDef.enabledStates ?? objDef.editableStates;
|
|
2209
|
+
let enabledStates = objDef.enabledStates ?? objDef.editableStates ?? [];
|
|
2207
2210
|
if (!Array.isArray(visibleStates) && typeof visibleStates === 'string') {
|
|
2208
2211
|
visibleStates = (visibleStates === neverVisible) ? [] : allStates;
|
|
2209
2212
|
}
|
|
@@ -2224,14 +2227,17 @@ class FormStructureAndData {
|
|
|
2224
2227
|
}
|
|
2225
2228
|
if (definitionReceived.tables) {
|
|
2226
2229
|
const tables = definitionReceived.tables.map(objDef => {
|
|
2227
|
-
let visibleStates = objDef.visibleStates
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
enabledStates = [...visibleStates];
|
|
2230
|
+
let visibleStates = objDef.visibleStates
|
|
2231
|
+
?? (objDef.tableModes?.split(',')?.map(state => state.trim())?.filter(state => state))
|
|
2232
|
+
?? [];
|
|
2233
|
+
let enabledStates = objDef.enabledStates ?? objDef.editableStates ?? [];
|
|
2234
|
+
if (!Array.isArray(visibleStates) && typeof visibleStates === 'string') {
|
|
2235
|
+
visibleStates = (visibleStates === neverVisible) ? [] : allStates;
|
|
2234
2236
|
}
|
|
2237
|
+
if (!Array.isArray(enabledStates) && typeof enabledStates === 'string') {
|
|
2238
|
+
enabledStates = (enabledStates === neverVisible) ? [] : visibleStates;
|
|
2239
|
+
}
|
|
2240
|
+
enabledStates = enabledStates.filter(state => visibleStates.includes(state));
|
|
2235
2241
|
return { ...objDef, visibleStates, enabledStates };
|
|
2236
2242
|
});
|
|
2237
2243
|
for (const tableReceived of tables) {
|
|
@@ -2245,11 +2251,11 @@ class FormStructureAndData {
|
|
|
2245
2251
|
}
|
|
2246
2252
|
if (definitionReceived.sections) {
|
|
2247
2253
|
const formSections = definitionReceived.sections.map(objDef => {
|
|
2248
|
-
let visibleStates = objDef.visibleStates
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2254
|
+
let visibleStates = objDef.visibleStates
|
|
2255
|
+
?? (objDef.sectionModes?.split(',')?.map(state => state.trim())?.filter(state => state))
|
|
2256
|
+
?? [];
|
|
2257
|
+
if (!Array.isArray(visibleStates) && typeof visibleStates === 'string') {
|
|
2258
|
+
visibleStates = (visibleStates === neverVisible) ? [] : allStates;
|
|
2253
2259
|
}
|
|
2254
2260
|
return { ...objDef, visibleStates };
|
|
2255
2261
|
});
|