@stemy/ngx-dynamic-form 19.9.6 → 19.9.7
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/fesm2022/stemy-ngx-dynamic-form.mjs +15 -11
- package/fesm2022/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +1 -0
- package/ngx-dynamic-form/ngx-dynamic-form.imports.d.ts +1 -1
- package/ngx-dynamic-form/utils/misc.d.ts +4 -4
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
|
@@ -175,33 +175,37 @@ function convertToNumber(value, defaultVal) {
|
|
|
175
175
|
const num = Number(value);
|
|
176
176
|
return isNaN(num) ? defaultVal ?? value : num;
|
|
177
177
|
}
|
|
178
|
-
function getFieldByPath(
|
|
179
|
-
|
|
178
|
+
function getFieldByPath(lookup, path) {
|
|
179
|
+
const field = ObjectUtils.isArray(lookup) ? null : lookup;
|
|
180
|
+
if (field?.path === path) {
|
|
180
181
|
return field;
|
|
181
182
|
}
|
|
182
|
-
|
|
183
|
+
const fields = ObjectUtils.isArray(lookup) ? lookup : field.fieldGroup;
|
|
184
|
+
if (!fields)
|
|
183
185
|
return null;
|
|
184
|
-
for (const sf of
|
|
186
|
+
for (const sf of fields) {
|
|
185
187
|
const found = getFieldByPath(sf, path);
|
|
186
188
|
if (found)
|
|
187
189
|
return found;
|
|
188
190
|
}
|
|
189
191
|
return null;
|
|
190
192
|
}
|
|
191
|
-
function getFieldsByPredicate(
|
|
192
|
-
|
|
193
|
+
function getFieldsByPredicate(lookup, cb) {
|
|
194
|
+
const field = ObjectUtils.isArray(lookup) ? null : lookup;
|
|
195
|
+
if (field && cb(field)) {
|
|
193
196
|
return [field];
|
|
194
197
|
}
|
|
195
|
-
if (!field.fieldGroup)
|
|
196
|
-
return [];
|
|
197
198
|
const results = [];
|
|
198
|
-
|
|
199
|
+
const fields = ObjectUtils.isArray(lookup) ? lookup : field.fieldGroup;
|
|
200
|
+
if (!fields)
|
|
201
|
+
return results;
|
|
202
|
+
for (const sf of fields) {
|
|
199
203
|
results.push(...getFieldsByPredicate(sf, cb));
|
|
200
204
|
}
|
|
201
205
|
return results;
|
|
202
206
|
}
|
|
203
|
-
function getFieldsByKey(
|
|
204
|
-
return getFieldsByPredicate(
|
|
207
|
+
function getFieldsByKey(lookup, key) {
|
|
208
|
+
return getFieldsByPredicate(lookup, f => f.key === key);
|
|
205
209
|
}
|
|
206
210
|
async function getSelectOptions(fieldOrOpts) {
|
|
207
211
|
const options = fieldOrOpts.props?.options || fieldOrOpts;
|