@sme.up/ketchup 6.0.0 → 6.2.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 (198) hide show
  1. package/dist/cjs/{cell-utils-a78d6fac.js → cell-utils-fe64a28c.js} +2 -2
  2. package/dist/cjs/{f-button-ac179257.js → f-button-5b69d882.js} +4 -4
  3. package/dist/cjs/f-cell-3a740c48.js +418 -0
  4. package/dist/cjs/f-checkbox-57443ca3.js +29 -0
  5. package/dist/cjs/{f-chip-b00897d7.js → f-chip-02e83f82.js} +3 -3
  6. package/dist/cjs/{f-image-89f25556.js → f-image-2a61ece2.js} +2 -2
  7. package/dist/cjs/{f-paginator-utils-8fa501b3.js → f-paginator-utils-09126bdd.js} +5 -5
  8. package/dist/cjs/{f-text-field-e1e45ade.js → f-text-field-9ee20a67.js} +3 -3
  9. package/dist/cjs/{index-eb556444.js → index-06b131ea.js} +6 -4
  10. package/dist/cjs/ketchup.cjs.js +3 -3
  11. package/dist/cjs/kup-accordion.cjs.entry.js +4 -4
  12. package/dist/cjs/kup-autocomplete_25.cjs.entry.js +209 -193
  13. package/dist/cjs/kup-box.cjs.entry.js +1306 -0
  14. package/dist/cjs/kup-calendar.cjs.entry.js +7 -7
  15. package/dist/cjs/kup-cell.cjs.entry.js +10 -9
  16. package/dist/cjs/kup-dash-list.cjs.entry.js +4 -4
  17. package/dist/cjs/kup-dash_2.cjs.entry.js +4 -7
  18. package/dist/cjs/{kup-form-editor.cjs.entry.js → kup-dashboard.cjs.entry.js} +123 -148
  19. package/dist/cjs/kup-drawer.cjs.entry.js +4 -4
  20. package/dist/cjs/{kup-box_2.cjs.entry.js → kup-echart.cjs.entry.js} +53 -1338
  21. package/dist/cjs/kup-family-tree.cjs.entry.js +410 -0
  22. package/dist/cjs/kup-form.cjs.entry.js +480 -0
  23. package/dist/cjs/kup-iframe.cjs.entry.js +3 -3
  24. package/dist/cjs/kup-image-list.cjs.entry.js +73 -11
  25. package/dist/cjs/kup-lazy.cjs.entry.js +4 -4
  26. package/dist/cjs/kup-magic-box.cjs.entry.js +4 -4
  27. package/dist/cjs/{kup-manager-7a941909.js → kup-manager-02acbb37.js} +407 -7
  28. package/dist/cjs/kup-nav-bar.cjs.entry.js +3 -3
  29. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  30. package/dist/cjs/kup-photo-frame.cjs.entry.js +5 -5
  31. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  33. package/dist/cjs/kup-snackbar.cjs.entry.js +5 -5
  34. package/dist/cjs/loader.cjs.js +3 -3
  35. package/dist/cjs/{utils-6287d878.js → utils-4b208b48.js} +1 -1
  36. package/dist/collection/assets/dashboard.js +113 -0
  37. package/dist/collection/assets/data-table.js +15 -0
  38. package/dist/collection/assets/family-tree.js +2437 -0
  39. package/dist/collection/assets/form.js +433 -0
  40. package/dist/collection/assets/grid.js +17 -0
  41. package/dist/collection/assets/index.js +14 -6
  42. package/dist/collection/collection-manifest.json +4 -3
  43. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +135 -129
  44. package/dist/collection/components/kup-box/kup-box.js +13 -2
  45. package/dist/collection/components/kup-button/kup-button.js +1 -0
  46. package/dist/collection/components/kup-combobox/kup-combobox.js +16 -13
  47. package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -0
  48. package/dist/collection/components/{kup-form-editor/kup-form-editor.css → kup-dashboard/kup-dashboard.css} +7 -6
  49. package/dist/collection/components/{kup-form-editor/kup-form-editor.js → kup-dashboard/kup-dashboard.js} +148 -149
  50. package/dist/collection/components/kup-data-table/kup-data-table.js +7 -6
  51. package/dist/collection/components/kup-drawer/kup-drawer.css +5 -8
  52. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +1 -0
  53. package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +12 -0
  54. package/dist/collection/components/kup-family-tree/kup-family-tree.css +101 -0
  55. package/dist/collection/components/kup-family-tree/kup-family-tree.js +666 -0
  56. package/dist/collection/components/kup-form/kup-form-declarations.js +25 -0
  57. package/dist/collection/components/kup-form/kup-form.css +99 -0
  58. package/dist/collection/components/kup-form/kup-form.js +647 -0
  59. package/dist/collection/components/kup-grid/kup-grid.js +1 -4
  60. package/dist/collection/components/kup-image-list/kup-image-list-state.js +9 -0
  61. package/dist/collection/components/kup-image-list/kup-image-list.css +0 -6
  62. package/dist/collection/components/kup-image-list/kup-image-list.js +113 -1
  63. package/dist/collection/components/kup-lazy/kup-lazy.css +13 -6
  64. package/dist/collection/components/kup-list/kup-list-helper.js +9 -3
  65. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +13 -3
  66. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +1 -1
  67. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +3 -0
  68. package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
  69. package/dist/collection/components/kup-time-picker/kup-time-picker.js +0 -6
  70. package/dist/collection/components/kup-tree/kup-tree.js +10 -4
  71. package/dist/collection/f-components/f-button/f-button.js +2 -2
  72. package/dist/collection/f-components/f-cell/f-cell-declarations.js +5 -1
  73. package/dist/collection/f-components/f-cell/f-cell.js +34 -114
  74. package/dist/collection/f-components/f-text-field/f-text-field.js +1 -1
  75. package/dist/collection/managers/kup-data/kup-data-node-helper.js +69 -0
  76. package/dist/collection/managers/kup-data/kup-data.js +109 -1
  77. package/dist/collection/managers/kup-language/kup-language-declarations.js +11 -0
  78. package/dist/collection/managers/kup-objects/kup-objects.js +10 -0
  79. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +20 -3
  80. package/dist/collection/types/GenericTypes.js +3 -2
  81. package/dist/esm/{cell-utils-964da6b5.js → cell-utils-cb5d4149.js} +2 -2
  82. package/dist/esm/{f-button-871a544b.js → f-button-fd44ef70.js} +4 -4
  83. package/dist/esm/{f-cell-521ef17a.js → f-cell-7b159a22.js} +48 -283
  84. package/dist/esm/f-checkbox-c51c4a75.js +27 -0
  85. package/dist/esm/{f-chip-1dda722f.js → f-chip-c2e4c522.js} +3 -3
  86. package/dist/esm/{f-image-c468d8ae.js → f-image-2ab4b9aa.js} +2 -2
  87. package/dist/esm/{f-paginator-utils-7dff8ff0.js → f-paginator-utils-ef537d82.js} +5 -5
  88. package/dist/esm/{f-text-field-d6c61c73.js → f-text-field-41c575eb.js} +3 -3
  89. package/dist/esm/{index-baeab1ac.js → index-ad6ab214.js} +6 -4
  90. package/dist/esm/ketchup.js +3 -3
  91. package/dist/esm/kup-accordion.entry.js +4 -4
  92. package/dist/esm/kup-autocomplete_25.entry.js +199 -183
  93. package/dist/esm/kup-box.entry.js +1302 -0
  94. package/dist/esm/kup-calendar.entry.js +7 -7
  95. package/dist/esm/kup-cell.entry.js +9 -8
  96. package/dist/esm/kup-dash-list.entry.js +4 -4
  97. package/dist/esm/kup-dash_2.entry.js +4 -7
  98. package/dist/esm/{kup-form-editor.entry.js → kup-dashboard.entry.js} +123 -148
  99. package/dist/esm/kup-drawer.entry.js +4 -4
  100. package/dist/esm/{kup-box_2.entry.js → kup-echart.entry.js} +54 -1338
  101. package/dist/esm/kup-family-tree.entry.js +406 -0
  102. package/dist/esm/kup-form.entry.js +476 -0
  103. package/dist/esm/kup-iframe.entry.js +3 -3
  104. package/dist/esm/kup-image-list.entry.js +72 -10
  105. package/dist/esm/kup-lazy.entry.js +4 -4
  106. package/dist/esm/kup-magic-box.entry.js +4 -4
  107. package/dist/esm/{kup-manager-58b075b4.js → kup-manager-22a475e6.js} +404 -8
  108. package/dist/esm/kup-nav-bar.entry.js +3 -3
  109. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  110. package/dist/esm/kup-photo-frame.entry.js +5 -5
  111. package/dist/esm/kup-probe.entry.js +2 -2
  112. package/dist/esm/kup-qlik.entry.js +2 -2
  113. package/dist/esm/kup-snackbar.entry.js +5 -5
  114. package/dist/esm/loader.js +3 -3
  115. package/dist/esm/{utils-d7e4b3c2.js → utils-2c1f4122.js} +1 -1
  116. package/dist/ketchup/ketchup.esm.js +1 -1
  117. package/dist/ketchup/p-06c6cc68.js +1 -0
  118. package/dist/ketchup/{p-3c11e615.entry.js → p-0dacd4bc.entry.js} +1 -1
  119. package/dist/ketchup/{p-fac1a08b.entry.js → p-1959f835.entry.js} +1 -1
  120. package/dist/ketchup/p-1c44dc62.entry.js +1 -0
  121. package/dist/ketchup/{p-f09f2f98.entry.js → p-264b1b19.entry.js} +1 -1
  122. package/dist/ketchup/p-38d7584e.js +1 -0
  123. package/dist/ketchup/{p-f71a1675.entry.js → p-42080355.entry.js} +1 -1
  124. package/dist/ketchup/p-4bc9f98b.entry.js +1 -0
  125. package/dist/ketchup/p-578583db.entry.js +1 -0
  126. package/dist/ketchup/p-5866d507.entry.js +1 -0
  127. package/dist/ketchup/p-61059e9d.entry.js +9 -0
  128. package/dist/ketchup/{p-a615a92b.entry.js → p-664be494.entry.js} +1 -1
  129. package/dist/ketchup/{p-d2ee56dd.entry.js → p-67cd575d.entry.js} +1 -1
  130. package/dist/ketchup/{p-e0035c58.js → p-682a367a.js} +1 -1
  131. package/dist/ketchup/p-6ccf7eb2.entry.js +1 -0
  132. package/dist/ketchup/p-7230ab97.entry.js +1 -0
  133. package/dist/ketchup/p-752b4cef.entry.js +1 -0
  134. package/dist/ketchup/{p-954cc340.entry.js → p-7de3e7ac.entry.js} +1 -1
  135. package/dist/ketchup/p-928c5c36.js +1 -0
  136. package/dist/ketchup/{p-6dff70f8.entry.js → p-9b36497d.entry.js} +1 -1
  137. package/dist/ketchup/{p-99e0d768.entry.js → p-b982d137.entry.js} +1 -1
  138. package/dist/ketchup/{p-8cdf61a4.js → p-c0219e5e.js} +1 -1
  139. package/dist/ketchup/p-c55fd0a7.entry.js +1 -0
  140. package/dist/ketchup/p-cd5cfa7c.js +1 -0
  141. package/dist/ketchup/p-d154b3a0.entry.js +1 -0
  142. package/dist/ketchup/p-d2affb6f.entry.js +27 -0
  143. package/dist/ketchup/p-d3b542b3.js +2 -0
  144. package/dist/ketchup/{p-7454cb92.js → p-d6c12c6c.js} +1 -1
  145. package/dist/ketchup/p-da0eab60.entry.js +1 -0
  146. package/dist/ketchup/{p-7eff4eee.js → p-dc62a30f.js} +1 -1
  147. package/dist/ketchup/p-e9366aaf.entry.js +39 -0
  148. package/dist/ketchup/{p-44ec4f03.js → p-edae3076.js} +1 -1
  149. package/dist/ketchup/p-fc2b1229.js +30 -0
  150. package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +1 -16
  151. package/dist/types/components/{kup-form-editor/kup-form-editor-declarations.d.ts → kup-dashboard/kup-dashboard-declarations.d.ts} +9 -27
  152. package/dist/types/components/{kup-form-editor/kup-form-editor.d.ts → kup-dashboard/kup-dashboard.d.ts} +12 -9
  153. package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +33 -0
  154. package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +61 -0
  155. package/dist/types/components/kup-form/kup-form-declarations.d.ts +60 -0
  156. package/dist/types/components/kup-form/kup-form.d.ts +63 -0
  157. package/dist/types/components/kup-image-list/kup-image-list-state.d.ts +6 -0
  158. package/dist/types/components/kup-image-list/kup-image-list.d.ts +17 -0
  159. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +3 -0
  160. package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
  161. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +0 -6
  162. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +2 -0
  163. package/dist/types/components.d.ts +460 -241
  164. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +4 -1
  165. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
  166. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +8 -0
  167. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +15 -1
  168. package/dist/types/managers/kup-data/kup-data.d.ts +7 -1
  169. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +11 -1
  170. package/dist/types/managers/kup-objects/kup-objects.d.ts +6 -0
  171. package/dist/types/types/GenericTypes.d.ts +3 -2
  172. package/package.json +2 -2
  173. package/dist/cjs/f-cell-69294bca.js +0 -653
  174. package/dist/cjs/kup-field.cjs.entry.js +0 -241
  175. package/dist/collection/assets/form-editor.js +0 -338
  176. package/dist/collection/components/kup-field/kup-field-declarations.js +0 -15
  177. package/dist/collection/components/kup-field/kup-field.css +0 -48
  178. package/dist/collection/components/kup-field/kup-field.js +0 -514
  179. package/dist/collection/components/kup-form-editor/kup-form-editor-declarations.js +0 -23
  180. package/dist/esm/kup-field.entry.js +0 -237
  181. package/dist/ketchup/p-1ae66cc5.js +0 -1
  182. package/dist/ketchup/p-34b74425.js +0 -1
  183. package/dist/ketchup/p-4ffbc3ff.js +0 -1
  184. package/dist/ketchup/p-5264a3e6.entry.js +0 -1
  185. package/dist/ketchup/p-65974e48.entry.js +0 -1
  186. package/dist/ketchup/p-65b46587.entry.js +0 -40
  187. package/dist/ketchup/p-80968627.entry.js +0 -1
  188. package/dist/ketchup/p-a0f6e25c.entry.js +0 -1
  189. package/dist/ketchup/p-aca0e54b.js +0 -30
  190. package/dist/ketchup/p-b8939a8b.entry.js +0 -1
  191. package/dist/ketchup/p-bfc3bac7.js +0 -1
  192. package/dist/ketchup/p-c5ce8951.entry.js +0 -1
  193. package/dist/ketchup/p-cad1e097.entry.js +0 -9
  194. package/dist/ketchup/p-db71436b.entry.js +0 -27
  195. package/dist/ketchup/p-e1039cf2.entry.js +0 -1
  196. package/dist/ketchup/p-ea10176c.entry.js +0 -1
  197. package/dist/types/components/kup-field/kup-field-declarations.d.ts +0 -25
  198. package/dist/types/components/kup-field/kup-field.d.ts +0 -90
@@ -0,0 +1,647 @@
1
+ import { Component, Element, forceUpdate, h, Host, Method, Prop, Watch, } from '@stencil/core';
2
+ import { KupFormProps, KupFormLabelPlacement, KupFormLabelAlignment, } from './kup-form-declarations';
3
+ import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
4
+ import { getProps, identify, setProps } from '../../utils/utils';
5
+ import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
6
+ import { componentWrapperId } from '../../variables/GenericVariables';
7
+ import { FCell } from '../../f-components/f-cell/f-cell';
8
+ import { FCellTypes, } from '../../f-components/f-cell/f-cell-declarations';
9
+ import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
10
+ const dom = document.documentElement;
11
+ export class KupForm {
12
+ constructor() {
13
+ /*-------------------------------------------------*/
14
+ /* P r o p s */
15
+ /*-------------------------------------------------*/
16
+ /**
17
+ * Custom style of the component.
18
+ * @default ""
19
+ * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
20
+ */
21
+ this.customStyle = '';
22
+ /**
23
+ * Actual data of the form.
24
+ * @default null
25
+ */
26
+ this.data = null;
27
+ /**
28
+ * How the form will arrange its content.
29
+ * @default null
30
+ */
31
+ this.layout = null;
32
+ /*-------------------------------------------------*/
33
+ /* I n t e r n a l V a r i a b l e s */
34
+ /*-------------------------------------------------*/
35
+ this.kupManager = kupManagerInstance();
36
+ this.visibleColumns = [];
37
+ }
38
+ /*-------------------------------------------------*/
39
+ /* W a t c h e r s */
40
+ /*-------------------------------------------------*/
41
+ onDataChanged() {
42
+ identify(this.getRows());
43
+ this.initVisibleColumns();
44
+ this.checkLayout();
45
+ }
46
+ onLayoutChanged() {
47
+ this.checkLayout();
48
+ }
49
+ /*-------------------------------------------------*/
50
+ /* P u b l i c M e t h o d s */
51
+ /*-------------------------------------------------*/
52
+ /**
53
+ * Used to retrieve component's props values.
54
+ * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
55
+ * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
56
+ */
57
+ async getProps(descriptions) {
58
+ return getProps(this, KupFormProps, descriptions);
59
+ }
60
+ /**
61
+ * This method is used to trigger a new render of the component.
62
+ */
63
+ async refresh() {
64
+ forceUpdate(this);
65
+ }
66
+ /**
67
+ * Sets the focus on an editable table cell.
68
+ * @param {string} column - Name of the column.
69
+ * @param {string} rowId - Id of the row.
70
+ */
71
+ async setFocus(column, rowId) {
72
+ const cells = this.rootElement.shadowRoot.querySelectorAll('td[data-column="' + column + '"]');
73
+ for (let index = 0; cells && index < cells.length; index++) {
74
+ const cell = cells[index];
75
+ if (cell['data-row'] && cell['data-row'].id == rowId) {
76
+ const input = cell.querySelector('input');
77
+ if (input) {
78
+ input.focus();
79
+ }
80
+ else {
81
+ const kupInput = cell.querySelector('.hydrated');
82
+ if (kupInput) {
83
+ try {
84
+ kupInput.setFocus();
85
+ }
86
+ catch (error) { }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ /**
93
+ * Sets the props to the component.
94
+ * @param {GenericObject} props - Object containing props that will be set to the component.
95
+ */
96
+ async setProps(props) {
97
+ setProps(this, KupFormProps, props);
98
+ }
99
+ /*-------------------------------------------------*/
100
+ /* P r i v a t e M e t h o d s */
101
+ /*-------------------------------------------------*/
102
+ getColumns() {
103
+ return this.data && this.data.columns
104
+ ? this.data.columns
105
+ : [{ title: '', name: '', size: undefined }];
106
+ }
107
+ initVisibleColumns() {
108
+ this.visibleColumns = this.getColumns().filter((column) => {
109
+ if (column.hasOwnProperty('visible')) {
110
+ return column.visible;
111
+ }
112
+ return true;
113
+ });
114
+ }
115
+ getRows() {
116
+ return this.data && this.data.rows ? this.data.rows : [];
117
+ }
118
+ checkLayout() {
119
+ if (this.layout) {
120
+ this.formLayout = this.layout;
121
+ return;
122
+ }
123
+ const section = {
124
+ horizontal: false,
125
+ sections: [],
126
+ };
127
+ const visibleColumns = this.visibleColumns;
128
+ let size = visibleColumns.length;
129
+ const content = [];
130
+ let cnt = 0;
131
+ while (size-- > 0) {
132
+ content.push({
133
+ column: visibleColumns[cnt++].name,
134
+ });
135
+ }
136
+ section.content = content;
137
+ this.formLayout = {
138
+ sections: [section],
139
+ };
140
+ }
141
+ renderRow(row) {
142
+ const visibleColumns = [...this.visibleColumns];
143
+ let formContent = null;
144
+ let rowLayout = row.layout;
145
+ if (!rowLayout) {
146
+ rowLayout = this.formLayout;
147
+ }
148
+ let horizontal = false;
149
+ if (rowLayout) {
150
+ if (rowLayout.horizontal) {
151
+ horizontal = true;
152
+ }
153
+ const sections = rowLayout.sections;
154
+ let size = sections.length;
155
+ let cnt = 0;
156
+ if (size > 0) {
157
+ formContent = [];
158
+ }
159
+ const parent = {
160
+ horizontal: horizontal,
161
+ };
162
+ while (size-- > 0) {
163
+ formContent.push(this.renderSection(sections[cnt++], parent, row, visibleColumns));
164
+ }
165
+ }
166
+ const classObj = {
167
+ form: true,
168
+ 'form--column': !horizontal,
169
+ };
170
+ return h("form", { class: classObj }, formContent);
171
+ }
172
+ renderSection(section, parent, row, visibleColumns) {
173
+ var _a;
174
+ let sectionContent = null;
175
+ if (section.sections && section.sections.length > 0) {
176
+ const sections = section.sections;
177
+ let size = sections.length;
178
+ let cnt = 0;
179
+ if (size > 0) {
180
+ sectionContent = [];
181
+ }
182
+ while (size-- > 0) {
183
+ sectionContent.push(this.renderSection(sections[cnt++], section, row, visibleColumns));
184
+ }
185
+ }
186
+ else if (section.content) {
187
+ const content = section.content;
188
+ let size = content.length;
189
+ let cnt = 0;
190
+ if (size > 0) {
191
+ sectionContent = [];
192
+ }
193
+ while (size-- > 0) {
194
+ const formField = this.renderFormField({
195
+ formField: content[cnt++],
196
+ row,
197
+ visibleColumns,
198
+ }, section);
199
+ let field = formField;
200
+ if (!section.horizontal) {
201
+ field = h("tr", null, formField);
202
+ }
203
+ sectionContent.push(field);
204
+ }
205
+ }
206
+ else if (visibleColumns.length > 0) {
207
+ const column = visibleColumns[0];
208
+ sectionContent = this.renderFormField({
209
+ formField: { column: column.name },
210
+ row,
211
+ visibleColumns,
212
+ });
213
+ }
214
+ const isGrid = !!section.columns;
215
+ const labelPlacement = ((_a = section === null || section === void 0 ? void 0 : section.label) === null || _a === void 0 ? void 0 : _a.placement) || KupFormLabelPlacement.LEFT;
216
+ const sectionClass = {
217
+ form__section: true,
218
+ 'form__section--column': !isGrid && !section.horizontal,
219
+ 'form__section--grid': isGrid,
220
+ 'form__section--titled': !!section.title,
221
+ 'form__section--last': !section.sections || section.sections.length === 0,
222
+ [`form__section--${labelPlacement}`]: true,
223
+ };
224
+ const sectionStyle = section.style || {};
225
+ if (section.dim && parent) {
226
+ sectionStyle.flex = `0 0 ${section.dim}`;
227
+ if (parent.horizontal) {
228
+ sectionStyle.maxWidth = section.dim;
229
+ }
230
+ else {
231
+ sectionStyle.maxHeight = section.dim;
232
+ }
233
+ }
234
+ if (isGrid) {
235
+ sectionStyle['grid-template-columns'] = `repeat(${section.columns}, 1fr)`;
236
+ }
237
+ return (h("div", { class: sectionClass, style: sectionStyle },
238
+ section.title ? h("h3", null, section.title) : null,
239
+ h("table", null,
240
+ h("tbody", null, section.horizontal ? (h("tr", null, sectionContent)) : (sectionContent)))));
241
+ }
242
+ renderFormField({ formField, row, visibleColumns, }, section) {
243
+ var _a;
244
+ const classObj = {
245
+ form__field: true,
246
+ };
247
+ const styleObj = {};
248
+ let column = null;
249
+ let index = -1;
250
+ for (let i = 0; i < visibleColumns.length; i++) {
251
+ const c = visibleColumns[i];
252
+ if (c.name === formField.column) {
253
+ index = i;
254
+ break;
255
+ }
256
+ }
257
+ if (index >= 0) {
258
+ column = visibleColumns[index];
259
+ visibleColumns.splice(index, 1);
260
+ }
261
+ else if (section) {
262
+ column = this.data.columns.find((x) => x.name === formField.column);
263
+ }
264
+ const cell = row.cells[formField.column];
265
+ let title = undefined;
266
+ if (cell) {
267
+ cell.isEditable = true;
268
+ if (!this.kupManager.objects.isEmptyKupObj(cell.obj)) {
269
+ if (this.kupManager.debug.isDebug()) {
270
+ title =
271
+ cell.obj.t +
272
+ '; ' +
273
+ cell.obj.p +
274
+ '; ' +
275
+ cell.obj.k +
276
+ ';';
277
+ }
278
+ }
279
+ }
280
+ else {
281
+ return null;
282
+ }
283
+ const cellProps = {
284
+ cell: formField.data ? Object.assign(Object.assign({}, cell), { data: formField.data }) : cell,
285
+ column: column,
286
+ component: this,
287
+ editable: true,
288
+ renderKup: true,
289
+ row: row,
290
+ setSizes: true,
291
+ shape: formField.shape,
292
+ };
293
+ const label = formField.label || column.title;
294
+ resetLabel();
295
+ switch ((_a = section.label) === null || _a === void 0 ? void 0 : _a.placement) {
296
+ case KupFormLabelPlacement.BOTTOM:
297
+ return [h("tr", null, fieldCell()), h("tr", null, labelCell(label))];
298
+ case KupFormLabelPlacement.PLACEHOLDER:
299
+ setPlaceholderLabel();
300
+ case KupFormLabelPlacement.HIDDEN: {
301
+ if (section) {
302
+ return [fieldCell()];
303
+ }
304
+ else {
305
+ return [h("tr", null, fieldCell())];
306
+ }
307
+ }
308
+ case KupFormLabelPlacement.RIGHT: {
309
+ if (section) {
310
+ return [fieldCell(), labelCell(label)];
311
+ }
312
+ else {
313
+ return [
314
+ h("tr", null,
315
+ fieldCell(),
316
+ labelCell(label)),
317
+ ];
318
+ }
319
+ }
320
+ case KupFormLabelPlacement.TOP:
321
+ return [h("tr", null, labelCell(label)), h("tr", null, fieldCell())];
322
+ default: {
323
+ if (section) {
324
+ return [labelCell(label), fieldCell()];
325
+ }
326
+ else {
327
+ return [
328
+ h("tr", null,
329
+ labelCell(label),
330
+ fieldCell()),
331
+ ];
332
+ }
333
+ }
334
+ }
335
+ function fieldCell() {
336
+ 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))));
337
+ }
338
+ function labelCell(label) {
339
+ var _a, _b, _c;
340
+ const alignment = ((_a = section === null || section === void 0 ? void 0 : section.label) === null || _a === void 0 ? void 0 : _a.alignment) || KupFormLabelAlignment.LEFT;
341
+ const style = {
342
+ width: ((_b = section === null || section === void 0 ? void 0 : section.label) === null || _b === void 0 ? void 0 : _b.width) ? (_c = section === null || section === void 0 ? void 0 : section.label) === null || _c === void 0 ? void 0 : _c.width : '',
343
+ };
344
+ return (h("td", { class: `form__label form__label--${alignment}`, style: style },
345
+ h("span", null, label)));
346
+ }
347
+ function resetLabel() {
348
+ if (!cell.data) {
349
+ cell.data = {};
350
+ }
351
+ try {
352
+ delete cell.data.label;
353
+ }
354
+ catch (_a) { }
355
+ try {
356
+ delete cell.data.data['kup-text-field'].label;
357
+ }
358
+ catch (_b) { }
359
+ }
360
+ function setPlaceholderLabel() {
361
+ switch (dom.ketchup.data.cell.getType(cell, cell.shape || column.shape || null)) {
362
+ case FCellTypes.AUTOCOMPLETE:
363
+ case FCellTypes.COLOR_PICKER:
364
+ case FCellTypes.COMBOBOX:
365
+ case FCellTypes.DATE:
366
+ case FCellTypes.DATETIME:
367
+ case FCellTypes.TIME:
368
+ if (cell.data.data) {
369
+ if (cell.data.data['kup-text-field']) {
370
+ cell.data.data['kup-text-field'].label =
371
+ column.title;
372
+ }
373
+ else {
374
+ cell.data.data = {
375
+ 'kup-text-field': {
376
+ label: column.title,
377
+ },
378
+ };
379
+ }
380
+ }
381
+ else {
382
+ cell.data.data = {
383
+ 'kup-text-field': {
384
+ label: column.title,
385
+ },
386
+ };
387
+ }
388
+ break;
389
+ case FCellTypes.CHECKBOX:
390
+ case FCellTypes.NUMBER:
391
+ case FCellTypes.STRING:
392
+ case FCellTypes.SWITCH:
393
+ cell.data.label = column.title;
394
+ }
395
+ }
396
+ }
397
+ /*-------------------------------------------------*/
398
+ /* L i f e c y c l e H o o k s */
399
+ /*-------------------------------------------------*/
400
+ componentWillLoad() {
401
+ this.kupManager.debug.logLoad(this, false);
402
+ this.kupManager.language.register(this);
403
+ this.kupManager.theme.register(this);
404
+ this.onDataChanged();
405
+ }
406
+ componentDidLoad() {
407
+ this.kupManager.debug.logLoad(this, true);
408
+ }
409
+ componentWillRender() {
410
+ this.kupManager.debug.logRender(this, false);
411
+ }
412
+ componentDidRender() {
413
+ const root = this.rootElement.shadowRoot;
414
+ if (root) {
415
+ const fs = root.querySelectorAll('.f-text-field');
416
+ for (let index = 0; index < fs.length; index++) {
417
+ FTextFieldMDC(fs[index]);
418
+ }
419
+ }
420
+ this.kupManager.debug.logRender(this, true);
421
+ }
422
+ render() {
423
+ let formContent = null;
424
+ if (this.data.rows.length === 0) {
425
+ formContent = (h("p", null, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA)));
426
+ }
427
+ else {
428
+ const rows = this.data.rows;
429
+ let size = rows.length;
430
+ let cnt = 0;
431
+ formContent = [];
432
+ while (size-- > 0) {
433
+ formContent.push(this.renderRow(rows[cnt++]));
434
+ }
435
+ }
436
+ return (h(Host, null,
437
+ h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)),
438
+ h("div", { id: componentWrapperId }, formContent)));
439
+ }
440
+ disconnectedCallback() {
441
+ this.kupManager.language.unregister(this);
442
+ this.kupManager.theme.unregister(this);
443
+ }
444
+ static get is() { return "kup-form"; }
445
+ static get encapsulation() { return "shadow"; }
446
+ static get originalStyleUrls() { return {
447
+ "$": ["kup-form.scss"]
448
+ }; }
449
+ static get styleUrls() { return {
450
+ "$": ["kup-form.css"]
451
+ }; }
452
+ static get properties() { return {
453
+ "customStyle": {
454
+ "type": "string",
455
+ "mutable": false,
456
+ "complexType": {
457
+ "original": "string",
458
+ "resolved": "string",
459
+ "references": {}
460
+ },
461
+ "required": false,
462
+ "optional": false,
463
+ "docs": {
464
+ "tags": [{
465
+ "name": "default",
466
+ "text": "\"\""
467
+ }, {
468
+ "name": "see",
469
+ "text": "https://ketchup.smeup.com/ketchup-showcase/#/customization"
470
+ }],
471
+ "text": "Custom style of the component."
472
+ },
473
+ "attribute": "custom-style",
474
+ "reflect": false,
475
+ "defaultValue": "''"
476
+ },
477
+ "data": {
478
+ "type": "unknown",
479
+ "mutable": false,
480
+ "complexType": {
481
+ "original": "KupFormData",
482
+ "resolved": "KupFormData",
483
+ "references": {
484
+ "KupFormData": {
485
+ "location": "import",
486
+ "path": "./kup-form-declarations"
487
+ }
488
+ }
489
+ },
490
+ "required": false,
491
+ "optional": false,
492
+ "docs": {
493
+ "tags": [{
494
+ "name": "default",
495
+ "text": "null"
496
+ }],
497
+ "text": "Actual data of the form."
498
+ },
499
+ "defaultValue": "null"
500
+ },
501
+ "layout": {
502
+ "type": "unknown",
503
+ "mutable": false,
504
+ "complexType": {
505
+ "original": "KupFormLayout",
506
+ "resolved": "KupFormLayout",
507
+ "references": {
508
+ "KupFormLayout": {
509
+ "location": "import",
510
+ "path": "./kup-form-declarations"
511
+ }
512
+ }
513
+ },
514
+ "required": false,
515
+ "optional": false,
516
+ "docs": {
517
+ "tags": [{
518
+ "name": "default",
519
+ "text": "null"
520
+ }],
521
+ "text": "How the form will arrange its content."
522
+ },
523
+ "defaultValue": "null"
524
+ }
525
+ }; }
526
+ static get methods() { return {
527
+ "getProps": {
528
+ "complexType": {
529
+ "signature": "(descriptions?: boolean) => Promise<GenericObject>",
530
+ "parameters": [{
531
+ "tags": [{
532
+ "name": "param",
533
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
534
+ }],
535
+ "text": "- When provided and true, the result will be the list of props with their description."
536
+ }],
537
+ "references": {
538
+ "Promise": {
539
+ "location": "global"
540
+ },
541
+ "GenericObject": {
542
+ "location": "import",
543
+ "path": "../../types/GenericTypes"
544
+ }
545
+ },
546
+ "return": "Promise<GenericObject>"
547
+ },
548
+ "docs": {
549
+ "text": "Used to retrieve component's props values.",
550
+ "tags": [{
551
+ "name": "param",
552
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
553
+ }, {
554
+ "name": "returns",
555
+ "text": "List of props as object, each key will be a prop."
556
+ }]
557
+ }
558
+ },
559
+ "refresh": {
560
+ "complexType": {
561
+ "signature": "() => Promise<void>",
562
+ "parameters": [],
563
+ "references": {
564
+ "Promise": {
565
+ "location": "global"
566
+ }
567
+ },
568
+ "return": "Promise<void>"
569
+ },
570
+ "docs": {
571
+ "text": "This method is used to trigger a new render of the component.",
572
+ "tags": []
573
+ }
574
+ },
575
+ "setFocus": {
576
+ "complexType": {
577
+ "signature": "(column: string, rowId: string) => Promise<void>",
578
+ "parameters": [{
579
+ "tags": [{
580
+ "name": "param",
581
+ "text": "column - Name of the column."
582
+ }],
583
+ "text": "- Name of the column."
584
+ }, {
585
+ "tags": [{
586
+ "name": "param",
587
+ "text": "rowId - Id of the row."
588
+ }],
589
+ "text": "- Id of the row."
590
+ }],
591
+ "references": {
592
+ "Promise": {
593
+ "location": "global"
594
+ }
595
+ },
596
+ "return": "Promise<void>"
597
+ },
598
+ "docs": {
599
+ "text": "Sets the focus on an editable table cell.",
600
+ "tags": [{
601
+ "name": "param",
602
+ "text": "column - Name of the column."
603
+ }, {
604
+ "name": "param",
605
+ "text": "rowId - Id of the row."
606
+ }]
607
+ }
608
+ },
609
+ "setProps": {
610
+ "complexType": {
611
+ "signature": "(props: GenericObject) => Promise<void>",
612
+ "parameters": [{
613
+ "tags": [{
614
+ "name": "param",
615
+ "text": "props - Object containing props that will be set to the component."
616
+ }],
617
+ "text": "- Object containing props that will be set to the component."
618
+ }],
619
+ "references": {
620
+ "Promise": {
621
+ "location": "global"
622
+ },
623
+ "GenericObject": {
624
+ "location": "import",
625
+ "path": "../../types/GenericTypes"
626
+ }
627
+ },
628
+ "return": "Promise<void>"
629
+ },
630
+ "docs": {
631
+ "text": "Sets the props to the component.",
632
+ "tags": [{
633
+ "name": "param",
634
+ "text": "props - Object containing props that will be set to the component."
635
+ }]
636
+ }
637
+ }
638
+ }; }
639
+ static get elementRef() { return "rootElement"; }
640
+ static get watchers() { return [{
641
+ "propName": "data",
642
+ "methodName": "onDataChanged"
643
+ }, {
644
+ "propName": "layout",
645
+ "methodName": "onLayoutChanged"
646
+ }]; }
647
+ }
@@ -86,10 +86,7 @@ export class KupGrid {
86
86
  el = h("slot", { name: `${i}` });
87
87
  }
88
88
  else {
89
- let span = 1;
90
- if (slots[i]['span']) {
91
- span = slots[i]['span'];
92
- }
89
+ const span = slots[i]['span'] || slots[i].getAttribute('span') || 1;
93
90
  el = (h("div", { class: `layout-grid__cell layout-grid__cell--span-${span}` },
94
91
  h("slot", { name: `${i}` })));
95
92
  }
@@ -0,0 +1,9 @@
1
+ export class KupImageListState {
2
+ constructor() {
3
+ this.load = false;
4
+ }
5
+ toDebugString() {
6
+ // TODO
7
+ return 'image-list state';
8
+ }
9
+ }
@@ -70,14 +70,8 @@
70
70
  background-color: rgba(var(--kup_imagelist_primary_color_rgb), 0.15);
71
71
  color: var(--kup_imagelist_primary_color);
72
72
  }
73
- .navigation-bar__wrapper--active .navigation-bar__back,
74
- .navigation-bar__wrapper--active .navigation-bar__top {
75
- display: block;
76
- }
77
73
  .navigation-bar__back, .navigation-bar__top {
78
74
  --kup-button-primary-color-rgb: 0;
79
- animation: fade-in 0.375s ease-in;
80
- display: none;
81
75
  }
82
76
  .navigation-bar__title {
83
77
  border-radius: 16px;