@sme.up/ketchup 6.1.0-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 (166) hide show
  1. package/dist/cjs/{cell-utils-a78d6fac.js → cell-utils-d894e802.js} +2 -2
  2. package/dist/cjs/{f-button-ac179257.js → f-button-414b3bc3.js} +4 -4
  3. package/dist/cjs/f-cell-c8983ec7.js +418 -0
  4. package/dist/cjs/f-checkbox-57443ca3.js +29 -0
  5. package/dist/cjs/{f-chip-b00897d7.js → f-chip-ef81bf51.js} +3 -3
  6. package/dist/cjs/{f-image-89f25556.js → f-image-0618c795.js} +2 -2
  7. package/dist/cjs/{f-paginator-utils-8fa501b3.js → f-paginator-utils-c9dd5173.js} +5 -5
  8. package/dist/cjs/{f-text-field-e1e45ade.js → f-text-field-7d31190f.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 +200 -187
  13. package/dist/cjs/kup-box_2.cjs.entry.js +23 -12
  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-field.cjs.entry.js +2 -2
  21. package/dist/cjs/kup-form.cjs.entry.js +469 -0
  22. package/dist/cjs/kup-iframe.cjs.entry.js +3 -3
  23. package/dist/cjs/kup-image-list.cjs.entry.js +11 -10
  24. package/dist/cjs/kup-lazy.cjs.entry.js +3 -3
  25. package/dist/cjs/kup-magic-box.cjs.entry.js +4 -4
  26. package/dist/cjs/{kup-manager-7a941909.js → kup-manager-2fee8cf3.js} +324 -6
  27. package/dist/cjs/kup-nav-bar.cjs.entry.js +3 -3
  28. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  29. package/dist/cjs/kup-photo-frame.cjs.entry.js +7 -9
  30. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  31. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +5 -5
  33. package/dist/cjs/loader.cjs.js +3 -3
  34. package/dist/cjs/{utils-6287d878.js → utils-8470184d.js} +1 -1
  35. package/dist/collection/assets/dashboard.js +113 -0
  36. package/dist/collection/assets/data-table.js +15 -0
  37. package/dist/collection/assets/form.js +179 -0
  38. package/dist/collection/assets/grid.js +17 -0
  39. package/dist/collection/assets/index.js +10 -6
  40. package/dist/collection/collection-manifest.json +3 -2
  41. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +135 -129
  42. package/dist/collection/components/kup-box/kup-box.js +13 -2
  43. package/dist/collection/components/kup-combobox/kup-combobox.js +16 -13
  44. package/dist/collection/components/kup-dashboard/kup-dashboard-declarations.js +10 -0
  45. package/dist/collection/components/{kup-form-editor/kup-form-editor.css → kup-dashboard/kup-dashboard.css} +7 -6
  46. package/dist/collection/components/{kup-form-editor/kup-form-editor.js → kup-dashboard/kup-dashboard.js} +148 -149
  47. package/dist/collection/components/kup-drawer/kup-drawer.css +5 -8
  48. package/dist/collection/components/kup-form/kup-form-declarations.js +19 -0
  49. package/dist/collection/components/kup-form/kup-form.css +86 -0
  50. package/dist/collection/components/kup-form/kup-form.js +668 -0
  51. package/dist/collection/components/kup-grid/kup-grid.js +1 -4
  52. package/dist/collection/components/kup-list/kup-list-helper.js +9 -3
  53. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +10 -7
  54. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +3 -5
  55. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +3 -0
  56. package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
  57. package/dist/collection/components/kup-time-picker/kup-time-picker.js +0 -6
  58. package/dist/collection/components/kup-tree/kup-tree.js +10 -4
  59. package/dist/collection/f-components/f-button/f-button.js +2 -2
  60. package/dist/collection/f-components/f-cell/f-cell-declarations.js +5 -1
  61. package/dist/collection/f-components/f-cell/f-cell.js +34 -114
  62. package/dist/collection/f-components/f-text-field/f-text-field.js +1 -1
  63. package/dist/collection/managers/kup-data/kup-data.js +94 -0
  64. package/dist/collection/managers/kup-language/kup-language-declarations.js +11 -0
  65. package/dist/collection/managers/kup-objects/kup-objects.js +10 -0
  66. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +18 -3
  67. package/dist/collection/types/GenericTypes.js +2 -1
  68. package/dist/esm/{cell-utils-964da6b5.js → cell-utils-7fc84d4e.js} +2 -2
  69. package/dist/esm/{f-button-871a544b.js → f-button-2f6cc296.js} +4 -4
  70. package/dist/esm/{f-cell-521ef17a.js → f-cell-4428481c.js} +48 -283
  71. package/dist/esm/f-checkbox-c51c4a75.js +27 -0
  72. package/dist/esm/{f-chip-1dda722f.js → f-chip-b39eb49a.js} +3 -3
  73. package/dist/esm/{f-image-c468d8ae.js → f-image-b08ebeb2.js} +2 -2
  74. package/dist/esm/{f-paginator-utils-7dff8ff0.js → f-paginator-utils-4fda6086.js} +5 -5
  75. package/dist/esm/{f-text-field-d6c61c73.js → f-text-field-184a5fb3.js} +3 -3
  76. package/dist/esm/{index-baeab1ac.js → index-ad6ab214.js} +6 -4
  77. package/dist/esm/ketchup.js +3 -3
  78. package/dist/esm/kup-accordion.entry.js +4 -4
  79. package/dist/esm/kup-autocomplete_25.entry.js +190 -177
  80. package/dist/esm/kup-box_2.entry.js +23 -12
  81. package/dist/esm/kup-calendar.entry.js +7 -7
  82. package/dist/esm/kup-cell.entry.js +9 -8
  83. package/dist/esm/kup-dash-list.entry.js +4 -4
  84. package/dist/esm/kup-dash_2.entry.js +4 -7
  85. package/dist/esm/{kup-form-editor.entry.js → kup-dashboard.entry.js} +123 -148
  86. package/dist/esm/kup-drawer.entry.js +4 -4
  87. package/dist/esm/kup-field.entry.js +2 -2
  88. package/dist/esm/kup-form.entry.js +465 -0
  89. package/dist/esm/kup-iframe.entry.js +3 -3
  90. package/dist/esm/kup-image-list.entry.js +10 -9
  91. package/dist/esm/kup-lazy.entry.js +3 -3
  92. package/dist/esm/kup-magic-box.entry.js +4 -4
  93. package/dist/esm/{kup-manager-58b075b4.js → kup-manager-3325b2d8.js} +321 -7
  94. package/dist/esm/kup-nav-bar.entry.js +3 -3
  95. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  96. package/dist/esm/kup-photo-frame.entry.js +7 -9
  97. package/dist/esm/kup-probe.entry.js +2 -2
  98. package/dist/esm/kup-qlik.entry.js +2 -2
  99. package/dist/esm/kup-snackbar.entry.js +5 -5
  100. package/dist/esm/loader.js +3 -3
  101. package/dist/esm/{utils-d7e4b3c2.js → utils-6373a07e.js} +1 -1
  102. package/dist/ketchup/ketchup.esm.js +1 -1
  103. package/dist/ketchup/p-006bc4d0.entry.js +1 -0
  104. package/dist/ketchup/{p-8cdf61a4.js → p-0741da57.js} +1 -1
  105. package/dist/ketchup/{p-44ec4f03.js → p-13e08580.js} +1 -1
  106. package/dist/ketchup/p-153697fb.entry.js +1 -0
  107. package/dist/ketchup/{p-a615a92b.entry.js → p-175edb62.entry.js} +1 -1
  108. package/dist/ketchup/{p-fac1a08b.entry.js → p-1db1d42b.entry.js} +1 -1
  109. package/dist/ketchup/{p-f09f2f98.entry.js → p-30820f8f.entry.js} +1 -1
  110. package/dist/ketchup/p-35325834.entry.js +9 -0
  111. package/dist/ketchup/{p-65b46587.entry.js → p-359e8bec.entry.js} +4 -4
  112. package/dist/ketchup/{p-6dff70f8.entry.js → p-3c7c92c0.entry.js} +1 -1
  113. package/dist/ketchup/{p-954cc340.entry.js → p-41cf8703.entry.js} +1 -1
  114. package/dist/ketchup/{p-3c11e615.entry.js → p-6127fccf.entry.js} +1 -1
  115. package/dist/ketchup/{p-f71a1675.entry.js → p-6b82e4e2.entry.js} +1 -1
  116. package/dist/ketchup/p-704e60eb.js +30 -0
  117. package/dist/ketchup/p-70660fe2.js +1 -0
  118. package/dist/ketchup/{p-ea10176c.entry.js → p-762c0382.entry.js} +1 -1
  119. package/dist/ketchup/{p-c5ce8951.entry.js → p-76947316.entry.js} +1 -1
  120. package/dist/ketchup/{p-d2ee56dd.entry.js → p-8103b80a.entry.js} +1 -1
  121. package/dist/ketchup/{p-99e0d768.entry.js → p-9fa457d4.entry.js} +1 -1
  122. package/dist/ketchup/{p-65974e48.entry.js → p-a0ce8075.entry.js} +1 -1
  123. package/dist/ketchup/p-a804fe83.entry.js +27 -0
  124. package/dist/ketchup/{p-7454cb92.js → p-ca9fd099.js} +1 -1
  125. package/dist/ketchup/p-caabb9ab.entry.js +1 -0
  126. package/dist/ketchup/p-cc3abf84.entry.js +1 -0
  127. package/dist/ketchup/p-cd5cfa7c.js +1 -0
  128. package/dist/ketchup/p-d2e76960.entry.js +1 -0
  129. package/dist/ketchup/p-d3b542b3.js +2 -0
  130. package/dist/ketchup/p-d7004ae4.js +1 -0
  131. package/dist/ketchup/{p-e0035c58.js → p-d95c904b.js} +1 -1
  132. package/dist/ketchup/{p-7eff4eee.js → p-ddce3430.js} +1 -1
  133. package/dist/ketchup/p-ee580b3a.entry.js +1 -0
  134. package/dist/ketchup/p-f49cb68e.js +1 -0
  135. package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +1 -16
  136. package/dist/types/components/{kup-form-editor/kup-form-editor-declarations.d.ts → kup-dashboard/kup-dashboard-declarations.d.ts} +9 -27
  137. package/dist/types/components/{kup-form-editor/kup-form-editor.d.ts → kup-dashboard/kup-dashboard.d.ts} +12 -9
  138. package/dist/types/components/kup-form/kup-form-declarations.d.ts +48 -0
  139. package/dist/types/components/kup-form/kup-form.d.ts +68 -0
  140. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +3 -0
  141. package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
  142. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +0 -6
  143. package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +2 -0
  144. package/dist/types/components.d.ts +412 -159
  145. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +4 -1
  146. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
  147. package/dist/types/managers/kup-data/kup-data.d.ts +2 -0
  148. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +11 -1
  149. package/dist/types/managers/kup-objects/kup-objects.d.ts +6 -0
  150. package/dist/types/types/GenericTypes.d.ts +2 -1
  151. package/package.json +2 -2
  152. package/dist/cjs/f-cell-69294bca.js +0 -653
  153. package/dist/collection/assets/form-editor.js +0 -338
  154. package/dist/collection/components/kup-form-editor/kup-form-editor-declarations.js +0 -23
  155. package/dist/ketchup/p-1ae66cc5.js +0 -1
  156. package/dist/ketchup/p-34b74425.js +0 -1
  157. package/dist/ketchup/p-4ffbc3ff.js +0 -1
  158. package/dist/ketchup/p-5264a3e6.entry.js +0 -1
  159. package/dist/ketchup/p-80968627.entry.js +0 -1
  160. package/dist/ketchup/p-976244f9.entry.js +0 -9
  161. package/dist/ketchup/p-a0f6e25c.entry.js +0 -1
  162. package/dist/ketchup/p-aca0e54b.js +0 -30
  163. package/dist/ketchup/p-b8939a8b.entry.js +0 -1
  164. package/dist/ketchup/p-bfc3bac7.js +0 -1
  165. package/dist/ketchup/p-db71436b.entry.js +0 -27
  166. package/dist/ketchup/p-e1039cf2.entry.js +0 -1
@@ -1,13 +1,16 @@
1
1
  import { Component, Element, forceUpdate, h, Host, Method, Prop, State, Event, Watch, } from '@stencil/core';
2
2
  import { FButton } from '../../f-components/f-button/f-button';
3
+ import { FCheckbox } from '../../f-components/f-checkbox/f-checkbox';
4
+ import { FTextField } from '../../f-components/f-text-field/f-text-field';
5
+ import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
3
6
  import { KupDebugCategory } from '../../managers/kup-debug/kup-debug-declarations';
4
7
  import { KupDragEffect } from '../../managers/kup-interact/kup-interact-declarations';
5
- import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
8
+ import { KupLanguageDashboard, KupLanguageGeneric, } from '../../managers/kup-language/kup-language-declarations';
6
9
  import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
7
10
  import { getProps, setProps } from '../../utils/utils';
8
11
  import { componentWrapperId } from '../../variables/GenericVariables';
9
- import { KupFormEditorDragTypes, KupFormEditorLabels, KupFormEditorProps, } from './kup-form-editor-declarations';
10
- export class KupFormEditor {
12
+ import { KupDashboardProps, } from './kup-dashboard-declarations';
13
+ export class KupDashboard {
11
14
  constructor() {
12
15
  /*-------------------------------------------------*/
13
16
  /* S t a t e s */
@@ -27,9 +30,14 @@ export class KupFormEditor {
27
30
  this.customStyle = '';
28
31
  /**
29
32
  * The data of the component.
30
- * @default false
33
+ * @default null
31
34
  */
32
35
  this.data = null;
36
+ /**
37
+ * Enable drag & drop of the section.
38
+ * @default false
39
+ */
40
+ this.enableDesign = false;
33
41
  /*-------------------------------------------------*/
34
42
  /* I n t e r n a l V a r i a b l e s */
35
43
  /*-------------------------------------------------*/
@@ -37,10 +45,6 @@ export class KupFormEditor {
37
45
  * Instance of the KupManager class.
38
46
  */
39
47
  this.kupManager = kupManagerInstance();
40
- /**
41
- * Draggable type of Form (Components or Sections).
42
- */
43
- this.dragType = KupFormEditorDragTypes.Components;
44
48
  /**
45
49
  * Internal data of the component.
46
50
  */
@@ -72,7 +76,7 @@ export class KupFormEditor {
72
76
  * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
73
77
  */
74
78
  async getProps(descriptions) {
75
- return getProps(this, KupFormEditorProps, descriptions);
79
+ return getProps(this, KupDashboardProps, descriptions);
76
80
  }
77
81
  /**
78
82
  * This method is used to trigger a new render of the component.
@@ -85,15 +89,21 @@ export class KupFormEditor {
85
89
  * @param {GenericObject} props - Object containing props that will be set to the component.
86
90
  */
87
91
  async setProps(props) {
88
- setProps(this, KupFormEditorProps, props);
92
+ setProps(this, KupDashboardProps, props);
89
93
  }
90
94
  /*-------------------------------------------------*/
91
95
  /* P r i v a t e M e t h o d s */
92
96
  /*-------------------------------------------------*/
97
+ buildGuid() {
98
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
99
+ var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
100
+ return v.toString(16);
101
+ });
102
+ }
93
103
  buildHeader() {
94
104
  const clearButtonProp = {
95
105
  icon: 'cancel',
96
- label: KupFormEditorLabels.Reset,
106
+ label: this.kupManager.language.translate(KupLanguageDashboard.RESET),
97
107
  secondary: true,
98
108
  onClick: () => {
99
109
  this.resetData();
@@ -101,41 +111,24 @@ export class KupFormEditor {
101
111
  };
102
112
  const saveButtonProp = {
103
113
  icon: 'save',
104
- label: KupFormEditorLabels.Save,
114
+ label: this.kupManager.language.translate(KupLanguageDashboard.SAVE),
105
115
  onClick: () => this.onKupSave(),
106
116
  };
107
- const selRadioProp = [
108
- {
109
- label: KupFormEditorLabels.Components,
110
- value: KupFormEditorDragTypes.Components,
111
- checked: this.dragType == KupFormEditorDragTypes.Components,
112
- },
113
- {
114
- label: KupFormEditorLabels.Sections,
115
- value: KupFormEditorDragTypes.Sections,
116
- checked: this.dragType == KupFormEditorDragTypes.Sections,
117
- },
118
- ];
119
117
  return (h("div", { class: "header" },
120
- h("kup-radio", { data: selRadioProp, "onKup-radio-change": (ev) => {
121
- this.dragType = ev.detail
122
- .value;
123
- this.resetData(this.internalData);
124
- } }),
125
- h(FButton, Object.assign({}, clearButtonProp)),
126
- h(FButton, Object.assign({}, saveButtonProp))));
118
+ this.enableDesign ? (h(FButton, Object.assign({}, clearButtonProp))) : undefined,
119
+ this.enableDesign ? (h(FButton, Object.assign({}, saveButtonProp))) : undefined));
127
120
  }
128
121
  buildForm(form, parent) {
129
122
  const classes = {
130
123
  form: true,
131
124
  'layout-column': form && form.layout == 'column',
132
125
  'layout-row': form && form.layout == 'row',
133
- 'form-dropzone': form &&
134
- this.dragType == KupFormEditorDragTypes.Sections &&
126
+ 'form-dropzone': this.enableDesign &&
127
+ form &&
135
128
  form.sections != null &&
136
129
  form.sections.length > 0,
137
130
  };
138
- return form ? (h("div", { class: classes, ref: (el) => {
131
+ return form ? (h("div", { class: classes, style: this.getGridStyle(form), ref: (el) => {
139
132
  if (!el)
140
133
  return;
141
134
  const kel = el;
@@ -143,6 +136,14 @@ export class KupFormEditor {
143
136
  } }, form.sections.map((section) => this.buildSection(section, form)))) : (h("div", null, this.kupManager.language.translate(KupLanguageGeneric.EMPTY_DATA)));
144
137
  }
145
138
  buildSectionHeader(section, parent) {
139
+ const dimTextFieldProp = {
140
+ value: section.dim,
141
+ label: this.kupManager.language.translate(KupLanguageDashboard.DIMENSION),
142
+ onChange: (e) => {
143
+ const { target } = e;
144
+ section.dim = target.value;
145
+ },
146
+ };
146
147
  const addButtonProp = {
147
148
  icon: 'add',
148
149
  slim: true,
@@ -154,12 +155,7 @@ export class KupFormEditor {
154
155
  id: section.id + (section.sections.length + 1),
155
156
  loaded: section.loaded,
156
157
  layout: section.layout,
157
- components: [],
158
158
  };
159
- if (section.components) {
160
- section.components.forEach((x) => newSec.components.push(x));
161
- section.components.splice(0);
162
- }
163
159
  section.sections.push(newSec);
164
160
  this.resetData(this.internalData);
165
161
  },
@@ -174,97 +170,66 @@ export class KupFormEditor {
174
170
  this.resetData(this.internalData);
175
171
  },
176
172
  };
173
+ const loadedCheckBoxProp = {
174
+ checked: section.loaded,
175
+ label: this.kupManager.language.translate(KupLanguageDashboard.LOADED),
176
+ onChange: () => {
177
+ section.loaded = !section.loaded;
178
+ this.refresh();
179
+ },
180
+ };
181
+ const columnCheckBoxProp = {
182
+ checked: section.layout == 'column',
183
+ label: this.kupManager.language.translate(KupLanguageDashboard.VERTICAL),
184
+ onChange: () => {
185
+ section.layout = section.layout == 'column' ? 'row' : 'column';
186
+ this.refresh();
187
+ },
188
+ };
177
189
  return (h("div", { class: "section-header" },
178
190
  h("div", null,
179
191
  section.id,
180
- ' ',
181
- section.dim ? '(' + section.dim + ')' : undefined,
182
- " -",
183
- ' ',
192
+ " - ",
184
193
  section.layout),
185
194
  h("div", null,
186
195
  h("div", { class: "section-header-actions" },
187
- h("kup-switch", { checked: section.loaded, label: KupFormEditorLabels.Loaded, "onKup-switch-change": (ev) => {
188
- section.loaded = ev.detail.value == 'on';
189
- } }),
190
- h("kup-switch", { checked: section.layout == 'column', label: KupFormEditorLabels.Column, "onKup-switch-change": (ev) => {
191
- section.layout =
192
- ev.detail.value == 'on' ? 'column' : 'row';
193
- this.resetData(this.internalData);
194
- } }),
196
+ h(FTextField, Object.assign({}, dimTextFieldProp)),
197
+ h(FCheckbox, Object.assign({}, loadedCheckBoxProp)),
198
+ h(FCheckbox, Object.assign({}, columnCheckBoxProp)),
195
199
  h(FButton, Object.assign({}, addButtonProp)),
196
- h(FButton, Object.assign({}, removeButtonProp)),
197
- section.components && section.components.length > 0 ? (h("kup-image", { resource: "widgets", sizeX: "24px", sizeY: "24px" })) : undefined))));
200
+ h(FButton, Object.assign({}, removeButtonProp))))));
198
201
  }
199
202
  buildSection(section, parent) {
200
203
  const classes = {
201
204
  section: true,
202
- 'section-draggable': this.dragType == KupFormEditorDragTypes.Sections,
203
- 'section-dropzone': !section.sections ||
204
- section.sections.length == 0 ||
205
- this.dragType == KupFormEditorDragTypes.Sections,
205
+ 'section-draggable': this.enableDesign,
206
+ 'section-dropzone': this.enableDesign,
206
207
  };
207
208
  const bodyClasses = {
208
209
  'section-body': true,
209
210
  'layout-column': section && section.layout == 'column',
210
211
  'layout-row': section && section.layout == 'row',
211
212
  };
212
- let bodyStyles = {};
213
- if (section.sections) {
214
- let gridTemplate = '';
215
- section.sections.forEach((childSection) => {
216
- if (!childSection.dim)
217
- gridTemplate += ' 1fr';
218
- else
219
- gridTemplate +=
220
- childSection.dim.indexOf('%') < 0
221
- ? ' ' + childSection.dim + 'px'
222
- : ' ' + childSection.dim;
223
- });
224
- if (section.layout == 'column')
225
- bodyStyles['gridTemplateRows'] = gridTemplate;
226
- if (section.layout == 'row')
227
- bodyStyles['gridTemplateColumns'] = gridTemplate;
228
- }
229
213
  return (h("div", { class: classes, ref: (el) => {
230
214
  if (!el)
231
215
  return;
232
216
  const kel = el;
233
217
  kel.kupData = { parent: parent, section: section };
234
218
  } },
235
- this.dragType == KupFormEditorDragTypes.Sections
219
+ this.enableDesign
236
220
  ? this.buildSectionHeader(section, parent)
237
221
  : undefined,
238
- h("div", { class: bodyClasses, style: bodyStyles },
239
- this.dragType == KupFormEditorDragTypes.Components &&
240
- section.components
241
- ? section.components.map((component) => component.type == 'SCH' ? (this.buildForm(component, section)) : (h("div", { class: "component component-draggable", ref: (el) => {
242
- if (!el)
243
- return;
244
- const kel = el;
245
- kel.kupData = {
246
- section: section,
247
- componnent: component,
248
- };
249
- } },
250
- component.id,
251
- " - ",
252
- component.type,
253
- h("kup-switch", { checked: component.loaded, label: KupFormEditorLabels.Loaded, "onKup-switch-change": (ev) => {
254
- component.loaded =
255
- ev.detail.value == 'on';
256
- } }))))
257
- : undefined,
258
- section.sections
222
+ h("div", { class: bodyClasses, style: this.getGridStyle(section) },
223
+ !this.enableDesign &&
224
+ section.loaded &&
225
+ (!section.sections || section.sections.length == 0) ? (h("slot", { name: section.id })) : undefined,
226
+ section.sections && (section.loaded || this.enableDesign)
259
227
  ? section.sections.map((childSection) => this.buildSection(childSection, section))
260
228
  : undefined)));
261
229
  }
262
230
  didRenderInteractables() {
263
231
  try {
264
232
  const items = [];
265
- this.rootElement.shadowRoot
266
- .querySelectorAll('.component-draggable')
267
- .forEach((x) => items.push(x));
268
233
  this.rootElement.shadowRoot
269
234
  .querySelectorAll('.section-draggable')
270
235
  .forEach((x) => items.push(x));
@@ -286,7 +251,6 @@ export class KupFormEditor {
286
251
  items.forEach((item) => {
287
252
  this.kupManager.interact.dropzone(item, null, null, {
288
253
  drop: (ev) => {
289
- ev.currentTarget.appendChild(ev.relatedTarget);
290
254
  this.dropped(ev.currentTarget, ev.relatedTarget);
291
255
  },
292
256
  });
@@ -297,44 +261,51 @@ export class KupFormEditor {
297
261
  }
298
262
  }
299
263
  dropped(parent, child) {
300
- if (this.dragType == KupFormEditorDragTypes.Components) {
301
- const idx = child.kupData.section.components.indexOf(child.kupData.componnent);
302
- child.kupData.section.components.splice(idx, 1);
303
- parent.kupData.section.components.push(child.kupData.componnent);
304
- child.kupData.section = parent.kupData.section;
264
+ const idx = child.kupData.parent.sections.indexOf(child.kupData.section);
265
+ child.kupData.parent.sections.splice(idx, 1);
266
+ if (parent.kupData.form) {
267
+ // form is the target of drop.
268
+ if (!parent.kupData.form.sections)
269
+ parent.kupData.form.sections = [];
270
+ parent.kupData.form.sections.push(child.kupData.section);
271
+ child.kupData.parent = parent.kupData.form;
305
272
  }
306
- else if (this.dragType == KupFormEditorDragTypes.Sections) {
307
- const idx = child.kupData.parent.sections.indexOf(child.kupData.section);
308
- child.kupData.parent.sections.splice(idx, 1);
309
- if (parent.kupData.form) {
310
- // il nuovo target è la form.
311
- if (!parent.kupData.form.sections)
312
- parent.kupData.form.sections = [];
313
- parent.kupData.form.sections.push(child.kupData.section);
314
- child.kupData.parent = parent.kupData.form;
273
+ else if (parent.kupData.section) {
274
+ // section is the target of drop.
275
+ if (!parent.kupData.section.sections ||
276
+ parent.kupData.section.sections.length == 0) {
277
+ // if the section target of drop doesn't contains other sections, i create a wrapper that will contain target section and dragged section.
278
+ const newSec = JSON.parse(JSON.stringify(parent.kupData.section));
279
+ newSec.dim = null;
280
+ child.kupData.section.dim = null;
281
+ parent.kupData.section.id = this.buildGuid();
282
+ parent.kupData.section.sections = [];
283
+ parent.kupData.section.sections.push(newSec);
315
284
  }
316
- else if (parent.kupData.section) {
317
- // il nuovo target è la section.
318
- if (!parent.kupData.section.sections)
319
- parent.kupData.section.sections = [];
320
- if (parent.kupData.section.components &&
321
- parent.kupData.section.components.length > 0) {
322
- // devo creare una section contenitore e sposare i components
323
- const newSec = {
324
- id: parent.kupData.section.id + '1',
325
- loaded: parent.kupData.section.loaded,
326
- layout: parent.kupData.section.layout,
327
- components: [],
328
- };
329
- parent.kupData.section.components.forEach((x) => newSec.components.push(x));
330
- parent.kupData.section.components.splice(0);
331
- parent.kupData.section.sections.push(newSec);
332
- }
333
- parent.kupData.section.sections.push(child.kupData.section);
334
- child.kupData.parent = parent.kupData.section;
335
- }
336
- this.resetData(this.internalData);
285
+ parent.kupData.section.sections.push(child.kupData.section);
286
+ child.kupData.parent = parent.kupData.section;
287
+ }
288
+ this.resetData(this.internalData);
289
+ }
290
+ getGridStyle(entity) {
291
+ let bodyStyles = {};
292
+ if (!this.enableDesign && entity.sections) {
293
+ let gridTemplate = '';
294
+ entity.sections.forEach((childSection) => {
295
+ if (!childSection.dim)
296
+ gridTemplate += ' 1fr';
297
+ else
298
+ gridTemplate +=
299
+ childSection.dim.indexOf('%') < 0
300
+ ? ' ' + childSection.dim + 'px'
301
+ : ' ' + childSection.dim;
302
+ });
303
+ if (entity.layout == 'column')
304
+ bodyStyles['gridTemplateRows'] = gridTemplate;
305
+ if (entity.layout == 'row')
306
+ bodyStyles['gridTemplateColumns'] = gridTemplate;
337
307
  }
308
+ return bodyStyles;
338
309
  }
339
310
  resetData(form = null) {
340
311
  if (form)
@@ -349,7 +320,6 @@ export class KupFormEditor {
349
320
  }, 250);
350
321
  }
351
322
  unregisterInteractables() {
352
- this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.component-draggable')));
353
323
  this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-dropzone')));
354
324
  this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.section-draggable')));
355
325
  this.kupManager.interact.unregister(Array.from(this.rootElement.shadowRoot.querySelectorAll('.form-dropzone')));
@@ -377,6 +347,14 @@ export class KupFormEditor {
377
347
  }
378
348
  componentDidRender() {
379
349
  this.kupManager.debug.logRender(this, true);
350
+ const root = this.rootElement.shadowRoot;
351
+ if (root) {
352
+ const fields = root.querySelectorAll('.f-text-field');
353
+ if (fields)
354
+ fields.forEach((f) => {
355
+ FTextFieldMDC(f);
356
+ });
357
+ }
380
358
  this.didRenderInteractables();
381
359
  }
382
360
  render() {
@@ -392,13 +370,13 @@ export class KupFormEditor {
392
370
  this.kupManager.language.unregister(this);
393
371
  this.kupManager.theme.unregister(this);
394
372
  }
395
- static get is() { return "kup-form-editor"; }
373
+ static get is() { return "kup-dashboard"; }
396
374
  static get encapsulation() { return "shadow"; }
397
375
  static get originalStyleUrls() { return {
398
- "$": ["kup-form-editor.scss"]
376
+ "$": ["kup-dashboard.scss"]
399
377
  }; }
400
378
  static get styleUrls() { return {
401
- "$": ["kup-form-editor.css"]
379
+ "$": ["kup-dashboard.css"]
402
380
  }; }
403
381
  static get properties() { return {
404
382
  "customStyle": {
@@ -429,12 +407,12 @@ export class KupFormEditor {
429
407
  "type": "unknown",
430
408
  "mutable": false,
431
409
  "complexType": {
432
- "original": "KupForm",
433
- "resolved": "KupForm",
410
+ "original": "KupDataDashboard",
411
+ "resolved": "KupDataDashboard",
434
412
  "references": {
435
- "KupForm": {
413
+ "KupDataDashboard": {
436
414
  "location": "import",
437
- "path": "./kup-form-editor-declarations"
415
+ "path": "./kup-dashboard-declarations"
438
416
  }
439
417
  }
440
418
  },
@@ -443,11 +421,32 @@ export class KupFormEditor {
443
421
  "docs": {
444
422
  "tags": [{
445
423
  "name": "default",
446
- "text": "false"
424
+ "text": "null"
447
425
  }],
448
426
  "text": "The data of the component."
449
427
  },
450
428
  "defaultValue": "null"
429
+ },
430
+ "enableDesign": {
431
+ "type": "boolean",
432
+ "mutable": false,
433
+ "complexType": {
434
+ "original": "boolean",
435
+ "resolved": "boolean",
436
+ "references": {}
437
+ },
438
+ "required": false,
439
+ "optional": false,
440
+ "docs": {
441
+ "tags": [{
442
+ "name": "default",
443
+ "text": "false"
444
+ }],
445
+ "text": "Enable drag & drop of the section."
446
+ },
447
+ "attribute": "enable-design",
448
+ "reflect": false,
449
+ "defaultValue": "false"
451
450
  }
452
451
  }; }
453
452
  static get states() { return {
@@ -455,7 +454,7 @@ export class KupFormEditor {
455
454
  }; }
456
455
  static get events() { return [{
457
456
  "method": "kupSave",
458
- "name": "kup-formeditor-save",
457
+ "name": "kup-dashboard-save",
459
458
  "bubbles": true,
460
459
  "cancelable": false,
461
460
  "composed": true,
@@ -464,12 +463,12 @@ export class KupFormEditor {
464
463
  "text": ""
465
464
  },
466
465
  "complexType": {
467
- "original": "KupFormEditorEventPayload",
468
- "resolved": "KupFormEditorEventPayload",
466
+ "original": "KupDashboardEventPayload",
467
+ "resolved": "KupDashboardEventPayload",
469
468
  "references": {
470
- "KupFormEditorEventPayload": {
469
+ "KupDashboardEventPayload": {
471
470
  "location": "import",
472
- "path": "./kup-form-editor-declarations"
471
+ "path": "./kup-dashboard-declarations"
473
472
  }
474
473
  }
475
474
  }
@@ -37,15 +37,13 @@
37
37
  }
38
38
 
39
39
  .backdrop {
40
+ background: var(--kup_drawer_backdrop);
41
+ display: none;
42
+ height: 100%;
43
+ left: 0;
40
44
  position: fixed;
41
45
  top: 0;
42
- left: 0;
43
46
  width: 100%;
44
- height: 100%;
45
- background: var(--kup_drawer_backdrop);
46
- opacity: 0;
47
- pointer-events: none;
48
- transition: opacity var(--kup_drawer_transition) ease-in;
49
47
  z-index: var(--kup-drawer-zindex);
50
48
  }
51
49
 
@@ -87,8 +85,7 @@
87
85
  left: 0;
88
86
  }
89
87
  :host([kup-opened]) .backdrop {
90
- opacity: 1;
91
- pointer-events: all;
88
+ display: block;
92
89
  }
93
90
 
94
91
  /*-------------------------------------------------*/
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Props of the kup-form component.
3
+ * Used to export every prop in an object.
4
+ */
5
+ export var KupFormProps;
6
+ (function (KupFormProps) {
7
+ KupFormProps["customStyle"] = "Custom style of the component.";
8
+ KupFormProps["data"] = "Actual data of the form.";
9
+ KupFormProps["layout"] = "How the form will arrange its content.";
10
+ })(KupFormProps || (KupFormProps = {}));
11
+ export var KupFormLabelPlacement;
12
+ (function (KupFormLabelPlacement) {
13
+ KupFormLabelPlacement["BOTTOM"] = "bottom";
14
+ KupFormLabelPlacement["LEFT"] = "left";
15
+ KupFormLabelPlacement["HIDDEN"] = "hidden";
16
+ KupFormLabelPlacement["PLACEHOLDER"] = "placeholder";
17
+ KupFormLabelPlacement["RIGHT"] = "right";
18
+ KupFormLabelPlacement["TOP"] = "top";
19
+ })(KupFormLabelPlacement || (KupFormLabelPlacement = {}));
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @prop --kup-form-background-color: Sets background of the component.
3
+ * @prop --kup-form-color: Sets text color of the component.
4
+ * @prop --kup-form-font-family: Sets font family of the component.
5
+ * @prop --kup-form-font-size: Sets font size of the component.
6
+ */
7
+ :host {
8
+ --kup_form_background_color: var(
9
+ --kup-form-background-color,
10
+ var(--kup-background-color)
11
+ );
12
+ --kup_form_color: var(--kup-form-color, var(--kup-text-color));
13
+ --kup_form_font_family: var(--kup-form-font-family, var(--kup-font-family));
14
+ --kup_form_font_size: var(--kup-form-font-size, var(--kup-font-size));
15
+ display: block;
16
+ font-family: var(--kup_form_font_family);
17
+ font-size: var(--kup_form_font_size);
18
+ }
19
+
20
+ :host([label-placement=left]) .form__label {
21
+ width: 0;
22
+ }
23
+
24
+ :host([label-placement=right]) .form__field {
25
+ min-width: 200px;
26
+ width: 0;
27
+ }
28
+
29
+ .form {
30
+ background: var(--kup_form_background_color);
31
+ color: var(--kup_form_color);
32
+ display: flex;
33
+ flex-grow: 1;
34
+ overflow: auto;
35
+ position: relative;
36
+ }
37
+ .form--column {
38
+ flex-direction: column;
39
+ }
40
+ .form__section {
41
+ display: flex;
42
+ flex: 1 1 1%;
43
+ flex-direction: row;
44
+ flex-wrap: wrap;
45
+ }
46
+ .form__section--column {
47
+ flex-direction: column;
48
+ flex-wrap: unset;
49
+ }
50
+ .form__section--column > .form__section {
51
+ flex: 0 0 auto;
52
+ }
53
+ .form__section--grid {
54
+ display: grid;
55
+ }
56
+ .form__section--titled {
57
+ border: 1px solid var(--kup-border-color);
58
+ padding-top: 5px;
59
+ position: relative;
60
+ margin: 10px;
61
+ }
62
+ .form__section--titled > h3 {
63
+ background: var(--kup-background-color);
64
+ font-size: calc(var(--kup-font-size) * 1.15);
65
+ position: absolute;
66
+ margin: 0px;
67
+ padding: 0 8px;
68
+ top: -11px;
69
+ left: 5px;
70
+ transition: background-color 0.25s ease;
71
+ }
72
+ .form__label {
73
+ -webkit-font-smoothing: antialiased;
74
+ font-size: 0.875em;
75
+ letter-spacing: 0.0178571429em;
76
+ white-space: nowrap;
77
+ }
78
+ .form__field {
79
+ min-height: 16px;
80
+ }
81
+ .form__field img {
82
+ height: auto;
83
+ }
84
+ .form .f-cell.c-right-aligned:not(.c-centered) .f-cell__content {
85
+ justify-content: flex-start;
86
+ }