@stubber/form-fields 2.0.21 → 2.0.23

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.
@@ -84,6 +84,7 @@ export interface IBaseField<TParams> {
84
84
  };
85
85
  without_value_details?: boolean;
86
86
  params?: TParams;
87
+ __order?: number;
87
88
  }
88
89
  export type IField = ITextField | INoteField | INumberField | ICheckboxField | ICheckboxAutocompleteField | ISectionField | IMultistepField | IArrayBuilderField | IGridField | ISelectField | ISelectResourceField | IContactSelectorField | ICurrencyField | IDataIndicationField | IDateField | IDateTimeField | IEmailField | ISliderField | IFieldBuilderField | IJSONEditorField | IFileField | IHeadingField | IHiddenField | IHiddenLocationField | IHTMLField | IMapField | ITelephoneField | IObjectBuilderField | IRadioField | IMultiCheckboxField | IQRCodeScannerField | IScrollAndReadDisplayField | IVoicenoteField | ISignatureField | ISmartTextField | IScreenshotField | IScreenRecorderField | ICodeField;
89
90
  export type FieldType = IField["fieldtype"];
@@ -440,11 +440,11 @@ let validations_open = false;
440
440
  />
441
441
  </div>
442
442
  <div>
443
- <Label for="data_path">Data Path</Label>
443
+ <Label for="datapath">Data Path</Label>
444
444
  <Input
445
- id="data_path"
445
+ id="datapath"
446
446
  placeholder="Optional custom data path for the field"
447
- bind:value={value.details.data_path}
447
+ bind:value={value.details.datapath}
448
448
  />
449
449
  </div>
450
450
  </Collapsible.Content>
@@ -1,9 +1,9 @@
1
- import { get, isEqual, set, startCase, unset } from "lodash-es";
1
+ import { cloneDeep, get, isEqual, orderBy, set, startCase, unset } from "lodash-es";
2
2
  import { get as getStoreValue, writable } from "svelte/store";
3
3
  export const build_fields = (formStore, attachmentsStore, formDependencies, input_fields, base_path = null) => {
4
- return Object.entries(input_fields).map(([key, field]) => {
5
- return build_field(formStore, attachmentsStore, formDependencies, key, field, base_path);
6
- });
4
+ return Object.entries(input_fields)
5
+ .sort(([, a], [, b]) => (a.__order ?? Infinity) - (b.__order ?? Infinity))
6
+ .map(([key, field]) => build_field(formStore, attachmentsStore, formDependencies, key, field, base_path));
7
7
  };
8
8
  export const build_field = (formStore, attachmentsStore, formDependencies, field_key, field, base_path = null) => {
9
9
  // console.log("dependencies", formDependencies);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stubber/form-fields",
3
- "version": "2.0.21",
3
+ "version": "2.0.23",
4
4
  "description": "An automatic form builder based on field specifications",
5
5
  "keywords": [
6
6
  "components",