@nuraly/runtime 0.1.9 → 0.1.11
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.
- package/components/ui/components/base/controllers/InputHandlerController.ts +5 -0
- package/components/ui/components/inputs/ColorPicker/colorpicker.ts +1 -7
- package/components/ui/components/inputs/Form/Form.ts +3 -11
- package/components/ui/components/inputs/RadioButton/Radio-button.ts +1 -7
- package/components/ui/components/inputs/Select/Select.ts +1 -7
- package/components/ui/components/layout/Grid/Col.ts +2 -6
- package/components/ui/components/layout/Grid/Row.ts +2 -6
- package/components/ui/components/studio/FunctionsPanel/FunctionsPanel.ts +4 -16
- package/dist/AIChat-C-wFf4PD.js +220 -0
- package/dist/AIChat-Cly-frW6.js +260 -0
- package/dist/Badge-BUm76SZ2.js +70 -0
- package/dist/Badge-BarGcY8u.js +48 -0
- package/dist/{BaseElement-BNBn_IJk.js → BaseElement-wyA58UxT.js} +156 -24
- package/dist/Button-BEgayuX9.js +80 -0
- package/dist/Button-wgwjzM_f.js +92 -0
- package/dist/Card-B4r5RQgn.js +120 -0
- package/dist/Card-a1sdDpKe.js +150 -0
- package/dist/Checkbox-CC9PkwpC.js +59 -0
- package/dist/Checkbox-WVmAN9ZP.js +65 -0
- package/dist/Code-Dc66ui4C.js +109 -0
- package/dist/Code-kVoVXBbt.js +123 -0
- package/dist/{CodeEditor-B1gNuvPb.js → CodeEditor-2QHTZxKN.js} +22 -22
- package/dist/Col-BKbQ2o0P.js +217 -0
- package/dist/Col-x4rRO4dz.js +193 -0
- package/dist/Collapse-Dd2GfevD.js +74 -0
- package/dist/Collapse-Xo-jb8zs.js +96 -0
- package/dist/Collections-DEqUHWFe.js +151 -0
- package/dist/Collections-DsTr-Zt7.js +122 -0
- package/dist/Container-C1HjQgb7.js +204 -0
- package/dist/DatePicker-DRVwFJmL.js +99 -0
- package/dist/DatePicker-oAOJyU3e.js +80 -0
- package/dist/Divider-BMA6S7Pd.js +106 -0
- package/dist/Divider-zbcO-KF9.js +86 -0
- package/dist/Document-BqVezrmJ.js +90 -0
- package/dist/Document-C2lg-jdj.js +74 -0
- package/dist/Dropdown-BRN-hpgd.js +133 -0
- package/dist/Dropdown-j62nqdd-.js +112 -0
- package/dist/EmbedURL-Bgr2pdf_.js +114 -0
- package/dist/EmbedURL-DFt6rN3J.js +142 -0
- package/dist/FileUpload-B5TBQJPC.js +54 -0
- package/dist/FileUpload-sYxMn9Rj.js +47 -0
- package/dist/Form-7ZWgBVzR.js +286 -0
- package/dist/Form-CsN7UMF-.js +339 -0
- package/dist/Icon-B_2ZWGd0.js +64 -0
- package/dist/Icon-CkLIObME.js +74 -0
- package/dist/Image-CcswllGj.js +93 -0
- package/dist/Image-CihbGdKt.js +111 -0
- package/dist/Link-BEUscah_.js +95 -0
- package/dist/Link-C4HV3i5L.js +76 -0
- package/dist/Menu-B98hcumz.js +83 -0
- package/dist/Menu-BEzo-k-M.js +73 -0
- package/dist/MicroApp-BDPSu_XC.js +75 -0
- package/dist/MicroApp-DCBOKAJ4.js +100 -0
- package/dist/NumberInput-Bbo10XmQ.js +95 -0
- package/dist/NumberInput-YJKsJDcd.js +84 -0
- package/dist/Panel-C1tcqveD.js +161 -0
- package/dist/Panel-DidE5uT5.js +127 -0
- package/dist/Radio-button-CuVS3-fC.js +71 -0
- package/dist/Radio-button-Cxj0bL8i.js +53 -0
- package/dist/RefComponent-BgOcavVg.js +79 -0
- package/dist/RefComponent-DTerPZ8J.js +96 -0
- package/dist/RichText-BiZgSdNO.js +449 -0
- package/dist/RichText-CwMNVuR_.js +485 -0
- package/dist/Row-BEx5bGTR.js +202 -0
- package/dist/Row-XczXHjOV.js +229 -0
- package/dist/Select-Bd16OOiE.js +87 -0
- package/dist/Select-D0xinu-U.js +77 -0
- package/dist/Slider-BVFPWYh3.js +55 -0
- package/dist/Slider-DGulvswN.js +74 -0
- package/dist/Table-C44wa8yn.js +159 -0
- package/dist/Table-CQiS_Q-s.js +184 -0
- package/dist/Tabs-CPQxFISc.js +131 -0
- package/dist/Tabs-DW2Su8xF.js +116 -0
- package/dist/Tag-BEfAQrjG.js +61 -0
- package/dist/Tag-BLxTFDcC.js +47 -0
- package/dist/TextInput-BWhdGS3a.js +148 -0
- package/dist/TextInput-CV850FvO.js +193 -0
- package/dist/TextLabel-CbSGmoVY.js +102 -0
- package/dist/Textarea-Bncyxfts.js +83 -0
- package/dist/Textarea-SEbx4KI5.js +117 -0
- package/dist/Video--shJ014h.js +120 -0
- package/dist/Video-CflXfaiK.js +100 -0
- package/dist/aitchat-Btz9TPEN.js +23 -0
- package/dist/colorpicker-BO_4CeX4.js +64 -0
- package/dist/colorpicker-UzXsx6gP.js +75 -0
- package/dist/constants-Bs_KQRi_.js +4 -0
- package/dist/constants-CXdpxgF2.js +4 -0
- package/dist/{cssMode-D82-gS78.js → cssMode-tpaxIZJS.js} +1 -1
- package/dist/{freemarker2-CYRLpyjt.js → freemarker2-Nx-tkO9y.js} +1 -1
- package/dist/{handlebars-R8Efxi60.js → handlebars-CF3Jmmto.js} +1 -1
- package/dist/{html-czhjovcp.js → html-CdZEJTJR.js} +1 -1
- package/dist/{htmlMode-DpyKDYYs.js → htmlMode-CztruwTl.js} +1 -1
- package/dist/iconbutton-BwuZYQyh.js +53 -0
- package/dist/iconbutton-CE0Vxu1G.js +69 -0
- package/dist/{javascript-DwqkMEdb.js → javascript-CVODTc2t.js} +1 -1
- package/dist/{jsonMode-Cmxxe0W9.js → jsonMode-ChPl6moP.js} +1 -1
- package/dist/{liquid-2spuEcBh.js → liquid-BckHw388.js} +1 -1
- package/dist/{mdx-BjBXyEeR.js → mdx-DB1fiwuN.js} +1 -1
- package/dist/micro-app-entry-BgDXbkmh.js +12042 -0
- package/dist/micro-app.bundle.js +1 -1
- package/dist/micro-app.js +6 -4969
- package/dist/{python-DLI1ji08.js → python-DOQt67t7.js} +1 -1
- package/dist/{razor-oAnIJsrL.js → razor-D65ZeXuP.js} +1 -1
- package/dist/runtime.js +4 -2
- package/dist/{tsMode-D_PMsbjK.js → tsMode-CXrSAnjJ.js} +1 -1
- package/dist/{typescript-Bu3ZbtQI.js → typescript-BuKvlC_a.js} +1 -1
- package/dist/{xml-CNSSkPqy.js → xml-_nj2r-yt.js} +1 -1
- package/dist/{yaml-5RF_PGNe.js → yaml-m8PrW_TL.js} +1 -1
- package/package.json +1 -1
- package/utils/index.ts +4 -1
- package/utils/lazy-component-loader.ts +120 -0
- package/utils/register-components.ts +14 -40
- package/utils/render-util.ts +84 -0
- package/dist/micro-app-entry-DYAnCRDo.js +0 -15860
|
@@ -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-wyA58UxT.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 };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { B as u, n as h, A as l, o as d, b as y, c as p, t as b } from "./micro-app-entry-BgDXbkmh.js";
|
|
2
|
+
var $ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, r = (t, e, c, n) => {
|
|
3
|
+
for (var i = n > 1 ? void 0 : n ? v(e, c) : e, a = t.length - 1, s; a >= 0; a--)
|
|
4
|
+
(s = t[a]) && (i = (n ? s(e, c, i) : s(i)) || i);
|
|
5
|
+
return n && i && $(e, c, i), i;
|
|
6
|
+
};
|
|
7
|
+
try {
|
|
8
|
+
await import("@nuralyui/icon");
|
|
9
|
+
} catch {
|
|
10
|
+
console.warn("[@nuralyui/icon] Package not found or failed to load.");
|
|
11
|
+
}
|
|
12
|
+
let o = class extends u {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(), this.registerCallback("icon", () => {
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
super.connectedCallback();
|
|
19
|
+
}
|
|
20
|
+
renderComponent() {
|
|
21
|
+
const t = this.getStyles();
|
|
22
|
+
return y`
|
|
23
|
+
<nr-icon
|
|
24
|
+
${h(this.inputRef)}
|
|
25
|
+
.name=${this.inputHandlersValue.icon ?? "smile"}
|
|
26
|
+
.type=${this.inputHandlersValue.type || "solid"}
|
|
27
|
+
.alt=${this.inputHandlersValue.alt || ""}
|
|
28
|
+
.size=${this.inputHandlersValue.size || l}
|
|
29
|
+
.color=${this.inputHandlersValue.color || l}
|
|
30
|
+
.width=${t?.width || l}
|
|
31
|
+
.height=${t?.height || l}
|
|
32
|
+
.clickable=${this.inputHandlersValue.clickable || !1}
|
|
33
|
+
.disabled=${this.inputHandlersValue.state === "disabled"}
|
|
34
|
+
@click=${(e) => {
|
|
35
|
+
this.executeEvent("onClick", e);
|
|
36
|
+
}}
|
|
37
|
+
@icon-click=${(e) => {
|
|
38
|
+
this.executeEvent("onIconClick", e);
|
|
39
|
+
}}
|
|
40
|
+
@icon-keyboard-activation=${(e) => {
|
|
41
|
+
this.executeEvent("onIconKeyboardActivation", e);
|
|
42
|
+
}}
|
|
43
|
+
style=${d({
|
|
44
|
+
display: "block",
|
|
45
|
+
...this.getStyles(),
|
|
46
|
+
"--nuraly-icon-width": t?.width,
|
|
47
|
+
"--nuraly-icon-height": t?.height
|
|
48
|
+
})}>
|
|
49
|
+
</nr-icon>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
r([
|
|
54
|
+
p({ type: Object })
|
|
55
|
+
], o.prototype, "component", 2);
|
|
56
|
+
r([
|
|
57
|
+
p({ type: Object })
|
|
58
|
+
], o.prototype, "item", 2);
|
|
59
|
+
o = r([
|
|
60
|
+
b("icon-block")
|
|
61
|
+
], o);
|
|
62
|
+
export {
|
|
63
|
+
o as IconBlock
|
|
64
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { nothing, html } from 'lit';
|
|
2
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
3
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
|
+
import { ae as BaseElementBlock } from './BaseElement-wyA58UxT.js';
|
|
5
|
+
import { ref } from 'lit/directives/ref.js';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
try {
|
|
18
|
+
await import('@nuralyui/icon');
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.warn("[@nuralyui/icon] Package not found or failed to load.");
|
|
21
|
+
}
|
|
22
|
+
let IconBlock = class extends BaseElementBlock {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.registerCallback("icon", () => {
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
}
|
|
31
|
+
renderComponent() {
|
|
32
|
+
const iconStyles = this.getStyles();
|
|
33
|
+
return html`
|
|
34
|
+
<nr-icon
|
|
35
|
+
${ref(this.inputRef)}
|
|
36
|
+
.name=${this.inputHandlersValue.icon ?? "smile"}
|
|
37
|
+
.type=${this.inputHandlersValue.type || "solid"}
|
|
38
|
+
.alt=${this.inputHandlersValue.alt || ""}
|
|
39
|
+
.size=${this.inputHandlersValue.size || nothing}
|
|
40
|
+
.color=${this.inputHandlersValue.color || nothing}
|
|
41
|
+
.width=${iconStyles?.width || nothing}
|
|
42
|
+
.height=${iconStyles?.height || nothing}
|
|
43
|
+
.clickable=${this.inputHandlersValue.clickable || false}
|
|
44
|
+
.disabled=${this.inputHandlersValue.state === "disabled"}
|
|
45
|
+
@click=${(e) => {
|
|
46
|
+
this.executeEvent("onClick", e);
|
|
47
|
+
}}
|
|
48
|
+
@icon-click=${(e) => {
|
|
49
|
+
this.executeEvent("onIconClick", e);
|
|
50
|
+
}}
|
|
51
|
+
@icon-keyboard-activation=${(e) => {
|
|
52
|
+
this.executeEvent("onIconKeyboardActivation", e);
|
|
53
|
+
}}
|
|
54
|
+
style=${styleMap({
|
|
55
|
+
display: "block",
|
|
56
|
+
...this.getStyles(),
|
|
57
|
+
"--nuraly-icon-width": iconStyles?.width,
|
|
58
|
+
"--nuraly-icon-height": iconStyles?.height
|
|
59
|
+
})}>
|
|
60
|
+
</nr-icon>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
__decorateClass([
|
|
65
|
+
property({ type: Object })
|
|
66
|
+
], IconBlock.prototype, "component", 2);
|
|
67
|
+
__decorateClass([
|
|
68
|
+
property({ type: Object })
|
|
69
|
+
], IconBlock.prototype, "item", 2);
|
|
70
|
+
IconBlock = __decorateClass([
|
|
71
|
+
customElement("icon-block")
|
|
72
|
+
], IconBlock);
|
|
73
|
+
|
|
74
|
+
export { IconBlock };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { B as u, n, o as c, b as d, A as h, i as m, c as g, t as b } from "./micro-app-entry-BgDXbkmh.js";
|
|
2
|
+
var f = Object.defineProperty, y = Object.getOwnPropertyDescriptor, p = (t, r, i, a) => {
|
|
3
|
+
for (var e = a > 1 ? void 0 : a ? y(r, i) : r, l = t.length - 1, s; l >= 0; l--)
|
|
4
|
+
(s = t[l]) && (e = (a ? s(r, i, e) : s(e)) || e);
|
|
5
|
+
return a && e && f(r, i, e), e;
|
|
6
|
+
};
|
|
7
|
+
try {
|
|
8
|
+
await import("@nuralyui/image");
|
|
9
|
+
} catch {
|
|
10
|
+
console.warn("[@nuralyui/image] Package not found or failed to load.");
|
|
11
|
+
}
|
|
12
|
+
let o = class extends u {
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
super.connectedCallback(), this.isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches, window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (t) => {
|
|
15
|
+
this.isDarkMode = t.matches, this.requestUpdate();
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
renderComponent() {
|
|
19
|
+
const t = this.getStyles(), r = this.getStyles() || {}, i = this.component?.styleHandlers ? Object.fromEntries(
|
|
20
|
+
Object.entries(this.component?.styleHandlers).filter(([e, l]) => l)
|
|
21
|
+
) : {}, a = this.isDarkMode ? this.inputHandlersValue?.darkSrc ?? this.inputHandlersValue?.src : this.inputHandlersValue?.src;
|
|
22
|
+
return a ? d`
|
|
23
|
+
<nr-image
|
|
24
|
+
${n(this.inputRef)}
|
|
25
|
+
style=${c({
|
|
26
|
+
...this.getStyles(),
|
|
27
|
+
display: "block",
|
|
28
|
+
"--nuraly-image-local-border-top-left-radius": t?.["border-top-left-radius"] ?? "",
|
|
29
|
+
"--nuraly-image-local-border-top-right-radius": t?.["border-top-right-radius"] ?? "",
|
|
30
|
+
"--nuraly-image-local-border-bottom-left-radius": t?.["border-bottom-left-radius"] ?? "",
|
|
31
|
+
"--nuraly-image-local-border-bottom-right-radius": t?.["border-bottom-right-radius"] ?? ""
|
|
32
|
+
})}
|
|
33
|
+
.src=${a}
|
|
34
|
+
.fallback=${this.inputHandlersValue?.fallback ?? h}
|
|
35
|
+
.previewable=${this.inputHandlersValue?.previewable ?? !1}
|
|
36
|
+
.fit=${this.inputHandlersValue?.fit ?? h}
|
|
37
|
+
.block=${this.inputHandlersValue?.block ?? !1}
|
|
38
|
+
.width=${i?.width || r?.width}
|
|
39
|
+
.height=${i?.height || r?.height}
|
|
40
|
+
.alt=${this.inputHandlersValue?.alt ?? "image"}
|
|
41
|
+
@click=${(e) => this.executeEvent("onClick", e)}
|
|
42
|
+
@nr-image-error=${(e) => this.executeEvent("onError", e)}
|
|
43
|
+
@nr-image-load=${(e) => this.executeEvent("onLoad", e)}
|
|
44
|
+
@nr-image-preview-open=${(e) => this.executeEvent("onPreviewOpen", e)}
|
|
45
|
+
@nr-image-preview-close=${(e) => this.executeEvent("onPreviewClose", e)}
|
|
46
|
+
>
|
|
47
|
+
</nr-image>
|
|
48
|
+
` : d`
|
|
49
|
+
<div
|
|
50
|
+
${n(this.inputRef)}
|
|
51
|
+
class="image-placeholder"
|
|
52
|
+
style=${c({
|
|
53
|
+
width: i?.width || r?.width || "100%",
|
|
54
|
+
height: i?.height || r?.height || "200px"
|
|
55
|
+
})}
|
|
56
|
+
@click=${(e) => this.executeEvent("onClick", e)}
|
|
57
|
+
>
|
|
58
|
+
<nr-icon name="image"></nr-icon>
|
|
59
|
+
<nr-label>No image source</nr-label>
|
|
60
|
+
</div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
o.styles = [m`
|
|
65
|
+
:host {
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
.image-placeholder {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
color: #64748b;
|
|
74
|
+
min-height: 200px;
|
|
75
|
+
min-width: 200px;
|
|
76
|
+
border-radius: 8px;
|
|
77
|
+
border: 2px dashed #cbd5e1;
|
|
78
|
+
gap: 12px;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
}
|
|
81
|
+
.image-placeholder nr-icon {
|
|
82
|
+
--nuraly-icon-size: 48px;
|
|
83
|
+
}
|
|
84
|
+
`];
|
|
85
|
+
p([
|
|
86
|
+
g({ type: Object })
|
|
87
|
+
], o.prototype, "component", 2);
|
|
88
|
+
o = p([
|
|
89
|
+
b("image-block")
|
|
90
|
+
], o);
|
|
91
|
+
export {
|
|
92
|
+
o as ImageBlock
|
|
93
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { html, nothing, css } from 'lit';
|
|
2
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
3
|
+
import { ae as BaseElementBlock } from './BaseElement-wyA58UxT.js';
|
|
4
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
5
|
+
import { ref } from 'lit/directives/ref.js';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
try {
|
|
18
|
+
await import('@nuralyui/image');
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.warn("[@nuralyui/image] Package not found or failed to load.");
|
|
21
|
+
}
|
|
22
|
+
let ImageBlock = class extends BaseElementBlock {
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
super.connectedCallback();
|
|
25
|
+
this.isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
26
|
+
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (event) => {
|
|
27
|
+
this.isDarkMode = event.matches;
|
|
28
|
+
this.requestUpdate();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
renderComponent() {
|
|
32
|
+
const fallbackStyles = this.getStyles();
|
|
33
|
+
const imageStyles = this.getStyles() || {};
|
|
34
|
+
const imageStyleHandlers = this.component?.styleHandlers ? Object.fromEntries(
|
|
35
|
+
Object.entries(this.component?.styleHandlers).filter(([key, value]) => value)
|
|
36
|
+
) : {};
|
|
37
|
+
const imageSrc = this.isDarkMode ? this.inputHandlersValue?.darkSrc ?? this.inputHandlersValue?.src : this.inputHandlersValue?.src;
|
|
38
|
+
if (!imageSrc) {
|
|
39
|
+
return html`
|
|
40
|
+
<div
|
|
41
|
+
${ref(this.inputRef)}
|
|
42
|
+
class="image-placeholder"
|
|
43
|
+
style=${styleMap({
|
|
44
|
+
width: imageStyleHandlers?.width || imageStyles?.width || "100%",
|
|
45
|
+
height: imageStyleHandlers?.height || imageStyles?.height || "200px"
|
|
46
|
+
})}
|
|
47
|
+
@click=${(e) => this.executeEvent("onClick", e)}
|
|
48
|
+
>
|
|
49
|
+
<nr-icon name="image"></nr-icon>
|
|
50
|
+
<nr-label>No image source</nr-label>
|
|
51
|
+
</div>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
return html`
|
|
55
|
+
<nr-image
|
|
56
|
+
${ref(this.inputRef)}
|
|
57
|
+
style=${styleMap({
|
|
58
|
+
...this.getStyles(),
|
|
59
|
+
"display": "block",
|
|
60
|
+
"--nuraly-image-local-border-top-left-radius": fallbackStyles?.["border-top-left-radius"] ?? "",
|
|
61
|
+
"--nuraly-image-local-border-top-right-radius": fallbackStyles?.["border-top-right-radius"] ?? "",
|
|
62
|
+
"--nuraly-image-local-border-bottom-left-radius": fallbackStyles?.["border-bottom-left-radius"] ?? "",
|
|
63
|
+
"--nuraly-image-local-border-bottom-right-radius": fallbackStyles?.["border-bottom-right-radius"] ?? ""
|
|
64
|
+
})}
|
|
65
|
+
.src=${imageSrc}
|
|
66
|
+
.fallback=${this.inputHandlersValue?.fallback ?? nothing}
|
|
67
|
+
.previewable=${this.inputHandlersValue?.previewable ?? false}
|
|
68
|
+
.fit=${this.inputHandlersValue?.fit ?? nothing}
|
|
69
|
+
.block=${this.inputHandlersValue?.block ?? false}
|
|
70
|
+
.width=${imageStyleHandlers?.width || imageStyles?.width}
|
|
71
|
+
.height=${imageStyleHandlers?.height || imageStyles?.height}
|
|
72
|
+
.alt=${this.inputHandlersValue?.alt ?? "image"}
|
|
73
|
+
@click=${(e) => this.executeEvent("onClick", e)}
|
|
74
|
+
@nr-image-error=${(e) => this.executeEvent("onError", e)}
|
|
75
|
+
@nr-image-load=${(e) => this.executeEvent("onLoad", e)}
|
|
76
|
+
@nr-image-preview-open=${(e) => this.executeEvent("onPreviewOpen", e)}
|
|
77
|
+
@nr-image-preview-close=${(e) => this.executeEvent("onPreviewClose", e)}
|
|
78
|
+
>
|
|
79
|
+
</nr-image>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
ImageBlock.styles = [css`
|
|
84
|
+
:host {
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
.image-placeholder {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
color: #64748b;
|
|
93
|
+
min-height: 200px;
|
|
94
|
+
min-width: 200px;
|
|
95
|
+
border-radius: 8px;
|
|
96
|
+
border: 2px dashed #cbd5e1;
|
|
97
|
+
gap: 12px;
|
|
98
|
+
box-sizing: border-box;
|
|
99
|
+
}
|
|
100
|
+
.image-placeholder nr-icon {
|
|
101
|
+
--nuraly-icon-size: 48px;
|
|
102
|
+
}
|
|
103
|
+
`];
|
|
104
|
+
__decorateClass([
|
|
105
|
+
property({ type: Object })
|
|
106
|
+
], ImageBlock.prototype, "component", 2);
|
|
107
|
+
ImageBlock = __decorateClass([
|
|
108
|
+
customElement("image-block")
|
|
109
|
+
], ImageBlock);
|
|
110
|
+
|
|
111
|
+
export { ImageBlock };
|