@sme.up/ketchup 5.2.1-SNAPSHOT → 6.2.0-SNAPSHOT

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 (231) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/cjs/{cell-utils-d96b2993.js → cell-utils-d894e802.js} +2 -2
  3. package/dist/cjs/{component-d1496215.js → component-72a5b626.js} +30 -0
  4. package/dist/cjs/{f-button-2b9b99b1.js → f-button-414b3bc3.js} +4 -4
  5. package/dist/cjs/f-cell-c8983ec7.js +418 -0
  6. package/dist/cjs/f-checkbox-57443ca3.js +29 -0
  7. package/dist/cjs/{f-chip-df59e1b0.js → f-chip-ef81bf51.js} +5 -4
  8. package/dist/cjs/{f-image-12bab3b5.js → f-image-0618c795.js} +2 -2
  9. package/dist/cjs/f-paginator-utils-c9dd5173.js +1898 -0
  10. package/dist/cjs/{f-text-field-e7c35b5b.js → f-text-field-7d31190f.js} +3 -3
  11. package/dist/cjs/{f-text-field-mdc-a67f5dfe.js → f-text-field-mdc-85997738.js} +23 -305
  12. package/dist/cjs/{index-eb556444.js → index-06b131ea.js} +6 -4
  13. package/dist/cjs/ketchup.cjs.js +3 -3
  14. package/dist/cjs/kup-accordion.cjs.entry.js +5 -5
  15. package/dist/cjs/{kup-autocomplete_27.cjs.entry.js → kup-autocomplete_25.cjs.entry.js} +1833 -5745
  16. package/dist/cjs/{kup-echart.cjs.entry.js → kup-box_2.cjs.entry.js} +17113 -14788
  17. package/dist/cjs/kup-calendar.cjs.entry.js +42 -34
  18. package/dist/cjs/kup-cell.cjs.entry.js +10 -9
  19. package/dist/cjs/kup-dash-list.cjs.entry.js +4 -4
  20. package/dist/cjs/kup-dash_2.cjs.entry.js +4 -7
  21. package/dist/cjs/kup-dashboard.cjs.entry.js +379 -0
  22. package/dist/cjs/kup-drawer.cjs.entry.js +12 -5
  23. package/dist/cjs/kup-field.cjs.entry.js +2 -2
  24. package/dist/cjs/kup-form.cjs.entry.js +469 -0
  25. package/dist/cjs/kup-iframe.cjs.entry.js +3 -3
  26. package/dist/cjs/kup-image-list.cjs.entry.js +229 -0
  27. package/dist/cjs/kup-lazy.cjs.entry.js +3 -3
  28. package/dist/cjs/kup-magic-box.cjs.entry.js +4 -4
  29. package/dist/cjs/kup-manager-2fee8cf3.js +17021 -0
  30. package/dist/cjs/kup-nav-bar.cjs.entry.js +3 -3
  31. package/dist/cjs/kup-numeric-picker.cjs.entry.js +5 -5
  32. package/dist/cjs/kup-photo-frame.cjs.entry.js +7 -9
  33. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  34. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  35. package/dist/cjs/kup-snackbar.cjs.entry.js +6 -6
  36. package/dist/cjs/loader.cjs.js +3 -3
  37. package/dist/cjs/{utils-e99921c1.js → utils-8470184d.js} +1 -1
  38. package/dist/collection/assets/card.js +4 -5
  39. package/dist/collection/assets/dashboard.js +113 -0
  40. package/dist/collection/assets/data-table.js +15 -79
  41. package/dist/collection/assets/form.js +179 -0
  42. package/dist/collection/assets/grid.js +17 -0
  43. package/dist/collection/assets/image-list.js +624 -0
  44. package/dist/collection/assets/index.js +16 -4
  45. package/dist/collection/assets/kupdata.js +0 -3
  46. package/dist/collection/assets/kuptooltip.js +53 -7
  47. package/dist/collection/assets/tree.js +0 -128
  48. package/dist/collection/collection-manifest.json +8 -6
  49. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +136 -130
  50. package/dist/collection/components/kup-box/kup-box-declarations.js +0 -4
  51. package/dist/collection/components/kup-box/kup-box.js +20 -137
  52. package/dist/collection/components/kup-card/built-in/kup-card-clock.js +1 -1
  53. package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +1 -2
  54. package/dist/collection/components/kup-card/kup-card.css +26 -8
  55. package/dist/collection/components/kup-card/kup-card.js +1 -2
  56. package/dist/collection/components/kup-card/standard/kup-card-standard.js +14 -6
  57. package/dist/collection/components/kup-combobox/kup-combobox.js +17 -14
  58. package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -0
  59. package/dist/collection/components/kup-dashboard/kup-dashboard.css +81 -0
  60. package/dist/collection/components/kup-dashboard/kup-dashboard.js +560 -0
  61. package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +1 -3
  62. package/dist/collection/components/kup-data-table/kup-data-table.js +19 -136
  63. package/dist/collection/components/kup-drawer/kup-drawer.css +6 -8
  64. package/dist/collection/components/kup-drawer/kup-drawer.js +8 -1
  65. package/dist/collection/components/kup-form/kup-form-declarations.js +19 -0
  66. package/dist/collection/components/kup-form/kup-form.css +86 -0
  67. package/dist/collection/components/kup-form/kup-form.js +668 -0
  68. package/dist/collection/components/kup-grid/kup-grid.js +1 -4
  69. package/dist/collection/components/kup-image-list/kup-image-list-declarations.js +10 -0
  70. package/dist/collection/components/kup-image-list/kup-image-list.css +166 -0
  71. package/dist/collection/components/kup-image-list/kup-image-list.js +432 -0
  72. package/dist/collection/components/kup-list/kup-list-helper.js +9 -3
  73. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +2 -9
  74. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +3 -5
  75. package/dist/collection/components/kup-snackbar/kup-snackbar.css +4 -0
  76. package/dist/collection/components/kup-tab-bar/kup-tab-bar.js +18 -19
  77. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +3 -0
  78. package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
  79. package/dist/collection/components/kup-time-picker/kup-time-picker.js +2 -8
  80. package/dist/collection/components/kup-tree/kup-tree-declarations.js +0 -4
  81. package/dist/collection/components/kup-tree/kup-tree.css +10 -3
  82. package/dist/collection/components/kup-tree/kup-tree.js +73 -142
  83. package/dist/collection/f-components/f-button/f-button.js +2 -2
  84. package/dist/collection/f-components/f-cell/f-cell-declarations.js +5 -1
  85. package/dist/collection/f-components/f-cell/f-cell.js +41 -121
  86. package/dist/collection/f-components/f-chip/f-chip.js +2 -1
  87. package/dist/collection/f-components/f-text-field/f-text-field.js +1 -1
  88. package/dist/collection/managers/kup-data/kup-data-node-helper.js +24 -0
  89. package/dist/collection/managers/kup-data/kup-data.js +98 -1
  90. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +4 -2
  91. package/dist/collection/managers/kup-interact/kup-interact.js +1 -22
  92. package/dist/collection/managers/kup-language/kup-language-declarations.js +13 -0
  93. package/dist/collection/managers/kup-manager/kup-manager.js +21 -2
  94. package/dist/collection/managers/kup-objects/kup-objects.js +10 -0
  95. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +21 -1
  96. package/dist/collection/managers/kup-tooltip/kup-tooltip.js +53 -20
  97. package/dist/collection/types/GenericTypes.js +3 -0
  98. package/dist/collection/utils/kup-column-menu/kup-column-menu.js +7 -11
  99. package/dist/esm/{cell-utils-f4bdbbc8.js → cell-utils-7fc84d4e.js} +3 -3
  100. package/dist/esm/{component-c4eb6153.js → component-b1bedf1d.js} +27 -2
  101. package/dist/esm/{f-button-54a49fd8.js → f-button-2f6cc296.js} +4 -4
  102. package/dist/esm/f-cell-4428481c.js +415 -0
  103. package/dist/esm/f-checkbox-c51c4a75.js +27 -0
  104. package/dist/esm/{f-chip-a3035b4b.js → f-chip-b39eb49a.js} +6 -5
  105. package/dist/esm/{f-image-d32465e3.js → f-image-b08ebeb2.js} +2 -2
  106. package/dist/esm/f-paginator-utils-4fda6086.js +1884 -0
  107. package/dist/esm/{f-text-field-c25cc63f.js → f-text-field-184a5fb3.js} +3 -3
  108. package/dist/esm/{f-text-field-mdc-9fbbefc3.js → f-text-field-mdc-d42d3f9e.js} +2 -284
  109. package/dist/esm/{index-baeab1ac.js → index-ad6ab214.js} +6 -4
  110. package/dist/esm/ketchup.js +3 -3
  111. package/dist/esm/kup-accordion.entry.js +6 -6
  112. package/dist/esm/{kup-autocomplete_27.entry.js → kup-autocomplete_25.entry.js} +1775 -5685
  113. package/dist/esm/{kup-echart.entry.js → kup-box_2.entry.js} +17113 -14789
  114. package/dist/esm/kup-calendar.entry.js +43 -35
  115. package/dist/esm/kup-cell.entry.js +9 -8
  116. package/dist/esm/kup-dash-list.entry.js +4 -4
  117. package/dist/esm/kup-dash_2.entry.js +4 -7
  118. package/dist/esm/kup-dashboard.entry.js +375 -0
  119. package/dist/esm/kup-drawer.entry.js +12 -5
  120. package/dist/esm/kup-field.entry.js +2 -2
  121. package/dist/esm/kup-form.entry.js +465 -0
  122. package/dist/esm/kup-iframe.entry.js +3 -3
  123. package/dist/esm/kup-image-list.entry.js +225 -0
  124. package/dist/esm/kup-lazy.entry.js +3 -3
  125. package/dist/esm/kup-magic-box.entry.js +4 -4
  126. package/dist/esm/kup-manager-3325b2d8.js +17000 -0
  127. package/dist/esm/kup-nav-bar.entry.js +3 -3
  128. package/dist/esm/kup-numeric-picker.entry.js +6 -6
  129. package/dist/esm/kup-photo-frame.entry.js +7 -9
  130. package/dist/esm/kup-probe.entry.js +2 -2
  131. package/dist/esm/kup-qlik.entry.js +2 -2
  132. package/dist/esm/kup-snackbar.entry.js +6 -6
  133. package/dist/esm/loader.js +3 -3
  134. package/dist/esm/polyfills/css-shim.js +1 -1
  135. package/dist/esm/{tslib.es6-8f2d44b6.js → tslib.es6-3eea2234.js} +1 -1
  136. package/dist/esm/{utils-f24319a0.js → utils-6373a07e.js} +2 -2
  137. package/dist/ketchup/ketchup.esm.js +1 -1
  138. package/dist/ketchup/p-006bc4d0.entry.js +1 -0
  139. package/dist/ketchup/p-0741da57.js +1 -0
  140. package/dist/ketchup/{p-669bde31.js → p-13e08580.js} +1 -1
  141. package/dist/ketchup/p-153697fb.entry.js +1 -0
  142. package/dist/ketchup/{p-9a61d8dc.entry.js → p-175edb62.entry.js} +1 -1
  143. package/dist/ketchup/{p-11e72a8c.entry.js → p-1db1d42b.entry.js} +1 -1
  144. package/dist/ketchup/{p-67842f1e.entry.js → p-30820f8f.entry.js} +1 -1
  145. package/dist/ketchup/p-35325834.entry.js +9 -0
  146. package/dist/ketchup/p-359e8bec.entry.js +40 -0
  147. package/dist/ketchup/{p-09d708c4.entry.js → p-3c7c92c0.entry.js} +1 -1
  148. package/dist/ketchup/p-41cf8703.entry.js +1 -0
  149. package/dist/ketchup/{p-e6709c26.entry.js → p-6127fccf.entry.js} +1 -1
  150. package/dist/ketchup/{p-203d6295.entry.js → p-6b82e4e2.entry.js} +1 -1
  151. package/dist/ketchup/p-704e60eb.js +30 -0
  152. package/dist/ketchup/{p-4f56932b.js → p-70660fe2.js} +1 -1
  153. package/dist/ketchup/{p-44192f30.entry.js → p-762c0382.entry.js} +1 -1
  154. package/dist/ketchup/{p-c58a2a81.entry.js → p-76947316.entry.js} +1 -1
  155. package/dist/ketchup/{p-a0b1d769.js → p-79b0730b.js} +1 -1
  156. package/dist/ketchup/{p-bb8844bf.entry.js → p-8103b80a.entry.js} +1 -1
  157. package/dist/ketchup/{p-8c44c3b9.js → p-81605f08.js} +4 -5
  158. package/dist/ketchup/p-9fa457d4.entry.js +1 -0
  159. package/dist/ketchup/{p-e8e3c9da.entry.js → p-a0ce8075.entry.js} +1 -1
  160. package/dist/ketchup/p-a203f78b.js +45 -0
  161. package/dist/ketchup/p-a804fe83.entry.js +27 -0
  162. package/dist/ketchup/{p-34748c91.js → p-ca9fd099.js} +1 -1
  163. package/dist/ketchup/p-caabb9ab.entry.js +1 -0
  164. package/dist/ketchup/p-cc3abf84.entry.js +1 -0
  165. package/dist/ketchup/p-cd5cfa7c.js +1 -0
  166. package/dist/ketchup/p-d2e76960.entry.js +1 -0
  167. package/dist/ketchup/p-d3b542b3.js +2 -0
  168. package/dist/ketchup/p-d7004ae4.js +1 -0
  169. package/dist/ketchup/{p-40f97429.js → p-d95c904b.js} +1 -1
  170. package/dist/ketchup/p-ddce3430.js +1 -0
  171. package/dist/ketchup/p-ee580b3a.entry.js +1 -0
  172. package/dist/ketchup/p-f49cb68e.js +1 -0
  173. package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +1 -16
  174. package/dist/types/components/kup-box/kup-box-declarations.d.ts +3 -5
  175. package/dist/types/components/kup-box/kup-box.d.ts +0 -22
  176. package/dist/types/components/kup-dashboard/kup-dashboard-declarations.d.ts +61 -0
  177. package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +75 -0
  178. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +2 -4
  179. package/dist/types/components/kup-data-table/kup-data-table.d.ts +1 -19
  180. package/dist/types/components/kup-form/kup-form-declarations.d.ts +48 -0
  181. package/dist/types/components/kup-form/kup-form.d.ts +68 -0
  182. package/dist/types/components/kup-image-list/kup-image-list-declarations.d.ts +14 -0
  183. package/dist/types/components/kup-image-list/kup-image-list.d.ts +56 -0
  184. package/dist/types/components/kup-tab-bar/kup-tab-bar-declarations.d.ts +3 -9
  185. package/dist/types/components/kup-tab-bar/kup-tab-bar.d.ts +6 -6
  186. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +3 -0
  187. package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
  188. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +0 -6
  189. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +3 -5
  190. package/dist/types/components/kup-tree/kup-tree.d.ts +1 -24
  191. package/dist/types/components.d.ts +512 -369
  192. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +4 -1
  193. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
  194. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +1 -0
  195. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +7 -0
  196. package/dist/types/managers/kup-data/kup-data.d.ts +3 -0
  197. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +13 -1
  198. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +4 -0
  199. package/dist/types/managers/kup-manager/kup-manager.d.ts +12 -0
  200. package/dist/types/managers/kup-objects/kup-objects.d.ts +6 -0
  201. package/dist/types/managers/kup-tooltip/kup-tooltip-declarations.d.ts +3 -3
  202. package/dist/types/managers/kup-tooltip/kup-tooltip.d.ts +17 -6
  203. package/dist/types/types/GenericTypes.d.ts +3 -0
  204. package/dist/types/utils/kup-column-menu/kup-column-menu.d.ts +1 -3
  205. package/package.json +15 -14
  206. package/dist/cjs/f-cell-8351cb84.js +0 -653
  207. package/dist/cjs/kup-manager-5c03da64.js +0 -8795
  208. package/dist/collection/assets/tooltip.js +0 -73
  209. package/dist/collection/components/kup-tooltip/kup-tooltip-declarations.js +0 -20
  210. package/dist/collection/components/kup-tooltip/kup-tooltip.css +0 -149
  211. package/dist/collection/components/kup-tooltip/kup-tooltip.js +0 -1205
  212. package/dist/collection/utils/helpers.js +0 -38
  213. package/dist/esm/f-cell-d5dac50b.js +0 -650
  214. package/dist/esm/kup-manager-9316a184.js +0 -8778
  215. package/dist/ketchup/p-12773ca8.js +0 -9
  216. package/dist/ketchup/p-34b74425.js +0 -1
  217. package/dist/ketchup/p-4173422f.entry.js +0 -1
  218. package/dist/ketchup/p-41741c28.entry.js +0 -1
  219. package/dist/ketchup/p-44f8da2a.js +0 -1
  220. package/dist/ketchup/p-7a74ad17.js +0 -1
  221. package/dist/ketchup/p-7ba8fa4a.entry.js +0 -39
  222. package/dist/ketchup/p-7de0d7e1.js +0 -1
  223. package/dist/ketchup/p-8418e8fa.entry.js +0 -1
  224. package/dist/ketchup/p-96bf19aa.entry.js +0 -1
  225. package/dist/ketchup/p-b0ddcce9.entry.js +0 -9
  226. package/dist/ketchup/p-b6c21223.entry.js +0 -27
  227. package/dist/ketchup/p-ca3d585b.entry.js +0 -1
  228. package/dist/ketchup/p-ecb7069b.js +0 -135
  229. package/dist/types/components/kup-tooltip/kup-tooltip-declarations.d.ts +0 -93
  230. package/dist/types/components/kup-tooltip/kup-tooltip.d.ts +0 -142
  231. package/dist/types/utils/helpers.d.ts +0 -4
@@ -0,0 +1,465 @@
1
+ import { r as registerInstance, f as forceUpdate, h, H as Host, g as getElement } from './index-ad6ab214.js';
2
+ import { k as kupManagerInstance, _ as FCellTypes, h as KupLanguageGeneric } from './kup-manager-3325b2d8.js';
3
+ import { i as identify, g as getProps, s as setProps } from './utils-6373a07e.js';
4
+ import { c as componentWrapperId } from './GenericVariables-665de00a.js';
5
+ import { F as FCell } from './f-cell-4428481c.js';
6
+ import { F as FTextFieldMDC } from './f-text-field-mdc-d42d3f9e.js';
7
+ import './cell-utils-7fc84d4e.js';
8
+ import './f-checkbox-c51c4a75.js';
9
+ import './f-text-field-184a5fb3.js';
10
+ import './f-image-b08ebeb2.js';
11
+ import './f-chip-b39eb49a.js';
12
+ import './tslib.es6-3eea2234.js';
13
+ import './component-b1bedf1d.js';
14
+
15
+ /**
16
+ * Props of the kup-form component.
17
+ * Used to export every prop in an object.
18
+ */
19
+ var KupFormProps;
20
+ (function (KupFormProps) {
21
+ KupFormProps["customStyle"] = "Custom style of the component.";
22
+ KupFormProps["data"] = "Actual data of the form.";
23
+ KupFormProps["layout"] = "How the form will arrange its content.";
24
+ })(KupFormProps || (KupFormProps = {}));
25
+ var KupFormLabelPlacement;
26
+ (function (KupFormLabelPlacement) {
27
+ KupFormLabelPlacement["BOTTOM"] = "bottom";
28
+ KupFormLabelPlacement["LEFT"] = "left";
29
+ KupFormLabelPlacement["HIDDEN"] = "hidden";
30
+ KupFormLabelPlacement["PLACEHOLDER"] = "placeholder";
31
+ KupFormLabelPlacement["RIGHT"] = "right";
32
+ KupFormLabelPlacement["TOP"] = "top";
33
+ })(KupFormLabelPlacement || (KupFormLabelPlacement = {}));
34
+
35
+ const kupFormCss = ":host{--kup_form_background_color:var(\n --kup-form-background-color,\n var(--kup-background-color)\n );--kup_form_color:var(--kup-form-color, var(--kup-text-color));--kup_form_font_family:var(--kup-form-font-family, var(--kup-font-family));--kup_form_font_size:var(--kup-form-font-size, var(--kup-font-size));display:block;font-family:var(--kup_form_font_family);font-size:var(--kup_form_font_size)}:host([label-placement=left]) .form__label{width:0}:host([label-placement=right]) .form__field{min-width:200px;width:0}.form{background:var(--kup_form_background_color);color:var(--kup_form_color);display:flex;flex-grow:1;overflow:auto;position:relative}.form--column{flex-direction:column}.form__section{display:flex;flex:1 1 1%;flex-direction:row;flex-wrap:wrap}.form__section--column{flex-direction:column;flex-wrap:unset}.form__section--column>.form__section{flex:0 0 auto}.form__section--grid{display:grid}.form__section--titled{border:1px solid var(--kup-border-color);padding-top:5px;position:relative;margin:10px}.form__section--titled>h3{background:var(--kup-background-color);font-size:calc(var(--kup-font-size) * 1.15);position:absolute;margin:0px;padding:0 8px;top:-11px;left:5px;transition:background-color 0.25s ease}.form__label{-webkit-font-smoothing:antialiased;font-size:0.875em;letter-spacing:0.0178571429em;white-space:nowrap}.form__field{min-height:16px}.form__field img{height:auto}.form .f-cell.c-right-aligned:not(.c-centered) .f-cell__content{justify-content:flex-start}";
36
+
37
+ const dom = document.documentElement;
38
+ const KupForm = class {
39
+ constructor(hostRef) {
40
+ registerInstance(this, hostRef);
41
+ /*-------------------------------------------------*/
42
+ /* P r o p s */
43
+ /*-------------------------------------------------*/
44
+ /**
45
+ * Custom style of the component.
46
+ * @default ""
47
+ * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
48
+ */
49
+ this.customStyle = '';
50
+ /**
51
+ * Actual data of the form.
52
+ * @default null
53
+ */
54
+ this.data = null;
55
+ /**
56
+ * Placement of fields' labels.
57
+ * @default KupFormLabelPlacement.LEFT
58
+ */
59
+ this.labelPlacement = KupFormLabelPlacement.LEFT;
60
+ /**
61
+ * How the form will arrange its content.
62
+ * @default null
63
+ */
64
+ this.layout = null;
65
+ /*-------------------------------------------------*/
66
+ /* I n t e r n a l V a r i a b l e s */
67
+ /*-------------------------------------------------*/
68
+ this.kupManager = kupManagerInstance();
69
+ this.visibleColumns = [];
70
+ }
71
+ /*-------------------------------------------------*/
72
+ /* W a t c h e r s */
73
+ /*-------------------------------------------------*/
74
+ onDataChanged() {
75
+ identify(this.getRows());
76
+ this.initVisibleColumns();
77
+ this.checkLayout();
78
+ }
79
+ onLayoutChanged() {
80
+ this.checkLayout();
81
+ }
82
+ /*-------------------------------------------------*/
83
+ /* P u b l i c M e t h o d s */
84
+ /*-------------------------------------------------*/
85
+ /**
86
+ * Used to retrieve component's props values.
87
+ * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
88
+ * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
89
+ */
90
+ async getProps(descriptions) {
91
+ return getProps(this, KupFormProps, descriptions);
92
+ }
93
+ /**
94
+ * This method is used to trigger a new render of the component.
95
+ */
96
+ async refresh() {
97
+ forceUpdate(this);
98
+ }
99
+ /**
100
+ * Sets the focus on an editable table cell.
101
+ * @param {string} column - Name of the column.
102
+ * @param {string} rowId - Id of the row.
103
+ */
104
+ async setFocus(column, rowId) {
105
+ const cells = this.rootElement.shadowRoot.querySelectorAll('td[data-column="' + column + '"]');
106
+ for (let index = 0; cells && index < cells.length; index++) {
107
+ const cell = cells[index];
108
+ if (cell['data-row'] && cell['data-row'].id == rowId) {
109
+ const input = cell.querySelector('input');
110
+ if (input) {
111
+ input.focus();
112
+ }
113
+ else {
114
+ const kupInput = cell.querySelector('.hydrated');
115
+ if (kupInput) {
116
+ try {
117
+ kupInput.setFocus();
118
+ }
119
+ catch (error) { }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ /**
126
+ * Sets the props to the component.
127
+ * @param {GenericObject} props - Object containing props that will be set to the component.
128
+ */
129
+ async setProps(props) {
130
+ setProps(this, KupFormProps, props);
131
+ }
132
+ /*-------------------------------------------------*/
133
+ /* P r i v a t e M e t h o d s */
134
+ /*-------------------------------------------------*/
135
+ getColumns() {
136
+ return this.data && this.data.columns
137
+ ? this.data.columns
138
+ : [{ title: '', name: '', size: undefined }];
139
+ }
140
+ initVisibleColumns() {
141
+ this.visibleColumns = this.getColumns().filter((column) => {
142
+ if (column.hasOwnProperty('visible')) {
143
+ return column.visible;
144
+ }
145
+ return true;
146
+ });
147
+ }
148
+ getRows() {
149
+ return this.data && this.data.rows ? this.data.rows : [];
150
+ }
151
+ checkLayout() {
152
+ if (this.layout) {
153
+ this.formLayout = this.layout;
154
+ return;
155
+ }
156
+ const section = {
157
+ horizontal: false,
158
+ sections: [],
159
+ };
160
+ const visibleColumns = this.visibleColumns;
161
+ let size = visibleColumns.length;
162
+ const content = [];
163
+ let cnt = 0;
164
+ while (size-- > 0) {
165
+ content.push({
166
+ column: visibleColumns[cnt++].name,
167
+ });
168
+ }
169
+ section.content = content;
170
+ this.formLayout = {
171
+ sections: [section],
172
+ };
173
+ }
174
+ renderRow(row) {
175
+ const visibleColumns = [...this.visibleColumns];
176
+ let formContent = null;
177
+ let rowLayout = row.layout;
178
+ if (!rowLayout) {
179
+ rowLayout = this.formLayout;
180
+ }
181
+ let horizontal = false;
182
+ if (rowLayout) {
183
+ if (rowLayout.horizontal) {
184
+ horizontal = true;
185
+ }
186
+ const sections = rowLayout.sections;
187
+ let size = sections.length;
188
+ let cnt = 0;
189
+ if (size > 0) {
190
+ formContent = [];
191
+ }
192
+ const parent = {
193
+ horizontal: horizontal,
194
+ };
195
+ while (size-- > 0) {
196
+ formContent.push(this.renderSection(sections[cnt++], parent, row, visibleColumns));
197
+ }
198
+ }
199
+ const classObj = {
200
+ form: true,
201
+ 'form--column': !horizontal,
202
+ };
203
+ return h("form", { class: classObj }, formContent);
204
+ }
205
+ renderSection(section, parent, row, visibleColumns) {
206
+ let sectionContent = null;
207
+ if (section.sections && section.sections.length > 0) {
208
+ const sections = section.sections;
209
+ let size = sections.length;
210
+ let cnt = 0;
211
+ if (size > 0) {
212
+ sectionContent = [];
213
+ }
214
+ while (size-- > 0) {
215
+ sectionContent.push(this.renderSection(sections[cnt++], section, row, visibleColumns));
216
+ }
217
+ }
218
+ else if (section.content) {
219
+ const content = section.content;
220
+ let size = content.length;
221
+ let cnt = 0;
222
+ if (size > 0) {
223
+ sectionContent = [];
224
+ }
225
+ while (size-- > 0) {
226
+ const formField = this.renderFormField({
227
+ formField: content[cnt++],
228
+ row,
229
+ visibleColumns,
230
+ }, true);
231
+ let field = formField;
232
+ if (!section.horizontal) {
233
+ field = h("tr", null, formField);
234
+ }
235
+ sectionContent.push(field);
236
+ }
237
+ }
238
+ else if (visibleColumns.length > 0) {
239
+ const column = visibleColumns[0];
240
+ sectionContent = this.renderFormField({
241
+ formField: { column: column.name },
242
+ row,
243
+ visibleColumns,
244
+ });
245
+ }
246
+ const isGrid = !!section.columns;
247
+ const sectionClass = {
248
+ form__section: true,
249
+ 'form__section--column': !isGrid && !section.horizontal,
250
+ 'form__section--grid': isGrid,
251
+ 'form__section--titled': !!section.title,
252
+ 'form__section--last': !section.sections || section.sections.length === 0,
253
+ };
254
+ const sectionStyle = section.style || {};
255
+ if (section.dim && parent) {
256
+ sectionStyle.flex = `0 0 ${section.dim}`;
257
+ if (parent.horizontal) {
258
+ sectionStyle.maxWidth = section.dim;
259
+ }
260
+ else {
261
+ sectionStyle.maxHeight = section.dim;
262
+ }
263
+ }
264
+ if (isGrid) {
265
+ sectionStyle['grid-template-columns'] = `repeat(${section.columns}, 1fr)`;
266
+ }
267
+ return (h("div", { class: sectionClass, style: sectionStyle }, section.title ? h("h3", null, section.title) : null, h("table", null, h("tbody", null, section.horizontal ? (h("tr", null, sectionContent)) : (sectionContent)))));
268
+ }
269
+ renderFormField({ formField, row, visibleColumns, }, fromSection) {
270
+ const classObj = {
271
+ form__field: true,
272
+ };
273
+ const styleObj = {};
274
+ let column = null;
275
+ let index = -1;
276
+ for (let i = 0; i < visibleColumns.length; i++) {
277
+ const c = visibleColumns[i];
278
+ if (c.name === formField.column) {
279
+ index = i;
280
+ break;
281
+ }
282
+ }
283
+ if (index >= 0) {
284
+ column = visibleColumns[index];
285
+ visibleColumns.splice(index, 1);
286
+ }
287
+ else if (fromSection) {
288
+ column = this.data.columns.find((x) => x.name === formField.column);
289
+ }
290
+ const cell = row.cells[formField.column];
291
+ let title = undefined;
292
+ if (cell) {
293
+ cell.isEditable = true;
294
+ if (!this.kupManager.objects.isEmptyKupObj(cell.obj)) {
295
+ if (this.kupManager.debug.isDebug()) {
296
+ title =
297
+ cell.obj.t +
298
+ '; ' +
299
+ cell.obj.p +
300
+ '; ' +
301
+ cell.obj.k +
302
+ ';';
303
+ }
304
+ }
305
+ }
306
+ else {
307
+ return null;
308
+ }
309
+ const cellProps = {
310
+ cell: cell,
311
+ column: column,
312
+ component: this,
313
+ editable: true,
314
+ renderKup: true,
315
+ row: row,
316
+ setSizes: true,
317
+ shape: formField.shape,
318
+ };
319
+ resetLabel();
320
+ switch (this.labelPlacement) {
321
+ case KupFormLabelPlacement.BOTTOM:
322
+ return [h("tr", null, fieldCell()), h("tr", null, labelCell())];
323
+ case KupFormLabelPlacement.PLACEHOLDER:
324
+ setPlaceholderLabel();
325
+ case KupFormLabelPlacement.HIDDEN: {
326
+ if (fromSection) {
327
+ return [fieldCell()];
328
+ }
329
+ else {
330
+ return [h("tr", null, fieldCell())];
331
+ }
332
+ }
333
+ case KupFormLabelPlacement.RIGHT: {
334
+ if (fromSection) {
335
+ return [fieldCell(), labelCell()];
336
+ }
337
+ else {
338
+ return [
339
+ h("tr", null, fieldCell(), labelCell()),
340
+ ];
341
+ }
342
+ }
343
+ case KupFormLabelPlacement.TOP:
344
+ return [h("tr", null, labelCell()), h("tr", null, fieldCell())];
345
+ default: {
346
+ if (fromSection) {
347
+ return [labelCell(), fieldCell()];
348
+ }
349
+ else {
350
+ return [
351
+ h("tr", null, labelCell(), fieldCell()),
352
+ ];
353
+ }
354
+ }
355
+ }
356
+ function fieldCell() {
357
+ return (h("td", { "data-cell": cell, "data-row": row, "data-column": formField.column, class: classObj, style: styleObj, title: title }, cell && column ? (h(FCell, Object.assign({}, cellProps))) : (h("span", null, formField.value))));
358
+ }
359
+ function labelCell() {
360
+ return (h("td", { class: "form__label" }, h("span", null, column.title)));
361
+ }
362
+ function resetLabel() {
363
+ if (!cell.data) {
364
+ cell.data = {};
365
+ }
366
+ try {
367
+ delete cell.data.label;
368
+ }
369
+ catch (_a) { }
370
+ try {
371
+ delete cell.data.data['kup-text-field'].label;
372
+ }
373
+ catch (_b) { }
374
+ }
375
+ function setPlaceholderLabel() {
376
+ switch (dom.ketchup.data.cell.getType(cell, cell.shape || column.shape || null)) {
377
+ case FCellTypes.AUTOCOMPLETE:
378
+ case FCellTypes.COLOR_PICKER:
379
+ case FCellTypes.COMBOBOX:
380
+ case FCellTypes.DATE:
381
+ case FCellTypes.DATETIME:
382
+ case FCellTypes.TIME:
383
+ if (cell.data.data) {
384
+ if (cell.data.data['kup-text-field']) {
385
+ cell.data.data['kup-text-field'].label =
386
+ column.title;
387
+ }
388
+ else {
389
+ cell.data.data = {
390
+ 'kup-text-field': {
391
+ label: column.title,
392
+ },
393
+ };
394
+ }
395
+ }
396
+ else {
397
+ cell.data.data = {
398
+ 'kup-text-field': {
399
+ label: column.title,
400
+ },
401
+ };
402
+ }
403
+ break;
404
+ case FCellTypes.CHECKBOX:
405
+ case FCellTypes.NUMBER:
406
+ case FCellTypes.STRING:
407
+ case FCellTypes.SWITCH:
408
+ cell.data.label = column.title;
409
+ }
410
+ }
411
+ }
412
+ /*-------------------------------------------------*/
413
+ /* L i f e c y c l e H o o k s */
414
+ /*-------------------------------------------------*/
415
+ componentWillLoad() {
416
+ this.kupManager.debug.logLoad(this, false);
417
+ this.kupManager.language.register(this);
418
+ this.kupManager.theme.register(this);
419
+ this.onDataChanged();
420
+ }
421
+ componentDidLoad() {
422
+ this.kupManager.debug.logLoad(this, true);
423
+ }
424
+ componentWillRender() {
425
+ this.kupManager.debug.logRender(this, false);
426
+ }
427
+ componentDidRender() {
428
+ const root = this.rootElement.shadowRoot;
429
+ if (root) {
430
+ const fs = root.querySelectorAll('.f-text-field');
431
+ for (let index = 0; index < fs.length; index++) {
432
+ FTextFieldMDC(fs[index]);
433
+ }
434
+ }
435
+ this.kupManager.debug.logRender(this, true);
436
+ }
437
+ render() {
438
+ let formContent = null;
439
+ if (this.data.rows.length === 0) {
440
+ formContent = (h("p", null, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA)));
441
+ }
442
+ else {
443
+ const rows = this.data.rows;
444
+ let size = rows.length;
445
+ let cnt = 0;
446
+ formContent = [];
447
+ while (size-- > 0) {
448
+ formContent.push(this.renderRow(rows[cnt++]));
449
+ }
450
+ }
451
+ return (h(Host, null, h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId }, formContent)));
452
+ }
453
+ disconnectedCallback() {
454
+ this.kupManager.language.unregister(this);
455
+ this.kupManager.theme.unregister(this);
456
+ }
457
+ get rootElement() { return getElement(this); }
458
+ static get watchers() { return {
459
+ "data": ["onDataChanged"],
460
+ "layout": ["onLayoutChanged"]
461
+ }; }
462
+ };
463
+ KupForm.style = kupFormCss;
464
+
465
+ export { KupForm as kup_form };
@@ -1,6 +1,6 @@
1
- import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-baeab1ac.js';
2
- import { k as kupManagerInstance, j as KupDebugCategory } from './kup-manager-9316a184.js';
3
- import { g as getProps, s as setProps } from './utils-f24319a0.js';
1
+ import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-ad6ab214.js';
2
+ import { k as kupManagerInstance, c as KupDebugCategory } from './kup-manager-3325b2d8.js';
3
+ import { g as getProps, s as setProps } from './utils-6373a07e.js';
4
4
 
5
5
  /**
6
6
  * Props of the kup-iframe component.