formeo 5.3.1 → 5.3.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.
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  formeo - https://formeo.io
4
- Version: 5.3.0
4
+ Version: 5.3.1
5
5
  Author: Draggable https://draggable.io
6
6
  */
7
7
 
@@ -8068,7 +8068,7 @@ Author: Draggable https://draggable.io
8068
8068
  })), name$1, version$2, type, main, module$1, unpkg, exports$1, files, homepage, repository, author, contributors, bugs, description, keywords, ignore, config, scripts, devDependencies, dependencies, release, commitlint, package_default;
8069
8069
  var init_package = __esmMin((() => {
8070
8070
  name$1 = "formeo";
8071
- version$2 = "5.3.0";
8071
+ version$2 = "5.3.1";
8072
8072
  type = "module";
8073
8073
  main = "dist/formeo.cjs.js";
8074
8074
  module$1 = "dist/formeo.es.js";
@@ -14525,6 +14525,23 @@ Author: Draggable https://draggable.io
14525
14525
  });
14526
14526
  }));
14527
14527
  //#endregion
14528
+ //#region src/lib/js/components/fields/control-attr-config.mjs
14529
+ var getControlConfig, controlAttrPanelConfig;
14530
+ var init_control_attr_config = __esmMin((() => {
14531
+ init_utils();
14532
+ getControlConfig = (control) => control?.controlData?.config ?? control?.config;
14533
+ controlAttrPanelConfig = (...sources) => {
14534
+ const collect = (key) => unique(sources.flatMap((source) => Array.isArray(source?.[key]) ? source[key] : []));
14535
+ const disabled = collect("disabledAttrs");
14536
+ const locked = collect("lockedAttrs");
14537
+ if (!disabled.length && !locked.length) return null;
14538
+ return { panels: { attrs: {
14539
+ disabled,
14540
+ locked
14541
+ } } };
14542
+ };
14543
+ }));
14544
+ //#endregion
14528
14545
  //#region src/lib/js/components/fields/field.js
14529
14546
  var field_exports = /* @__PURE__ */ __exportAll({ default: () => Field });
14530
14547
  var checkableTypes, isSelectableType, Field;
@@ -14535,6 +14552,8 @@ Author: Draggable https://draggable.io
14535
14552
  init_utils();
14536
14553
  init_constants();
14537
14554
  init_component();
14555
+ init_components();
14556
+ init_control_attr_config();
14538
14557
  checkableTypes = new Set(["checkbox", "radio"]);
14539
14558
  isSelectableType = new Set([
14540
14559
  "radio",
@@ -14550,11 +14569,12 @@ Author: Draggable https://draggable.io
14550
14569
  */
14551
14570
  constructor(fieldData = Object.create(null)) {
14552
14571
  super("field", fieldData);
14572
+ this.controlId = this.get("config.controlId") || this.get("meta.id");
14573
+ this.applyControlAttrConfig();
14553
14574
  this.debouncedUpdateEditPanels = debounce(this.updateEditPanels);
14554
14575
  this.debouncedUpdatePreview = debounce(this.updatePreview);
14555
14576
  this.label = dom.create(this.labelConfig);
14556
14577
  this.preview = this.fieldPreview();
14557
- this.controlId = this.get("config.controlId") || this.get("meta.id");
14558
14578
  const actionButtons = this.getActionButtons();
14559
14579
  const hasEditButton = this.actionButtons.some((child) => child.meta?.id === "edit");
14560
14580
  this.updateEditPanels();
@@ -14575,6 +14595,15 @@ Author: Draggable https://draggable.io
14575
14595
  this.dom = field;
14576
14596
  this.isEditing = false;
14577
14597
  }
14598
+ /**
14599
+ * Honour control-level `disabledAttrs` / `lockedAttrs` by merging them into this field's
14600
+ * panels.attrs config. Reads both the registered control definition and the field's own
14601
+ * saved config so forms saved before a control changed still pick up its rules.
14602
+ */
14603
+ applyControlAttrConfig() {
14604
+ const attrConfig = controlAttrPanelConfig(getControlConfig(components.controls?.get(this.controlId)), this.get("config"));
14605
+ if (attrConfig) this.config = { [this.id]: attrConfig };
14606
+ }
14578
14607
  get labelConfig() {
14579
14608
  if (!!this.get("config.hideLabel")) return null;
14580
14609
  const { label, editorLabel, disableHtmlLabel, helpText, tooltip } = this.get("config");
@@ -15018,7 +15047,7 @@ Author: Draggable https://draggable.io
15018
15047
  },
15019
15048
  config: {
15020
15049
  label: s.get("controls.form.radio-group"),
15021
- disabled: ["attrs.type"]
15050
+ disabledAttrs: ["type"]
15022
15051
  },
15023
15052
  meta: {
15024
15053
  group: "common",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "formeo",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "type": "module",
5
5
  "main": "dist/formeo.cjs.js",
6
6
  "module": "dist/formeo.es.js",