@nuraly/runtime 0.1.8 → 0.1.10

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 (106) hide show
  1. package/dist/AIChat-DP3ZdLL3.js +220 -0
  2. package/dist/AIChat-km1IYaR-.js +260 -0
  3. package/dist/Badge-BR94MUt5.js +48 -0
  4. package/dist/Badge-DzNZFKtC.js +70 -0
  5. package/dist/{BaseElement-BNBn_IJk.js → BaseElement-pS6m_x6Q.js} +153 -24
  6. package/dist/Button-BHAN7npC.js +92 -0
  7. package/dist/Button-DCqgsxrL.js +80 -0
  8. package/dist/Card-B70c8NFb.js +150 -0
  9. package/dist/Card-DhOCsGKC.js +120 -0
  10. package/dist/Checkbox-BZTcPwew.js +59 -0
  11. package/dist/Checkbox-LYTIBAUV.js +65 -0
  12. package/dist/Code-BWbiciC8.js +123 -0
  13. package/dist/Code-Ds0vFclr.js +109 -0
  14. package/dist/{CodeEditor-Bf4L2rO_.js → CodeEditor-ChuFC0ex.js} +22 -22
  15. package/dist/Col-B_wpWUcU.js +217 -0
  16. package/dist/Col-DYs8_65c.js +193 -0
  17. package/dist/Collapse-4kxbQ74u.js +74 -0
  18. package/dist/Collapse-Dkw6Ner6.js +96 -0
  19. package/dist/Collections-BSF-PqBz.js +122 -0
  20. package/dist/Collections-D5rwMFbv.js +151 -0
  21. package/dist/Container-DMNh5U4Y.js +204 -0
  22. package/dist/DatePicker-BmEOONiA.js +99 -0
  23. package/dist/DatePicker-VuUroOT4.js +80 -0
  24. package/dist/Divider-BfxR3rVl.js +86 -0
  25. package/dist/Divider-etMTYU3d.js +106 -0
  26. package/dist/Document-CHBcJciR.js +74 -0
  27. package/dist/Document-Cj-TmjAf.js +90 -0
  28. package/dist/Dropdown-BRtHvDa3.js +133 -0
  29. package/dist/Dropdown-C47Y11dj.js +112 -0
  30. package/dist/EmbedURL-BwbJRnY1.js +142 -0
  31. package/dist/EmbedURL-Ci5X1vQG.js +114 -0
  32. package/dist/FileUpload-BBgPcRag.js +54 -0
  33. package/dist/FileUpload-BgkhxtNe.js +47 -0
  34. package/dist/Form-BLq6U3In.js +339 -0
  35. package/dist/Form-E6zXqgsm.js +286 -0
  36. package/dist/Icon-CcLuhz6B.js +64 -0
  37. package/dist/Icon-_UiLblGb.js +74 -0
  38. package/dist/Image-B_VERIvH.js +111 -0
  39. package/dist/Image-hI8kIx8U.js +93 -0
  40. package/dist/Link-BVTo43Cc.js +76 -0
  41. package/dist/Link-xSrPxOLt.js +95 -0
  42. package/dist/Menu-CembLIjO.js +83 -0
  43. package/dist/Menu-D9ZjIOMg.js +73 -0
  44. package/dist/MicroApp-DI1kQwJk.js +100 -0
  45. package/dist/MicroApp-DJw57sLE.js +75 -0
  46. package/dist/NumberInput-DftAAKEs.js +84 -0
  47. package/dist/NumberInput-eOAk0-fb.js +95 -0
  48. package/dist/Panel-Bso5fv4i.js +127 -0
  49. package/dist/Panel-CwzW9iuA.js +161 -0
  50. package/dist/Radio-button-Sii5iveh.js +71 -0
  51. package/dist/Radio-button-YXsVqipQ.js +53 -0
  52. package/dist/RefComponent-Bwk_I0mK.js +79 -0
  53. package/dist/RefComponent-ZxafRVhZ.js +96 -0
  54. package/dist/RichText-CgYXXC_a.js +485 -0
  55. package/dist/RichText-DV46U7fI.js +449 -0
  56. package/dist/Row-Bb95f5DI.js +229 -0
  57. package/dist/Row-Dmd_61mR.js +202 -0
  58. package/dist/Select-Cma8JHAj.js +77 -0
  59. package/dist/Select-DqA08VYb.js +87 -0
  60. package/dist/Slider-B2_Qecjz.js +74 -0
  61. package/dist/Slider-DVY0N2YX.js +55 -0
  62. package/dist/Table-0WjrBnz-.js +159 -0
  63. package/dist/Table-dEma50kw.js +184 -0
  64. package/dist/Tabs-BDKEv1jn.js +131 -0
  65. package/dist/Tabs-Cvt3Q8vx.js +116 -0
  66. package/dist/Tag-BcZvQkE_.js +47 -0
  67. package/dist/Tag-DMZ0mu8y.js +61 -0
  68. package/dist/TextInput-KI6r9xET.js +193 -0
  69. package/dist/TextInput-hxK-HhJi.js +148 -0
  70. package/dist/TextLabel-DkV26yaL.js +102 -0
  71. package/dist/Textarea-Bzs3jSUm.js +117 -0
  72. package/dist/Textarea-CwK3SYbz.js +83 -0
  73. package/dist/Video-C4uBWCBb.js +100 -0
  74. package/dist/Video-CL1lgcvB.js +120 -0
  75. package/dist/aitchat-DjX5s7_8.js +23 -0
  76. package/dist/colorpicker-B-KETfWw.js +64 -0
  77. package/dist/colorpicker-DhB0AygJ.js +75 -0
  78. package/dist/constants-Bs_KQRi_.js +4 -0
  79. package/dist/constants-CXdpxgF2.js +4 -0
  80. package/dist/{cssMode-DMsdy1N0.js → cssMode-CV7QbFJv.js} +1 -1
  81. package/dist/{freemarker2-D51H9HYi.js → freemarker2-CqQxSEZa.js} +1 -1
  82. package/dist/{handlebars-CF6gdAX4.js → handlebars-a71LdN7X.js} +1 -1
  83. package/dist/{html-c2n_zkM3.js → html-D8UaB7IC.js} +1 -1
  84. package/dist/{htmlMode-9IJTuZUh.js → htmlMode-CqWQMFWX.js} +1 -1
  85. package/dist/iconbutton-DfnrRmmB.js +69 -0
  86. package/dist/iconbutton-DvIQHV8o.js +53 -0
  87. package/dist/{javascript-DhEEBMxD.js → javascript-D_jGqcRD.js} +1 -1
  88. package/dist/{jsonMode-CB6k-4rp.js → jsonMode-C3-m5xts.js} +1 -1
  89. package/dist/{liquid-CwtPiwnW.js → liquid-DLwYj6Te.js} +1 -1
  90. package/dist/{mdx-LewPRYF8.js → mdx-DhYjhxkW.js} +1 -1
  91. package/dist/micro-app-entry-DiNqE6xi.js +12042 -0
  92. package/dist/micro-app.bundle.js +1 -1
  93. package/dist/micro-app.js +6 -4940
  94. package/dist/{python-h5Z2g-yl.js → python-B-WcGqFq.js} +1 -1
  95. package/dist/{razor-D5ep1Doy.js → razor-JGACy1mz.js} +1 -1
  96. package/dist/runtime.js +4 -2
  97. package/dist/{tsMode-B_6LiBE1.js → tsMode-lzBM1oT2.js} +1 -1
  98. package/dist/{typescript-BBG0jH4p.js → typescript-CuL5pdO2.js} +1 -1
  99. package/dist/{xml-DgLB7rE6.js → xml-D1tacAKD.js} +1 -1
  100. package/dist/{yaml-DiI4HpSv.js → yaml-CjPB1g7v.js} +1 -1
  101. package/package.json +4 -1
  102. package/utils/index.ts +4 -1
  103. package/utils/lazy-component-loader.ts +120 -0
  104. package/utils/register-components.ts +14 -40
  105. package/utils/render-util.ts +84 -0
  106. package/dist/micro-app-entry-C3RDIukG.js +0 -15831
@@ -0,0 +1,114 @@
1
+ import { B as p, n as l, o as h, b as a, i as m, c as d, d as f, t as b } from "./micro-app-entry-DiNqE6xi.js";
2
+ var y = Object.defineProperty, v = Object.getOwnPropertyDescriptor, n = (e, s, o, t) => {
3
+ for (var r = t > 1 ? void 0 : t ? v(s, o) : s, c = e.length - 1, u; c >= 0; c--)
4
+ (u = e[c]) && (r = (t ? u(s, o, r) : u(r)) || r);
5
+ return t && r && y(s, o, r), r;
6
+ };
7
+ let i = class extends p {
8
+ constructor() {
9
+ super(), this.currentUrl = "", this._isUserFocused = !1, this._focusResetTimeout = null, this.iframeRef = l(), this.onFocus = (e) => {
10
+ this._isUserFocused = !0, this.executeEvent("onFocus", e);
11
+ }, this.onBlur = (e) => {
12
+ this._isUserFocused = !1, this.executeEvent("onBlur", e);
13
+ };
14
+ }
15
+ firstUpdated(e) {
16
+ super.firstUpdated(e), this.registerCallback("url", (s) => {
17
+ !this._isUserFocused && this.currentUrl !== s && (this.currentUrl = s ?? "");
18
+ });
19
+ }
20
+ handleIframeLoad(e) {
21
+ this.executeEvent("onLoad", e, {
22
+ url: this.currentUrl || this.inputHandlersValue?.url || ""
23
+ });
24
+ }
25
+ handleIframeError(e) {
26
+ this.executeEvent("onError", e, {
27
+ url: this.currentUrl || this.inputHandlersValue?.url || "",
28
+ error: "Failed to load iframe content"
29
+ });
30
+ }
31
+ resetFocusAfterInactivity() {
32
+ this._focusResetTimeout && clearTimeout(this._focusResetTimeout), this._focusResetTimeout = setTimeout(() => {
33
+ this._isUserFocused = !1;
34
+ }, 3e3);
35
+ }
36
+ disconnectedCallback() {
37
+ super.disconnectedCallback(), this.unsubscribe && this.unsubscribe(), this._focusResetTimeout && clearTimeout(this._focusResetTimeout);
38
+ }
39
+ renderComponent() {
40
+ const e = this.getStyles() || {}, s = this.component?.styleHandlers ? Object.fromEntries(
41
+ Object.entries(this.component?.styleHandlers).filter(([t, r]) => r)
42
+ ) : {}, o = this.currentUrl || this.inputHandlersValue?.url || "";
43
+ return o ? a`
44
+ <div
45
+ ${l(this.inputRef)}
46
+ tabindex="0"
47
+ @focus=${this.onFocus}
48
+ @blur=${this.onBlur}
49
+ @click=${(t) => this.executeEvent("onClick", t)}
50
+ style=${h(this.getStyles())}
51
+ >
52
+ <iframe
53
+ ${l(this.iframeRef)}
54
+ src=${o}
55
+ @load=${(t) => this.handleIframeLoad(t)}
56
+ @error=${(t) => this.handleIframeError(t)}
57
+ ></iframe>
58
+ </div>
59
+ ` : a`
60
+ <div
61
+ ${l(this.inputRef)}
62
+ class="embed-placeholder"
63
+ style=${h({
64
+ ...this.getStyles(),
65
+ width: s?.width || e?.width || "100%",
66
+ height: s?.height || e?.height || "200px"
67
+ })}
68
+ @click=${(t) => this.executeEvent("onClick", t)}
69
+ >
70
+ <nr-icon name="globe"></nr-icon>
71
+ <nr-label>No URL provided</nr-label>
72
+ </div>
73
+ `;
74
+ }
75
+ };
76
+ i.styles = [m`
77
+ iframe {
78
+ width: 100%;
79
+ height: 100%;
80
+ border: none;
81
+ }
82
+ .embed-placeholder {
83
+ display: flex;
84
+ flex-direction: column;
85
+ align-items: center;
86
+ justify-content: center;
87
+ color: #64748b;
88
+ min-height: 200px;
89
+ border-radius: 8px;
90
+ border: 2px dashed #cbd5e1;
91
+ gap: 12px;
92
+ }
93
+ .embed-placeholder nr-icon {
94
+ --nuraly-icon-size: 48px;
95
+ }
96
+ `];
97
+ n([
98
+ d({ type: Object })
99
+ ], i.prototype, "component", 2);
100
+ n([
101
+ d({ type: Object })
102
+ ], i.prototype, "item", 2);
103
+ n([
104
+ f()
105
+ ], i.prototype, "currentUrl", 2);
106
+ n([
107
+ f()
108
+ ], i.prototype, "_isUserFocused", 2);
109
+ i = n([
110
+ b("embed-url-block")
111
+ ], i);
112
+ export {
113
+ i as EmbedUrlBlock
114
+ };
@@ -0,0 +1,54 @@
1
+ import { customElement } from 'lit/decorators.js';
2
+ import { html, css } from 'lit';
3
+ import { ae as BaseElementBlock } from './BaseElement-pS6m_x6Q.js';
4
+ import { ref } from 'lit/directives/ref.js';
5
+ import { styleMap } from 'lit/directives/style-map.js';
6
+
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (decorator(result)) || result;
13
+ return result;
14
+ };
15
+ try {
16
+ await import('@nuralyui/file-upload');
17
+ } catch (error) {
18
+ console.warn("[@nuralyui/file-upload] Package not found or failed to load.");
19
+ }
20
+ let FileUploadBlock = class extends BaseElementBlock {
21
+ renderComponent() {
22
+ return html`
23
+ <nr-file-upload
24
+ style=${styleMap({
25
+ ...this.getStyles()
26
+ })}
27
+
28
+ ${ref(this.inputRef)}
29
+ accept="*/*"
30
+ drag
31
+ limit="5"
32
+ tip="JPG/PNG files up to 500kb"
33
+ @files-changed=${(e) => {
34
+ const files = e.detail;
35
+ this.executeEvent("onFilesChanged", e, {
36
+ files
37
+ });
38
+ }}
39
+ ></nr-file-upload>
40
+ `;
41
+ }
42
+ };
43
+ FileUploadBlock.styles = [
44
+ css`
45
+ :host {
46
+ display: block;
47
+ }
48
+ `
49
+ ];
50
+ FileUploadBlock = __decorateClass([
51
+ customElement("file-upload-block")
52
+ ], FileUploadBlock);
53
+
54
+ export { FileUploadBlock };
@@ -0,0 +1,47 @@
1
+ import { B as n, o as p, n as c, b as d, i as f, t as u } from "./micro-app-entry-DiNqE6xi.js";
2
+ var h = Object.getOwnPropertyDescriptor, g = (e, t, s, a) => {
3
+ for (var l = a > 1 ? void 0 : a ? h(t, s) : t, o = e.length - 1, i; o >= 0; o--)
4
+ (i = e[o]) && (l = i(l) || l);
5
+ return l;
6
+ };
7
+ try {
8
+ await import("@nuralyui/file-upload");
9
+ } catch {
10
+ console.warn("[@nuralyui/file-upload] Package not found or failed to load.");
11
+ }
12
+ let r = class extends n {
13
+ renderComponent() {
14
+ return d`
15
+ <nr-file-upload
16
+ style=${p({
17
+ ...this.getStyles()
18
+ })}
19
+
20
+ ${c(this.inputRef)}
21
+ accept="*/*"
22
+ drag
23
+ limit="5"
24
+ tip="JPG/PNG files up to 500kb"
25
+ @files-changed=${(e) => {
26
+ const t = e.detail;
27
+ this.executeEvent("onFilesChanged", e, {
28
+ files: t
29
+ });
30
+ }}
31
+ ></nr-file-upload>
32
+ `;
33
+ }
34
+ };
35
+ r.styles = [
36
+ f`
37
+ :host {
38
+ display: block;
39
+ }
40
+ `
41
+ ];
42
+ r = g([
43
+ u("file-upload-block")
44
+ ], r);
45
+ export {
46
+ r as FileUploadBlock
47
+ };
@@ -0,0 +1,339 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { property, state, customElement } from 'lit/decorators.js';
3
+ import { ae as BaseElementBlock, $ as $components, ak as setCurrentComponentIdAction, aM as renderComponent } from './BaseElement-pS6m_x6Q.js';
4
+ import { ref } from 'lit/directives/ref.js';
5
+ import '@nuralyui/icon';
6
+ import '@nuralyui/label';
7
+
8
+ const formStyles = css`
9
+ :host {
10
+ display: block;
11
+ width: 100%;
12
+ }
13
+
14
+ .form-placeholder {
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ justify-content: center;
19
+ color: #64748b;
20
+ min-height: 200px;
21
+ width: 100%;
22
+ border-radius: 8px;
23
+ border: 2px dashed #cbd5e1;
24
+ gap: 12px;
25
+ cursor: pointer;
26
+ }
27
+
28
+ .form-placeholder nr-icon {
29
+ --nuraly-icon-size: 48px;
30
+ }
31
+ `;
32
+
33
+ var __defProp = Object.defineProperty;
34
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
35
+ var __decorateClass = (decorators, target, key, kind) => {
36
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
37
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
38
+ if (decorator = decorators[i])
39
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
40
+ if (kind && result) __defProp(target, key, result);
41
+ return result;
42
+ };
43
+ try {
44
+ await import('@nuralyui/forms');
45
+ } catch (error) {
46
+ console.warn("[@nuralyui/forms] Package not found or failed to load.");
47
+ }
48
+ let FormBlock = class extends BaseElementBlock {
49
+ constructor() {
50
+ super();
51
+ this._formElement = null;
52
+ this._registeredFields = /* @__PURE__ */ new Map();
53
+ this.childrenComponents = [];
54
+ this._fieldRegisterHandler = this._handleFieldRegister.bind(this);
55
+ this._fieldUnregisterHandler = this._handleFieldUnregister.bind(this);
56
+ this._fieldValueChangeHandler = this._handleFieldValueChange.bind(this);
57
+ }
58
+ connectedCallback() {
59
+ super.connectedCallback();
60
+ this.updateChildrenComponents();
61
+ this.addEventListener("nr-field-register", this._fieldRegisterHandler);
62
+ this.addEventListener("nr-field-unregister", this._fieldUnregisterHandler);
63
+ this.addEventListener("nr-field-value-change", this._fieldValueChangeHandler);
64
+ }
65
+ willUpdate(changedProperties) {
66
+ super.willUpdate(changedProperties);
67
+ if (changedProperties.has("component")) {
68
+ this.updateChildrenComponents();
69
+ }
70
+ }
71
+ updateChildrenComponents() {
72
+ this.childrenComponents = this.component?.childrenIds?.map((id) => {
73
+ return $components.get()[this.component?.application_id]?.find((component) => component.uuid === id);
74
+ }).filter(Boolean) ?? [];
75
+ }
76
+ disconnectedCallback() {
77
+ super.disconnectedCallback();
78
+ this.removeEventListener("nr-field-register", this._fieldRegisterHandler);
79
+ this.removeEventListener("nr-field-unregister", this._fieldUnregisterHandler);
80
+ this.removeEventListener("nr-field-value-change", this._fieldValueChangeHandler);
81
+ this._registeredFields.clear();
82
+ }
83
+ firstUpdated(_changedProperties) {
84
+ super.firstUpdated(_changedProperties);
85
+ this._formElement = this.renderRoot.querySelector("nr-form");
86
+ this.registerCallback("disabled", (value) => {
87
+ if (this._formElement) {
88
+ this._formElement.disabled = value;
89
+ }
90
+ });
91
+ }
92
+ /**
93
+ * Handle field registration from child input blocks
94
+ */
95
+ _handleFieldRegister(event) {
96
+ event.stopPropagation();
97
+ const { element, name, blockElement } = event.detail;
98
+ if (!name || !element) {
99
+ console.warn("[FormBlock] Field registration missing name or element");
100
+ return;
101
+ }
102
+ this._registeredFields.set(name, { element, blockElement });
103
+ if (this._formElement?.validationController) {
104
+ try {
105
+ this._formElement.validationController.registerField(element);
106
+ } catch (error) {
107
+ console.warn("[FormBlock] Failed to register field with validation controller:", error);
108
+ }
109
+ }
110
+ }
111
+ /**
112
+ * Handle field unregistration when child input blocks are removed
113
+ */
114
+ _handleFieldUnregister(event) {
115
+ event.stopPropagation();
116
+ const { name } = event.detail;
117
+ if (name && this._registeredFields.has(name)) {
118
+ if (this._formElement?.validationController) {
119
+ try {
120
+ this._formElement.validationController.unregisterField(name);
121
+ } catch (error) {
122
+ console.warn("[FormBlock] Failed to unregister field:", error);
123
+ }
124
+ }
125
+ this._registeredFields.delete(name);
126
+ }
127
+ }
128
+ /**
129
+ * Handle field value changes for form data collection
130
+ */
131
+ _handleFieldValueChange(event) {
132
+ const { name, value } = event.detail;
133
+ if (name && this._registeredFields.has(name)) {
134
+ const fieldInfo = this._registeredFields.get(name);
135
+ fieldInfo.value = value;
136
+ }
137
+ }
138
+ /**
139
+ * Get all form field values
140
+ */
141
+ getFieldsValue() {
142
+ if (this._formElement?.getFieldsValue) {
143
+ return this._formElement.getFieldsValue();
144
+ }
145
+ const values = {};
146
+ for (const [name, fieldInfo] of this._registeredFields) {
147
+ values[name] = fieldInfo.element?.value ?? fieldInfo.value;
148
+ }
149
+ return values;
150
+ }
151
+ /**
152
+ * Set form field values
153
+ */
154
+ setFieldsValue(values) {
155
+ if (this._formElement?.setFieldsValue) {
156
+ this._formElement.setFieldsValue(values);
157
+ }
158
+ }
159
+ /**
160
+ * Validate all form fields
161
+ */
162
+ async validate() {
163
+ if (this._formElement?.validate) {
164
+ return this._formElement.validate();
165
+ }
166
+ return true;
167
+ }
168
+ /**
169
+ * Submit the form programmatically
170
+ */
171
+ async submit(customData) {
172
+ if (this._formElement?.submit) {
173
+ await this._formElement.submit(customData);
174
+ }
175
+ }
176
+ /**
177
+ * Reset the form
178
+ */
179
+ reset() {
180
+ if (this._formElement?.reset) {
181
+ this._formElement.reset();
182
+ }
183
+ }
184
+ /**
185
+ * Get form state summary
186
+ */
187
+ getFormState() {
188
+ if (this._formElement?.getFormState) {
189
+ return this._formElement.getFormState();
190
+ }
191
+ return {
192
+ isValid: true,
193
+ isSubmitting: false,
194
+ hasErrors: false,
195
+ errorCount: 0,
196
+ fieldCount: this._registeredFields.size
197
+ };
198
+ }
199
+ /**
200
+ * Render placeholder when form is empty in editor mode
201
+ */
202
+ renderPlaceholder() {
203
+ return html`
204
+ <div
205
+ class="form-placeholder"
206
+ @click="${() => setCurrentComponentIdAction(this.component?.uuid)}"
207
+ >
208
+ <nr-icon name="file-text"></nr-icon>
209
+ <nr-label>Add form fields to this form</nr-label>
210
+ <drag-wrapper
211
+ .where=${"inside"}
212
+ .message=${"Drop inside"}
213
+ .component=${{ ...this.component }}
214
+ .inputRef=${this.inputRef}
215
+ .isDragInitiator=${this.isDragInitiator}
216
+ >
217
+ </drag-wrapper>
218
+ </div>
219
+ `;
220
+ }
221
+ /**
222
+ * Render children components
223
+ */
224
+ renderChildren() {
225
+ return renderComponent(
226
+ this.childrenComponents.map((component) => ({ ...component, item: this.item })),
227
+ this.item,
228
+ this.isViewMode,
229
+ { ...this.component, uniqueUUID: this.uniqueUUID }
230
+ );
231
+ }
232
+ renderComponent() {
233
+ const inputStyles = this.getStyles();
234
+ const hasChildren = this.childrenComponents.length > 0;
235
+ if (this.isViewMode) {
236
+ return html`
237
+ <nr-form
238
+ ${ref(this.inputRef)}
239
+ class="${`drop-${this.component.uuid}`}"
240
+ style=${Object.entries(inputStyles).map(([k, v]) => `${k}:${v}`).join(";")}
241
+ .disabled=${this.inputHandlersValue?.disabled || false}
242
+ .validateOnChange=${this.inputHandlersValue?.validateOnChange ?? false}
243
+ .validateOnBlur=${this.inputHandlersValue?.validateOnBlur ?? true}
244
+ .preventInvalidSubmission=${this.inputHandlersValue?.preventInvalidSubmission ?? true}
245
+ .resetOnSuccess=${this.inputHandlersValue?.resetOnSuccess ?? false}
246
+ .action=${this.inputHandlersValue?.action ?? nothing}
247
+ .method=${this.inputHandlersValue?.method ?? "POST"}
248
+ @nr-form-submit-success=${(e) => {
249
+ this.executeEvent("onSubmitSuccess", e, {
250
+ formData: e.detail?.formData,
251
+ values: this.getFieldsValue()
252
+ });
253
+ }}
254
+ @nr-form-submit-error=${(e) => {
255
+ this.executeEvent("onSubmitError", e, {
256
+ error: e.detail?.error
257
+ });
258
+ }}
259
+ @nr-form-validation-changed=${(e) => {
260
+ this.executeEvent("onValidationChange", e, {
261
+ validationResult: e.detail?.validationResult
262
+ });
263
+ }}
264
+ @nr-form-field-changed=${(e) => {
265
+ this.executeEvent("onFieldChange", e, {
266
+ field: e.detail?.field
267
+ });
268
+ }}
269
+ @nr-form-reset=${(e) => {
270
+ this.executeEvent("onReset", e, {});
271
+ }}
272
+ >
273
+ ${hasChildren ? this.renderChildren() : nothing}
274
+ </nr-form>
275
+ `;
276
+ }
277
+ return html`
278
+ <nr-form
279
+ ${ref(this.inputRef)}
280
+ class="${`drop-${this.component.uuid}`}"
281
+ style=${Object.entries(inputStyles).map(([k, v]) => `${k}:${v}`).join(";")}
282
+ .disabled=${this.inputHandlersValue?.disabled || false}
283
+ .validateOnChange=${this.inputHandlersValue?.validateOnChange ?? false}
284
+ .validateOnBlur=${this.inputHandlersValue?.validateOnBlur ?? true}
285
+ .preventInvalidSubmission=${this.inputHandlersValue?.preventInvalidSubmission ?? true}
286
+ .resetOnSuccess=${this.inputHandlersValue?.resetOnSuccess ?? false}
287
+ .action=${this.inputHandlersValue?.action ?? nothing}
288
+ .method=${this.inputHandlersValue?.method ?? "POST"}
289
+ @nr-form-submit-success=${(e) => {
290
+ this.executeEvent("onSubmitSuccess", e, {
291
+ formData: e.detail?.formData,
292
+ values: this.getFieldsValue()
293
+ });
294
+ }}
295
+ @nr-form-submit-error=${(e) => {
296
+ this.executeEvent("onSubmitError", e, {
297
+ error: e.detail?.error
298
+ });
299
+ }}
300
+ @nr-form-validation-changed=${(e) => {
301
+ this.executeEvent("onValidationChange", e, {
302
+ validationResult: e.detail?.validationResult
303
+ });
304
+ }}
305
+ @nr-form-field-changed=${(e) => {
306
+ this.executeEvent("onFieldChange", e, {
307
+ field: e.detail?.field
308
+ });
309
+ }}
310
+ @nr-form-reset=${(e) => {
311
+ this.executeEvent("onReset", e, {});
312
+ }}
313
+ >
314
+ ${hasChildren ? this.renderChildren() : this.renderPlaceholder()}
315
+ </nr-form>
316
+ `;
317
+ }
318
+ };
319
+ FormBlock.styles = [formStyles];
320
+ __decorateClass([
321
+ property({ type: Object })
322
+ ], FormBlock.prototype, "component", 2);
323
+ __decorateClass([
324
+ property({ type: Object })
325
+ ], FormBlock.prototype, "item", 2);
326
+ __decorateClass([
327
+ state()
328
+ ], FormBlock.prototype, "_formElement", 2);
329
+ __decorateClass([
330
+ state()
331
+ ], FormBlock.prototype, "_registeredFields", 2);
332
+ __decorateClass([
333
+ state()
334
+ ], FormBlock.prototype, "childrenComponents", 2);
335
+ FormBlock = __decorateClass([
336
+ customElement("form-block")
337
+ ], FormBlock);
338
+
339
+ export { FormBlock };