Skip to content

Commit d82d319

Browse files
committed
feature(plugin) Improve fng-ui-select support, especially in arrays
1 parent 07b795e commit d82d319

File tree

13 files changed

+167
-748
lines changed

13 files changed

+167
-748
lines changed

dist/forms-angular.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ declare module fng {
2121
updateDocument(dataToSave: any, options: any, scope: fng.IFormScope, ctrlState: any): void;
2222
readRecord($scope: fng.IFormScope, ctrlState: any): any;
2323
scrollTheList($scope: fng.IFormScope): any;
24-
getListData(record: any, fieldName: any, select2List: any, listSchema: any): any;
24+
getListData(record: any, fieldName: any, listSchema: any): any;
2525
suffixCleanId(inst: any, suffix: any): any;
2626
setData(object: any, fieldname: any, element: any, value: any): any;
2727
setUpSelectOptions(lookupCollection: any, schemaElement: any, $scope: fng.IFormScope, ctrlState: any, handleSchema: any): any;
@@ -68,6 +68,7 @@ declare module fng {
6868
activeTabNo?: number;
6969
topLevelFormName: string;
7070
record: any;
71+
originalData: any;
7172
phase: any;
7273
disableFunctions: any;
7374
dataEventFunctions: any;
@@ -77,7 +78,6 @@ declare module fng {
7778
conversions: any;
7879
pageSize: any;
7980
pagesLoaded: any;
80-
select2List: any;
8181
formSchema: Array<IFieldViewInfo>;
8282
baseSchema(): Array<any>;
8383
setFormDirty: any;
@@ -95,6 +95,7 @@ declare module fng {
9595
getListData: any;
9696
dismissError: any;
9797
handleHttpError(response: any): void;
98+
dropConversionWatcher: () => void;
9899
}
99100
interface IBaseFormOptions {
100101
/**
@@ -288,7 +289,7 @@ declare module fng.services {
288289
* All methods should be state-less
289290
*
290291
*/
291-
function recordHandler($location: any, $window: any, $filter: any, $timeout: any, routingService: any, SubmissionsService: any, SchemasService: any): fng.IRecordHandler;
292+
function recordHandler($http: any, $location: any, $window: any, $filter: any, $timeout: any, routingService: any, SubmissionsService: any, SchemasService: any): fng.IRecordHandler;
292293
}
293294
declare module fng.services {
294295
function SchemasService($http: any): {

dist/forms-angular.js

Lines changed: 75 additions & 305 deletions
Large diffs are not rendered by default.

dist/forms-angular.min.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/directives/form.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,7 @@ module fng.directives {
116116
switch (fieldInfo.type) {
117117
case 'select' :
118118
if (fieldInfo.select2) {
119-
common += 'class="fng-select2' + allInputsVars.formControl + allInputsVars.compactClass + allInputsVars.sizeClassBS2 + '"';
120-
common += (fieldInfo.readonly ? ' readonly' : '');
121-
common += (fieldInfo.required ? ' ng-required="true"' : '');
122-
common += fieldInfo.add ? (' ' + fieldInfo.add + ' ') : '';
123-
if (fieldInfo.select2.fngAjax) {
124-
if (cssFrameworkService.framework() === 'bs2') {
125-
value = '<div class="input-append">';
126-
value += '<input ui-select2="' + fieldInfo.select2.fngAjax + '" ' + common + '>';
127-
value += '<button class="btn" type="button" data-select2-open="' + idString + '" ng-click="openSelect2($event)"><i class="icon-search"></i></button>';
128-
value += '</div>';
129-
} else {
130-
value = '<div class="input-group">';
131-
value += '<input ui-select2="' + fieldInfo.select2.fngAjax + '" ' + common + '>';
132-
value += '<span class="input-group-addon' + allInputsVars.compactClass + '" data-select2-open="' + idString + '" ';
133-
value += ' ng-click="openSelect2($event)"><i class="glyphicon glyphicon-search"></i></span>';
134-
value += '</div>';
135-
}
136-
} else if (fieldInfo.select2) {
137-
value = '<input ui-select2="' + fieldInfo.select2.s2query + '" ' + common + '>';
138-
}
119+
value = '<input placeholder="fng-select2 has been removed" readonly>';
139120
} else {
140121
common += (fieldInfo.readonly ? 'disabled ' : '');
141122
common += fieldInfo.add ? (' ' + fieldInfo.add + ' ') : '';
@@ -464,6 +445,7 @@ module fng.directives {
464445

465446
var callHandleField = true;
466447
if (info.directive) {
448+
console.log('We have a directive');
467449
var directiveName = info.directive;
468450
var newElement = '<' + directiveName + ' model="' + (options.model || 'record') + '"';
469451
var thisElement = element[0];

js/fng-types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module fng {
2323
updateDocument(dataToSave : any, options: any, scope: fng.IFormScope, ctrlState: any) : void;
2424
readRecord($scope: fng.IFormScope, ctrlState);
2525
scrollTheList($scope: fng.IFormScope);
26-
getListData(record, fieldName, select2List, listSchema);
26+
getListData(record, fieldName, listSchema);
2727
suffixCleanId(inst, suffix);
2828
setData(object, fieldname, element, value);
2929
setUpSelectOptions(lookupCollection, schemaElement, $scope: fng.IFormScope, ctrlState, handleSchema);
@@ -76,6 +76,7 @@ module fng {
7676
activeTabNo?: number;
7777
topLevelFormName: string; // The name of the form
7878
record: any;
79+
originalData: any; // the unconverted data read from the server
7980
phase: any;
8081
disableFunctions: any;
8182
dataEventFunctions: any;
@@ -85,7 +86,6 @@ module fng {
8586
conversions: any;
8687
pageSize: any;
8788
pagesLoaded: any;
88-
select2List: any;
8989
formSchema: Array<IFieldViewInfo>;
9090

9191
//functions
@@ -105,6 +105,7 @@ module fng {
105105
getListData: any;
106106
dismissError: any;
107107
handleHttpError(response: any): void;
108+
dropConversionWatcher: () => void;
108109
}
109110

110111
export interface IBaseFormOptions {

0 commit comments

Comments
 (0)