@magmonium/one 0.2.65 → 0.2.66

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.
@@ -6992,7 +6992,7 @@ class SectionFormItemComponent extends ConfigComponent {
6992
6992
  break;
6993
6993
  }
6994
6994
  case InputType.TOGGLE: {
6995
- const { ToggleInputComponent } = await import('./magmonium-one-toggle-Bt7PKdJF.mjs');
6995
+ const { ToggleInputComponent } = await import('./magmonium-one-toggle-Djtg0Edf.mjs');
6996
6996
  this.createDynamicComponent(seq, ToggleInputComponent, [], true);
6997
6997
  break;
6998
6998
  }
@@ -7004,12 +7004,12 @@ class SectionFormItemComponent extends ConfigComponent {
7004
7004
  break;
7005
7005
  }
7006
7006
  case InputType.PASSWORD: {
7007
- const { PasswordInputComponent } = await import('./magmonium-one-password-DFK2Wr3Q.mjs');
7007
+ const { PasswordInputComponent } = await import('./magmonium-one-password-DAWQCKJk.mjs');
7008
7008
  this.createDynamicComponent(seq, PasswordInputComponent);
7009
7009
  break;
7010
7010
  }
7011
7011
  case InputType.OTP: {
7012
- const { OtpInputComponent } = await import('./magmonium-one-otp-DAjGRkND.mjs');
7012
+ const { OtpInputComponent } = await import('./magmonium-one-otp-BnPAO29a.mjs');
7013
7013
  this.createDynamicComponent(seq, OtpInputComponent);
7014
7014
  break;
7015
7015
  }
@@ -7386,6 +7386,25 @@ const toModelValues = (data, keys) => {
7386
7386
  return values;
7387
7387
  };
7388
7388
 
7389
+ /**
7390
+ * Whether a form's value moved because the User edited a Field — the only
7391
+ * move `dataChange` announces.
7392
+ *
7393
+ * Everything else that moves the value is the form's own bookkeeping, and a
7394
+ * caller wiring `(dataChange)` to a save must not hear it:
7395
+ * - a Field registering late adds a key with an empty value, so only keys the
7396
+ * previous value already held are compared;
7397
+ * - a new `data` restamps the model from the caller's own record, which the
7398
+ * caller already has — including the record a `[(data)]` binding writes back;
7399
+ * - the first read has nothing to compare against.
7400
+ */
7401
+ const isUserEdit = (previous, next, dataChanged) => {
7402
+ if (previous === null || dataChanged)
7403
+ return false;
7404
+ return Object.keys(previous).some((key) => Object.prototype.hasOwnProperty.call(next, key) &&
7405
+ JSON.stringify(previous[key]) !== JSON.stringify(next[key]));
7406
+ };
7407
+
7389
7408
  /**
7390
7409
  * `T` is the record the form carries, named by whoever binds `data`. An output
7391
7410
  * cannot be typed from what was projected into the form — a Field announces its
@@ -7464,6 +7483,7 @@ class SectionFormComponent extends ConfigComponent {
7464
7483
  parentSize = injectParentSize();
7465
7484
  injector = inject(Injector);
7466
7485
  previousValue = null;
7486
+ previousData = undefined;
7467
7487
  // Names announced by projected items (content projection has no template
7468
7488
  // `(fieldKey)` hook). Merged with `config.inputs` so the FieldTree always
7469
7489
  // has a slot for every rendered field.
@@ -7663,16 +7683,21 @@ class SectionFormComponent extends ConfigComponent {
7663
7683
  void this.resolvedValidation();
7664
7684
  untracked(() => this.rebuild());
7665
7685
  });
7686
+ // User edits only (isUserEdit): a Field registering, a new `data` and a
7687
+ // `reset()` all move the value too, and a caller saving on `dataChange`
7688
+ // would send a request nobody made.
7666
7689
  effect(() => {
7667
7690
  const formTree = this.formGroup();
7668
7691
  if (!formTree)
7669
7692
  return;
7670
- const { value } = formTree();
7671
- if (this.previousValue !== null &&
7672
- JSON.stringify(this.previousValue) !== JSON.stringify(value())) {
7673
- this.dataChange.emit({ ...this.data(), ...value() });
7674
- }
7675
- this.previousValue = value();
7693
+ const value = formTree().value();
7694
+ const data = this.data();
7695
+ const dataChanged = data !== this.previousData;
7696
+ if (isUserEdit(this.previousValue, value, dataChanged)) {
7697
+ this.dataChange.emit({ ...data, ...value });
7698
+ }
7699
+ this.previousValue = value;
7700
+ this.previousData = data;
7676
7701
  });
7677
7702
  // A form on a visual editor's Canvas is a picture of a form: it is rebuilt
7678
7703
  // on every config edit, and taking the caret each time would leave the
@@ -7737,7 +7762,10 @@ class SectionFormComponent extends ConfigComponent {
7737
7762
  */
7738
7763
  reset = () => {
7739
7764
  untracked(() => {
7740
- this.model.set(toModelValues(this.data(), this.modelKeys()));
7765
+ const values = toModelValues(this.data(), this.modelKeys());
7766
+ this.model.set(values);
7767
+ // Emptying the form is the caller's act, not the User's edit.
7768
+ this.previousValue = values;
7741
7769
  });
7742
7770
  this.rebuild();
7743
7771
  };
@@ -20802,7 +20830,7 @@ class WrapperInputComponent extends ConfigComponent {
20802
20830
  break;
20803
20831
  }
20804
20832
  case InputType.TOGGLE: {
20805
- const { ToggleInputComponent } = await import('./magmonium-one-toggle-Bt7PKdJF.mjs');
20833
+ const { ToggleInputComponent } = await import('./magmonium-one-toggle-Djtg0Edf.mjs');
20806
20834
  this.createDynamicComponent(seq, ToggleInputComponent, [], true);
20807
20835
  break;
20808
20836
  }
@@ -20814,12 +20842,12 @@ class WrapperInputComponent extends ConfigComponent {
20814
20842
  break;
20815
20843
  }
20816
20844
  case InputType.PASSWORD: {
20817
- const { PasswordInputComponent } = await import('./magmonium-one-password-DFK2Wr3Q.mjs');
20845
+ const { PasswordInputComponent } = await import('./magmonium-one-password-DAWQCKJk.mjs');
20818
20846
  this.createDynamicComponent(seq, PasswordInputComponent);
20819
20847
  break;
20820
20848
  }
20821
20849
  case InputType.OTP: {
20822
- const { OtpInputComponent } = await import('./magmonium-one-otp-DAjGRkND.mjs');
20850
+ const { OtpInputComponent } = await import('./magmonium-one-otp-BnPAO29a.mjs');
20823
20851
  this.createDynamicComponent(seq, OtpInputComponent);
20824
20852
  break;
20825
20853
  }
@@ -21730,7 +21758,9 @@ const STARS = [0, 1, 2, 3, 4];
21730
21758
  const MAX_RATING = STARS.length - 1;
21731
21759
  /**
21732
21760
  * Reads a bound value as a rating: a form model hands it over as text ('' or
21733
- * '3'), so strings are parsed; blank or non-numeric reads as unrated.
21761
+ * '3'), so strings are parsed; blank, non-numeric or negative reads as unrated.
21762
+ * Only an explicit 0 selects the first star — a negative is never clamped up
21763
+ * to it, so an unrated 1-based source shifted to `-1` stays unrated.
21734
21764
  */
21735
21765
  const toRating = (raw) => {
21736
21766
  if (raw === null || raw === undefined)
@@ -21738,9 +21768,9 @@ const toRating = (raw) => {
21738
21768
  if (typeof raw === 'string' && !raw.trim())
21739
21769
  return null;
21740
21770
  const parsed = Number(raw);
21741
- if (!Number.isFinite(parsed))
21771
+ if (!Number.isFinite(parsed) || parsed < 0)
21742
21772
  return null;
21743
- return Math.min(Math.max(parsed, 0), MAX_RATING);
21773
+ return Math.min(parsed, MAX_RATING);
21744
21774
  };
21745
21775
  class RatingInputComponent extends BaseInputComponent {
21746
21776
  value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
@@ -35410,4 +35440,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
35410
35440
  */
35411
35441
 
35412
35442
  export { DEFAULT_FILTER_VARIANT as $, ACCESS_DOMAINS as A, BaseInputComponent as B, COMPONENT_INPUT_REGISTRY as C, CardComponent as D, CardWrapperComponent as E, CarouselComponent as F, ChartComponent as G, ChatBubbleComponent as H, IS_DESIGN_MODE as I, CheckboxInputComponent as J, ClearableInputComponent as K, LabelComponent as L, ColComponent as M, ColorPickerInputComponent as N, CommentItemComponent as O, CommentsApiService as P, CommentsComponent as Q, CommentsStore as R, ComponentInputComponent as S, TranslatePipe as T, ComponentStepperComponent as U, ConfigComponent as V, ConfirmComponent as W, ContextMenuComponent as X, CustomIconClass as Y, CustomIconEditComponent as Z, DEFAULT_FILTER_RANGE_MODE as _, BaseTextInputComponent as a, MultiRangeInputComponent as a$, DEFAULT_NAV_PARAM as a0, DEFAULT_NAV_SEGMENT as a1, DEFAULT_SIZE as a2, DashboardCardComponent as a3, DateInputComponent as a4, DatePickerComponent as a5, DeviceService as a6, DomService as a7, Domain as a8, DotGridComponent as a9, ImgComponent as aA, InputType as aB, InstrumentScoreComponent as aC, InterceptorObservables as aD, JumbotronComponent as aE, KeyValueComponent as aF, LAYOUT_ASSET_FOLDER as aG, LOGIN_COMPONENT as aH, LOGIN_STORE as aI, LanguageComponent as aJ, ListComponent as aK, LogoComponent as aL, MAG_SOCKET_EVENT as aM, MHeroColorDirective as aN, MHeroComponent as aO, MODAL_REF as aP, MODAL_STORE_REF as aQ, MRefDirective as aR, MStepComponent as aS, MURL_PARAM as aT, MURL_SEP as aU, ManifestEnrichmentService as aV, MenuComponent as aW, ModalDirective as aX, ModalRef as aY, ModalStore as aZ, MoneyPipe as a_, DragListDirective as aa, DragListItemDirective as ab, DraggableDirective as ac, DropdownInputComponent as ad, FILTER_GROUP_CONTEXT as ae, FILTER_RANGE_MODES as af, FILTER_VARIANTS as ag, FLEX_VARIANTS as ah, FOLDER_PICK_LISTENER as ai, FORM_ASSET_FOLDER as aj, FileService as ak, FileUploadDirective as al, FileUploadInputComponent as am, FlexComponent as an, FlexItemComponent as ao, FormGroupComponent as ap, FrameComponent as aq, FreezeService as ar, GRID_BREAKPOINTS as as, GetNavService as at, HeaderComponent$1 as au, HighlightDirective as av, HttpService as aw, ICON_SOURCE as ax, IS_SIDE_PANEL as ay, IconComponent as az, TextOutputComponent as b, SectionAccordionDirective as b$, MurlUrlSerializer as b0, NAV_DEFAULT_MURL as b1, NAV_ID_SEP as b2, NAV_MAIN_BUTTONS as b3, NAV_SEGMENT_RE as b4, NAV_STORE_REF as b5, NAV_WC_COMPONENTS as b6, NAV_WIDGET_MAP as b7, NavComponent as b8, NavDetailsComponent as b9, PercentagePipe as bA, PlaygroundComponent as bB, PositionDirective as bC, PwaInstallComponent as bD, ROOT_NAV$1 as bE, RadioGroupComponent as bF, RadioInputComponent as bG, RangeInputComponent as bH, RatingInputComponent as bI, ReactiveElementComponent as bJ, RemoteComponent as bK, RemoteLoaderService as bL, ResizeElementComponent as bM, RouteContainer as bN, RowComponent as bO, SEARCH_QUERY as bP, SEARCH_RESULTS_EVENT as bQ, SECTION_ACCORDION_GROUP as bR, SECTION_FORM_CONTEXT as bS, SHARED_ICONS as bT, SIZE_CONTEXT as bU, ScoreComponent as bV, ScrollComponent as bW, ScrollService as bX, SearchPanelComponent as bY, SearchStore as bZ, SearchUserPanelComponent as b_, NavHeaderComponent as ba, NavMenuComponent as bb, NavStore as bc, NavTrailComponent as bd, NothingComponent as be, NotificationElementComponent as bf, NotificationGroupComponent as bg, NotificationPopupComponent as bh, NotificationService as bi, NotificationStore as bj, NotificationType as bk, NotificationWidgetComponent as bl, ONE_ASSET_BASE_URL as bm, OPTIONS_SOURCE as bn, OVERLAY_WIDGETS as bo, OneApp as bp, OptionsSourceDirective as bq, OverlayBodyComponent as br, OverlayRef as bs, OverlayService as bt, PLATFORM_BUTTON_NAV_IDS as bu, PLATFORM_EXTENSIBLE_NAV_IDS as bv, PLATFORM_NAV_MAP as bw, PLATFORM_ROOT_CHILDREN as bx, PaginationComponent as by, PanelComponent as bz, ButtonComponent as c, URL_SEP as c$, SectionAccordionGroupDirective as c0, SectionBackComponent as c1, SectionBadgesComponent as c2, SectionButtonGroupComponent as c3, SectionCardComponent as c4, SectionCarouselComponent as c5, SectionComponent as c6, SectionFilterComponent as c7, SectionFilterGroupComponent as c8, SectionFilterMenuComponent as c9, StepsComponent as cA, StorageService as cB, StrokeLinecap as cC, StrokeLinejoin as cD, SummaryComponent as cE, SvgGeneratorComponent as cF, SvgGeneratorService as cG, SvgService as cH, TOTAL_COLUMNS as cI, TRANSLATION_SOURCE as cJ, TableComponent as cK, TechnicalMeterComponent as cL, TextInputComponent as cM, TextareaInputComponent as cN, ThemeComponent as cO, ThemeDataService as cP, ThemeService as cQ, ThemeStore as cR, TimeAgoPipe as cS, TimelineComponent as cT, ToggleButtonComponent as cU, ToggleInputComponent as cV, ToggleRadioInputComponent as cW, ToolTipDirective as cX, TooltipComponent as cY, TranslateService as cZ, TreeGridComponent as c_, SectionFilterPanelComponent as ca, SectionFilterRangePanelComponent as cb, SectionFooterComponent as cc, SectionFormComponent as cd, SectionFormItemComponent as ce, SectionHeaderComponent as cf, SectionHeroComponent as cg, SectionPaginationComponent as ch, SectionSearchComponent as ci, SectionStepperComponent as cj, SectionTabsComponent as ck, SectionToggleComponent as cl, SectionToggleItemDirective as cm, SelectableCardInputComponent as cn, SelectorDirective as co, SettingsSearchBarComponent as cp, SettingsSearchService as cq, ShapeComponent as cr, SharedStoreRegistry as cs, SidePanelDirective as ct, Size as cu, SocketStore as cv, SortComponent as cw, StatComponent as cx, StepComponent as cy, StepperComponent as cz, APP_CONTEXT_REF as d, getTierFromPreviewPath as d$, USER_STORE_REF as d0, USER_TAB_MAP as d1, UniverseComponent as d2, UserApiService as d3, UserAvatarComponent as d4, UserComponent as d5, UserNavComponent as d6, UserSettingsComponent as d7, UserStore as d8, WC_ROUTE_CHANGED_EVENT as d9, deriveOppositeColor as dA, derivePropertyName as dB, emailValidation as dC, evaluate as dD, evaluateBool as dE, filterHoldsList as dF, filterHoldsOneBound as dG, filterHoldsOptions as dH, filterHoldsRange as dI, filterList as dJ, filterNumber as dK, filterNumberList as dL, filterOne as dM, filterPanelOf as dN, filterPanelWidth as dO, filterRange as dP, filterTreeGridRows as dQ, filterValueList as dR, filterValues as dS, flattenTreeGridRows as dT, formatBadgeCount as dU, fullName as dV, generateClipPath as dW, generateTransform as dX, getClassList as dY, getProperty as dZ, getScrollParent as d_, WC_SEARCH_GROUPS as da, WIN_USER_TAB_HOOK as db, WIN_USER_TAB_KEY as dc, WatermarkComponent as dd, WcRouterStore as de, WrapperInputComponent as df, anchorNavId as dg, applyColorsToElement as dh, assetOptions as di, bootstrapMagApp as dj, bootstrapPwaInstall as dk, buildWcBaseUrl as dl, calculateLuminance as dm, calculateRanks as dn, cellText as dp, checkFilterCondition as dq, childNavId as dr, classListSignal as ds, coerceSize as dt, cornerEdge as du, cornerSide as dv, createMap as dw, createPlatformNavMap as dx, deriveAvatarGradient as dy, deriveContrastColor as dz, ASSET_BASE_URL as e, provideAppContext as e$, getTreeGridRow as e0, getUniqueId as e1, getValue as e2, hasErrorComputed as e3, hexToRgb as e4, hslToRgb$1 as e5, initMagmoniumApp as e6, initialNotificationState as e7, initialState$2 as e8, initials as e9, maxLengthValidation as eA, maxValidation as eB, mergePlatformNav as eC, mergeUnique as eD, mergeUniqueBy as eE, mergeUniqueWith as eF, minAgeValidation as eG, minLengthValidation as eH, minValidation as eI, miniMarkToHtml as eJ, navIdChain as eK, navIdFor as eL, navIdSegment as eM, navIdToRoutePath as eN, navIdToSegments as eO, navParamOf as eP, navToId as eQ, normalizeAssetOptions as eR, parentNavId as eS, parseAddress as eT, parseColor as eU, parsePatternNames as eV, patternValidation as eW, patternsValidation as eX, platformNavWidgets as eY, privateGuard as eZ, processImageToSvg as e_, injectAuthenticate as ea, injectInstallApp as eb, injectParentSize as ec, injectScrollSticky as ed, isButtonName as ee, isCancelledComputed as ef, isExtensiblePlatformNavId as eg, isJson as eh, isLoadingComputed as ei, isLocalhost as ej, isNavInstanceConfig as ek, isNavMenuConfig as el, isNavRowsConfig as em, isPlatformNavId as en, isSize as eo, isTierPreview as ep, isUrlLocalhost as eq, isValidNavId as er, isValidNavSegment as es, isWebComponent as et, linkToId as eu, linkToNav as ev, loadingActions as ew, mInterceptor as ex, manualValidation as ey, matchFieldValidation as ez, AccordionBodyDirective as f, provideMagAppConfig as f0, provideMagWcConfig as f1, provideMagWcRoutes as f2, provideModalComponents as f3, provideMurlUrlSerializer as f4, provideNavWidgets as f5, provideOverlayWidgets as f6, providePlatformNavWidgets as f7, provideSearch as f8, provideSizeContext as f9, toLength$1 as fA, toLocalNavId as fB, toggleTreeGridRow as fC, unfetchedPlatformNav as fD, urlValidation as fE, provideUserTabs as fa, publicGuard as fb, readFieldPatterns as fc, renderAddress as fd, requiredValidation as fe, resolveConfigAsset as ff, resolveIconSize as fg, resolvePallet as fh, resolvePatternRules as fi, resolveSize as fj, rgbToHex as fk, rgbToHsl as fl, rowHasChildren as fm, samePatterns as fn, segmentsToNavId as fo, setProperty as fp, setTreeGridChildren as fq, settingsWidgets as fr, shouldShowBadge as fs, splitNavId as ft, splitOnMatch as fu, stringToColor as fv, toAttrBool as fw, toAttrNumber as fx, toCssLength as fy, toHostNavId as fz, AccordionComponent as g, AccordionGroupComponent as h, ActionComponent as i, AnimatedGraphsComponent as j, AppCardComponent as k, AppRelationType as l, AppTileComponent as m, AssetStore as n, AssetUrlPipe as o, Assets as p, AuthActivityPageComponent as q, AuthApiService as r, AuthStore as s, AutosizeDirective as t, BadgeComponent as u, BandingComponent as v, BaseArrayInputComponent as w, BaseRootWebComponent as x, BaseWebComponent as y, ButtonGroupComponent as z };
35413
- //# sourceMappingURL=magmonium-one-magmonium-one-C2uyw8As.mjs.map
35443
+ //# sourceMappingURL=magmonium-one-magmonium-one-CC30IxNZ.mjs.map