@masterteam/components 0.0.299 → 0.0.301
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/assets/common.css +1 -1
- package/fesm2022/masterteam-components-business-fields.mjs +153 -25
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-checkbox-field.mjs +2 -2
- package/fesm2022/masterteam-components-checkbox-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +196 -210
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-radio-button-field.mjs +2 -2
- package/fesm2022/masterteam-components-radio-button-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-select-field.mjs +23 -2
- package/fesm2022/masterteam-components-select-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs +2 -2
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +43 -2
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +88 -12
- package/types/masterteam-components-entities.d.ts +133 -63
- package/types/masterteam-components-select-field.d.ts +14 -0
- package/types/masterteam-components.d.ts +27 -2
|
@@ -1352,6 +1352,7 @@ class SelectFieldConfig extends BaseFieldConfig {
|
|
|
1352
1352
|
filter;
|
|
1353
1353
|
filterBy;
|
|
1354
1354
|
filterPlaceholder;
|
|
1355
|
+
/** Unset lets mt-select-field decide: clearable unless the field is required. */
|
|
1355
1356
|
showClear;
|
|
1356
1357
|
emptyMessage;
|
|
1357
1358
|
size;
|
|
@@ -1368,7 +1369,7 @@ class SelectFieldConfig extends BaseFieldConfig {
|
|
|
1368
1369
|
this.filter = config.filter || false;
|
|
1369
1370
|
this.filterBy = config.filterBy || '';
|
|
1370
1371
|
this.filterPlaceholder = config.filterPlaceholder || 'Search...';
|
|
1371
|
-
this.showClear = config.showClear
|
|
1372
|
+
this.showClear = config.showClear;
|
|
1372
1373
|
this.emptyMessage = config.emptyMessage || 'No options available';
|
|
1373
1374
|
this.size = config.size || '';
|
|
1374
1375
|
this.hasPlaceholderPrefix =
|
|
@@ -2393,6 +2394,46 @@ function clockTimeToSeconds(parts) {
|
|
|
2393
2394
|
return parts.hours * 3600 + parts.minutes * 60 + parts.seconds;
|
|
2394
2395
|
}
|
|
2395
2396
|
|
|
2397
|
+
/**
|
|
2398
|
+
* Helpers for `Checkbox` property values — a boolean the backend stores and
|
|
2399
|
+
* returns as **text**.
|
|
2400
|
+
*
|
|
2401
|
+
* A property value is persisted as a string, and the render pipeline formats a
|
|
2402
|
+
* checkbox as the literal `"True"` / `"False"` (`PropertyRenderingService`), so
|
|
2403
|
+
* a loaded checkbox arrives as `'True'`, not `true`. `mt-toggle-field` hands
|
|
2404
|
+
* whatever it is given straight to `p-toggleswitch`, which decides "checked" by
|
|
2405
|
+
* `modelValue === trueValue` — a strict comparison a string can never win. The
|
|
2406
|
+
* result is a checked record whose edit form renders every toggle off, and a
|
|
2407
|
+
* silent flip to `false` the moment the user saves without touching it.
|
|
2408
|
+
*
|
|
2409
|
+
* The truth set mirrors the backend's own `string.ToBool()`, which accepts
|
|
2410
|
+
* `1` / `true` / `yes` / `ok` case-insensitively.
|
|
2411
|
+
*/
|
|
2412
|
+
const TRUTHY_CHECKBOX_TOKENS = new Set(['1', 'true', 'yes', 'ok']);
|
|
2413
|
+
/**
|
|
2414
|
+
* Coerce a stored checkbox value to a real boolean.
|
|
2415
|
+
*
|
|
2416
|
+
* Returns `null` for a value that was never set (`null`, `undefined`, blank
|
|
2417
|
+
* text) rather than `false`, so an untouched checkbox stays "empty" for the
|
|
2418
|
+
* callers that decide whether a field carries anything to submit.
|
|
2419
|
+
*/
|
|
2420
|
+
function coerceCheckboxValue(value) {
|
|
2421
|
+
if (typeof value === 'boolean')
|
|
2422
|
+
return value;
|
|
2423
|
+
if (value === null || value === undefined)
|
|
2424
|
+
return null;
|
|
2425
|
+
if (typeof value === 'number') {
|
|
2426
|
+
return Number.isNaN(value) ? null : value !== 0;
|
|
2427
|
+
}
|
|
2428
|
+
if (typeof value === 'string') {
|
|
2429
|
+
const normalized = value.trim().toLowerCase();
|
|
2430
|
+
if (!normalized)
|
|
2431
|
+
return null;
|
|
2432
|
+
return TRUTHY_CHECKBOX_TOKENS.has(normalized);
|
|
2433
|
+
}
|
|
2434
|
+
return null;
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2396
2437
|
class MTDateFormatPipe {
|
|
2397
2438
|
locale = inject(LOCALE_ID);
|
|
2398
2439
|
formats = inject(MT_DATE_FORMATS);
|
|
@@ -2473,5 +2514,5 @@ function parseDateOnlyValue(value) {
|
|
|
2473
2514
|
* Generated bundle index. Do not edit.
|
|
2474
2515
|
*/
|
|
2475
2516
|
|
|
2476
|
-
export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DS_BLUE, DS_CHART_SERIES, DS_CONTROL_HEIGHT, DS_DEFAULT_PRIMARY_COLOR, DS_ERROR, DS_FONT_FAMILY, DS_GRAY, DS_INDIGO, DS_RADIUS, DS_SEMANTIC, DS_SHADOW, DS_SUCCESS, DS_WARNING, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MT_DESIGN_IDENTITY_CLASS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, READABLE_DARK_INK, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, WCAG_AA_NORMAL_TEXT, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, contrastRatio, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid, newFieldId, parseClockTime, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, readableTextOn, relativeLuminance, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
|
|
2517
|
+
export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DS_BLUE, DS_CHART_SERIES, DS_CONTROL_HEIGHT, DS_DEFAULT_PRIMARY_COLOR, DS_ERROR, DS_FONT_FAMILY, DS_GRAY, DS_INDIGO, DS_RADIUS, DS_SEMANTIC, DS_SHADOW, DS_SUCCESS, DS_WARNING, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MT_DESIGN_IDENTITY_CLASS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, READABLE_DARK_INK, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, WCAG_AA_NORMAL_TEXT, applyDesignIdentityClass, changeBackgroundColor, changePrimaryColor, changeTextColor, clockTimeToSeconds, coerceCheckboxValue, contrastRatio, createCustomValidator, createEntityAdapter, dsChartSeries, dsIdentityConfigs, endLoading, formatClockTime, generateTailwindPalette, getContrastColor, getLightColor, getMTDesignIdentity, handleApiRequest, isInvalid, newFieldId, parseClockTime, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, readableTextOn, relativeLuminance, setLoadingError, setMTDesignIdentity, startLoading, toAngularDateFormat, toClockTimeParts, wrapValidatorWithMessage };
|
|
2477
2518
|
//# sourceMappingURL=masterteam-components.mjs.map
|