forms-angular 0.12.0-beta.264 → 0.12.0-beta.265
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/client/forms-angular.js +357 -207
- package/dist/client/forms-angular.min.js +1 -1
- package/dist/client/index.d.ts +24 -13
- package/dist/server/data_form.js +35 -24
- package/dist/server/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ declare module fng {
|
|
|
2
2
|
export interface IFng extends angular.IModule {
|
|
3
3
|
beforeProcess?: (scope: IFormScope, cb: (err?: Error) => void) => void;
|
|
4
4
|
beforeHandleIncomingDataPromises?: () => angular.IPromise<any>[];
|
|
5
|
+
pseudo?: (token: string, upperFirst: boolean) => string;
|
|
5
6
|
title?: { prefix?: string; suffix?: string };
|
|
6
7
|
// when provided, the named function (assumed to be present on $rootscope) will be used to determine the visibility
|
|
7
8
|
// of menu items and control groups
|
|
@@ -271,6 +272,7 @@ declare module fng {
|
|
|
271
272
|
select2?: any; // deprecated
|
|
272
273
|
schema?: IFormInstruction[]; // If the field is an array of fields
|
|
273
274
|
intType?: "date";
|
|
275
|
+
coloffset?: number;
|
|
274
276
|
[directiveOptions: string]: any;
|
|
275
277
|
}
|
|
276
278
|
|
|
@@ -307,7 +309,7 @@ declare module fng {
|
|
|
307
309
|
anything else will be used as a paragraph stype
|
|
308
310
|
*/
|
|
309
311
|
titleTagOrClass?: string;
|
|
310
|
-
content:
|
|
312
|
+
content: IFormSchemaElement[];
|
|
311
313
|
}
|
|
312
314
|
|
|
313
315
|
export type IFormSchemaElement = IFormInstruction | IContainer;
|
|
@@ -508,12 +510,7 @@ declare module fng {
|
|
|
508
510
|
export interface IContextMenuDivider {
|
|
509
511
|
divider: boolean;
|
|
510
512
|
}
|
|
511
|
-
export interface
|
|
512
|
-
// For it to make any sense, a menu option needs one of the next three properties
|
|
513
|
-
url?: string;
|
|
514
|
-
fn?: () => void;
|
|
515
|
-
urlFunc?: () => string;
|
|
516
|
-
|
|
513
|
+
export interface IContextMenuBaseOption {
|
|
517
514
|
// provided to the security hook (see elemSecurityFuncName) - optional where that is not being used
|
|
518
515
|
id?: string;
|
|
519
516
|
|
|
@@ -527,6 +524,18 @@ declare module fng {
|
|
|
527
524
|
creating: boolean;
|
|
528
525
|
editing: boolean;
|
|
529
526
|
}
|
|
527
|
+
export interface IContextSubMenuOption extends IContextMenuBaseOption {
|
|
528
|
+
items: ContextMenuItem[];
|
|
529
|
+
}
|
|
530
|
+
export interface IContextMenuOption extends IContextMenuBaseOption{
|
|
531
|
+
// For it to make any sense, a menu option needs one of the next three properties
|
|
532
|
+
url?: string;
|
|
533
|
+
fn?: (...args: any) => void;
|
|
534
|
+
urlFunc?: () => string;
|
|
535
|
+
broadcast?: string;
|
|
536
|
+
args?: any[];
|
|
537
|
+
}
|
|
538
|
+
export type ContextMenuItem = IContextMenuOption | IContextSubMenuOption | IContextMenuDivider;
|
|
530
539
|
|
|
531
540
|
export interface IModelCtrlService {
|
|
532
541
|
loadControllerAndMenu: (sharedData: any, titleCaseModelName: string, level: number, needDivider: boolean, scope: angular.IScope) => void;
|
|
@@ -535,8 +544,8 @@ declare module fng {
|
|
|
535
544
|
export interface IModelController extends IFormScope {
|
|
536
545
|
onBaseCtrlReady?: (baseScope: IFormScope) => void; // Optional callback after form is instantiated
|
|
537
546
|
onAllReady?: (baseScope: IFormScope) => void; // Optional callback after form is instantiated and populated
|
|
538
|
-
contextMenu?:
|
|
539
|
-
contextMenuPromise?: Promise<
|
|
547
|
+
contextMenu?: ContextMenuItem[];
|
|
548
|
+
contextMenuPromise?: Promise<ContextMenuItem[]>;
|
|
540
549
|
}
|
|
541
550
|
|
|
542
551
|
export interface IBaseFormOptions {
|
|
@@ -652,7 +661,8 @@ declare module fng {
|
|
|
652
661
|
interface IPluginHelperService {
|
|
653
662
|
extractFromAttr: (
|
|
654
663
|
attr: any,
|
|
655
|
-
directiveName: string
|
|
664
|
+
directiveName: string,
|
|
665
|
+
scope: fng.IFormScope
|
|
656
666
|
) => { info: IFormInstruction; options: IFormOptions; directiveOptions: any };
|
|
657
667
|
buildInputMarkup: (
|
|
658
668
|
scope: angular.IScope,
|
|
@@ -690,7 +700,7 @@ declare module fng {
|
|
|
690
700
|
processedAttrs: IProcessedAttrs,
|
|
691
701
|
idSuffix: string
|
|
692
702
|
) => string;
|
|
693
|
-
handlePseudos: (str: string) => string;
|
|
703
|
+
handlePseudos: (scope: fng.IFormScope, str: string) => string;
|
|
694
704
|
genDisableableAncestorStr: (processedAttrs: IProcessedAttrs) => string;
|
|
695
705
|
}
|
|
696
706
|
|
|
@@ -814,14 +824,15 @@ declare module fng {
|
|
|
814
824
|
allInputsVars: (scope: angular.IScope, fieldInfo: fng.IFormInstruction, options: fng.IFormOptions, modelString: string, idString: string, nameString: string) => Partial<fng.IBuildingBlocks>;
|
|
815
825
|
inputChrome: (value: string, fieldInfo: fng.IFormInstruction, options: fng.IFormOptions, markupVars) => string;
|
|
816
826
|
generateSimpleInput: (common: string, fieldInfo: fng.IFormInstruction, options: fng.IFormOptions) => string;
|
|
817
|
-
controlDivClasses: (options: fng.IFormOptions) => string[];
|
|
827
|
+
controlDivClasses: (options: fng.IFormOptions, fieldInfo: fng.IFormInstruction) => string[];
|
|
818
828
|
handleInputAndControlDiv: (inputMarkup: string, controlDivClasses: string[]) => string;
|
|
819
829
|
handleArrayInputAndControlDiv: (inputMarkup: string, controlDivClasses: string[], scope: fng.IFormScope, info: fng.IFormInstruction, options: fng.IFormOptions) => string;
|
|
820
830
|
addTextInputMarkup: (allInputsVars: Partial<fng.IBuildingBlocks>, fieldInfo: fng.IFormInstruction, requiredStr: string) => string;
|
|
821
831
|
handleReadOnlyDisabled: (partialFieldInfo: { name: string, id?: string, nonUniqueId?: string, readonly?: boolean | string }, scope: fng.IFormScope) => string[];
|
|
822
832
|
generateArrayElementIdString: (idString: string, info: fng.IFormInstruction, options: fng.IFormOptions) => string;
|
|
823
833
|
genDisableableAncestorStr: (id: string) => string;
|
|
824
|
-
generateNgShow(showWhen: IFngShowWhen, model: string)
|
|
834
|
+
generateNgShow: (showWhen: IFngShowWhen, model: string) => string;
|
|
835
|
+
handlePseudos: (scope: fng.IFormScope, str: string, dynamicFuncName?: string) => string;
|
|
825
836
|
}
|
|
826
837
|
}
|
|
827
838
|
|
package/dist/server/data_form.js
CHANGED
|
@@ -235,7 +235,35 @@ class FormsAngular {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
extend(resource.options, this.preprocess(resource, resource.model.schema
|
|
238
|
+
extend(resource.options, this.preprocess(resource, resource.model.schema.paths));
|
|
239
|
+
resource.options.searchFields = [];
|
|
240
|
+
// commenting this out, as we used to do this in a place where the type of resource.model.schema was any,
|
|
241
|
+
// so it was allowed, despite the fact that _indexes is not a known property of a mongoose schema.
|
|
242
|
+
// changing it to indexes does compile, but this might not be what was intended
|
|
243
|
+
//
|
|
244
|
+
// for (let j = 0; j < resource.model.schema._indexes.length; j++) {
|
|
245
|
+
// let attributes = resource.model.schema._indexes[j][0];
|
|
246
|
+
// let field = Object.keys(attributes)[0];
|
|
247
|
+
// if (resource.options.searchFields.indexOf(field) === -1) {
|
|
248
|
+
// resource.options.searchFields.push(field);
|
|
249
|
+
// }
|
|
250
|
+
// }
|
|
251
|
+
function addSearchFields(schema, pathSoFar) {
|
|
252
|
+
for (let path in schema.paths) {
|
|
253
|
+
if (path !== '_id' && schema.paths.hasOwnProperty(path)) {
|
|
254
|
+
const qualifiedPath = pathSoFar ? pathSoFar + "." + path : path;
|
|
255
|
+
if (schema.paths[path].options.index && !schema.paths[path].options.noSearch) {
|
|
256
|
+
if (resource.options.searchFields.indexOf(qualifiedPath) === -1) {
|
|
257
|
+
resource.options.searchFields.push(qualifiedPath);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
else if (schema.paths[path].schema) {
|
|
261
|
+
addSearchFields(schema.paths[path].schema, qualifiedPath);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
addSearchFields(resource.model.schema, "");
|
|
239
267
|
if (resource.options.searchImportance) {
|
|
240
268
|
this.searchFunc = async.forEachSeries;
|
|
241
269
|
}
|
|
@@ -376,31 +404,14 @@ class FormsAngular {
|
|
|
376
404
|
for (let i = 0; i < resourceCount; i++) {
|
|
377
405
|
let resource = resourcesToSearch[i];
|
|
378
406
|
if (resourceCount === 1 || (resource.options.searchImportance !== false && (!collectionName || collectionNameLower === resource.resourceNameLower || resource.options?.synonyms?.find(s => s.name === collectionNameLower)))) {
|
|
379
|
-
let
|
|
380
|
-
|
|
381
|
-
for (let j = 0; j < schema._indexes.length; j++) {
|
|
382
|
-
let attributes = schema._indexes[j][0];
|
|
383
|
-
let field = Object.keys(attributes)[0];
|
|
384
|
-
if (indexedFields.indexOf(field) === -1) {
|
|
385
|
-
indexedFields.push(field);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
for (let path in schema.paths) {
|
|
389
|
-
if (path !== '_id' && schema.paths.hasOwnProperty(path)) {
|
|
390
|
-
if (schema.paths[path]._index && !schema.paths[path].options.noSearch) {
|
|
391
|
-
if (indexedFields.indexOf(path) === -1) {
|
|
392
|
-
indexedFields.push(path);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
if (indexedFields.length === 0) {
|
|
407
|
+
let searchFields = resource.options.searchFields;
|
|
408
|
+
if (searchFields.length === 0) {
|
|
398
409
|
console.log('ERROR: Searching on a collection with no indexes ' + resource.resourceName);
|
|
399
410
|
}
|
|
400
411
|
let synonymObj = resource.options?.synonyms?.find(s => s.name.toLowerCase() === collectionNameLower);
|
|
401
412
|
const synonymFilter = synonymObj?.filter;
|
|
402
|
-
for (let m = 0; m <
|
|
403
|
-
let searchObj = { resource: resource, field:
|
|
413
|
+
for (let m = 0; m < searchFields.length; m++) {
|
|
414
|
+
let searchObj = { resource: resource, field: searchFields[m] };
|
|
404
415
|
if (synonymFilter) {
|
|
405
416
|
searchObj.filter = synonymFilter;
|
|
406
417
|
}
|
|
@@ -734,7 +745,7 @@ class FormsAngular {
|
|
|
734
745
|
}, {});
|
|
735
746
|
}
|
|
736
747
|
let outPath = {}, hiddenFields = [], listFields = [];
|
|
737
|
-
if (resource &&
|
|
748
|
+
if (resource && resource.preprocessed && resource.preprocessed[formName || "__default"]) {
|
|
738
749
|
return resource.preprocessed[formName || "__default"].paths;
|
|
739
750
|
}
|
|
740
751
|
else {
|
|
@@ -798,7 +809,7 @@ class FormsAngular {
|
|
|
798
809
|
if (listFields.length > 0) {
|
|
799
810
|
returnObj.listFields = listFields;
|
|
800
811
|
}
|
|
801
|
-
if (resource
|
|
812
|
+
if (resource) {
|
|
802
813
|
resource.preprocessed = resource.preprocessed || {};
|
|
803
814
|
resource.preprocessed[formName || "__default"] = returnObj;
|
|
804
815
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ declare module fngServer {
|
|
|
57
57
|
idIsList?: IIdIsList,
|
|
58
58
|
searchResultFormat?: ISearchResultFormatter,
|
|
59
59
|
searchOrder?: any,
|
|
60
|
-
doNotCacheSchema?: boolean, // useful if bespoke fields can be added at runtime, for instance
|
|
61
60
|
listOrder?: any,
|
|
62
61
|
onAccess?: (req, cb) => void,
|
|
63
62
|
searchFunc?: SearchFunc;
|
|
@@ -72,7 +71,8 @@ declare module fngServer {
|
|
|
72
71
|
// below here are autogenerated
|
|
73
72
|
listFields?: ListField[]; // added after preprocess
|
|
74
73
|
dependents?: DependencyList; // can be added by generateDependencyList
|
|
75
|
-
hide? : string[];
|
|
74
|
+
hide? : string[]; // added after preprocess
|
|
75
|
+
searchFields? : string[]; // added after preprocess
|
|
76
76
|
paths?: Paths;
|
|
77
77
|
}
|
|
78
78
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Mark Chapman <support@forms-angular.org>",
|
|
4
4
|
"description": "A form builder that sits on top of Angular.js, Twitter Bootstrap, jQuery UI, Angular-UI, Express and Mongoose. Opinionated or what?",
|
|
5
5
|
"homepage": "http://forms-angular.org",
|
|
6
|
-
"version": "0.12.0-beta.
|
|
6
|
+
"version": "0.12.0-beta.265",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=8.x",
|
|
9
9
|
"npm": ">=5.x"
|