@sme.up/ketchup 6.2.0-SNAPSHOT → 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 (154) hide show
  1. package/dist/cjs/{cell-utils-d894e802.js → cell-utils-fe64a28c.js} +2 -2
  2. package/dist/cjs/{f-button-414b3bc3.js → f-button-5b69d882.js} +1 -1
  3. package/dist/cjs/{f-cell-c8983ec7.js → f-cell-3a740c48.js} +6 -6
  4. package/dist/cjs/{f-chip-ef81bf51.js → f-chip-02e83f82.js} +2 -2
  5. package/dist/cjs/{f-image-0618c795.js → f-image-2a61ece2.js} +1 -1
  6. package/dist/cjs/{f-paginator-utils-c9dd5173.js → f-paginator-utils-09126bdd.js} +4 -4
  7. package/dist/cjs/{f-text-field-7d31190f.js → f-text-field-9ee20a67.js} +1 -1
  8. package/dist/cjs/ketchup.cjs.js +2 -2
  9. package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
  10. package/dist/cjs/kup-autocomplete_25.cjs.entry.js +35 -21
  11. package/dist/cjs/kup-box.cjs.entry.js +1306 -0
  12. package/dist/cjs/kup-calendar.cjs.entry.js +6 -6
  13. package/dist/cjs/kup-cell.cjs.entry.js +7 -7
  14. package/dist/cjs/kup-dash-list.cjs.entry.js +3 -3
  15. package/dist/cjs/kup-dash_2.cjs.entry.js +2 -2
  16. package/dist/cjs/kup-dashboard.cjs.entry.js +5 -5
  17. package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
  18. package/dist/cjs/{kup-box_2.cjs.entry.js → kup-echart.cjs.entry.js} +52 -1348
  19. package/dist/cjs/kup-family-tree.cjs.entry.js +410 -0
  20. package/dist/cjs/kup-form.cjs.entry.js +40 -29
  21. package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
  22. package/dist/cjs/kup-image-list.cjs.entry.js +70 -9
  23. package/dist/cjs/kup-lazy.cjs.entry.js +3 -3
  24. package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
  25. package/dist/cjs/{kup-manager-2fee8cf3.js → kup-manager-02acbb37.js} +83 -1
  26. package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
  27. package/dist/cjs/kup-numeric-picker.cjs.entry.js +2 -2
  28. package/dist/cjs/kup-photo-frame.cjs.entry.js +8 -6
  29. package/dist/cjs/kup-probe.cjs.entry.js +1 -1
  30. package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
  31. package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
  32. package/dist/cjs/loader.cjs.js +2 -2
  33. package/dist/cjs/{utils-8470184d.js → utils-4b208b48.js} +1 -1
  34. package/dist/collection/assets/data-table.js +44 -0
  35. package/dist/collection/assets/family-tree.js +2437 -0
  36. package/dist/collection/assets/form.js +254 -0
  37. package/dist/collection/assets/index.js +4 -0
  38. package/dist/collection/collection-manifest.json +2 -2
  39. package/dist/collection/components/kup-button/kup-button.js +1 -0
  40. package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
  41. package/dist/collection/components/kup-data-table/kup-data-table.js +7 -6
  42. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +1 -0
  43. package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +12 -0
  44. package/dist/collection/components/kup-family-tree/kup-family-tree.css +101 -0
  45. package/dist/collection/components/kup-family-tree/kup-family-tree.js +666 -0
  46. package/dist/collection/components/kup-form/kup-form-declarations.js +6 -0
  47. package/dist/collection/components/kup-form/kup-form.css +22 -9
  48. package/dist/collection/components/kup-form/kup-form.js +28 -49
  49. package/dist/collection/components/kup-image-list/kup-image-list-state.js +9 -0
  50. package/dist/collection/components/kup-image-list/kup-image-list.css +0 -6
  51. package/dist/collection/components/kup-image-list/kup-image-list.js +113 -1
  52. package/dist/collection/components/kup-lazy/kup-lazy.css +13 -6
  53. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +9 -2
  54. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +5 -3
  55. package/dist/collection/components/kup-tree/kup-tree.js +16 -5
  56. package/dist/collection/managers/kup-data/kup-data-node-helper.js +69 -0
  57. package/dist/collection/managers/kup-data/kup-data.js +15 -1
  58. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +2 -0
  59. package/dist/collection/types/GenericTypes.js +1 -1
  60. package/dist/esm/{cell-utils-7fc84d4e.js → cell-utils-cb5d4149.js} +2 -2
  61. package/dist/esm/{f-button-2f6cc296.js → f-button-fd44ef70.js} +1 -1
  62. package/dist/esm/{f-cell-4428481c.js → f-cell-7b159a22.js} +6 -6
  63. package/dist/esm/{f-chip-b39eb49a.js → f-chip-c2e4c522.js} +2 -2
  64. package/dist/esm/{f-image-b08ebeb2.js → f-image-2ab4b9aa.js} +1 -1
  65. package/dist/esm/{f-paginator-utils-4fda6086.js → f-paginator-utils-ef537d82.js} +4 -4
  66. package/dist/esm/{f-text-field-184a5fb3.js → f-text-field-41c575eb.js} +1 -1
  67. package/dist/esm/ketchup.js +2 -2
  68. package/dist/esm/kup-accordion.entry.js +3 -3
  69. package/dist/esm/kup-autocomplete_25.entry.js +35 -21
  70. package/dist/esm/kup-box.entry.js +1302 -0
  71. package/dist/esm/kup-calendar.entry.js +6 -6
  72. package/dist/esm/kup-cell.entry.js +7 -7
  73. package/dist/esm/kup-dash-list.entry.js +3 -3
  74. package/dist/esm/kup-dash_2.entry.js +2 -2
  75. package/dist/esm/kup-dashboard.entry.js +5 -5
  76. package/dist/esm/kup-drawer.entry.js +2 -2
  77. package/dist/esm/{kup-box_2.entry.js → kup-echart.entry.js} +53 -1348
  78. package/dist/esm/kup-family-tree.entry.js +406 -0
  79. package/dist/esm/kup-form.entry.js +40 -29
  80. package/dist/esm/kup-iframe.entry.js +2 -2
  81. package/dist/esm/kup-image-list.entry.js +70 -9
  82. package/dist/esm/kup-lazy.entry.js +3 -3
  83. package/dist/esm/kup-magic-box.entry.js +3 -3
  84. package/dist/esm/{kup-manager-3325b2d8.js → kup-manager-22a475e6.js} +83 -1
  85. package/dist/esm/kup-nav-bar.entry.js +2 -2
  86. package/dist/esm/kup-numeric-picker.entry.js +2 -2
  87. package/dist/esm/kup-photo-frame.entry.js +8 -6
  88. package/dist/esm/kup-probe.entry.js +1 -1
  89. package/dist/esm/kup-qlik.entry.js +1 -1
  90. package/dist/esm/kup-snackbar.entry.js +4 -4
  91. package/dist/esm/loader.js +2 -2
  92. package/dist/esm/{utils-6373a07e.js → utils-2c1f4122.js} +1 -1
  93. package/dist/ketchup/ketchup.esm.js +1 -1
  94. package/dist/ketchup/{p-d7004ae4.js → p-06c6cc68.js} +1 -1
  95. package/dist/ketchup/{p-6127fccf.entry.js → p-0dacd4bc.entry.js} +1 -1
  96. package/dist/ketchup/{p-1db1d42b.entry.js → p-1959f835.entry.js} +1 -1
  97. package/dist/ketchup/p-1c44dc62.entry.js +1 -0
  98. package/dist/ketchup/{p-30820f8f.entry.js → p-264b1b19.entry.js} +1 -1
  99. package/dist/ketchup/{p-70660fe2.js → p-38d7584e.js} +1 -1
  100. package/dist/ketchup/{p-6b82e4e2.entry.js → p-42080355.entry.js} +1 -1
  101. package/dist/ketchup/p-4bc9f98b.entry.js +1 -0
  102. package/dist/ketchup/p-578583db.entry.js +1 -0
  103. package/dist/ketchup/{p-cc3abf84.entry.js → p-5866d507.entry.js} +1 -1
  104. package/dist/ketchup/p-61059e9d.entry.js +9 -0
  105. package/dist/ketchup/{p-175edb62.entry.js → p-664be494.entry.js} +1 -1
  106. package/dist/ketchup/{p-8103b80a.entry.js → p-67cd575d.entry.js} +1 -1
  107. package/dist/ketchup/{p-d95c904b.js → p-682a367a.js} +1 -1
  108. package/dist/ketchup/{p-153697fb.entry.js → p-6ccf7eb2.entry.js} +1 -1
  109. package/dist/ketchup/p-7230ab97.entry.js +1 -0
  110. package/dist/ketchup/p-752b4cef.entry.js +1 -0
  111. package/dist/ketchup/{p-41cf8703.entry.js → p-7de3e7ac.entry.js} +1 -1
  112. package/dist/ketchup/{p-f49cb68e.js → p-928c5c36.js} +1 -1
  113. package/dist/ketchup/{p-3c7c92c0.entry.js → p-9b36497d.entry.js} +1 -1
  114. package/dist/ketchup/{p-9fa457d4.entry.js → p-b982d137.entry.js} +1 -1
  115. package/dist/ketchup/{p-0741da57.js → p-c0219e5e.js} +1 -1
  116. package/dist/ketchup/p-c55fd0a7.entry.js +1 -0
  117. package/dist/ketchup/p-d154b3a0.entry.js +1 -0
  118. package/dist/ketchup/{p-a804fe83.entry.js → p-d2affb6f.entry.js} +1 -1
  119. package/dist/ketchup/p-d6c12c6c.js +1 -0
  120. package/dist/ketchup/{p-caabb9ab.entry.js → p-da0eab60.entry.js} +1 -1
  121. package/dist/ketchup/{p-ddce3430.js → p-dc62a30f.js} +1 -1
  122. package/dist/ketchup/p-e9366aaf.entry.js +39 -0
  123. package/dist/ketchup/{p-13e08580.js → p-edae3076.js} +1 -1
  124. package/dist/ketchup/{p-704e60eb.js → p-fc2b1229.js} +3 -3
  125. package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
  126. package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +33 -0
  127. package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +61 -0
  128. package/dist/types/components/kup-form/kup-form-declarations.d.ts +18 -6
  129. package/dist/types/components/kup-form/kup-form.d.ts +1 -6
  130. package/dist/types/components/kup-image-list/kup-image-list-state.d.ts +6 -0
  131. package/dist/types/components/kup-image-list/kup-image-list.d.ts +17 -0
  132. package/dist/types/components/kup-tree/kup-tree.d.ts +0 -1
  133. package/dist/types/components.d.ts +63 -97
  134. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +8 -0
  135. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +15 -1
  136. package/dist/types/managers/kup-data/kup-data.d.ts +5 -1
  137. package/dist/types/types/GenericTypes.d.ts +1 -1
  138. package/package.json +2 -2
  139. package/dist/cjs/kup-field.cjs.entry.js +0 -241
  140. package/dist/collection/components/kup-field/kup-field-declarations.js +0 -15
  141. package/dist/collection/components/kup-field/kup-field.css +0 -48
  142. package/dist/collection/components/kup-field/kup-field.js +0 -514
  143. package/dist/esm/kup-field.entry.js +0 -237
  144. package/dist/ketchup/p-006bc4d0.entry.js +0 -1
  145. package/dist/ketchup/p-35325834.entry.js +0 -9
  146. package/dist/ketchup/p-359e8bec.entry.js +0 -40
  147. package/dist/ketchup/p-762c0382.entry.js +0 -1
  148. package/dist/ketchup/p-76947316.entry.js +0 -1
  149. package/dist/ketchup/p-a0ce8075.entry.js +0 -1
  150. package/dist/ketchup/p-ca9fd099.js +0 -1
  151. package/dist/ketchup/p-d2e76960.entry.js +0 -1
  152. package/dist/ketchup/p-ee580b3a.entry.js +0 -1
  153. package/dist/types/components/kup-field/kup-field-declarations.d.ts +0 -25
  154. package/dist/types/components/kup-field/kup-field.d.ts +0 -90
@@ -1,237 +0,0 @@
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 { c as componentWrapperId } from './GenericVariables-665de00a.js';
4
-
5
- /**
6
- * Props of the kup-field component.
7
- * Used to export every prop in an object.
8
- */
9
- var KupFieldProps;
10
- (function (KupFieldProps) {
11
- KupFieldProps["customStyle"] = "Custom style of the component.";
12
- KupFieldProps["data"] = "Effective data to pass to the component.";
13
- KupFieldProps["label"] = "The text of the label. If set to empty or has only white space chars, the label will be removed.";
14
- KupFieldProps["labelPos"] = "Sets the label's position, left right or top.";
15
- KupFieldProps["showSubmit"] = "Sets whether the submit button must be displayed or not.";
16
- KupFieldProps["submitLabel"] = "Sets the submit button's label.";
17
- KupFieldProps["submitPos"] = "Sets the submit button's position, top right bottom or left.";
18
- KupFieldProps["type"] = "The type of the FLD";
19
- })(KupFieldProps || (KupFieldProps = {}));
20
-
21
- const kupFieldCss = ":host{display:block;font-size:var(--kup-font-size)}label{color:var(--kup-text-color);font-family:var(--kup-font-family);font-size:1em}.kup-field__component{display:inline-block}.label-top.submit-top label{float:left;margin:auto auto 1em auto}.label-top.submit-top kup-button{float:right;margin:auto auto 1em auto}.label-right label{display:inline-block;margin:auto auto auto 1em}.submit-right kup-button{display:inline-block;margin:auto auto auto 1em}.label-left label{display:inline-block;margin:auto 1em auto auto}.submit-left kup-button{display:inline-block;margin:auto 1em auto auto}.submit-bottom kup-button{display:block;margin:1em auto auto auto}";
22
-
23
- const KupField = class {
24
- constructor(hostRef) {
25
- registerInstance(this, hostRef);
26
- this.kupChange = createEvent(this, "kup-field-change", 6);
27
- this.kupSubmit = createEvent(this, "kup-field-submit", 6);
28
- /*-------------------------------------------------*/
29
- /* P r o p s */
30
- /*-------------------------------------------------*/
31
- /**
32
- * Custom style of the component.
33
- * @default ""
34
- * @see https://ketchup.smeup.com/ketchup-showcase/#/customization
35
- */
36
- this.customStyle = '';
37
- /**
38
- * Effective data to pass to the component.
39
- * @default {}
40
- */
41
- this.data = {};
42
- /**
43
- * The text of the label. If set to empty or has only white space chars, the label will be removed.
44
- * @default ""
45
- */
46
- this.label = '';
47
- /**
48
- * Sets the label's position, left right or top.
49
- * @default "left"
50
- */
51
- this.labelPos = 'left';
52
- /**
53
- * Sets whether the submit button must be displayed or not.
54
- * @default false
55
- */
56
- this.showSubmit = false;
57
- /**
58
- * Sets the submit button's label.
59
- * @default ""
60
- */
61
- this.submitLabel = '';
62
- /**
63
- * Sets the submit button's position, top right bottom or left.
64
- * @default "right"
65
- */
66
- this.submitPos = 'right';
67
- /**
68
- * The type of the FLD
69
- * @default undefined
70
- */
71
- this.type = undefined;
72
- /*-------------------------------------------------*/
73
- /* I n t e r n a l V a r i a b l e s */
74
- /*-------------------------------------------------*/
75
- /**
76
- * Instance of the KupManager class.
77
- */
78
- this.kupManager = kupManagerInstance();
79
- this.currentValue = null;
80
- this.previousValue = null;
81
- // Generates an instance of the event handler while binding the current component as its this value
82
- // This is done once per component to improve performance speed
83
- this.onChangeInstance = this.onChange.bind(this);
84
- this.onSubmitInstance = this.onSubmit.bind(this);
85
- }
86
- // When a change or update event must be launched as if it's coming from the FLD itself
87
- onChange(event) {
88
- const { value, info } = event.detail;
89
- this.kupChange.emit({
90
- originalEvent: event,
91
- oldValue: this.currentValue,
92
- value,
93
- info,
94
- });
95
- this.previousValue = this.currentValue;
96
- this.currentValue = value;
97
- }
98
- // When a submit event must be launched as if it's coming from the FLD itself
99
- onSubmit(event) {
100
- this.kupSubmit.emit({
101
- originalEvent: event,
102
- oldValue: this.previousValue,
103
- value: this.currentValue,
104
- info: {
105
- obj: event.detail.info && event.detail.info.obj
106
- ? event.detail.info.obj
107
- : undefined,
108
- },
109
- });
110
- }
111
- /*-------------------------------------------------*/
112
- /* P u b l i c M e t h o d s */
113
- /*-------------------------------------------------*/
114
- /**
115
- * Provides an interface to get the current value programmatically
116
- * @method getCurrentValue
117
- * @returns {any}
118
- */
119
- async getCurrentValue() {
120
- return this.currentValue;
121
- }
122
- /**
123
- * Used to retrieve component's props values.
124
- * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
125
- * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
126
- */
127
- async getProps(descriptions) {
128
- let props = {};
129
- if (descriptions) {
130
- props = KupFieldProps;
131
- }
132
- else {
133
- for (const key in KupFieldProps) {
134
- if (Object.prototype.hasOwnProperty.call(KupFieldProps, key)) {
135
- props[key] = this[key];
136
- }
137
- }
138
- }
139
- return props;
140
- }
141
- /**
142
- * This method is used to trigger a new render of the component.
143
- */
144
- async refresh() {
145
- forceUpdate(this);
146
- }
147
- /*-------------------------------------------------*/
148
- /* L i f e c y c l e H o o k s */
149
- /*-------------------------------------------------*/
150
- componentWillLoad() {
151
- this.kupManager.debug.logLoad(this, false);
152
- this.kupManager.theme.register(this);
153
- }
154
- componentDidLoad() {
155
- this.kupManager.debug.logLoad(this, true);
156
- }
157
- componentWillRender() {
158
- this.kupManager.debug.logRender(this, false);
159
- }
160
- componentDidRender() {
161
- this.kupManager.debug.logRender(this, true);
162
- }
163
- render() {
164
- let toRender = [];
165
- const baseClass = 'kup-field';
166
- let label = null;
167
- let submit = null;
168
- let wrapperClass = '';
169
- let propList = Object.assign({}, this.data);
170
- if (this.label.trim().length) {
171
- wrapperClass += ' label-' + this.labelPos;
172
- label = (h("label", { class: baseClass +
173
- '__label' +
174
- ' ' +
175
- baseClass +
176
- '--' +
177
- this.labelPos }, this.label));
178
- }
179
- if (this.showSubmit) {
180
- wrapperClass += ' submit-' + this.submitPos;
181
- submit = (h("kup-button", { class: baseClass + '__submit', label: this.submitLabel, "onkup-button-click": this.onSubmitInstance }));
182
- }
183
- //-- If a component must be positioned on top of the dynamic one --
184
- const labelIsTop = this.labelPos === 'top';
185
- const labelIsLeft = this.labelPos === 'left';
186
- const labelIsRight = this.labelPos === 'right';
187
- const submitIsTop = this.submitPos === 'top';
188
- const submitIsLeft = this.submitPos === 'left';
189
- const submitIsRight = this.submitPos === 'right';
190
- const submitIsBottom = this.submitPos === 'bottom';
191
- if (labelIsTop || submitIsTop) {
192
- toRender.push(h("div", { class: baseClass + '__top-container' }, labelIsTop && label ? label : null, submitIsTop && submit ? submit : null));
193
- }
194
- if (labelIsLeft && label) {
195
- toRender.push(label);
196
- }
197
- if (submitIsLeft && submit) {
198
- toRender.push(submit);
199
- }
200
- let comp = undefined;
201
- if (this.type === undefined) {
202
- this.kupManager.debug.logMessage(this, 'Type (state) is undefined!', KupDebugCategory.WARNING);
203
- }
204
- else {
205
- switch (this.type.toLowerCase()) {
206
- case 'cmb':
207
- comp = 'kup-combobox';
208
- propList.onKupComboboxChange = this.onChangeInstance;
209
- break;
210
- case 'itx':
211
- comp = 'kup-text-field';
212
- propList.onkupTextFieldChange = this.onChangeInstance;
213
- break;
214
- case 'rad':
215
- comp = 'kup-radio';
216
- propList.onkupRadioChange = this.onChangeInstance;
217
- break;
218
- }
219
- }
220
- const $DynamicComponent = comp; // TODO check if there is a better typing
221
- toRender.push(h($DynamicComponent, Object.assign({ class: baseClass + '__component' }, propList)));
222
- if (labelIsRight && label) {
223
- toRender.push(label);
224
- }
225
- if ((submitIsRight || submitIsBottom) && submit) {
226
- toRender.push(submit);
227
- }
228
- return (h(Host, null, h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId, class: wrapperClass }, toRender)));
229
- }
230
- disconnectedCallback() {
231
- this.kupManager.theme.unregister(this);
232
- }
233
- get rootElement() { return getElement(this); }
234
- };
235
- KupField.style = kupFieldCss;
236
-
237
- export { KupField as kup_field };
@@ -1 +0,0 @@
1
- import{r as t,f as o,h as e,H as s,g as i}from"./p-d3b542b3.js";import{k as r,_ as n,h as l}from"./p-704e60eb.js";import{i as a,g as c,s as f}from"./p-d95c904b.js";import{c as u}from"./p-97e8ea42.js";import{F as m}from"./p-d7004ae4.js";import{F as h}from"./p-a203f78b.js";import"./p-ca9fd099.js";import"./p-cd5cfa7c.js";import"./p-13e08580.js";import"./p-70660fe2.js";import"./p-ddce3430.js";import"./p-79b0730b.js";import"./p-81605f08.js";var d,p;!function(t){t.customStyle="Custom style of the component.",t.data="Actual data of the form.",t.layout="How the form will arrange its content."}(d||(d={})),function(t){t.BOTTOM="bottom",t.LEFT="left",t.HIDDEN="hidden",t.PLACEHOLDER="placeholder",t.RIGHT="right",t.TOP="top"}(p||(p={}));const _=document.documentElement,b=class{constructor(o){t(this,o),this.customStyle="",this.data=null,this.labelPlacement=p.LEFT,this.layout=null,this.kupManager=r(),this.visibleColumns=[]}onDataChanged(){a(this.getRows()),this.initVisibleColumns(),this.checkLayout()}onLayoutChanged(){this.checkLayout()}async getProps(t){return c(this,d,t)}async refresh(){o(this)}async setFocus(t,o){const e=this.rootElement.shadowRoot.querySelectorAll('td[data-column="'+t+'"]');for(let t=0;e&&t<e.length;t++){const s=e[t];if(s["data-row"]&&s["data-row"].id==o){const t=s.querySelector("input");if(t)t.focus();else{const t=s.querySelector(".hydrated");if(t)try{t.setFocus()}catch(t){}}}}}async setProps(t){f(this,d,t)}getColumns(){return this.data&&this.data.columns?this.data.columns:[{title:"",name:"",size:void 0}]}initVisibleColumns(){this.visibleColumns=this.getColumns().filter((t=>!t.hasOwnProperty("visible")||t.visible))}getRows(){return this.data&&this.data.rows?this.data.rows:[]}checkLayout(){if(this.layout)return void(this.formLayout=this.layout);const t={horizontal:!1,sections:[]},o=this.visibleColumns;let e=o.length;const s=[];let i=0;for(;e-- >0;)s.push({column:o[i++].name});t.content=s,this.formLayout={sections:[t]}}renderRow(t){const o=[...this.visibleColumns];let s=null,i=t.layout;i||(i=this.formLayout);let r=!1;if(i){i.horizontal&&(r=!0);const e=i.sections;let n=e.length,l=0;n>0&&(s=[]);const a={horizontal:r};for(;n-- >0;)s.push(this.renderSection(e[l++],a,t,o))}return e("form",{class:{form:!0,"form--column":!r}},s)}renderSection(t,o,s,i){let r=null;if(t.sections&&t.sections.length>0){const o=t.sections;let e=o.length,n=0;for(e>0&&(r=[]);e-- >0;)r.push(this.renderSection(o[n++],t,s,i))}else if(t.content){const o=t.content;let n=o.length,l=0;for(n>0&&(r=[]);n-- >0;){const n=this.renderFormField({formField:o[l++],row:s,visibleColumns:i},!0);let a=n;t.horizontal||(a=e("tr",null,n)),r.push(a)}}else i.length>0&&(r=this.renderFormField({formField:{column:i[0].name},row:s,visibleColumns:i}));const n=!!t.columns,l={form__section:!0,"form__section--column":!n&&!t.horizontal,"form__section--grid":n,"form__section--titled":!!t.title,"form__section--last":!t.sections||0===t.sections.length},a=t.style||{};return t.dim&&o&&(a.flex=`0 0 ${t.dim}`,o.horizontal?a.maxWidth=t.dim:a.maxHeight=t.dim),n&&(a["grid-template-columns"]=`repeat(${t.columns}, 1fr)`),e("div",{class:l,style:a},t.title?e("h3",null,t.title):null,e("table",null,e("tbody",null,t.horizontal?e("tr",null,r):r)))}renderFormField({formField:t,row:o,visibleColumns:s},i){const r={form__field:!0},l={};let a=null,c=-1;for(let o=0;o<s.length;o++)if(s[o].name===t.column){c=o;break}c>=0?(a=s[c],s.splice(c,1)):i&&(a=this.data.columns.find((o=>o.name===t.column)));const f=o.cells[t.column];let u;if(!f)return null;f.isEditable=!0,this.kupManager.objects.isEmptyKupObj(f.obj)||this.kupManager.debug.isDebug()&&(u=f.obj.t+"; "+f.obj.p+"; "+f.obj.k+";");const h={cell:f,column:a,component:this,editable:!0,renderKup:!0,row:o,setSizes:!0,shape:t.shape};switch(function(){f.data||(f.data={});try{delete f.data.label}catch(t){}try{delete f.data.data["kup-text-field"].label}catch(t){}}(),this.labelPlacement){case p.BOTTOM:return[e("tr",null,d()),e("tr",null,b())];case p.PLACEHOLDER:!function(){switch(_.ketchup.data.cell.getType(f,f.shape||a.shape||null)){case n.AUTOCOMPLETE:case n.COLOR_PICKER:case n.COMBOBOX:case n.DATE:case n.DATETIME:case n.TIME:f.data.data&&f.data.data["kup-text-field"]?f.data.data["kup-text-field"].label=a.title:f.data.data={"kup-text-field":{label:a.title}};break;case n.CHECKBOX:case n.NUMBER:case n.STRING:case n.SWITCH:f.data.label=a.title}}();case p.HIDDEN:return i?[d()]:[e("tr",null,d())];case p.RIGHT:return i?[d(),b()]:[e("tr",null,d(),b())];case p.TOP:return[e("tr",null,b()),e("tr",null,d())];default:return i?[b(),d()]:[e("tr",null,b(),d())]}function d(){return e("td",{"data-cell":f,"data-row":o,"data-column":t.column,class:r,style:l,title:u},f&&a?e(m,Object.assign({},h)):e("span",null,t.value))}function b(){return e("td",{class:"form__label"},e("span",null,a.title))}}componentWillLoad(){this.kupManager.debug.logLoad(this,!1),this.kupManager.language.register(this),this.kupManager.theme.register(this),this.onDataChanged()}componentDidLoad(){this.kupManager.debug.logLoad(this,!0)}componentWillRender(){this.kupManager.debug.logRender(this,!1)}componentDidRender(){const t=this.rootElement.shadowRoot;if(t){const o=t.querySelectorAll(".f-text-field");for(let t=0;t<o.length;t++)h(o[t])}this.kupManager.debug.logRender(this,!0)}render(){let t=null;if(0===this.data.rows.length)t=e("p",null,this.kupManager.language.translate(l.EMPTY_DATA));else{const o=this.data.rows;let e=o.length,s=0;for(t=[];e-- >0;)t.push(this.renderRow(o[s++]))}return e(s,null,e("style",null,this.kupManager.theme.setKupStyle(this.rootElement)),e("div",{id:u},t))}disconnectedCallback(){this.kupManager.language.unregister(this),this.kupManager.theme.unregister(this)}get rootElement(){return i(this)}static get watchers(){return{data:["onDataChanged"],layout:["onLayoutChanged"]}}};b.style=":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}";export{b as kup_form}