@mmlogic/components 0.5.9 → 0.5.11
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/dist/cjs/mrd-boolean-field_25.cjs.entry.js +87 -28
- package/dist/collection/components/table/mrd-table/mrd-table.js +87 -28
- package/dist/components/mrd-table2.js +1 -1
- package/dist/esm/mrd-boolean-field_25.entry.js +87 -28
- package/dist/mosterdcomponents/cell-renderer-B8u5BCK-.js.map +1 -0
- package/dist/mosterdcomponents/client-layout-Bc42CfJB.js.map +1 -0
- package/dist/mosterdcomponents/document-attachments-BufPmMRv.js.map +1 -0
- package/dist/mosterdcomponents/field-helpers-CUJsHr1V.js.map +1 -0
- package/dist/mosterdcomponents/file-upload-common-DdTDuxEU.js.map +1 -0
- package/dist/mosterdcomponents/format-gcecItcD.js.map +1 -0
- package/dist/mosterdcomponents/i18n-Ba7_jO9I.js.map +1 -0
- package/dist/mosterdcomponents/index-1ayBojyN.js.map +1 -0
- package/dist/mosterdcomponents/index-DhffneUF.js.map +1 -0
- package/dist/mosterdcomponents/index.esm.js.map +1 -0
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +1 -0
- package/dist/mosterdcomponents/{p-986a68d6.entry.js → p-eee4be8b.entry.js} +2 -2
- package/dist/mosterdcomponents/purify.es-_duHfPgC.js.map +1 -0
- package/dist/mosterdcomponents/query-params-BZbQoeYF.js.map +1 -0
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +1 -0
- package/dist/mosterdcomponents/validation-CjjTt66G.js.map +1 -0
- package/dist/types/components/table/mrd-table/mrd-table.d.ts +26 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-CjjTt66G.js","sources":["src/utils/validation.ts"],"sourcesContent":["import { ClientLayoutItemFieldDataType } from '../types';\n\nexport function validateRequired(value: unknown): boolean {\n if (value === null || value === undefined) return false;\n if (typeof value === 'string') return value.trim().length > 0;\n if (Array.isArray(value)) return value.length > 0;\n if (typeof value === 'object') {\n // HyperlinkValue check\n const hv = value as { href?: unknown };\n if ('href' in hv) return typeof hv.href === 'string' && hv.href.trim().length > 0;\n // CurrencyValue check\n const cv = value as { amount?: unknown };\n if ('amount' in cv) return cv.amount !== null && cv.amount !== undefined && cv.amount !== '';\n }\n return true;\n}\n\nexport function validateEmail(value: string): boolean {\n if (!value) return true;\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value);\n}\n\nexport function validateUrl(value: string): boolean {\n if (!value) return true;\n try {\n const url = new URL(value);\n return url.protocol === 'http:' || url.protocol === 'https:';\n } catch {\n return false;\n }\n}\n\nexport function validateNumber(value: unknown, dataType: ClientLayoutItemFieldDataType): boolean {\n if (value === null || value === undefined || value === '') return true;\n const num = Number(value);\n if (isNaN(num)) return false;\n if (dataType === ClientLayoutItemFieldDataType.INTEGER) {\n return Number.isInteger(num);\n }\n if (dataType === ClientLayoutItemFieldDataType.PERCENTAGE) {\n return num >= 0 && num <= 100;\n }\n return true;\n}\n"],"names":[],"mappings":";;;AAEM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,KAAK;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;AAC7D,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;AACjD,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;;QAE7B,MAAM,EAAE,GAAG,KAA2B;QACtC,IAAI,MAAM,IAAI,EAAE;AAAE,YAAA,OAAO,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,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;AACb;;;;"}
|
|
@@ -15,6 +15,8 @@ export declare class MrdTable {
|
|
|
15
15
|
private keydownHandler;
|
|
16
16
|
private createPickerClickHandler;
|
|
17
17
|
private viewPopoverClickHandler;
|
|
18
|
+
/** Watches the host for gaining a box (e.g. its tab pane being shown) — see componentDidLoad. */
|
|
19
|
+
private resizeObserver;
|
|
18
20
|
/** Guards against scheduling more than one column-width measurement per freeze. */
|
|
19
21
|
private colWidthMeasureScheduled;
|
|
20
22
|
/** Drag origin of the running column resize (null = no drag in progress). */
|
|
@@ -160,8 +162,32 @@ export declare class MrdTable {
|
|
|
160
162
|
setAggregations(data: AggregationResult): Promise<void>;
|
|
161
163
|
disconnectedCallback(): void;
|
|
162
164
|
componentDidRender(): void;
|
|
165
|
+
/** Freeze the column widths once the first data page has rendered.
|
|
166
|
+
*
|
|
167
|
+
* The measurement reads layout and writes the colWidths @State, which would trigger a
|
|
168
|
+
* re-render *during* the render cycle if done synchronously from componentDidRender. It is
|
|
169
|
+
* deferred to a writeTask so the state mutation happens outside the render pass (avoids the
|
|
170
|
+
* Stencil "state/prop changed during rendering" warning and potential loops).
|
|
171
|
+
*
|
|
172
|
+
* NB: the freeze must not depend on the totalElements prop — hosts may omit it and rely on
|
|
173
|
+
* minKnownTotal, in which case the widths would never be locked and every incoming page
|
|
174
|
+
* would re-flow all columns. */
|
|
175
|
+
private freezeColWidths;
|
|
163
176
|
/** Current rendered header widths, or null when they can't be trusted (header not laid out yet). */
|
|
164
177
|
private measureColWidths;
|
|
178
|
+
/** Width one cell needs to show its content in full, borders included.
|
|
179
|
+
* Read from scrollWidth rather than the laid-out box: cells clip with `overflow: hidden`,
|
|
180
|
+
* so a squeezed cell reports the width it *was given*, not the width it needs. */
|
|
181
|
+
private neededWidth;
|
|
182
|
+
/** Width each column needs for its header and its rendered page-0 cells — what the columns
|
|
183
|
+
* are locked to, so they never end up narrower than their content.
|
|
184
|
+
*
|
|
185
|
+
* Deliberately not the laid-out widths: with many columns the browser squeezes them to fit
|
|
186
|
+
* the container instead of overflowing (the cells clip, so they no longer resist), which
|
|
187
|
+
* cost the horizontal scrollbar. Locking the needed widths makes the summed table width
|
|
188
|
+
* exceed the container again, and `.mrd-table__scroll` scrolls. Capped per column at
|
|
189
|
+
* MAX_AUTOFIT_WIDTH so one outlier value can't blow up the layout — same cap as auto-fit. */
|
|
190
|
+
private measureContentWidths;
|
|
165
191
|
/** Re-reads the rendered header widths into colWidths so a drag starts from what is
|
|
166
192
|
* actually on screen — and locks the columns if they weren't locked yet.
|
|
167
193
|
*
|