@citizenplane/pimp 8.0.4 → 8.1.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.
package/dist/pimp.es.js CHANGED
@@ -1917,6 +1917,15 @@ function normalizeValues(matrix, vals) {
1917
1917
  }
1918
1918
  }, null);
1919
1919
  }
1920
+ function removeZeroes(vals) {
1921
+ const newVals = {};
1922
+ for (const [key, value] of Object.entries(vals)) {
1923
+ if (value !== 0) {
1924
+ newVals[key] = value;
1925
+ }
1926
+ }
1927
+ return newVals;
1928
+ }
1920
1929
  class Duration {
1921
1930
  constructor(config) {
1922
1931
  const accurate = config.conversionAccuracy === "longterm" || false;
@@ -2152,6 +2161,12 @@ class Duration {
2152
2161
  normalizeValues(this.matrix, vals);
2153
2162
  return clone$1(this, { values: vals }, true);
2154
2163
  }
2164
+ rescale() {
2165
+ if (!this.isValid)
2166
+ return this;
2167
+ const vals = removeZeroes(this.normalize().shiftToAll().toObject());
2168
+ return clone$1(this, { values: vals }, true);
2169
+ }
2155
2170
  shiftTo(...units) {
2156
2171
  if (!this.isValid)
2157
2172
  return this;
@@ -2191,6 +2206,11 @@ class Duration {
2191
2206
  }
2192
2207
  return clone$1(this, { values: built }, true).normalize();
2193
2208
  }
2209
+ shiftToAll() {
2210
+ if (!this.isValid)
2211
+ return this;
2212
+ return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds");
2213
+ }
2194
2214
  negate() {
2195
2215
  if (!this.isValid)
2196
2216
  return this;
@@ -10673,11 +10693,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
10673
10693
  ], 14, _hoisted_11);
10674
10694
  }), 128)),
10675
10695
  withDirectives(createElementVNode("td", _hoisted_13, [
10676
- createElementVNode("button", {
10677
- onClick: withModifiers(($event) => $options.handleRowRightClick({ rowData, rowIndex }, $event), ["stop"])
10678
- }, [
10679
- createVNode(_component_cp_icon, { type: "more-vertical" })
10680
- ], 8, _hoisted_14)
10696
+ renderSlot(_ctx.$slots, "row-quick-actions", { row: rowData }, () => [
10697
+ createElementVNode("button", {
10698
+ onClick: withModifiers(($event) => $options.handleRowRightClick({ rowData, rowIndex }, $event), ["stop"])
10699
+ }, [
10700
+ createVNode(_component_cp_icon, { type: "more-vertical" })
10701
+ ], 8, _hoisted_14)
10702
+ ])
10681
10703
  ], 512), [
10682
10704
  [vShow, $options.areRowOptionsEnabled(rowData)]
10683
10705
  ])