@mk-kit/ui 0.42.0 → 0.44.0

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 (57) hide show
  1. package/README.md +5 -3
  2. package/THIRD_PARTY_NOTICES.md +4 -2
  3. package/fesm2022/mk-kit-ui-block-editor.mjs +4 -2
  4. package/fesm2022/mk-kit-ui-block-editor.mjs.map +1 -1
  5. package/fesm2022/mk-kit-ui-checkbox.mjs +4 -2
  6. package/fesm2022/mk-kit-ui-checkbox.mjs.map +1 -1
  7. package/fesm2022/mk-kit-ui-core.mjs +136 -1
  8. package/fesm2022/mk-kit-ui-core.mjs.map +1 -1
  9. package/fesm2022/mk-kit-ui-data.mjs +438 -8
  10. package/fesm2022/mk-kit-ui-data.mjs.map +1 -1
  11. package/fesm2022/mk-kit-ui-datetime.mjs +88 -50
  12. package/fesm2022/mk-kit-ui-datetime.mjs.map +1 -1
  13. package/fesm2022/mk-kit-ui-directives.mjs +27 -8
  14. package/fesm2022/mk-kit-ui-directives.mjs.map +1 -1
  15. package/fesm2022/mk-kit-ui-dnd.mjs +43 -8
  16. package/fesm2022/mk-kit-ui-dnd.mjs.map +1 -1
  17. package/fesm2022/mk-kit-ui-dynamic-form.mjs +149 -2
  18. package/fesm2022/mk-kit-ui-dynamic-form.mjs.map +1 -1
  19. package/fesm2022/mk-kit-ui-feedback.mjs +1 -1
  20. package/fesm2022/mk-kit-ui-feedback.mjs.map +1 -1
  21. package/fesm2022/mk-kit-ui-forms.mjs +326 -78
  22. package/fesm2022/mk-kit-ui-forms.mjs.map +1 -1
  23. package/fesm2022/mk-kit-ui-icon-extended.mjs +425 -0
  24. package/fesm2022/mk-kit-ui-icon-extended.mjs.map +1 -0
  25. package/fesm2022/mk-kit-ui-icon.mjs +296 -459
  26. package/fesm2022/mk-kit-ui-icon.mjs.map +1 -1
  27. package/fesm2022/mk-kit-ui-media.mjs +1 -1
  28. package/fesm2022/mk-kit-ui-media.mjs.map +1 -1
  29. package/fesm2022/mk-kit-ui-query-builder.mjs +1 -1
  30. package/fesm2022/mk-kit-ui-query-builder.mjs.map +1 -1
  31. package/fesm2022/mk-kit-ui-rich-text.mjs +4 -2
  32. package/fesm2022/mk-kit-ui-rich-text.mjs.map +1 -1
  33. package/fesm2022/mk-kit-ui-table.mjs +668 -24
  34. package/fesm2022/mk-kit-ui-table.mjs.map +1 -1
  35. package/fesm2022/mk-kit-ui-testing.mjs +54 -0
  36. package/fesm2022/mk-kit-ui-testing.mjs.map +1 -1
  37. package/fesm2022/mk-kit-ui.mjs +1 -0
  38. package/fesm2022/mk-kit-ui.mjs.map +1 -1
  39. package/package.json +5 -1
  40. package/schematics/migrate-primeng/transform.js +4 -1
  41. package/schematics/ng-add/index.js +30 -2
  42. package/schematics/ng-add/schema.json +6 -0
  43. package/types/mk-kit-ui-block-editor.d.ts +2 -0
  44. package/types/mk-kit-ui-checkbox.d.ts +2 -0
  45. package/types/mk-kit-ui-core.d.ts +82 -2
  46. package/types/mk-kit-ui-data.d.ts +203 -2
  47. package/types/mk-kit-ui-datetime.d.ts +41 -19
  48. package/types/mk-kit-ui-directives.d.ts +12 -6
  49. package/types/mk-kit-ui-dnd.d.ts +32 -4
  50. package/types/mk-kit-ui-dynamic-form.d.ts +44 -1
  51. package/types/mk-kit-ui-forms.d.ts +154 -16
  52. package/types/mk-kit-ui-icon-extended.d.ts +83 -0
  53. package/types/mk-kit-ui-icon.d.ts +100 -17
  54. package/types/mk-kit-ui-rich-text.d.ts +2 -0
  55. package/types/mk-kit-ui-table.d.ts +234 -25
  56. package/types/mk-kit-ui-testing.d.ts +16 -0
  57. package/types/mk-kit-ui.d.ts +1 -0
@@ -1889,30 +1889,37 @@ const formatters = new MkIntlCache((locale, options) => new Intl.RelativeTimeFor
1889
1889
  * The pipe picks the largest unit whose magnitude is at least 1 (seconds →
1890
1890
  * minutes → hours → days → weeks → months → years) and rounds. Pass `now`
1891
1891
  * for deterministic output in tests, or bind a ticking signal to keep a
1892
- * list live — a pure pipe only re-runs when an argument changes:
1892
+ * list live — a pure pipe only re-runs when an argument changes. The second
1893
+ * argument is either that `now` or the options object, so options alone
1894
+ * need no `null` placeholder; the three-argument form (`now`, then options)
1895
+ * works too:
1893
1896
  *
1894
1897
  * ```html
1895
1898
  * {{ comment.createdAt | mkRelativeTime }} <!-- 3 minutes ago -->
1896
1899
  * {{ due | mkRelativeTime:now() }} <!-- in 2 days (now() ticks) -->
1897
- * {{ due | mkRelativeTime:null:{ style: 'short' } }} <!-- in 2 days -->
1898
- * {{ ts | mkRelativeTime:null:{ locale: 'pl', numeric: 'always' } }} <!-- 3 minuty temu -->
1900
+ * {{ due | mkRelativeTime:{ style: 'short' } }} <!-- in 2 days -->
1901
+ * {{ ts | mkRelativeTime:{ locale: 'pl', numeric: 'always' } }} <!-- 3 minuty temu -->
1902
+ * {{ due | mkRelativeTime:now():{ style: 'short' } }} <!-- in 2 days (ticking) -->
1899
1903
  * ```
1900
1904
  */
1901
1905
  class MkRelativeTimePipe {
1902
1906
  i18n = inject(MK_I18N);
1903
1907
  /**
1904
1908
  * @param value The instant to describe.
1905
- * @param now Reference instant; defaults to `Date.now()` at call time.
1906
- * @param options Locale, numeric mode, style and unit cap.
1909
+ * @param nowOrOptions Reference instant (defaults to `Date.now()` at call
1910
+ * time), or — when only options are wanted the options object itself.
1911
+ * @param options Locale, numeric mode, style and unit cap (three-argument
1912
+ * form, after an explicit `now`).
1907
1913
  */
1908
- transform(value, now, options = {}) {
1914
+ transform(value, nowOrOptions, options) {
1909
1915
  const target = mkToTimestamp(value);
1910
1916
  if (target === null)
1911
1917
  return '';
1918
+ const [now, opts] = splitArgs(nowOrOptions, options);
1912
1919
  const reference = mkToTimestamp(now) ?? Date.now();
1913
1920
  const diff = target - reference;
1914
- const [unit, amount] = pickUnit(diff, options.maxUnit ?? 'year');
1915
- const { locale, maxUnit: _maxUnit, ...rest } = options;
1921
+ const [unit, amount] = pickUnit(diff, opts.maxUnit ?? 'year');
1922
+ const { locale, maxUnit: _maxUnit, ...rest } = opts;
1916
1923
  return formatters
1917
1924
  .get(mkResolveLocale(this.i18n, locale), {
1918
1925
  numeric: 'auto',
@@ -1928,6 +1935,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
1928
1935
  type: Pipe,
1929
1936
  args: [{ name: 'mkRelativeTime', pure: true }]
1930
1937
  }] });
1938
+ /**
1939
+ * Resolve the overloaded second argument: a plain object (not a `Date`) is
1940
+ * the options and `now` is left to default; anything else is `now`.
1941
+ */
1942
+ function splitArgs(nowOrOptions, options) {
1943
+ if (nowOrOptions !== null &&
1944
+ typeof nowOrOptions === 'object' &&
1945
+ !(nowOrOptions instanceof Date)) {
1946
+ return [undefined, { ...nowOrOptions, ...options }];
1947
+ }
1948
+ return [nowOrOptions, options ?? {}];
1949
+ }
1931
1950
  /** Choose the largest unit (≤ `maxUnit`) whose rounded magnitude is ≥ 1; seconds otherwise. */
1932
1951
  function pickUnit(diffMs, maxUnit) {
1933
1952
  const cap = UNITS.findIndex(([u]) => u === maxUnit || `${u}s` === maxUnit);