ember-headless-table 1.4.4 → 1.4.5

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.
@@ -46,11 +46,26 @@ const styleStringFor = column => {
46
46
  * have the same width
47
47
  */
48
48
  for (let [key, value] of Object.entries(columnMeta.style)) {
49
- result += `${key}:${value};`;
49
+ result += `${toStyle(key)}:${value};`;
50
50
  }
51
51
  result = ';' + result;
52
52
  return htmlSafe(result);
53
53
  };
54
54
 
55
+ /**
56
+ * the JS API for styles is camel case,
57
+ * but CSS is kebab-case. To save on complexity and
58
+ * amount of code, we have a super small conversion function
59
+ * for only the properties relevant to the sticky plugin.
60
+ */
61
+ const toStyle = key => {
62
+ switch (key) {
63
+ case 'minWidth':
64
+ return 'min-width';
65
+ default:
66
+ return key;
67
+ }
68
+ };
69
+
55
70
  export { canShrink, hasResizeHandle, isResizing, styleStringFor };
56
71
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../src/plugins/column-resizing/helpers.ts"],"sourcesContent":["import { htmlSafe } from '@ember/template';\n\nimport { meta } from '../-private/base';\nimport { ColumnResizing } from './plugin';\n\nimport type { Column } from '[public-types]';\n\n/**\n * The column actively being resized by the user.\n *\n * Note that during resizing, multiple columns are resized at once,\n * dependending on the boundaries of the resize events.\n *\n * The other columns being resized as a consequence of \"this\" column will not\n * be marked as isResizing, because this is a user-scoped question:\n * \"Is the user directly resizing this column?\"\n */\nexport const isResizing = (column: Column) => meta.forColumn(column, ColumnResizing).isResizing;\n\n/**\n * Does the column have room to shrink?\n */\nexport const canShrink = (column: Column) => meta.forColumn(column, ColumnResizing).canShrink;\n\n/**\n * Does the column have a resize handle?\n * The return value of this function can be determined by\n * - if resizing is enabled for the column\n * - if resizing is enabled for the whole table\n * - or if we're asking about the first column (resize handles may only be \"between\" columns)\n */\nexport const hasResizeHandle = (column: Column) =>\n meta.forColumn(column, ColumnResizing).hasResizeHandle;\n\n/**\n * In this plugin (by default), styles are only applied to the headers automatically.\n * in <Table> UIs, the header cells control the widths of all cells in that column.\n * There are other kinds of tabular-like markup that may want to grab the widths of columns,\n * because The Platform does not manage that automatically (like if divs and roles were used manually)\n *\n * This utility is meant to be applied to the `style` attribute of a particular td-like element.\n */\nexport const styleStringFor = <DataType = unknown>(\n column: Column<DataType>\n): ReturnType<typeof htmlSafe> => {\n let columnMeta = meta.forColumn(column, ColumnResizing);\n\n let result = '';\n\n /**\n * Styles are applied regardless of the \"table\" being resizable or not\n * because in non-<table> UIs, we need to ensure that all cells in a column\n * have the same width\n */\n for (let [key, value] of Object.entries(columnMeta.style)) {\n result += `${key}:${value};`;\n }\n\n result = ';' + result;\n\n return htmlSafe(result);\n};\n"],"names":["isResizing","column","meta","forColumn","ColumnResizing","canShrink","hasResizeHandle","styleStringFor","columnMeta","result","key","value","Object","entries","style","htmlSafe"],"mappings":";;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACaA,MAAAA,UAAU,GAAIC,MAAc,IAAKC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAACJ,WAAU;;AAE/F;AACA;AACA;AACaK,MAAAA,SAAS,GAAIJ,MAAc,IAAKC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAACC,UAAS;;AAE7F;AACA;AACA;AACA;AACA;AACA;AACA;AACaC,MAAAA,eAAe,GAAIL,MAAc,IAC5CC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAACE,gBAAe;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACaC,MAAAA,cAAc,GACzBN,MAAwB,IACQ;EAChC,IAAIO,UAAU,GAAGN,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAAA;EAEvD,IAAIK,MAAM,GAAG,EAAE,CAAA;;AAEf;AACF;AACA;AACA;AACA;AACE,EAAA,KAAK,IAAI,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,UAAU,CAACM,KAAK,CAAC,EAAE;AACzDL,IAAAA,MAAM,IAAK,CAAA,EAAEC,GAAI,CAAA,CAAA,EAAGC,KAAM,CAAE,CAAA,CAAA,CAAA;AAC9B,GAAA;EAEAF,MAAM,GAAG,GAAG,GAAGA,MAAM,CAAA;EAErB,OAAOM,QAAQ,CAACN,MAAM,CAAC,CAAA;AACzB;;;;"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../src/plugins/column-resizing/helpers.ts"],"sourcesContent":["import { htmlSafe } from '@ember/template';\n\nimport { meta } from '../-private/base';\nimport { ColumnResizing } from './plugin';\n\nimport type { Column } from '[public-types]';\n\n/**\n * The column actively being resized by the user.\n *\n * Note that during resizing, multiple columns are resized at once,\n * dependending on the boundaries of the resize events.\n *\n * The other columns being resized as a consequence of \"this\" column will not\n * be marked as isResizing, because this is a user-scoped question:\n * \"Is the user directly resizing this column?\"\n */\nexport const isResizing = (column: Column) => meta.forColumn(column, ColumnResizing).isResizing;\n\n/**\n * Does the column have room to shrink?\n */\nexport const canShrink = (column: Column) => meta.forColumn(column, ColumnResizing).canShrink;\n\n/**\n * Does the column have a resize handle?\n * The return value of this function can be determined by\n * - if resizing is enabled for the column\n * - if resizing is enabled for the whole table\n * - or if we're asking about the first column (resize handles may only be \"between\" columns)\n */\nexport const hasResizeHandle = (column: Column) =>\n meta.forColumn(column, ColumnResizing).hasResizeHandle;\n\n/**\n * In this plugin (by default), styles are only applied to the headers automatically.\n * in <Table> UIs, the header cells control the widths of all cells in that column.\n * There are other kinds of tabular-like markup that may want to grab the widths of columns,\n * because The Platform does not manage that automatically (like if divs and roles were used manually)\n *\n * This utility is meant to be applied to the `style` attribute of a particular td-like element.\n */\nexport const styleStringFor = <DataType = unknown>(\n column: Column<DataType>\n): ReturnType<typeof htmlSafe> => {\n let columnMeta = meta.forColumn(column, ColumnResizing);\n\n let result = '';\n\n /**\n * Styles are applied regardless of the \"table\" being resizable or not\n * because in non-<table> UIs, we need to ensure that all cells in a column\n * have the same width\n */\n for (let [key, value] of Object.entries(columnMeta.style)) {\n result += `${toStyle(key)}:${value};`;\n }\n\n result = ';' + result;\n\n return htmlSafe(result);\n};\n\n/**\n * the JS API for styles is camel case,\n * but CSS is kebab-case. To save on complexity and\n * amount of code, we have a super small conversion function\n * for only the properties relevant to the sticky plugin.\n */\nconst toStyle = (key: string): string => {\n switch (key) {\n case 'minWidth':\n return 'min-width';\n default:\n return key;\n }\n};\n"],"names":["isResizing","column","meta","forColumn","ColumnResizing","canShrink","hasResizeHandle","styleStringFor","columnMeta","result","key","value","Object","entries","style","toStyle","htmlSafe"],"mappings":";;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACaA,MAAAA,UAAU,GAAIC,MAAc,IAAKC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAACJ,WAAU;;AAE/F;AACA;AACA;AACaK,MAAAA,SAAS,GAAIJ,MAAc,IAAKC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAACC,UAAS;;AAE7F;AACA;AACA;AACA;AACA;AACA;AACA;AACaC,MAAAA,eAAe,GAAIL,MAAc,IAC5CC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAACE,gBAAe;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACaC,MAAAA,cAAc,GACzBN,MAAwB,IACQ;EAChC,IAAIO,UAAU,GAAGN,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,cAAc,CAAC,CAAA;EAEvD,IAAIK,MAAM,GAAG,EAAE,CAAA;;AAEf;AACF;AACA;AACA;AACA;AACE,EAAA,KAAK,IAAI,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,UAAU,CAACM,KAAK,CAAC,EAAE;IACzDL,MAAM,IAAK,GAAEM,OAAO,CAACL,GAAG,CAAE,CAAA,CAAA,EAAGC,KAAM,CAAE,CAAA,CAAA,CAAA;AACvC,GAAA;EAEAF,MAAM,GAAG,GAAG,GAAGA,MAAM,CAAA;EAErB,OAAOO,QAAQ,CAACP,MAAM,CAAC,CAAA;AACzB,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,OAAO,GAAIL,GAAW,IAAa;AACvC,EAAA,QAAQA,GAAG;AACT,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,WAAW,CAAA;AACpB,IAAA;AACE,MAAA,OAAOA,GAAG,CAAA;AAAC,GAAA;AAEjB,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-headless-table",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "An implementation of table behaviors for driving any table or table-like UI -- all without a UI (headless)",
5
5
  "keywords": [
6
6
  "ember-addon",