@mmlogic/components 0.5.4 → 0.5.6

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.
Files changed (30) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mosterdcomponents.cjs.js +1 -1
  3. package/dist/cjs/mrd-boolean-field_25.cjs.entry.js +86 -12
  4. package/dist/collection/components/fields/mrd-currency-field/mrd-currency-field.js +56 -5
  5. package/dist/collection/components/fields/mrd-number-field/mrd-number-field.js +33 -8
  6. package/dist/collection/dev/app.js +58 -13
  7. package/dist/components/cell-renderer.js +1 -1
  8. package/dist/components/format.js +1 -1
  9. package/dist/components/mrd-currency-field2.js +1 -1
  10. package/dist/components/mrd-document-list2.js +1 -1
  11. package/dist/components/mrd-document-view2.js +1 -1
  12. package/dist/components/mrd-email-view2.js +1 -1
  13. package/dist/components/mrd-invoice-view2.js +1 -1
  14. package/dist/components/mrd-layout-section.js +1 -1
  15. package/dist/components/mrd-merge-view.js +1 -1
  16. package/dist/components/mrd-number-field2.js +1 -1
  17. package/dist/components/mrd-table2.js +1 -1
  18. package/dist/esm/{cell-renderer-C2FLUrMN.js → cell-renderer-Dd_PKH0_.js} +1 -1
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/esm/mosterdcomponents.js +1 -1
  21. package/dist/esm/mrd-boolean-field_25.entry.js +87 -13
  22. package/dist/esm/mrd-merge-view.entry.js +1 -1
  23. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  24. package/dist/mosterdcomponents/{p-4ea5b97c.entry.js → p-1fc897f4.entry.js} +1 -1
  25. package/dist/mosterdcomponents/p-53b00783.entry.js +3 -0
  26. package/dist/mosterdcomponents/{p-BgsPVesg.js → p-CGm4ff1O.js} +1 -1
  27. package/dist/types/components/fields/mrd-currency-field/mrd-currency-field.d.ts +13 -0
  28. package/dist/types/components/fields/mrd-number-field/mrd-number-field.d.ts +6 -0
  29. package/package.json +1 -1
  30. package/dist/mosterdcomponents/p-8736313b.entry.js +0 -3
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["mrd-merge-view.cjs",[[2,"mrd-merge-view",{"locale":[1],"basicType":[1,"basic-type"],"mostSignificantClass":[1,"most-significant-class"],"fields":[16],"currentHref":[1,"current-href"],"currentRecord":[16],"currentLabel":[1,"current-label"],"step":[32],"searchQuery":[32],"searchResults":[32],"isLoading":[32],"candidate":[32],"resolutions":[32],"openHistoryKey":[32],"setSearchResults":[64],"setLoading":[64]}]]],["mrd-boolean-field_25.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"me":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}],"me":[{"meChanged":0}]}],[2,"mrd-layout-section",{"items":[16],"data":[16],"views":[16],"links":[16],"locale":[1],"archetypes":[16],"searchQueryMap":[32],"searchResultsMap":[32],"imagePreviewUrl":[32],"imagePreviews":[32],"openHistoryField":[32],"setSearchResults":[64],"setViewPage":[64],"setViewAggregations":[64],"setViewDistinct":[64],"setViewFileReference":[64],"setViewCreatedObject":[64],"setImagePreview":[64],"openImagePreview":[64]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16],"historyEntries":[32],"currentValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-container",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"viewKey":[1,"view-key"],"height":[2],"locale":[1],"mode":[32],"canCreate":[32],"targetLabel":[32]}],[2,"mrd-document-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-email-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[262,"mrd-invoice-view",{"archetype":[16],"data":[16],"locale":[1],"statusListItems":[16]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"localValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-list",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"locale":[1],"containers":[32],"rootLoading":[32],"singleContainer":[32],"selectedId":[32],"dropTargetId":[32],"uploadingNodeId":[32],"rootDropActive":[32],"setDistinct":[64],"setDocuments":[64],"createFolder":[64],"uploadFile":[64],"setFileReference":[64],"setCreatedHref":[64]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"internalHref":[32],"internalName":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-longtext-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]},null,{"allRecords":[{"allRecordsChanged":0}],"value":[{"valueChanged":0}]}],[2,"mrd-secret-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-table",{"item":[16],"parentId":[1,"parent-id"],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"requestTimeoutMs":[2,"request-timeout-ms"],"activeViewIdx":[32],"loadedPages":[32],"requestedPages":[32],"failedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"createPickerOpen":[32],"viewPopoverOpen":[32],"scrollTop":[32],"textblockModal":[32],"jsonModal":[32],"aggregations":[32],"aggregationsTotal":[32],"minKnownTotal":[32],"init":[64],"setPage":[64],"setAggregations":[64]},null,{"totalElements":[{"totalElementsChanged":0}],"item":[{"itemChanged":0}]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
9
+ return index.bootstrapLazy([["mrd-merge-view.cjs",[[2,"mrd-merge-view",{"locale":[1],"basicType":[1,"basic-type"],"mostSignificantClass":[1,"most-significant-class"],"fields":[16],"currentHref":[1,"current-href"],"currentRecord":[16],"currentLabel":[1,"current-label"],"step":[32],"searchQuery":[32],"searchResults":[32],"isLoading":[32],"candidate":[32],"resolutions":[32],"openHistoryKey":[32],"setSearchResults":[64],"setLoading":[64]}]]],["mrd-boolean-field_25.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"me":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}],"me":[{"meChanged":0}]}],[2,"mrd-layout-section",{"items":[16],"data":[16],"views":[16],"links":[16],"locale":[1],"archetypes":[16],"searchQueryMap":[32],"searchResultsMap":[32],"imagePreviewUrl":[32],"imagePreviews":[32],"openHistoryField":[32],"setSearchResults":[64],"setViewPage":[64],"setViewAggregations":[64],"setViewDistinct":[64],"setViewFileReference":[64],"setViewCreatedObject":[64],"setImagePreview":[64],"openImagePreview":[64]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16],"historyEntries":[32],"currentValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-container",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"viewKey":[1,"view-key"],"height":[2],"locale":[1],"mode":[32],"canCreate":[32],"targetLabel":[32]}],[2,"mrd-document-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-email-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[262,"mrd-invoice-view",{"archetype":[16],"data":[16],"locale":[1],"statusListItems":[16]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]},null,{"value":[{"valueChanged":0}],"locale":[{"localeChanged":0}]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"localValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-list",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"locale":[1],"containers":[32],"rootLoading":[32],"singleContainer":[32],"selectedId":[32],"dropTargetId":[32],"uploadingNodeId":[32],"rootDropActive":[32],"setDistinct":[64],"setDocuments":[64],"createFolder":[64],"uploadFile":[64],"setFileReference":[64],"setCreatedHref":[64]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"internalHref":[32],"internalName":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-longtext-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]},null,{"value":[{"valueChanged":0}],"locale":[{"localeChanged":0}]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]},null,{"allRecords":[{"allRecordsChanged":0}],"value":[{"valueChanged":0}]}],[2,"mrd-secret-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-table",{"item":[16],"parentId":[1,"parent-id"],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"requestTimeoutMs":[2,"request-timeout-ms"],"activeViewIdx":[32],"loadedPages":[32],"requestedPages":[32],"failedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"createPickerOpen":[32],"viewPopoverOpen":[32],"scrollTop":[32],"textblockModal":[32],"jsonModal":[32],"aggregations":[32],"aggregationsTotal":[32],"minKnownTotal":[32],"init":[64],"setPage":[64],"setAggregations":[64]},null,{"totalElements":[{"totalElementsChanged":0}],"item":[{"itemChanged":0}]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["mrd-merge-view.cjs",[[2,"mrd-merge-view",{"locale":[1],"basicType":[1,"basic-type"],"mostSignificantClass":[1,"most-significant-class"],"fields":[16],"currentHref":[1,"current-href"],"currentRecord":[16],"currentLabel":[1,"current-label"],"step":[32],"searchQuery":[32],"searchResults":[32],"isLoading":[32],"candidate":[32],"resolutions":[32],"openHistoryKey":[32],"setSearchResults":[64],"setLoading":[64]}]]],["mrd-boolean-field_25.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"me":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}],"me":[{"meChanged":0}]}],[2,"mrd-layout-section",{"items":[16],"data":[16],"views":[16],"links":[16],"locale":[1],"archetypes":[16],"searchQueryMap":[32],"searchResultsMap":[32],"imagePreviewUrl":[32],"imagePreviews":[32],"openHistoryField":[32],"setSearchResults":[64],"setViewPage":[64],"setViewAggregations":[64],"setViewDistinct":[64],"setViewFileReference":[64],"setViewCreatedObject":[64],"setImagePreview":[64],"openImagePreview":[64]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16],"historyEntries":[32],"currentValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-container",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"viewKey":[1,"view-key"],"height":[2],"locale":[1],"mode":[32],"canCreate":[32],"targetLabel":[32]}],[2,"mrd-document-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-email-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[262,"mrd-invoice-view",{"archetype":[16],"data":[16],"locale":[1],"statusListItems":[16]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"localValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-list",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"locale":[1],"containers":[32],"rootLoading":[32],"singleContainer":[32],"selectedId":[32],"dropTargetId":[32],"uploadingNodeId":[32],"rootDropActive":[32],"setDistinct":[64],"setDocuments":[64],"createFolder":[64],"uploadFile":[64],"setFileReference":[64],"setCreatedHref":[64]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"internalHref":[32],"internalName":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-longtext-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]},null,{"allRecords":[{"allRecordsChanged":0}],"value":[{"valueChanged":0}]}],[2,"mrd-secret-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-table",{"item":[16],"parentId":[1,"parent-id"],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"requestTimeoutMs":[2,"request-timeout-ms"],"activeViewIdx":[32],"loadedPages":[32],"requestedPages":[32],"failedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"createPickerOpen":[32],"viewPopoverOpen":[32],"scrollTop":[32],"textblockModal":[32],"jsonModal":[32],"aggregations":[32],"aggregationsTotal":[32],"minKnownTotal":[32],"init":[64],"setPage":[64],"setAggregations":[64]},null,{"totalElements":[{"totalElementsChanged":0}],"item":[{"itemChanged":0}]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
22
+ return index.bootstrapLazy([["mrd-merge-view.cjs",[[2,"mrd-merge-view",{"locale":[1],"basicType":[1,"basic-type"],"mostSignificantClass":[1,"most-significant-class"],"fields":[16],"currentHref":[1,"current-href"],"currentRecord":[16],"currentLabel":[1,"current-label"],"step":[32],"searchQuery":[32],"searchResults":[32],"isLoading":[32],"candidate":[32],"resolutions":[32],"openHistoryKey":[32],"setSearchResults":[64],"setLoading":[64]}]]],["mrd-boolean-field_25.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"referenceHref":[1,"reference-href"],"referenceClass":[1,"reference-class"],"showCancel":[4,"show-cancel"],"me":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}],"me":[{"meChanged":0}]}],[2,"mrd-layout-section",{"items":[16],"data":[16],"views":[16],"links":[16],"locale":[1],"archetypes":[16],"searchQueryMap":[32],"searchResultsMap":[32],"imagePreviewUrl":[32],"imagePreviews":[32],"openHistoryField":[32],"setSearchResults":[64],"setViewPage":[64],"setViewAggregations":[64],"setViewDistinct":[64],"setViewFileReference":[64],"setViewCreatedObject":[64],"setImagePreview":[64],"openImagePreview":[64]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16],"historyEntries":[32],"currentValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-container",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"viewKey":[1,"view-key"],"height":[2],"locale":[1],"mode":[32],"canCreate":[32],"targetLabel":[32]}],[2,"mrd-document-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-email-view",{"archetype":[16],"data":[16],"locale":[1]},null,{"data":[{"dataChanged":0}]}],[262,"mrd-invoice-view",{"archetype":[16],"data":[16],"locale":[1],"statusListItems":[16]},null,{"data":[{"dataChanged":0}]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]},null,{"value":[{"valueChanged":0}],"locale":[{"localeChanged":0}]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"localValue":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-document-list",{"item":[16],"archetype":[16],"parentId":[1,"parent-id"],"containerHref":[1,"container-href"],"locale":[1],"containers":[32],"rootLoading":[32],"singleContainer":[32],"selectedId":[32],"dropTargetId":[32],"uploadingNodeId":[32],"rootDropActive":[32],"setDistinct":[64],"setDocuments":[64],"createFolder":[64],"uploadFile":[64],"setFileReference":[64],"setCreatedHref":[64]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"internalHref":[32],"internalName":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-image-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"multiple":[4],"entries":[32],"isDragging":[32],"error":[32]},null,{"value":[{"valueChanged":0}]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-longtext-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]},null,{"value":[{"valueChanged":0}],"locale":[{"localeChanged":0}]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"mostSignificantClass":[1,"most-significant-class"],"displayType":[1,"display-type"],"editBehavior":[1,"edit-behavior"],"commonRelation":[1,"common-relation"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"allRecords":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setAllRecords":[64],"setSearchResults":[64],"setLoading":[64]},null,{"allRecords":[{"allRecordsChanged":0}],"value":[{"valueChanged":0}]}],[2,"mrd-secret-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-table",{"item":[16],"parentId":[1,"parent-id"],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"requestTimeoutMs":[2,"request-timeout-ms"],"activeViewIdx":[32],"loadedPages":[32],"requestedPages":[32],"failedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"filterMode":[32],"activeFilters":[32],"openFilterCol":[32],"pendingFilter":[32],"popupPos":[32],"createPickerOpen":[32],"viewPopoverOpen":[32],"scrollTop":[32],"textblockModal":[32],"jsonModal":[32],"aggregations":[32],"aggregationsTotal":[32],"minKnownTotal":[32],"init":[64],"setPage":[64],"setAggregations":[64]},null,{"totalElements":[{"totalElementsChanged":0}],"item":[{"itemChanged":0}]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -121,13 +121,26 @@ const MrdCurrencyField = class {
121
121
  this.amountDisplay = '';
122
122
  this.currency = 'EUR';
123
123
  this.error = '';
124
+ /** While focused the user owns the text; prop updates must not overwrite it. */
125
+ this.focused = false;
124
126
  this.handleAmountInput = (e) => {
125
127
  this.amountDisplay = e.target.value;
126
128
  };
129
+ this.handleAmountFocus = () => {
130
+ this.focused = true;
131
+ // Drop the grouping separators while editing, but keep the locale's decimal
132
+ // separator: String(1234.56) would be re-read as 123456 where '.' groups.
133
+ const parsed = cellRenderer.parseLocalizedNumber(this.amountDisplay, this.locale);
134
+ if (parsed !== null) {
135
+ this.amountDisplay = cellRenderer.formatNumber(parsed, this.locale, { useGrouping: false, maximumFractionDigits: 20 });
136
+ }
137
+ };
127
138
  this.handleAmountBlur = (e) => {
139
+ this.focused = false;
128
140
  const raw = e.target.value;
129
141
  const parsed = cellRenderer.parseLocalizedNumber(raw, this.locale);
130
142
  this.error = requiredError(raw, this.required, this.locale);
143
+ this.amountDisplay = parsed !== null ? this.formatAmount(parsed) : '';
131
144
  const val = { amount: parsed, currency: this.currency };
132
145
  this.mrdChange.emit({ name: this.name, value: val });
133
146
  this.mrdBlur.emit({ name: this.name, value: val });
@@ -139,15 +152,52 @@ const MrdCurrencyField = class {
139
152
  };
140
153
  }
141
154
  componentWillLoad() {
142
- if (this.value) {
143
- this.currency = this.value.currency || 'EUR';
144
- this.amountDisplay = this.value.amount !== null ? String(this.value.amount) : '';
155
+ this.syncFromValue();
156
+ }
157
+ componentDidRender() {
158
+ // A rendered `selected` attribute is ignored once the select has an established
159
+ // value, so the currency is applied imperatively — same reason as the DROPDOWN
160
+ // preselect in mrd-relation-field. Without this an edit-mode record that loads
161
+ // after mount keeps showing EUR and would be saved back with the wrong currency.
162
+ if (this.selectEl && this.selectEl.value !== this.currency) {
163
+ this.selectEl.value = this.currency;
145
164
  }
146
165
  }
166
+ /** The record's own currency may sit outside the common list; never drop it. */
167
+ currencyOptions() {
168
+ return COMMON_CURRENCIES.includes(this.currency) ? COMMON_CURRENCIES : [this.currency, ...COMMON_CURRENCIES];
169
+ }
170
+ /** Edit mode loads the record after mount, so the incoming value must re-sync. */
171
+ valueChanged() {
172
+ if (!this.focused)
173
+ this.syncFromValue();
174
+ }
175
+ localeChanged() {
176
+ if (!this.focused)
177
+ this.syncFromValue();
178
+ }
179
+ syncFromValue() {
180
+ const value = this.value;
181
+ this.currency = (value === null || value === void 0 ? void 0 : value.currency) || 'EUR';
182
+ this.amountDisplay =
183
+ (value === null || value === void 0 ? void 0 : value.amount) !== null && (value === null || value === void 0 ? void 0 : value.amount) !== undefined ? this.formatAmount(value.amount) : '';
184
+ }
185
+ /** Display form: locale separators, always two decimals. The ISO code sits in the select. */
186
+ formatAmount(amount) {
187
+ return cellRenderer.formatNumber(amount, this.locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
188
+ }
147
189
  render() {
148
190
  const hasError = !!this.error;
149
- return (index.h(index.Host, { key: 'e1a76ab778820c0d781d5ec1549448716d368c1f' }, index.h("div", { key: '8298720abac7f689fe3e697c3c4410702e6a87f2', class: "mrd-currency-field" }, index.h(FieldLabel, { key: 'b23782aef9a866f1fb72e152cb91aeae00a975fa', base: "mrd-currency-field", label: this.label, required: this.required }), index.h("div", { key: '51e5177f9be3c5a6bdf3a5c1187f9261fcc349cf', class: "mrd-currency-field__row" }, index.h("input", { key: 'c6bda6cc92f3a2a34861d44b6163d417e200a6e4', class: controlClass('mrd-currency-field', hasError, 'amount'), type: "text", inputMode: "decimal", name: `${this.name}_amount`, value: this.amountDisplay, placeholder: "0.00", required: this.required, disabled: this.disabled, onInput: this.handleAmountInput, onBlur: this.handleAmountBlur }), index.h("select", { key: '29231cfa142d26aa81594609f1bf7bd5168df073', class: "mrd-currency-field__currency", disabled: this.disabled, onChange: this.handleCurrencyChange }, COMMON_CURRENCIES.map(c => (index.h("option", { key: c, value: c, selected: c === this.currency }, c))))), index.h(FieldError, { key: 'bea9615466427631f08a6ac8a779ae77695d36e3', base: "mrd-currency-field", error: this.error }))));
191
+ return (index.h(index.Host, { key: '43ef1fe660c4eaef025203544916b077975b6aa3' }, index.h("div", { key: '00b8e79182c8e2a353d57ad5c341024caf00d4ea', class: "mrd-currency-field" }, index.h(FieldLabel, { key: '96835c311e0d490864c484b818f1dcc623f488b2', base: "mrd-currency-field", label: this.label, required: this.required }), index.h("div", { key: '80317cfe562af00cc4cbf9aabf4bac2126cf6fe5', class: "mrd-currency-field__row" }, index.h("input", { key: '1983ef1e4d19e0fc529cf5e8be7d287fea36620a', class: controlClass('mrd-currency-field', hasError, 'amount'), type: "text", inputMode: "decimal", name: `${this.name}_amount`, value: this.amountDisplay, placeholder: this.formatAmount(0), required: this.required, disabled: this.disabled, onInput: this.handleAmountInput, onFocus: this.handleAmountFocus, onBlur: this.handleAmountBlur }), index.h("select", { key: 'b5fe3f03590bebaa564d76bc5fcb47c327eacece', class: "mrd-currency-field__currency", ref: el => (this.selectEl = el), disabled: this.disabled, onChange: this.handleCurrencyChange }, this.currencyOptions().map(c => (index.h("option", { key: c, value: c, selected: c === this.currency }, c))))), index.h(FieldError, { key: '1a128b26293170d4137f787622d4e89a23e62c0b', base: "mrd-currency-field", error: this.error }))));
150
192
  }
193
+ static get watchers() { return {
194
+ "value": [{
195
+ "valueChanged": 0
196
+ }],
197
+ "locale": [{
198
+ "localeChanged": 0
199
+ }]
200
+ }; }
151
201
  };
152
202
  MrdCurrencyField.style = mrdCurrencyFieldCss();
153
203
 
@@ -5736,10 +5786,13 @@ const MrdNumberField = class {
5736
5786
  this.decimalPrecision = 2;
5737
5787
  this.displayValue = '';
5738
5788
  this.error = '';
5789
+ /** While focused the user owns the text; prop updates must not overwrite it. */
5790
+ this.focused = false;
5739
5791
  this.handleInput = (e) => {
5740
5792
  this.displayValue = e.target.value;
5741
5793
  };
5742
5794
  this.handleBlur = (e) => {
5795
+ this.focused = false;
5743
5796
  const raw = e.target.value;
5744
5797
  const parsed = cellRenderer.parseLocalizedNumber(raw, this.locale);
5745
5798
  if (this.required && (parsed === null || raw === '')) {
@@ -5758,17 +5811,30 @@ const MrdNumberField = class {
5758
5811
  this.mrdBlur.emit({ name: this.name, value: parsed });
5759
5812
  };
5760
5813
  this.handleFocus = () => {
5761
- // Show raw number on focus
5762
- if (this.value !== null && this.value !== undefined) {
5763
- const str = String(this.value);
5764
- this.displayValue = str;
5814
+ this.focused = true;
5815
+ // Drop the grouping separators while editing, but keep the locale's decimal
5816
+ // separator: String(1234.56) would be re-read as 123456 where '.' groups.
5817
+ const parsed = cellRenderer.parseLocalizedNumber(this.displayValue, this.locale);
5818
+ if (parsed !== null) {
5819
+ this.displayValue = cellRenderer.formatNumber(parsed, this.locale, { useGrouping: false, maximumFractionDigits: 20 });
5765
5820
  }
5766
5821
  };
5767
5822
  }
5768
5823
  componentWillLoad() {
5769
- if (this.value !== null && this.value !== undefined) {
5770
- this.displayValue = this.formatForDisplay(this.value);
5771
- }
5824
+ this.syncFromValue();
5825
+ }
5826
+ /** Edit mode loads the record after mount, so the incoming value must re-sync. */
5827
+ valueChanged() {
5828
+ if (!this.focused)
5829
+ this.syncFromValue();
5830
+ }
5831
+ localeChanged() {
5832
+ if (!this.focused)
5833
+ this.syncFromValue();
5834
+ }
5835
+ syncFromValue() {
5836
+ this.displayValue =
5837
+ this.value !== null && this.value !== undefined ? this.formatForDisplay(this.value) : '';
5772
5838
  }
5773
5839
  formatForDisplay(val) {
5774
5840
  if (this.dataType === clientLayout.ClientLayoutItemFieldDataType.PERCENTAGE) {
@@ -5789,8 +5855,16 @@ const MrdNumberField = class {
5789
5855
  const hasError = !!this.error;
5790
5856
  const suffix = this.dataType === clientLayout.ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
5791
5857
  this.dataType === clientLayout.ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
5792
- return (index.h(index.Host, { key: '5df5c2e16c85cd54944d95b7a8c340ae1a4ddb34' }, index.h("div", { key: 'e332bd0190d537c002b14090fa96ec6502e34746', class: "mrd-number-field" }, index.h(FieldLabel, { key: 'e26ae85ef6c6d7935b2d34041a7ee2294da392a4', base: "mrd-number-field", label: this.label, required: this.required }), index.h("div", { key: 'fb1a44a363a36b69124a0092e80b67d41b538c03', class: "mrd-number-field__input-wrapper" }, index.h("input", { key: '175c448177bbd46015fc7f47b98b76e16ee3b743', class: controlClass('mrd-number-field', hasError), type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), index.h(FieldError, { key: 'ecb16ddf655e563f0569e774ab2f2e419f60b0f1', base: "mrd-number-field", error: this.error }))));
5858
+ return (index.h(index.Host, { key: '7343dbca882b5054f22de17672ac748a8e3eca11' }, index.h("div", { key: 'cef10b39515b48fc9c44e651910c6a0c2a847628', class: "mrd-number-field" }, index.h(FieldLabel, { key: '66f178cf20f1f2f0587bd9614db150d6ae63023e', base: "mrd-number-field", label: this.label, required: this.required }), index.h("div", { key: 'c57c22e663a570f6e5a70b07b817970f135e850c', class: "mrd-number-field__input-wrapper" }, index.h("input", { key: '388b20ac11fa4aaf78df124c858b579e12f53619', class: controlClass('mrd-number-field', hasError), type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), index.h(FieldError, { key: 'f99bb85668b047a97162ffee2582eb45dc0589ae', base: "mrd-number-field", error: this.error }))));
5793
5859
  }
5860
+ static get watchers() { return {
5861
+ "value": [{
5862
+ "valueChanged": 0
5863
+ }],
5864
+ "locale": [{
5865
+ "localeChanged": 0
5866
+ }]
5867
+ }; }
5794
5868
  };
5795
5869
  MrdNumberField.style = mrdNumberFieldCss();
5796
5870
 
@@ -1,5 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { parseLocalizedNumber } from "../../../utils/format";
2
+ import { formatNumber, parseLocalizedNumber } from "../../../utils/format";
3
3
  import { FieldLabel, FieldError, controlClass, requiredError } from "../field-helpers";
4
4
  const COMMON_CURRENCIES = [
5
5
  'EUR', 'USD', 'GBP', 'CHF', 'JPY', 'CNY', 'AUD', 'CAD',
@@ -17,13 +17,26 @@ export class MrdCurrencyField {
17
17
  this.amountDisplay = '';
18
18
  this.currency = 'EUR';
19
19
  this.error = '';
20
+ /** While focused the user owns the text; prop updates must not overwrite it. */
21
+ this.focused = false;
20
22
  this.handleAmountInput = (e) => {
21
23
  this.amountDisplay = e.target.value;
22
24
  };
25
+ this.handleAmountFocus = () => {
26
+ this.focused = true;
27
+ // Drop the grouping separators while editing, but keep the locale's decimal
28
+ // separator: String(1234.56) would be re-read as 123456 where '.' groups.
29
+ const parsed = parseLocalizedNumber(this.amountDisplay, this.locale);
30
+ if (parsed !== null) {
31
+ this.amountDisplay = formatNumber(parsed, this.locale, { useGrouping: false, maximumFractionDigits: 20 });
32
+ }
33
+ };
23
34
  this.handleAmountBlur = (e) => {
35
+ this.focused = false;
24
36
  const raw = e.target.value;
25
37
  const parsed = parseLocalizedNumber(raw, this.locale);
26
38
  this.error = requiredError(raw, this.required, this.locale);
39
+ this.amountDisplay = parsed !== null ? this.formatAmount(parsed) : '';
27
40
  const val = { amount: parsed, currency: this.currency };
28
41
  this.mrdChange.emit({ name: this.name, value: val });
29
42
  this.mrdBlur.emit({ name: this.name, value: val });
@@ -35,14 +48,43 @@ export class MrdCurrencyField {
35
48
  };
36
49
  }
37
50
  componentWillLoad() {
38
- if (this.value) {
39
- this.currency = this.value.currency || 'EUR';
40
- this.amountDisplay = this.value.amount !== null ? String(this.value.amount) : '';
51
+ this.syncFromValue();
52
+ }
53
+ componentDidRender() {
54
+ // A rendered `selected` attribute is ignored once the select has an established
55
+ // value, so the currency is applied imperatively — same reason as the DROPDOWN
56
+ // preselect in mrd-relation-field. Without this an edit-mode record that loads
57
+ // after mount keeps showing EUR and would be saved back with the wrong currency.
58
+ if (this.selectEl && this.selectEl.value !== this.currency) {
59
+ this.selectEl.value = this.currency;
41
60
  }
42
61
  }
62
+ /** The record's own currency may sit outside the common list; never drop it. */
63
+ currencyOptions() {
64
+ return COMMON_CURRENCIES.includes(this.currency) ? COMMON_CURRENCIES : [this.currency, ...COMMON_CURRENCIES];
65
+ }
66
+ /** Edit mode loads the record after mount, so the incoming value must re-sync. */
67
+ valueChanged() {
68
+ if (!this.focused)
69
+ this.syncFromValue();
70
+ }
71
+ localeChanged() {
72
+ if (!this.focused)
73
+ this.syncFromValue();
74
+ }
75
+ syncFromValue() {
76
+ const value = this.value;
77
+ this.currency = (value === null || value === void 0 ? void 0 : value.currency) || 'EUR';
78
+ this.amountDisplay =
79
+ (value === null || value === void 0 ? void 0 : value.amount) !== null && (value === null || value === void 0 ? void 0 : value.amount) !== undefined ? this.formatAmount(value.amount) : '';
80
+ }
81
+ /** Display form: locale separators, always two decimals. The ISO code sits in the select. */
82
+ formatAmount(amount) {
83
+ return formatNumber(amount, this.locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
84
+ }
43
85
  render() {
44
86
  const hasError = !!this.error;
45
- return (h(Host, { key: 'e1a76ab778820c0d781d5ec1549448716d368c1f' }, h("div", { key: '8298720abac7f689fe3e697c3c4410702e6a87f2', class: "mrd-currency-field" }, h(FieldLabel, { key: 'b23782aef9a866f1fb72e152cb91aeae00a975fa', base: "mrd-currency-field", label: this.label, required: this.required }), h("div", { key: '51e5177f9be3c5a6bdf3a5c1187f9261fcc349cf', class: "mrd-currency-field__row" }, h("input", { key: 'c6bda6cc92f3a2a34861d44b6163d417e200a6e4', class: controlClass('mrd-currency-field', hasError, 'amount'), type: "text", inputMode: "decimal", name: `${this.name}_amount`, value: this.amountDisplay, placeholder: "0.00", required: this.required, disabled: this.disabled, onInput: this.handleAmountInput, onBlur: this.handleAmountBlur }), h("select", { key: '29231cfa142d26aa81594609f1bf7bd5168df073', class: "mrd-currency-field__currency", disabled: this.disabled, onChange: this.handleCurrencyChange }, COMMON_CURRENCIES.map(c => (h("option", { key: c, value: c, selected: c === this.currency }, c))))), h(FieldError, { key: 'bea9615466427631f08a6ac8a779ae77695d36e3', base: "mrd-currency-field", error: this.error }))));
87
+ return (h(Host, { key: '43ef1fe660c4eaef025203544916b077975b6aa3' }, h("div", { key: '00b8e79182c8e2a353d57ad5c341024caf00d4ea', class: "mrd-currency-field" }, h(FieldLabel, { key: '96835c311e0d490864c484b818f1dcc623f488b2', base: "mrd-currency-field", label: this.label, required: this.required }), h("div", { key: '80317cfe562af00cc4cbf9aabf4bac2126cf6fe5', class: "mrd-currency-field__row" }, h("input", { key: '1983ef1e4d19e0fc529cf5e8be7d287fea36620a', class: controlClass('mrd-currency-field', hasError, 'amount'), type: "text", inputMode: "decimal", name: `${this.name}_amount`, value: this.amountDisplay, placeholder: this.formatAmount(0), required: this.required, disabled: this.disabled, onInput: this.handleAmountInput, onFocus: this.handleAmountFocus, onBlur: this.handleAmountBlur }), h("select", { key: 'b5fe3f03590bebaa564d76bc5fcb47c327eacece', class: "mrd-currency-field__currency", ref: el => (this.selectEl = el), disabled: this.disabled, onChange: this.handleCurrencyChange }, this.currencyOptions().map(c => (h("option", { key: c, value: c, selected: c === this.currency }, c))))), h(FieldError, { key: '1a128b26293170d4137f787622d4e89a23e62c0b', base: "mrd-currency-field", error: this.error }))));
46
88
  }
47
89
  static get is() { return "mrd-currency-field"; }
48
90
  static get encapsulation() { return "scoped"; }
@@ -239,4 +281,13 @@ export class MrdCurrencyField {
239
281
  }
240
282
  }];
241
283
  }
284
+ static get watchers() {
285
+ return [{
286
+ "propName": "value",
287
+ "methodName": "valueChanged"
288
+ }, {
289
+ "propName": "locale",
290
+ "methodName": "localeChanged"
291
+ }];
292
+ }
242
293
  }
@@ -17,10 +17,13 @@ export class MrdNumberField {
17
17
  this.decimalPrecision = 2;
18
18
  this.displayValue = '';
19
19
  this.error = '';
20
+ /** While focused the user owns the text; prop updates must not overwrite it. */
21
+ this.focused = false;
20
22
  this.handleInput = (e) => {
21
23
  this.displayValue = e.target.value;
22
24
  };
23
25
  this.handleBlur = (e) => {
26
+ this.focused = false;
24
27
  const raw = e.target.value;
25
28
  const parsed = parseLocalizedNumber(raw, this.locale);
26
29
  if (this.required && (parsed === null || raw === '')) {
@@ -39,17 +42,30 @@ export class MrdNumberField {
39
42
  this.mrdBlur.emit({ name: this.name, value: parsed });
40
43
  };
41
44
  this.handleFocus = () => {
42
- // Show raw number on focus
43
- if (this.value !== null && this.value !== undefined) {
44
- const str = String(this.value);
45
- this.displayValue = str;
45
+ this.focused = true;
46
+ // Drop the grouping separators while editing, but keep the locale's decimal
47
+ // separator: String(1234.56) would be re-read as 123456 where '.' groups.
48
+ const parsed = parseLocalizedNumber(this.displayValue, this.locale);
49
+ if (parsed !== null) {
50
+ this.displayValue = formatNumber(parsed, this.locale, { useGrouping: false, maximumFractionDigits: 20 });
46
51
  }
47
52
  };
48
53
  }
49
54
  componentWillLoad() {
50
- if (this.value !== null && this.value !== undefined) {
51
- this.displayValue = this.formatForDisplay(this.value);
52
- }
55
+ this.syncFromValue();
56
+ }
57
+ /** Edit mode loads the record after mount, so the incoming value must re-sync. */
58
+ valueChanged() {
59
+ if (!this.focused)
60
+ this.syncFromValue();
61
+ }
62
+ localeChanged() {
63
+ if (!this.focused)
64
+ this.syncFromValue();
65
+ }
66
+ syncFromValue() {
67
+ this.displayValue =
68
+ this.value !== null && this.value !== undefined ? this.formatForDisplay(this.value) : '';
53
69
  }
54
70
  formatForDisplay(val) {
55
71
  if (this.dataType === ClientLayoutItemFieldDataType.PERCENTAGE) {
@@ -70,7 +86,7 @@ export class MrdNumberField {
70
86
  const hasError = !!this.error;
71
87
  const suffix = this.dataType === ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
72
88
  this.dataType === ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
73
- return (h(Host, { key: '5df5c2e16c85cd54944d95b7a8c340ae1a4ddb34' }, h("div", { key: 'e332bd0190d537c002b14090fa96ec6502e34746', class: "mrd-number-field" }, h(FieldLabel, { key: 'e26ae85ef6c6d7935b2d34041a7ee2294da392a4', base: "mrd-number-field", label: this.label, required: this.required }), h("div", { key: 'fb1a44a363a36b69124a0092e80b67d41b538c03', class: "mrd-number-field__input-wrapper" }, h("input", { key: '175c448177bbd46015fc7f47b98b76e16ee3b743', class: controlClass('mrd-number-field', hasError), type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), h(FieldError, { key: 'ecb16ddf655e563f0569e774ab2f2e419f60b0f1', base: "mrd-number-field", error: this.error }))));
89
+ return (h(Host, { key: '7343dbca882b5054f22de17672ac748a8e3eca11' }, h("div", { key: 'cef10b39515b48fc9c44e651910c6a0c2a847628', class: "mrd-number-field" }, h(FieldLabel, { key: '66f178cf20f1f2f0587bd9614db150d6ae63023e', base: "mrd-number-field", label: this.label, required: this.required }), h("div", { key: 'c57c22e663a570f6e5a70b07b817970f135e850c', class: "mrd-number-field__input-wrapper" }, h("input", { key: '388b20ac11fa4aaf78df124c858b579e12f53619', class: controlClass('mrd-number-field', hasError), type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), h(FieldError, { key: 'f99bb85668b047a97162ffee2582eb45dc0589ae', base: "mrd-number-field", error: this.error }))));
74
90
  }
75
91
  static get is() { return "mrd-number-field"; }
76
92
  static get encapsulation() { return "scoped"; }
@@ -314,4 +330,13 @@ export class MrdNumberField {
314
330
  }
315
331
  }];
316
332
  }
333
+ static get watchers() {
334
+ return [{
335
+ "propName": "value",
336
+ "methodName": "valueChanged"
337
+ }, {
338
+ "propName": "locale",
339
+ "methodName": "localeChanged"
340
+ }];
341
+ }
317
342
  }
@@ -134,7 +134,7 @@ async function initDetailViewTab() {
134
134
  table.item = window.EXAMPLE_COMPANY_VIEW_ITEM;
135
135
  table.totalElements = window.EXAMPLE_COMPANIES.length;
136
136
  table.pageSize = 20;
137
- table.locale = 'nl-NL';
137
+ table.locale = _locale;
138
138
 
139
139
  // Register before init(): init() emits mrdLoadPage for page 0 itself.
140
140
  table.addEventListener('mrdLoadPage', async (e) => {
@@ -174,7 +174,7 @@ function showCompanyDetail(row) {
174
174
  const section = document.createElement('mrd-layout-section');
175
175
  section.items = layout.items;
176
176
  section.data = company;
177
- section.locale = 'nl-NL';
177
+ section.locale = _locale;
178
178
 
179
179
  section.addEventListener('mrdNavigate', (e) => {
180
180
  logEvent('mrdNavigate', e.detail);
@@ -1136,16 +1136,57 @@ customElements.whenDefined('mrd-form').then(() => {
1136
1136
  form.addEventListener('mrdFetchAll', (e) => { console.log('[mrdFetchAll]', e.detail); logEvent('mrdFetchAll', e.detail); });
1137
1137
  });
1138
1138
 
1139
- document.getElementById('locale-select').addEventListener('change', (e) => {
1140
- _locale = e.target.value;
1141
- const demoForm = document.getElementById('demo-form');
1142
- if (demoForm) demoForm.locale = _locale;
1143
- const liveForm = document.getElementById('live-form');
1144
- if (liveForm) liveForm.locale = _locale;
1145
- // Update actieve section als aanwezig
1146
- const section = document.querySelector('#sections-container mrd-layout-section');
1147
- if (section) section.locale = _locale;
1148
- });
1139
+ /* =====================================================================
1140
+ LOCALE CONTROL
1141
+ ===================================================================== */
1142
+
1143
+ /** Every component that takes a `locale` prop — the control drives all of them. */
1144
+ const LOCALE_HOSTS = [
1145
+ 'mrd-form', 'mrd-layout-section', 'mrd-table', 'mrd-merge-view',
1146
+ 'mrd-document-container', 'mrd-document-list', 'mrd-document-view',
1147
+ 'mrd-invoice-view', 'mrd-email-view',
1148
+ ].join(', ');
1149
+
1150
+ /** Single source of truth: push the selected locale into everything on the page. */
1151
+ function applyLocale(locale) {
1152
+ _locale = locale;
1153
+ document.querySelectorAll(LOCALE_HOSTS).forEach((el) => { el.locale = locale; });
1154
+ renderLocaleHint();
1155
+ }
1156
+
1157
+ /**
1158
+ * Shows what the selected locale does next to what the browser would do on its
1159
+ * own. Those two differ exactly where the `locale` prop earns its keep — the
1160
+ * date fields format by prop, a native date input would follow the browser.
1161
+ */
1162
+ function renderLocaleHint() {
1163
+ const hint = document.getElementById('locale-hint');
1164
+ if (!hint) return;
1165
+ const sample = new Date(2026, 6, 6, 14, 30); // 6 July — day > 12 keeps d/m order readable
1166
+ const format = (loc) => new Intl.DateTimeFormat(loc, {
1167
+ year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit',
1168
+ }).format(sample);
1169
+
1170
+ hint.innerHTML =
1171
+ `<span>prop <code>${escHtml(_locale)}</code> → <b>${escHtml(format(_locale))}</b></span>` +
1172
+ `<span>browser <code>${escHtml(navigator.language)}</code> → <b>${escHtml(format(navigator.language))}</b></span>`;
1173
+ }
1174
+
1175
+ function initLocaleControl() {
1176
+ const select = document.getElementById('locale-select');
1177
+ // The browser locale is worth testing too, even when it is not in the list.
1178
+ if (![...select.options].some((o) => o.value === _locale)) {
1179
+ const option = document.createElement('option');
1180
+ option.value = _locale;
1181
+ option.textContent = `🖥️ Browser (${_locale})`;
1182
+ select.insertBefore(option, select.firstChild);
1183
+ }
1184
+ select.value = _locale;
1185
+ select.addEventListener('change', (e) => applyLocale(e.target.value));
1186
+ applyLocale(_locale);
1187
+ }
1188
+
1189
+ initLocaleControl();
1149
1190
 
1150
1191
  document.getElementById('btn-inject-results').addEventListener('click', () => {
1151
1192
  const relationField = document.querySelector('mrd-relation-field');
@@ -1170,7 +1211,7 @@ document.addEventListener('DOMContentLoaded', async () => {
1170
1211
  const ftSection = document.getElementById('field-types-section');
1171
1212
  ftSection.items = window.EXAMPLE_FIELD_TYPES_ITEMS;
1172
1213
  ftSection.data = window.EXAMPLE_FIELD_TYPES_DATA;
1173
- ftSection.locale = 'nl-NL';
1214
+ ftSection.locale = _locale;
1174
1215
 
1175
1216
  // Simulate host resolving a signed URL for IMAGE fields (thumbnail on load).
1176
1217
  ftSection.addEventListener('mrdLoadImage', (e) => {
@@ -1197,6 +1238,10 @@ document.addEventListener('DOMContentLoaded', async () => {
1197
1238
  ftSection.setSearchResults(mock, dataClass);
1198
1239
  });
1199
1240
 
1241
+ // Re-apply once the whole page is parsed, so components mounted in markup
1242
+ // (and any upgraded after the control ran) all agree on the locale.
1243
+ applyLocale(_locale);
1244
+
1200
1245
  authRestoreSession();
1201
1246
  await authHandleCallback();
1202
1247
 
@@ -1 +1 @@
1
- import{e as r,a as e,f as t,b as n,c as u,d as a}from"./format.js";import{a as l}from"./client-layout.js";class o{static render(r,e,t){var n,u,a,c;if(r.type===l.RELATION){const t=null!==(n=r.name)&&void 0!==n?n:"",l=null===(u=null==e?void 0:e._links)||void 0===u?void 0:u[t];return l?Array.isArray(l)?l.map((r=>{var e;return null!==(e=r.name)&&void 0!==e?e:""})).filter(Boolean).join(", "):null!==(a=l.name)&&void 0!==a?a:"":""}if(r.type!==l.FIELD)return"";const s=null!==(c=r.name)&&void 0!==c?c:"",i=r.dataType,d=r.listItems;let E=null==e?void 0:e[s];return r.historyEnabled&&null!=E&&"object"==typeof E&&!Array.isArray(E)&&"current"in E&&(E=E.current),null==E||""===E?"":(Array.isArray(E)?E:[E]).map((r=>o.renderValue(null!=i?i:"TEXT",r,null!=d?d:[],t))).filter((r=>""!==r)).join(", ")}static renderValue(l,o,c,s){var i,d;switch(l){case"INTEGER":return u(Number(o),s,{maximumFractionDigits:0});case"DECIMAL":return u(Number(o),s);case"PERCENTAGE":return a(Number(o),s);case"CURRENCY":{const{amount:r,currency:e}="object"==typeof o&&null!==o?o:{amount:o,currency:""};return e?n(Number(r),e,s):u(Number(r),s)}case"DATE":return t(o,s);case"DATETIME":return e(o,s);case"TIME":return r(o,s);case"BOOLEAN":return o?"✓":"";case"FILE":case"IMAGE":return"object"==typeof o&&null!==o&&null!==(i=o.fileName)&&void 0!==i?i:"";case"LIST":{const r=c.find((r=>r.key===String(o)));return null!==(d=null==r?void 0:r.label)&&void 0!==d?d:String(o)}case"TEXTBLOCK":{const r=String(o).replace(/<[^>]*>/g,""),e=document.createElement("textarea");return e.innerHTML=r,e.value.trim()}case"LONGTEXT":return String(o).replace(/[\r\n]+/g," ").trim();case"JSON":return("object"==typeof o?JSON.stringify(o):String(o)).replace(/[\r\n]+/g," ").trim();case"SECRET":return o?"••••••••":"";default:return String(o)}}static formatJson(r,e=!1){try{const t="string"==typeof r?JSON.parse(r):r;return(e?JSON.stringify(t):JSON.stringify(t,null,2)).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(r=>{let e="color:#2aa198";return/^"/.test(r)?e=/:$/.test(r)?"color:#881391":"color:#268bd2":/true|false/.test(r)?e="color:#b58900":/null/.test(r)&&(e="color:#dc322f"),`<span style="${e}">${r}</span>`}))}catch(e){return String(r)}}}export{o as C}
1
+ import{e as r,b as e,a as t,c as n,f as u,d as a}from"./format.js";import{a as l}from"./client-layout.js";class o{static render(r,e,t){var n,u,a,c;if(r.type===l.RELATION){const t=null!==(n=r.name)&&void 0!==n?n:"",l=null===(u=null==e?void 0:e._links)||void 0===u?void 0:u[t];return l?Array.isArray(l)?l.map((r=>{var e;return null!==(e=r.name)&&void 0!==e?e:""})).filter(Boolean).join(", "):null!==(a=l.name)&&void 0!==a?a:"":""}if(r.type!==l.FIELD)return"";const s=null!==(c=r.name)&&void 0!==c?c:"",i=r.dataType,d=r.listItems;let E=null==e?void 0:e[s];return r.historyEnabled&&null!=E&&"object"==typeof E&&!Array.isArray(E)&&"current"in E&&(E=E.current),null==E||""===E?"":(Array.isArray(E)?E:[E]).map((r=>o.renderValue(null!=i?i:"TEXT",r,null!=d?d:[],t))).filter((r=>""!==r)).join(", ")}static renderValue(l,o,c,s){var i,d;switch(l){case"INTEGER":return u(Number(o),s,{maximumFractionDigits:0});case"DECIMAL":return u(Number(o),s);case"PERCENTAGE":return a(Number(o),s);case"CURRENCY":{const{amount:r,currency:e}="object"==typeof o&&null!==o?o:{amount:o,currency:""};return e?n(Number(r),e,s):u(Number(r),s)}case"DATE":return t(o,s);case"DATETIME":return e(o,s);case"TIME":return r(o,s);case"BOOLEAN":return o?"✓":"";case"FILE":case"IMAGE":return"object"==typeof o&&null!==o&&null!==(i=o.fileName)&&void 0!==i?i:"";case"LIST":{const r=c.find((r=>r.key===String(o)));return null!==(d=null==r?void 0:r.label)&&void 0!==d?d:String(o)}case"TEXTBLOCK":{const r=String(o).replace(/<[^>]*>/g,""),e=document.createElement("textarea");return e.innerHTML=r,e.value.trim()}case"LONGTEXT":return String(o).replace(/[\r\n]+/g," ").trim();case"JSON":return("object"==typeof o?JSON.stringify(o):String(o)).replace(/[\r\n]+/g," ").trim();case"SECRET":return o?"••••••••":"";default:return String(o)}}static formatJson(r,e=!1){try{const t="string"==typeof r?JSON.parse(r):r;return(e?JSON.stringify(t):JSON.stringify(t,null,2)).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(r=>{let e="color:#2aa198";return/^"/.test(r)?e=/:$/.test(r)?"color:#881391":"color:#268bd2":/true|false/.test(r)?e="color:#b58900":/null/.test(r)&&(e="color:#dc322f"),`<span style="${e}">${r}</span>`}))}catch(e){return String(r)}}}export{o as C}
@@ -1 +1 @@
1
- function n(n,i,t){return null==n||isNaN(n)?"":new Intl.NumberFormat(i,t).format(n)}function i(n,i,t){return null==n||isNaN(n)?"":new Intl.NumberFormat(t,{style:"currency",currency:i,minimumFractionDigits:2,maximumFractionDigits:2}).format(n)}function t(n,i,t=2){return null==n||isNaN(n)?"":new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}).format(n)}function e(n,i){if(!n)return"";const t="string"==typeof n?new Date(n):n;return isNaN(t.getTime())?"":new Intl.DateTimeFormat(i,{year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}function r(n,i){if(!n)return"";const t="string"==typeof n?new Date(n):n;return isNaN(t.getTime())?"":new Intl.DateTimeFormat(i,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function u(n,i){if(!n)return"";const[t,e]=n.split(":").map(Number),r=new Date;return r.setHours(t,e,0,0),new Intl.DateTimeFormat(i,{hour:"2-digit",minute:"2-digit"}).format(r)}function a(n,i){var t,e,r,u;if(!n||!n.trim())return null;const a=new Intl.NumberFormat(i).formatToParts(1234567.89),o=null!==(e=null===(t=a.find((n=>"group"===n.type)))||void 0===t?void 0:t.value)&&void 0!==e?e:",",l=null!==(u=null===(r=a.find((n=>"decimal"===n.type)))||void 0===r?void 0:r.value)&&void 0!==u?u:".",s=n.replace(new RegExp(`\\${o}`,"g"),"").replace(new RegExp(`\\${l}`),".").replace("%","").trim(),c=parseFloat(s);return isNaN(c)?null:c}export{r as a,i as b,n as c,t as d,u as e,e as f,a as p}
1
+ function n(n,i,t){return null==n||isNaN(n)?"":new Intl.NumberFormat(i,t).format(n)}function i(n,i,t){return null==n||isNaN(n)?"":new Intl.NumberFormat(t,{style:"currency",currency:i,minimumFractionDigits:2,maximumFractionDigits:2}).format(n)}function t(n,i,t=2){return null==n||isNaN(n)?"":new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}).format(n)}function e(n,i){if(!n)return"";const t="string"==typeof n?new Date(n):n;return isNaN(t.getTime())?"":new Intl.DateTimeFormat(i,{year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}function r(n,i){if(!n)return"";const t="string"==typeof n?new Date(n):n;return isNaN(t.getTime())?"":new Intl.DateTimeFormat(i,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function u(n,i){if(!n)return"";const[t,e]=n.split(":").map(Number),r=new Date;return r.setHours(t,e,0,0),new Intl.DateTimeFormat(i,{hour:"2-digit",minute:"2-digit"}).format(r)}function a(n,i){var t,e,r,u;if(!n||!n.trim())return null;const a=new Intl.NumberFormat(i).formatToParts(1234567.89),o=null!==(e=null===(t=a.find((n=>"group"===n.type)))||void 0===t?void 0:t.value)&&void 0!==e?e:",",l=null!==(u=null===(r=a.find((n=>"decimal"===n.type)))||void 0===r?void 0:r.value)&&void 0!==u?u:".",s=n.replace(new RegExp(`\\${o}`,"g"),"").replace(new RegExp(`\\${l}`),".").replace("%","").trim(),c=parseFloat(s);return isNaN(c)?null:c}export{e as a,r as b,i as c,t as d,u as e,n as f,a as p}
@@ -1 +1 @@
1
- import{proxyCustomElement as r,HTMLElement as e,createEvent as d,h as c,Host as o,transformTag as i}from"@stencil/core/internal/client";import{p as a}from"./format.js";import{r as t,F as n,c as s,a as l}from"./field-helpers.js";const m=["EUR","USD","GBP","CHF","JPY","CNY","AUD","CAD","SEK","NOK","DKK","NZD","SGD","HKD","PLN","CZK","HUF","MXN","BRL","INR","TRY","ZAR","AED","SAR"],u=r(class extends e{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdChange=d(this,"mrdChange",7),this.mrdBlur=d(this,"mrdBlur",7),this.name="",this.label="",this.value={amount:null,currency:"EUR"},this.required=!1,this.disabled=!1,this.locale=navigator.language,this.amountDisplay="",this.currency="EUR",this.error="",this.handleAmountInput=r=>{this.amountDisplay=r.target.value},this.handleAmountBlur=r=>{const e=r.target.value,d=a(e,this.locale);this.error=t(e,this.required,this.locale);const c={amount:d,currency:this.currency};this.mrdChange.emit({name:this.name,value:c}),this.mrdBlur.emit({name:this.name,value:c})},this.handleCurrencyChange=r=>{this.currency=r.target.value;const e=a(this.amountDisplay,this.locale);this.mrdChange.emit({name:this.name,value:{amount:e,currency:this.currency}})}}componentWillLoad(){this.value&&(this.currency=this.value.currency||"EUR",this.amountDisplay=null!==this.value.amount?String(this.value.amount):"")}render(){const r=!!this.error;return c(o,{key:"e1a76ab778820c0d781d5ec1549448716d368c1f"},c("div",{key:"8298720abac7f689fe3e697c3c4410702e6a87f2",class:"mrd-currency-field"},c(n,{key:"b23782aef9a866f1fb72e152cb91aeae00a975fa",base:"mrd-currency-field",label:this.label,required:this.required}),c("div",{key:"51e5177f9be3c5a6bdf3a5c1187f9261fcc349cf",class:"mrd-currency-field__row"},c("input",{key:"c6bda6cc92f3a2a34861d44b6163d417e200a6e4",class:s("mrd-currency-field",r,"amount"),type:"text",inputMode:"decimal",name:`${this.name}_amount`,value:this.amountDisplay,placeholder:"0.00",required:this.required,disabled:this.disabled,onInput:this.handleAmountInput,onBlur:this.handleAmountBlur}),c("select",{key:"29231cfa142d26aa81594609f1bf7bd5168df073",class:"mrd-currency-field__currency",disabled:this.disabled,onChange:this.handleCurrencyChange},m.map((r=>c("option",{key:r,value:r,selected:r===this.currency},r))))),c(l,{key:"bea9615466427631f08a6ac8a779ae77695d36e3",base:"mrd-currency-field",error:this.error})))}static get style(){return'.sc-mrd-currency-field-h{display:block}.mrd-currency-field.sc-mrd-currency-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-currency-field__label.sc-mrd-currency-field{display:block;font-family:var(--mrd-font-family);font-size:var(--mrd-label-font-size);font-weight:var(--mrd-label-font-weight);color:var(--mrd-label-color)}.mrd-currency-field__label--required.sc-mrd-currency-field::after{content:" *";color:var(--mrd-color-danger)}.mrd-currency-field__row.sc-mrd-currency-field{display:flex;gap:var(--mrd-space-2);align-items:stretch}.mrd-currency-field__amount.sc-mrd-currency-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition);outline:none;appearance:none;box-sizing:border-box}.mrd-currency-field__amount.sc-mrd-currency-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-currency-field__amount.sc-mrd-currency-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-currency-field__amount.sc-mrd-currency-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-currency-field__amount--error.sc-mrd-currency-field{border-color:var(--mrd-border-color-error)}.mrd-currency-field__amount--error.sc-mrd-currency-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-currency-field__amount.sc-mrd-currency-field{flex:1;text-align:right}.mrd-currency-field__currency.sc-mrd-currency-field{width:90px;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-space-2);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-input-color);background-color:var(--mrd-color-neutral-50);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;cursor:pointer;box-sizing:border-box;appearance:none;text-align:center}.mrd-currency-field__currency.sc-mrd-currency-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-currency-field__currency.sc-mrd-currency-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-currency-field__error.sc-mrd-currency-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}'}},[2,"mrd-currency-field",{name:[1],label:[1],value:[16],required:[4],disabled:[4],locale:[1],amountDisplay:[32],currency:[32],error:[32]}]);function f(){"undefined"!=typeof customElements&&["mrd-currency-field"].forEach((r=>{"mrd-currency-field"===r&&(customElements.get(i(r))||customElements.define(i(r),u))}))}export{u as M,f as d}
1
+ import{proxyCustomElement as r,HTMLElement as e,createEvent as i,h as d,Host as c,transformTag as o}from"@stencil/core/internal/client";import{p as t,f as a}from"./format.js";import{r as s,F as n,c as l,a as m}from"./field-helpers.js";const u=["EUR","USD","GBP","CHF","JPY","CNY","AUD","CAD","SEK","NOK","DKK","NZD","SGD","HKD","PLN","CZK","HUF","MXN","BRL","INR","TRY","ZAR","AED","SAR"],h=r(class extends e{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdChange=i(this,"mrdChange",7),this.mrdBlur=i(this,"mrdBlur",7),this.name="",this.label="",this.value={amount:null,currency:"EUR"},this.required=!1,this.disabled=!1,this.locale=navigator.language,this.amountDisplay="",this.currency="EUR",this.error="",this.focused=!1,this.handleAmountInput=r=>{this.amountDisplay=r.target.value},this.handleAmountFocus=()=>{this.focused=!0;const r=t(this.amountDisplay,this.locale);null!==r&&(this.amountDisplay=a(r,this.locale,{useGrouping:!1,maximumFractionDigits:20}))},this.handleAmountBlur=r=>{this.focused=!1;const e=r.target.value,i=t(e,this.locale);this.error=s(e,this.required,this.locale),this.amountDisplay=null!==i?this.formatAmount(i):"";const d={amount:i,currency:this.currency};this.mrdChange.emit({name:this.name,value:d}),this.mrdBlur.emit({name:this.name,value:d})},this.handleCurrencyChange=r=>{this.currency=r.target.value;const e=t(this.amountDisplay,this.locale);this.mrdChange.emit({name:this.name,value:{amount:e,currency:this.currency}})}}componentWillLoad(){this.syncFromValue()}componentDidRender(){this.selectEl&&this.selectEl.value!==this.currency&&(this.selectEl.value=this.currency)}currencyOptions(){return u.includes(this.currency)?u:[this.currency,...u]}valueChanged(){this.focused||this.syncFromValue()}localeChanged(){this.focused||this.syncFromValue()}syncFromValue(){const r=this.value;this.currency=(null==r?void 0:r.currency)||"EUR",this.amountDisplay=null!=(null==r?void 0:r.amount)?this.formatAmount(r.amount):""}formatAmount(r){return a(r,this.locale,{minimumFractionDigits:2,maximumFractionDigits:2})}render(){const r=!!this.error;return d(c,{key:"43ef1fe660c4eaef025203544916b077975b6aa3"},d("div",{key:"00b8e79182c8e2a353d57ad5c341024caf00d4ea",class:"mrd-currency-field"},d(n,{key:"96835c311e0d490864c484b818f1dcc623f488b2",base:"mrd-currency-field",label:this.label,required:this.required}),d("div",{key:"80317cfe562af00cc4cbf9aabf4bac2126cf6fe5",class:"mrd-currency-field__row"},d("input",{key:"1983ef1e4d19e0fc529cf5e8be7d287fea36620a",class:l("mrd-currency-field",r,"amount"),type:"text",inputMode:"decimal",name:`${this.name}_amount`,value:this.amountDisplay,placeholder:this.formatAmount(0),required:this.required,disabled:this.disabled,onInput:this.handleAmountInput,onFocus:this.handleAmountFocus,onBlur:this.handleAmountBlur}),d("select",{key:"b5fe3f03590bebaa564d76bc5fcb47c327eacece",class:"mrd-currency-field__currency",ref:r=>this.selectEl=r,disabled:this.disabled,onChange:this.handleCurrencyChange},this.currencyOptions().map((r=>d("option",{key:r,value:r,selected:r===this.currency},r))))),d(m,{key:"1a128b26293170d4137f787622d4e89a23e62c0b",base:"mrd-currency-field",error:this.error})))}static get watchers(){return{value:[{valueChanged:0}],locale:[{localeChanged:0}]}}static get style(){return'.sc-mrd-currency-field-h{display:block}.mrd-currency-field.sc-mrd-currency-field{display:flex;flex-direction:column;gap:var(--mrd-space-1);width:100%}.mrd-currency-field__label.sc-mrd-currency-field{display:block;font-family:var(--mrd-font-family);font-size:var(--mrd-label-font-size);font-weight:var(--mrd-label-font-weight);color:var(--mrd-label-color)}.mrd-currency-field__label--required.sc-mrd-currency-field::after{content:" *";color:var(--mrd-color-danger)}.mrd-currency-field__row.sc-mrd-currency-field{display:flex;gap:var(--mrd-space-2);align-items:stretch}.mrd-currency-field__amount.sc-mrd-currency-field{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition);outline:none;appearance:none;box-sizing:border-box}.mrd-currency-field__amount.sc-mrd-currency-field::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-currency-field__amount.sc-mrd-currency-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-currency-field__amount.sc-mrd-currency-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-currency-field__amount--error.sc-mrd-currency-field{border-color:var(--mrd-border-color-error)}.mrd-currency-field__amount--error.sc-mrd-currency-field:focus{box-shadow:var(--mrd-shadow-focus-error)}.mrd-currency-field__amount.sc-mrd-currency-field{flex:1;text-align:right}.mrd-currency-field__currency.sc-mrd-currency-field{width:90px;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-space-2);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-input-color);background-color:var(--mrd-color-neutral-50);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;cursor:pointer;box-sizing:border-box;appearance:none;text-align:center}.mrd-currency-field__currency.sc-mrd-currency-field:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-currency-field__currency.sc-mrd-currency-field:disabled{background-color:var(--mrd-input-bg-disabled);cursor:not-allowed;opacity:0.7}.mrd-currency-field__error.sc-mrd-currency-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}'}},[2,"mrd-currency-field",{name:[1],label:[1],value:[16],required:[4],disabled:[4],locale:[1],amountDisplay:[32],currency:[32],error:[32]},void 0,{value:[{valueChanged:0}],locale:[{localeChanged:0}]}]);function f(){"undefined"!=typeof customElements&&["mrd-currency-field"].forEach((r=>{"mrd-currency-field"===r&&(customElements.get(o(r))||customElements.define(o(r),h))}))}export{h as M,f as d}