@startinblox/core 2.0.0-beta.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +26 -10
  2. 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`<${this.emptyWidget} value=${o$2(this.emptyValue)}></${this.emptyWidget}>`;
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")
@@ -34597,6 +34603,7 @@ const formTemplates = {
34597
34603
  template: (_value, attributes) => x`
34598
34604
  <solid-form-dropdown
34599
34605
  data-holder
34606
+ class="solid-form-dropdown"
34600
34607
  name=${o$2(attributes.name)}
34601
34608
  data-id=${o$2(attributes.id)}
34602
34609
  range=${o$2(attributes.range)}
@@ -37604,6 +37611,7 @@ const WidgetMixin = {
37604
37611
  const widgetMeta = this.multiple(escapedField) || this.getWidget(escapedField);
37605
37612
  let tagName = widgetMeta.tagName;
37606
37613
  let widgetTemplate = x``;
37614
+ const classAttr = attributes.class;
37607
37615
  const value = await this.getValue(field, currentResource);
37608
37616
  if (widgetMeta.type === WidgetType.NATIVE) {
37609
37617
  widgetTemplate = preHTML`<${tagName} name="${o$2(attributes.name)}" class="${o$2(attributes.class)}">${value}</${tagName}>`;
@@ -37632,7 +37640,12 @@ const WidgetMixin = {
37632
37640
  attributes,
37633
37641
  currentResource
37634
37642
  );
37635
- widgetTemplate = preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
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}>`;
37636
37649
  }
37637
37650
  this.nameWidgets.push(field);
37638
37651
  return widgetTemplate;
@@ -37648,10 +37661,13 @@ const WidgetMixin = {
37648
37661
  */
37649
37662
  async createSet(field) {
37650
37663
  const setWidget = this.getWidget(field, true);
37651
- const attrs = { name: field };
37664
+ const attrs = { name: field, class: setWidget.tagName };
37652
37665
  const setAttributes = ["class", "label"];
37653
37666
  for (const attr of setAttributes)
37654
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;
37655
37671
  let widget = this.element.querySelector(
37656
37672
  `${setWidget.tagName}[name="${field}"]`
37657
37673
  );
@@ -37679,14 +37695,13 @@ const WidgetMixin = {
37679
37695
  const tagName = this.element.getAttribute(`empty-${field}`);
37680
37696
  const valueSet = this.element.getAttribute(`empty-${field}-value`);
37681
37697
  if (valueSet) attributes.value = valueSet;
37682
- return preHTML`<${tagName} ...=${spread(attributes)}></${tagName}>`;
37698
+ return preHTML`
37699
+ <${tagName}
37700
+ ...=${spread(attributes)}
37701
+ class="${tagName}"
37702
+ ></${tagName}>`;
37683
37703
  }
37684
37704
  }
37685
- if (setFields.length === 0) {
37686
- console.warn(
37687
- `Set with name ${field} has not been generated due to being empty`
37688
- );
37689
- }
37690
37705
  const widgetsTemplate = await Promise.all(
37691
37706
  setFields.map((field2) => this.createWidgetTemplate(field2))
37692
37707
  );
@@ -39132,6 +39147,7 @@ const SolidWidget = {
39132
39147
  const template = this.template;
39133
39148
  const newWidget = {
39134
39149
  name: this.name,
39150
+ class: this.template,
39135
39151
  use: [BaseWidgetMixin, StoreMixin, FormMixin, ActionMixin],
39136
39152
  attributes: {
39137
39153
  label: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "2.0.0-beta.1",
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",