@startinblox/core 1.0.0 → 2.0.0-beta.2
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/dist/index.js +60 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14126,7 +14126,12 @@ const ListMixin = {
|
|
|
14126
14126
|
*/
|
|
14127
14127
|
async handleEmptyWidget(resources, listPostProcessors, div, context2) {
|
|
14128
14128
|
if (this.emptyWidget) {
|
|
14129
|
-
const emptyWidgetTemplate = preHTML
|
|
14129
|
+
const emptyWidgetTemplate = preHTML`
|
|
14130
|
+
<${this.emptyWidget}
|
|
14131
|
+
class=${this.emptyWidget}
|
|
14132
|
+
value=${o$2(this.emptyValue)}
|
|
14133
|
+
></${this.emptyWidget}>
|
|
14134
|
+
`;
|
|
14130
14135
|
if (!this.emptyWrapper) {
|
|
14131
14136
|
this.emptyWrapper = document.createElement("span");
|
|
14132
14137
|
this.element.appendChild(this.emptyWrapper);
|
|
@@ -33433,7 +33438,8 @@ const MultipleFormMixin = {
|
|
|
33433
33438
|
"data-holder": true,
|
|
33434
33439
|
name: this.name,
|
|
33435
33440
|
value,
|
|
33436
|
-
range: this.range
|
|
33441
|
+
range: this.range,
|
|
33442
|
+
class: this.widget
|
|
33437
33443
|
};
|
|
33438
33444
|
for (const name of Object.keys(attributes)) {
|
|
33439
33445
|
if (typeof attributes[name] === "boolean")
|
|
@@ -34494,43 +34500,49 @@ const formTemplates = {
|
|
|
34494
34500
|
},
|
|
34495
34501
|
radio: {
|
|
34496
34502
|
template: (value, attributes) => x`
|
|
34497
|
-
|
|
34503
|
+
<fieldset>
|
|
34504
|
+
<legend
|
|
34498
34505
|
name=${o$2(attributes.name)}
|
|
34499
34506
|
>
|
|
34500
|
-
${
|
|
34507
|
+
${attributes.label}
|
|
34508
|
+
</legend>
|
|
34509
|
+
${(attributes.range || []).map(
|
|
34501
34510
|
(el) => x`
|
|
34502
|
-
|
|
34503
|
-
|
|
34504
|
-
|
|
34505
|
-
|
|
34506
|
-
|
|
34507
|
-
|
|
34508
|
-
|
|
34509
|
-
|
|
34510
|
-
|
|
34511
|
-
|
|
34511
|
+
<label>
|
|
34512
|
+
<input
|
|
34513
|
+
type="radio"
|
|
34514
|
+
name=${o$2(attributes.id)}
|
|
34515
|
+
value=${el.value}
|
|
34516
|
+
?required=${attributes.required}
|
|
34517
|
+
?checked=${value === el.selectedValue}
|
|
34518
|
+
> <span>${el.label}</span>
|
|
34519
|
+
</label>
|
|
34520
|
+
`
|
|
34512
34521
|
)}
|
|
34513
|
-
|
|
34522
|
+
${Object.entries(attributes.enum || []).map(
|
|
34514
34523
|
([key, val]) => x`
|
|
34515
|
-
|
|
34516
|
-
|
|
34517
|
-
|
|
34518
|
-
|
|
34519
|
-
|
|
34520
|
-
|
|
34521
|
-
|
|
34522
|
-
|
|
34523
|
-
|
|
34524
|
-
|
|
34524
|
+
<label>
|
|
34525
|
+
<input
|
|
34526
|
+
type="radio"
|
|
34527
|
+
value="${key}"
|
|
34528
|
+
name=${o$2(attributes.id)}
|
|
34529
|
+
?required=${attributes.required}
|
|
34530
|
+
?checked=${value === key}
|
|
34531
|
+
> <span>${val}</span>
|
|
34532
|
+
</label>
|
|
34533
|
+
`
|
|
34525
34534
|
)}
|
|
34535
|
+
</fieldset>
|
|
34526
34536
|
`,
|
|
34527
34537
|
dependencies: [FormRadioMixin, FormMixin, RangeMixin]
|
|
34528
34538
|
},
|
|
34529
34539
|
multicheckbox: {
|
|
34530
34540
|
template: (_value, attributes) => x`
|
|
34531
|
-
<
|
|
34532
|
-
|
|
34533
|
-
|
|
34541
|
+
<fieldset>
|
|
34542
|
+
<legend
|
|
34543
|
+
name=${o$2(attributes.name)}>
|
|
34544
|
+
${attributes.label}
|
|
34545
|
+
</legend>
|
|
34534
34546
|
${(attributes.range || []).map(
|
|
34535
34547
|
(el) => x`
|
|
34536
34548
|
<label>
|
|
@@ -34551,7 +34563,7 @@ const formTemplates = {
|
|
|
34551
34563
|
</label>
|
|
34552
34564
|
`
|
|
34553
34565
|
)}
|
|
34554
|
-
</
|
|
34566
|
+
</fieldset>
|
|
34555
34567
|
`,
|
|
34556
34568
|
dependencies: [FormCheckboxesMixin, FormMixin, RangeMixin]
|
|
34557
34569
|
},
|
|
@@ -34568,6 +34580,7 @@ const formTemplates = {
|
|
|
34568
34580
|
order-asc=${o$2(attributes.orderAsc)}
|
|
34569
34581
|
order-desc=${o$2(attributes.orderDesc)}
|
|
34570
34582
|
?required=${attributes.required}
|
|
34583
|
+
label=${o$2(attributes.label)}
|
|
34571
34584
|
></solid-form-multicheckbox>
|
|
34572
34585
|
`,
|
|
34573
34586
|
dependencies: [MultipleselectFormMixin, FormMixin, RangeMixin]
|
|
@@ -34590,6 +34603,7 @@ const formTemplates = {
|
|
|
34590
34603
|
template: (_value, attributes) => x`
|
|
34591
34604
|
<solid-form-dropdown
|
|
34592
34605
|
data-holder
|
|
34606
|
+
class="solid-form-dropdown"
|
|
34593
34607
|
name=${o$2(attributes.name)}
|
|
34594
34608
|
data-id=${o$2(attributes.id)}
|
|
34595
34609
|
range=${o$2(attributes.range)}
|
|
@@ -37597,6 +37611,7 @@ const WidgetMixin = {
|
|
|
37597
37611
|
const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);
|
|
37598
37612
|
let tagName = widgetMeta.tagName;
|
|
37599
37613
|
let widgetTemplate = x``;
|
|
37614
|
+
const classAttr = attributes.class;
|
|
37600
37615
|
const value = await this.getValue(field, currentResource);
|
|
37601
37616
|
if (widgetMeta.type === WidgetType.NATIVE) {
|
|
37602
37617
|
widgetTemplate = preHTML`<${tagName} name="${o$2(attributes.name)}" class="${o$2(attributes.class)}">${value}</${tagName}>`;
|
|
@@ -37625,7 +37640,12 @@ const WidgetMixin = {
|
|
|
37625
37640
|
attributes,
|
|
37626
37641
|
currentResource
|
|
37627
37642
|
);
|
|
37628
|
-
|
|
37643
|
+
if (value == null ? void 0 : value["@id"]) attributes["auto-subscribe"] = value["@id"];
|
|
37644
|
+
widgetTemplate = preHTML`
|
|
37645
|
+
<${tagName}
|
|
37646
|
+
...=${spread(attributes)}
|
|
37647
|
+
class="${classAttr !== void 0 ? tagName.concat(" ", classAttr) : tagName}"
|
|
37648
|
+
></${tagName}>`;
|
|
37629
37649
|
}
|
|
37630
37650
|
this.nameWidgets.push(field);
|
|
37631
37651
|
return widgetTemplate;
|
|
@@ -37641,10 +37661,13 @@ const WidgetMixin = {
|
|
|
37641
37661
|
*/
|
|
37642
37662
|
async createSet(field) {
|
|
37643
37663
|
const setWidget = this.getWidget(field, true);
|
|
37644
|
-
const attrs = { name: field };
|
|
37664
|
+
const attrs = { name: field, class: setWidget.tagName };
|
|
37645
37665
|
const setAttributes = ["class", "label"];
|
|
37646
37666
|
for (const attr of setAttributes)
|
|
37647
37667
|
this.addToAttributes(`${attr}-${field}`, attr, attrs);
|
|
37668
|
+
if (attrs.class !== void 0) {
|
|
37669
|
+
attrs.class = setWidget.tagName.concat(" ", attrs.class);
|
|
37670
|
+
} else attrs.class = setWidget.tagName;
|
|
37648
37671
|
let widget = this.element.querySelector(
|
|
37649
37672
|
`${setWidget.tagName}[name="${field}"]`
|
|
37650
37673
|
);
|
|
@@ -37672,14 +37695,13 @@ const WidgetMixin = {
|
|
|
37672
37695
|
const tagName = this.element.getAttribute(`empty-${field}`);
|
|
37673
37696
|
const valueSet = this.element.getAttribute(`empty-${field}-value`);
|
|
37674
37697
|
if (valueSet) attributes.value = valueSet;
|
|
37675
|
-
return preHTML
|
|
37698
|
+
return preHTML`
|
|
37699
|
+
<${tagName}
|
|
37700
|
+
...=${spread(attributes)}
|
|
37701
|
+
class="${tagName}"
|
|
37702
|
+
></${tagName}>`;
|
|
37676
37703
|
}
|
|
37677
37704
|
}
|
|
37678
|
-
if (setFields.length === 0) {
|
|
37679
|
-
console.warn(
|
|
37680
|
-
`Set with name ${field} has not been generated due to being empty`
|
|
37681
|
-
);
|
|
37682
|
-
}
|
|
37683
37705
|
const widgetsTemplate = await Promise.all(
|
|
37684
37706
|
setFields.map((field2) => this.createWidgetTemplate(field2))
|
|
37685
37707
|
);
|
|
@@ -39125,6 +39147,7 @@ const SolidWidget = {
|
|
|
39125
39147
|
const template = this.template;
|
|
39126
39148
|
const newWidget = {
|
|
39127
39149
|
name: this.name,
|
|
39150
|
+
class: this.template,
|
|
39128
39151
|
use: [BaseWidgetMixin, StoreMixin, FormMixin, ActionMixin],
|
|
39129
39152
|
attributes: {
|
|
39130
39153
|
label: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startinblox/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|