forms-angular 0.12.0-beta.353 → 0.12.0-beta.355

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.
@@ -423,6 +423,11 @@ declare module fng {
423
423
  requiresDisabledChildren: (elemId: string) => boolean;
424
424
  }
425
425
 
426
+ /*
427
+ The style of a message shown by showError() / the showErrorMessage event
428
+ */
429
+ export type MessageType = "error" | "warning" | "info" | "success";
430
+
426
431
  /*
427
432
  The scope which contains form data
428
433
  */
@@ -432,6 +437,7 @@ declare module fng {
432
437
  modelName: string;
433
438
  formName: string;
434
439
  alertTitle: any;
440
+ alertType?: MessageType;
435
441
  errorVisible: boolean;
436
442
  errorMessage: any;
437
443
  errorHideTimer: number;
@@ -469,7 +475,10 @@ declare module fng {
469
475
  pagesLoaded: any;
470
476
  redirectOptions?: { redirect?: string; allowChange?: boolean };
471
477
  cancel: () => any;
472
- showError: (error: any, alertTitle?: string) => void;
478
+ /*
479
+ Despite the name, shows any kind of message. type defaults to "error"
480
+ */
481
+ showError: (error: any, alertTitle?: string, type?: MessageType) => void;
473
482
  prepareForSave: (cb: (error: string, dataToSave?: any) => void) => void;
474
483
  setDefaults: (formSchema: IFormSchema, base?: string) => any;
475
484
  formSchema: IControlledFormSchema;
@@ -551,13 +551,15 @@ export class FormsAngular {
551
551
  function recordMatches(resultObject, aDoc, item) {
552
552
  const before = calcAddHits(resultObject);
553
553
  const charsBefore = matchedChars(resultObject);
554
+ // A resource can opt out of the exact match bonus, so its exact matches never jump above resources of greater importance
555
+ const exactBonus = item.resource.options.searchExactBonus !== false;
554
556
  resultObject.matched = resultObject.matched || [];
555
557
  if (item.combined) {
556
558
  if (multiMatchPossible) {
557
559
  resultObject.matched = searchStrings.map((word, i) => i);
558
560
  }
559
561
  else {
560
- resultObject.exact = true;
562
+ resultObject.exact = exactBonus;
561
563
  }
562
564
  }
563
565
  else {
@@ -584,7 +586,7 @@ export class FormsAngular {
584
586
  }
585
587
  }
586
588
  else if (fieldValue === searchFor) {
587
- resultObject.exact = true;
589
+ resultObject.exact = exactBonus;
588
590
  }
589
591
  }
590
592
  }
@@ -53,6 +53,7 @@ declare module fngServer {
53
53
  onRemove?: (doc, req, cb) => void;
54
54
  handleRemove?: 'allow' | 'cascade'; // default behaviour is to prevent deletion if record is used as a foreign key
55
55
  searchImportance?: boolean | number,
56
+ searchExactBonus?: boolean, // false stops an exact match ranking this resource's results above those of more important resources
56
57
  onSave?: (doc, req, cb) => void,
57
58
  onSaveError?: (err:Error, req: Express.Request, res: Express.Response) => void,
58
59
  findFunc?: (req: Express.Request, cb: (err:Error, criteria?: FilterQuery<any>) => void) => void,
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "description": "A form builder that sits on top of Angular.js, Twitter Bootstrap, jQuery UI, Angular-UI, Express and Mongoose. Opinionated or what?",
8
8
  "homepage": "http://forms-angular.org",
9
- "version": "0.12.0-beta.353",
9
+ "version": "0.12.0-beta.355",
10
10
  "packageManager": "npm@10.2.4",
11
11
  "type": "module",
12
12
  "engines": {