@mtna/web-form-angular 1.0.0 → 1.0.1

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/_index.scss CHANGED
@@ -6,19 +6,18 @@
6
6
  // Component themes
7
7
  @forward './lib/form-item-controls/date-item-theme' as date-item-* show date-item-theme, date-item-color, date-item-typography;
8
8
  @forward './lib/form-item-controls/form-control-theme' as form-control-* show form-control-theme, form-control-color,
9
- form-control-typography;
10
- @forward './lib/form-item-controls/year-quarter-item-theme' as year-quarter-item-* show year-quarter-item-theme,
11
- year-quarter-item-color, year-quarter-item-typography;
9
+ form-control-typography;
10
+ @forward './lib/form-item-controls/year-quarter-item-theme' as year-quarter-item-* show year-quarter-item-theme, year-quarter-item-color,
11
+ year-quarter-item-typography;
12
12
  @forward './lib/form-stepper/form-step-group-theme' as form-step-group-* show form-step-group-theme, form-step-group-color,
13
- form-step-group-typography;
14
- @forward './lib/form-stepper/form-stepper-theme' as form-stepper-* show form-stepper-theme, form-stepper-color,
15
- form-stepper-typography;
13
+ form-step-group-typography;
14
+ @forward './lib/form-stepper/form-stepper-theme' as form-stepper-* show form-stepper-theme, form-stepper-color, form-stepper-typography;
16
15
  @forward './lib/groups/checkbox-theme' as checkbox-* show checkbox-theme, checkbox-color, checkbox-typography;
17
16
  @forward './lib/groups/form-group-theme' as form-group-* show form-group-theme, form-group-color, form-group-typography;
18
17
  @forward './lib/groups/multiple-choice-theme' as multiple-choice-* show multiple-choice-theme, multiple-choice-color,
19
- multiple-choice-typography;
18
+ multiple-choice-typography;
20
19
  @forward './lib/groups/repeatable-item-theme' as repeatable-item-* show repeatable-item-theme, repeatable-item-color,
21
- repeatable-item-typography;
20
+ repeatable-item-typography;
22
21
  @forward './lib/item-header/item-header-theme' as item-header-* show item-header-theme, item-header-color, item-header-typography;
23
22
  @forward './lib/step-card/step-card-theme' as step-card-* show step-card-theme, step-card-color, step-card-typography;
24
23
 
@@ -1902,18 +1902,32 @@
1902
1902
  return steps.reduce(function (a, b) { return a.concat(isFormStepGroup(b) ? b.steps : b); }, new Array());
1903
1903
  }
1904
1904
 
1905
- function generateFormSteps(items) {
1905
+ /**
1906
+ * Builds up an array of FormSteps or FormStepGroups based on what is found in the provided form items. For most typical
1907
+ * forms this will mean that a step is generated for every section that is found in the form. It is assumed that all
1908
+ * inputs are held within sections and therefore the sections are the steps that should be monitored for completeness.
1909
+ * However, in some circumstances, like very short forms, it may be the case that there are no sections and that all
1910
+ * the items are set directly on the form itself. In these circumstances the allSteps parameter can be set to true and
1911
+ * a step will be produced for each form item found.
1912
+ *
1913
+ * @param items the items of the form
1914
+ * @param allSteps flag indicating that a form step should be produced for every form item
1915
+ */
1916
+ function generateFormSteps(items, allSteps) {
1917
+ if (allSteps === void 0) { allSteps = false; }
1906
1918
  // Build up an array of steps based on the form items
1907
1919
  return items.reduce(function (newArray, item) {
1908
1920
  // The number of non-group steps, used to number the top level steps
1909
1921
  var count = newArray.filter(function (step) { return !isFormStepGroup(step); }).length;
1910
- if (webFormTs.isSection(item)) {
1922
+ if (allSteps) {
1923
+ newArray.push(new FormStep(count + 1, item.name || 'No Title', item.instanceId, !item.required));
1924
+ }
1925
+ else if (webFormTs.isSection(item)) {
1911
1926
  // If the item is a Section, add a step
1912
1927
  newArray.push(new FormStep(count + 1, item.title.value || 'No Title', item.instanceId, !item.required));
1913
1928
  }
1914
1929
  else if (webFormTs.isDataCubeItem(item)) {
1915
- // If the item is a DataCubeItem, add a step
1916
- // and add a group step for the sub-sections
1930
+ // If the item is a DataCubeItem, add a step and add a group step for the sub-sections
1917
1931
  newArray.push(new FormStep(count + 1, item.title.value || '', item.instanceId, !item.required));
1918
1932
  var subSectionSteps = item.items
1919
1933
  .filter(webFormTs.isSection)