@dmitryvim/form-builder 0.2.1 → 0.2.3

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/esm/index.js CHANGED
@@ -2064,6 +2064,7 @@ function renderMultipleFileElement(element, ctx, wrapper, pathKey) {
2064
2064
  function validateFileElement(element, key, context) {
2065
2065
  const errors = [];
2066
2066
  const { scopeRoot, skipValidation, path } = context;
2067
+ const isMultipleField = element.type === "files" || "multiple" in element && Boolean(element.multiple);
2067
2068
  const validateFileCount = (key2, resourceIds, element2) => {
2068
2069
  if (skipValidation) return;
2069
2070
  const minFiles = "minCount" in element2 ? element2.minCount ?? 0 : 0;
@@ -2078,7 +2079,7 @@ function validateFileElement(element, key, context) {
2078
2079
  errors.push(`${key2}: maximum ${maxFiles} files allowed`);
2079
2080
  }
2080
2081
  };
2081
- if ("multiple" in element && element.multiple) {
2082
+ if (isMultipleField) {
2082
2083
  const fullKey = pathJoin(path, key);
2083
2084
  const pickerInput = scopeRoot.querySelector(
2084
2085
  `input[type="file"][name="${fullKey}"]`
@@ -3017,7 +3018,7 @@ var FormBuilderInstance = class {
3017
3018
  constructor(config) {
3018
3019
  this.instanceId = generateInstanceId();
3019
3020
  this.state = createInstanceState(config);
3020
- if (process.env.NODE_ENV === "development") {
3021
+ if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
3021
3022
  if (config?.getThumbnail) {
3022
3023
  const testResult = config.getThumbnail("test-id");
3023
3024
  if (!(testResult instanceof Promise)) {
@@ -3581,7 +3582,7 @@ var FormBuilderInstance = class {
3581
3582
  this.state.formRoot = null;
3582
3583
  this.state.schema = null;
3583
3584
  this.state.externalActions = null;
3584
- if (process.env.NODE_ENV === "development") {
3585
+ if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
3585
3586
  globalThis.__formBuilderInstances?.delete(this.instanceId);
3586
3587
  }
3587
3588
  }