@ngx-smz/ui-kit 21.9.0-next.16 → 21.9.0-next.19

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.
@@ -173,17 +173,26 @@ const SINGLE_GROUPS = [
173
173
  function tokensOf(value) {
174
174
  return (value ?? '').split(/\s+/).filter(Boolean);
175
175
  }
176
- function hasPrefix(tokens, prefixes) {
177
- return tokens.some((token) => prefixes.some((prefix) => token.startsWith(prefix)));
176
+ /**
177
+ * Utilitario de padding de verdade (`p-4`, `px-[3px]`, `pl-px`, `px-input-x`), e nao uma classe qualquer que
178
+ * so comeca com "p-" (`p-col-12`, `p-column-filter`, ...), que nao pode remover o padding base do componente.
179
+ */
180
+ const PADDING_UTILITY = /^p([xytblrse]?)-(?:\d|\[|px$|auto$|input-|control-)/;
181
+ function isPadding(token, sides) {
182
+ const match = PADDING_UTILITY.exec(token);
183
+ return match !== null && sides.includes(`p${match[1]}`);
184
+ }
185
+ function hasPadding(tokens, sides) {
186
+ return tokens.some((token) => isPadding(token, sides));
178
187
  }
179
188
  /** Resolve o padding de um eixo (x ou y) quando o consumidor sobrescreve so um lado. */
180
189
  function resolveAxis(token, axis, extra) {
181
- const all = hasPrefix(extra, ['p-']);
182
- const both = hasPrefix(extra, [`p${axis}-`]);
183
- const sides = axis === 'x' ? ['pl-', 'ps-'] : ['pt-'];
184
- const otherSides = axis === 'x' ? ['pr-', 'pe-'] : ['pb-'];
185
- const first = hasPrefix(extra, sides);
186
- const second = hasPrefix(extra, otherSides);
190
+ const all = hasPadding(extra, ['p']);
191
+ const both = hasPadding(extra, [`p${axis}`]);
192
+ const sides = axis === 'x' ? ['pl', 'ps'] : ['pt'];
193
+ const otherSides = axis === 'x' ? ['pr', 'pe'] : ['pb'];
194
+ const first = hasPadding(extra, sides);
195
+ const second = hasPadding(extra, otherSides);
187
196
  const value = token.slice(3);
188
197
  if (all || both || (first && second))
189
198
  return null;
@@ -6001,9 +6010,13 @@ class SmzInputMaskComponent extends SmzValueAccessor {
6001
6010
  }
6002
6011
  return text;
6003
6012
  }, ...(ngDevMode ? [{ debugName: "display" }] : []));
6013
+ /**
6014
+ * Aceita `number` alem de `string` (ex.: `FormControl` com `5`): o valor e convertido para texto antes de distribuir
6015
+ * nos slots, senao `text.length` e `undefined` e o campo abre vazio.
6016
+ */
6004
6017
  writeValue(value) {
6005
- super.writeValue(value);
6006
- this.entered.set(this.fitToSlots(value ?? ''));
6018
+ super.writeValue(value === null || value === undefined ? null : String(value));
6019
+ this.entered.set(this.fitToSlots(value === null || value === undefined ? '' : String(value)));
6007
6020
  }
6008
6021
  onFocus() {
6009
6022
  this.focusedState.set(true);