forms-angular 0.12.0-beta.217 → 0.12.0-beta.219
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 +183 -181
- package/dist/client/forms-angular.min.js +1 -1
- package/dist/client/index.d.ts +123 -12
- package/package.json +2 -2
|
@@ -13,8 +13,8 @@ var fng;
|
|
|
13
13
|
var directives;
|
|
14
14
|
(function (directives) {
|
|
15
15
|
/*@ngInject*/
|
|
16
|
-
modelControllerDropdown.$inject = ["
|
|
17
|
-
function modelControllerDropdown(
|
|
16
|
+
modelControllerDropdown.$inject = ["SecurityService"];
|
|
17
|
+
function modelControllerDropdown(SecurityService) {
|
|
18
18
|
var menuVisibilityStr;
|
|
19
19
|
var menuDisabledStr;
|
|
20
20
|
var itemVisibilityStr = "isHidden($index)";
|
|
@@ -23,8 +23,8 @@ var fng;
|
|
|
23
23
|
// the next-best alternative, which is one-time binding
|
|
24
24
|
var oneTimeBinding = fng.formsAngular.elemSecurityFuncBinding !== "normal";
|
|
25
25
|
var bindingStr = oneTimeBinding ? "::" : "";
|
|
26
|
-
if (
|
|
27
|
-
menuVisibilityStr = "ng-if=\"contextMenuId && !contextMenuHidden\" ".concat(
|
|
26
|
+
if (SecurityService.canDoSecurity("hidden")) {
|
|
27
|
+
menuVisibilityStr = "ng-if=\"contextMenuId && !contextMenuHidden\" ".concat(SecurityService.getHideableAttrs('{{ ::contextMenuId }}'));
|
|
28
28
|
if (oneTimeBinding) {
|
|
29
29
|
// because the isHidden(...) logic is highly likely to be model dependent, that cannot be one-time bound. to
|
|
30
30
|
// be able to combine one-time and regular binding, we'll use ng-if for the one-time bound stuff and ng-hide for the rest
|
|
@@ -33,20 +33,20 @@ var fng;
|
|
|
33
33
|
else if (fng.formsAngular.elemSecurityFuncBinding === "normal") {
|
|
34
34
|
itemVisibilityStr = "ng-hide=\"".concat(itemVisibilityStr, " || (!choice.divider && isSecurelyHidden(choice.id))\"");
|
|
35
35
|
}
|
|
36
|
-
itemVisibilityStr += " ".concat(
|
|
36
|
+
itemVisibilityStr += " ".concat(SecurityService.getHideableAttrs('{{ ::choice.id }}'));
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
39
|
menuVisibilityStr = "";
|
|
40
40
|
itemVisibilityStr = "ng-hide=\"".concat(itemVisibilityStr, "\"");
|
|
41
41
|
}
|
|
42
|
-
if (
|
|
43
|
-
menuDisabledStr = "disableable-link ng-disabled=\"contextMenuDisabled\" ".concat(
|
|
42
|
+
if (SecurityService.canDoSecurity("disabled")) {
|
|
43
|
+
menuDisabledStr = "disableable-link ng-disabled=\"contextMenuDisabled\" ".concat(SecurityService.getDisableableAttrs('{{ ::contextMenuId }}'));
|
|
44
44
|
// as ng-class is already being used, we'll add the .disabled class if the menu item is securely disabled using
|
|
45
45
|
// class="{{ }}". note that we "prevent" a disabled menu item from being clicked by checking for the DISABLED
|
|
46
46
|
// attribute in the doClick(...) function, and aborting if this is found.
|
|
47
47
|
// note that the 'normal' class introduced here might not actually do anything, but for one-time binding to work
|
|
48
48
|
// properly, we need a truthy value
|
|
49
|
-
itemDisabledStr += " class=\"{{ ".concat(bindingStr, "(!choice.divider && isSecurelyDisabled(choice.id)) ? 'disabled' : 'normal' }}\" ").concat(
|
|
49
|
+
itemDisabledStr += " class=\"{{ ".concat(bindingStr, "(!choice.divider && isSecurelyDisabled(choice.id)) ? 'disabled' : 'normal' }}\" ").concat(SecurityService.getDisableableAttrs('{{ ::choice.id }}'));
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
menuDisabledStr = "";
|
|
@@ -77,11 +77,11 @@ var fng;
|
|
|
77
77
|
var directives;
|
|
78
78
|
(function (directives) {
|
|
79
79
|
/*@ngInject*/
|
|
80
|
-
errorDisplay.$inject = ["
|
|
81
|
-
function errorDisplay(
|
|
80
|
+
errorDisplay.$inject = ["CssFrameworkService"];
|
|
81
|
+
function errorDisplay(CssFrameworkService) {
|
|
82
82
|
return {
|
|
83
83
|
restrict: 'E',
|
|
84
|
-
templateUrl: 'error-display-' +
|
|
84
|
+
templateUrl: 'error-display-' + CssFrameworkService.framework() + '.html'
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
directives.errorDisplay = errorDisplay;
|
|
@@ -131,8 +131,8 @@ var fng;
|
|
|
131
131
|
var directives;
|
|
132
132
|
(function (directives) {
|
|
133
133
|
/*@ngInject*/
|
|
134
|
-
fngLink.$inject = ["
|
|
135
|
-
function fngLink(
|
|
134
|
+
fngLink.$inject = ["RoutingService", "SubmissionsService"];
|
|
135
|
+
function fngLink(RoutingService, SubmissionsService) {
|
|
136
136
|
return {
|
|
137
137
|
restrict: 'E',
|
|
138
138
|
scope: { dataSrc: '&model' },
|
|
@@ -199,7 +199,7 @@ var fng;
|
|
|
199
199
|
newVal = undefined;
|
|
200
200
|
}
|
|
201
201
|
if (newVal) {
|
|
202
|
-
scope['link'] =
|
|
202
|
+
scope['link'] = RoutingService.buildUrl(ref + '/' + form + (newVal.id || newVal) + '/edit' + linktab);
|
|
203
203
|
}
|
|
204
204
|
else {
|
|
205
205
|
scope['link'] = undefined;
|
|
@@ -220,7 +220,7 @@ var fng;
|
|
|
220
220
|
if (typeof index !== 'undefined' && angular.isArray(newVal)) {
|
|
221
221
|
newVal = newVal[index];
|
|
222
222
|
}
|
|
223
|
-
scope['link'] =
|
|
223
|
+
scope['link'] = RoutingService.buildUrl(ref + '/' + form + newVal + '/edit' + linktab);
|
|
224
224
|
if (!scope['text']) {
|
|
225
225
|
SubmissionsService.getListAttributes(ref, newVal).then(function (response) {
|
|
226
226
|
var data = response.data;
|
|
@@ -267,11 +267,11 @@ var fng;
|
|
|
267
267
|
var directives;
|
|
268
268
|
(function (directives) {
|
|
269
269
|
/*@ngInject*/
|
|
270
|
-
formButtons.$inject = ["
|
|
271
|
-
function formButtons(
|
|
270
|
+
formButtons.$inject = ["CssFrameworkService"];
|
|
271
|
+
function formButtons(CssFrameworkService) {
|
|
272
272
|
return {
|
|
273
273
|
restrict: 'A',
|
|
274
|
-
templateUrl: 'form-button-' +
|
|
274
|
+
templateUrl: 'form-button-' + CssFrameworkService.framework() + '.html'
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
277
|
directives.formButtons = formButtons;
|
|
@@ -282,7 +282,7 @@ var fng;
|
|
|
282
282
|
(function (fng) {
|
|
283
283
|
var directives;
|
|
284
284
|
(function (directives) {
|
|
285
|
-
formInput.$inject = ["$compile", "$rootScope", "$filter", "$timeout", "
|
|
285
|
+
formInput.$inject = ["$compile", "$rootScope", "$filter", "$timeout", "CssFrameworkService", "FormGeneratorService", "FormMarkupHelperService", "SecurityService"];
|
|
286
286
|
var tabsSetupState;
|
|
287
287
|
(function (tabsSetupState) {
|
|
288
288
|
tabsSetupState[tabsSetupState["Y"] = 0] = "Y";
|
|
@@ -290,7 +290,7 @@ var fng;
|
|
|
290
290
|
tabsSetupState[tabsSetupState["Forced"] = 2] = "Forced";
|
|
291
291
|
})(tabsSetupState || (tabsSetupState = {}));
|
|
292
292
|
/*@ngInject*/
|
|
293
|
-
function formInput($compile, $rootScope, $filter, $timeout,
|
|
293
|
+
function formInput($compile, $rootScope, $filter, $timeout, CssFrameworkService, FormGeneratorService, FormMarkupHelperService, SecurityService) {
|
|
294
294
|
return {
|
|
295
295
|
restrict: 'EA',
|
|
296
296
|
link: function (scope, element, attrs) {
|
|
@@ -362,7 +362,7 @@ var fng;
|
|
|
362
362
|
}
|
|
363
363
|
var idString = fieldInfo.id;
|
|
364
364
|
if (fieldInfo.array || options.subschema) {
|
|
365
|
-
idString =
|
|
365
|
+
idString = FormMarkupHelperService.generateArrayElementIdString(idString, fieldInfo, options);
|
|
366
366
|
}
|
|
367
367
|
var nameString;
|
|
368
368
|
if (!modelString) {
|
|
@@ -393,7 +393,7 @@ var fng;
|
|
|
393
393
|
modelString += fieldInfo.name;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
var allInputsVars =
|
|
396
|
+
var allInputsVars = FormMarkupHelperService.allInputsVars(scope, fieldInfo, options, modelString, idString, nameString);
|
|
397
397
|
var common = allInputsVars.common;
|
|
398
398
|
var value;
|
|
399
399
|
isRequired = isRequired || fieldInfo.required;
|
|
@@ -405,7 +405,7 @@ var fng;
|
|
|
405
405
|
value = '<input placeholder="fng-select2 has been removed" readonly>';
|
|
406
406
|
}
|
|
407
407
|
else {
|
|
408
|
-
common +=
|
|
408
|
+
common += FormMarkupHelperService.handleReadOnlyDisabled(fieldInfo, scope).join(" ");
|
|
409
409
|
common += fieldInfo.add ? (' ' + fieldInfo.add + ' ') : '';
|
|
410
410
|
common += " aria-label=\"".concat(fieldInfo.label && fieldInfo.label !== "" ? fieldInfo.label : fieldInfo.name, "\" ");
|
|
411
411
|
value = '<select ' + common + 'class="' + allInputsVars.formControl.trim() + allInputsVars.compactClass + allInputsVars.sizeClassBS2 + '" ' + requiredStr + '>';
|
|
@@ -459,7 +459,7 @@ var fng;
|
|
|
459
459
|
case 'radio':
|
|
460
460
|
value = '';
|
|
461
461
|
common += requiredStr;
|
|
462
|
-
common +=
|
|
462
|
+
common += FormMarkupHelperService.handleReadOnlyDisabled(fieldInfo, scope).join(" ");
|
|
463
463
|
;
|
|
464
464
|
common += fieldInfo.add ? (' ' + fieldInfo.add + ' ') : '';
|
|
465
465
|
var separateLines = options.formstyle === 'vertical' || (options.formstyle !== 'inline' && !fieldInfo.inlineRadio);
|
|
@@ -491,17 +491,17 @@ var fng;
|
|
|
491
491
|
break;
|
|
492
492
|
case 'checkbox':
|
|
493
493
|
common += requiredStr;
|
|
494
|
-
common +=
|
|
494
|
+
common += FormMarkupHelperService.handleReadOnlyDisabled(fieldInfo, scope).join(" ");
|
|
495
495
|
;
|
|
496
496
|
common += fieldInfo.add ? (' ' + fieldInfo.add + ' ') : '';
|
|
497
|
-
value =
|
|
498
|
-
if (
|
|
497
|
+
value = FormMarkupHelperService.generateSimpleInput(common, fieldInfo, options);
|
|
498
|
+
if (CssFrameworkService.framework() === 'bs3') {
|
|
499
499
|
value = '<div class="checkbox">' + value + '</div>';
|
|
500
500
|
}
|
|
501
501
|
break;
|
|
502
502
|
default:
|
|
503
|
-
common +=
|
|
504
|
-
common +=
|
|
503
|
+
common += FormMarkupHelperService.addTextInputMarkup(allInputsVars, fieldInfo, requiredStr);
|
|
504
|
+
common += FormMarkupHelperService.handleReadOnlyDisabled(fieldInfo, scope).join(" ");
|
|
505
505
|
;
|
|
506
506
|
if (fieldInfo.type === 'textarea') {
|
|
507
507
|
if (fieldInfo.rows) {
|
|
@@ -515,17 +515,17 @@ var fng;
|
|
|
515
515
|
if (fieldInfo.editor === 'ckEditor') {
|
|
516
516
|
console.log('Deprecation Warning: "editor" property deprecated - use "add"');
|
|
517
517
|
common += 'ckeditor = "" ';
|
|
518
|
-
if (
|
|
518
|
+
if (CssFrameworkService.framework() === 'bs3') {
|
|
519
519
|
allInputsVars.sizeClassBS3 = 'col-xs-12';
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
value = '<textarea ' + common + '></textarea>';
|
|
523
523
|
}
|
|
524
524
|
else {
|
|
525
|
-
value =
|
|
525
|
+
value = FormMarkupHelperService.generateSimpleInput(common, fieldInfo, options);
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return FormMarkupHelperService.inputChrome(value, fieldInfo, options, allInputsVars);
|
|
529
529
|
};
|
|
530
530
|
var convertFormStyleToClass = function (aFormStyle) {
|
|
531
531
|
var result;
|
|
@@ -571,7 +571,7 @@ var fng;
|
|
|
571
571
|
// TODO Figure out tab history updates (check for other tab-history-todos)
|
|
572
572
|
// result.before = '<uib-tab deselect="tabDeselect($event, $selectedIndex)" select="updateQueryForTab(\'' + info.title + '\')" heading="' + info.title + '"'
|
|
573
573
|
var idStr = "".concat(_.camelCase(info.title), "Tab");
|
|
574
|
-
var visibility =
|
|
574
|
+
var visibility = SecurityService.considerVisibility(idStr, scope);
|
|
575
575
|
if (visibility.omit) {
|
|
576
576
|
// we already know this field should be invisible, so we needn't add anything for it
|
|
577
577
|
result.omit = true;
|
|
@@ -582,7 +582,7 @@ var fng;
|
|
|
582
582
|
// an angular expression to determine the visibility of this field later...
|
|
583
583
|
attrs_1 += " ".concat(visibility.visibilityAttr);
|
|
584
584
|
}
|
|
585
|
-
attrs_1 +=
|
|
585
|
+
attrs_1 += SecurityService.generateDisabledAttr(idStr, scope, { attr: "disable", attrRequiresValue: true }); // uib-tab expects 'disable="true"` rather than 'disabled="true"' or just disabled
|
|
586
586
|
result.before = "<uib-tab ".concat(attrs_1, " deselect=\"tabDeselect($event, $selectedIndex)\" select=\"updateQueryForTab('").concat(info.title, "')\" heading=\"").concat(info.title, "\"");
|
|
587
587
|
if (tabNo > 0) {
|
|
588
588
|
result.before += 'active="tabs[' + tabNo + '].active"';
|
|
@@ -669,7 +669,7 @@ var fng;
|
|
|
669
669
|
res += 'ng-show="' + info.showWhen + '"';
|
|
670
670
|
}
|
|
671
671
|
else {
|
|
672
|
-
res += 'ng-show="' +
|
|
672
|
+
res += 'ng-show="' + FormMarkupHelperService.generateNgShow(info.showWhen, model) + '"';
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
675
|
if (info.id && typeof info.id.replace === "function") {
|
|
@@ -681,7 +681,7 @@ var fng;
|
|
|
681
681
|
return res;
|
|
682
682
|
};
|
|
683
683
|
var handleField = function (info, options) {
|
|
684
|
-
var fieldChrome =
|
|
684
|
+
var fieldChrome = FormMarkupHelperService.fieldChrome(scope, info, options);
|
|
685
685
|
if (fieldChrome.omit) {
|
|
686
686
|
return "";
|
|
687
687
|
}
|
|
@@ -728,9 +728,9 @@ var fng;
|
|
|
728
728
|
var topButton = '';
|
|
729
729
|
if (info.unshift) {
|
|
730
730
|
topButton = '<button id="unshift_' + info.id + '_btn" class="add-btn btn btn-default btn-xs btn-mini form-btn" ng-click="unshift(\'' + info.name + '\',$event)">' +
|
|
731
|
-
'<i class="' +
|
|
731
|
+
'<i class="' + FormMarkupHelperService.glyphClass() + '-plus"></i> Add</button>';
|
|
732
732
|
}
|
|
733
|
-
if (
|
|
733
|
+
if (CssFrameworkService.framework() === 'bs3') {
|
|
734
734
|
template += '<div class="row schema-head"><div class="col-sm-offset-3">' + info.label + topButton + '</div></div>';
|
|
735
735
|
}
|
|
736
736
|
else {
|
|
@@ -744,7 +744,7 @@ var fng;
|
|
|
744
744
|
// handleReadOnlyDisabled() returns two strings - the 'disabled' attribute(s), and the 'disableable'
|
|
745
745
|
// attributes. for the purpose of deciding if / how to disable sorting if the list itself is
|
|
746
746
|
// disabled, we're only interested in the former...
|
|
747
|
-
var disableCond =
|
|
747
|
+
var disableCond = FormMarkupHelperService.handleReadOnlyDisabled(info, scope)[0];
|
|
748
748
|
// if we already know that the field is disabled (only possible when formsAngular.elemSecurityFuncBinding === "instant")
|
|
749
749
|
// then we don't need to add the sortable attribute at all
|
|
750
750
|
// otherwise, we need to include the ng-disabled on the <ol> so this can be referenced by the ui-sortable directive
|
|
@@ -756,17 +756,17 @@ var fng;
|
|
|
756
756
|
// if a "disabled + children" DOM effect is applied to the list, this should serve to disable all of the
|
|
757
757
|
// fields in the list sub-schema, along with the remove and add buttons for this list. the following
|
|
758
758
|
// string will be added to the list items and the add and remove buttons to identify this fact.
|
|
759
|
-
var disableableAncestorStr =
|
|
759
|
+
var disableableAncestorStr = FormMarkupHelperService.genDisableableAncestorStr(info.id);
|
|
760
760
|
template +=
|
|
761
761
|
"<li ng-form id=\"".concat(info.id, "List_{{$index}}\" name=\"form_").concat(niceName, "{{$index}}\" ").concat(disableableAncestorStr) +
|
|
762
762
|
" class=\"".concat(convertFormStyleToClass(info.formStyle)) +
|
|
763
|
-
" ".concat(
|
|
763
|
+
" ".concat(CssFrameworkService.framework() === 'bs2' ? 'row-fluid' : '') +
|
|
764
764
|
" ".concat(info.inlineHeaders ? 'width-controlled' : '') +
|
|
765
765
|
" ".concat(info.ngClass ? "ng-class:" + info.ngClass : '', "\"") +
|
|
766
766
|
" ng-repeat=\"subDoc in ".concat(model, " track by $index\"") +
|
|
767
767
|
" ".concat(info.filterable ? 'data-ng-hide="subDoc._hidden"' : '') +
|
|
768
768
|
">";
|
|
769
|
-
if (
|
|
769
|
+
if (CssFrameworkService.framework() === 'bs2') {
|
|
770
770
|
template += '<div class="row-fluid sub-doc">';
|
|
771
771
|
}
|
|
772
772
|
if (info.noRemove !== true || info.customSubDoc) {
|
|
@@ -780,11 +780,11 @@ var fng;
|
|
|
780
780
|
if (info.noRemove !== true) {
|
|
781
781
|
template += "<button ".concat(disableCond, " ").concat(info.noRemove ? 'ng-hide="' + info.noRemove + '"' : '', " name=\"remove_").concat(info.id, "_btn\" ng-click=\"remove('").concat(info.name, "', $index, $event)\"");
|
|
782
782
|
if (info.remove) {
|
|
783
|
-
template += ' class="remove-btn btn btn-mini btn-default btn-xs form-btn"><i class="' +
|
|
783
|
+
template += ' class="remove-btn btn btn-mini btn-default btn-xs form-btn"><i class="' + FormMarkupHelperService.glyphClass() + '-minus"></i> Remove';
|
|
784
784
|
}
|
|
785
785
|
else {
|
|
786
786
|
template += ' style="position: relative; z-index: 20;" type="button" class="close pull-right">';
|
|
787
|
-
if (
|
|
787
|
+
if (CssFrameworkService.framework() === 'bs3') {
|
|
788
788
|
template += '<span aria-hidden="true">×</span><span class="sr-only">Close</span>';
|
|
789
789
|
}
|
|
790
790
|
else {
|
|
@@ -814,7 +814,7 @@ var fng;
|
|
|
814
814
|
if (parts === null || parts === void 0 ? void 0 : parts.after) {
|
|
815
815
|
template += parts.after;
|
|
816
816
|
}
|
|
817
|
-
if (
|
|
817
|
+
if (CssFrameworkService.framework() === 'bs2') {
|
|
818
818
|
template += ' </div>';
|
|
819
819
|
}
|
|
820
820
|
template += '</li>';
|
|
@@ -837,7 +837,7 @@ var fng;
|
|
|
837
837
|
// adding disableableAncestorStr seems more correct than for it to have the disableable attribute
|
|
838
838
|
footer +=
|
|
839
839
|
"<button ".concat(hideCond, " ").concat(disableCond, " ").concat(disableableAncestorStr, " id=\"add_").concat(info.id, "_btn\" class=\"add-btn btn btn-default btn-xs btn-mini\" ng-click=\"add('").concat(info.name, "',$event)\">") +
|
|
840
|
-
" <i class=\"".concat(
|
|
840
|
+
" <i class=\"".concat(FormMarkupHelperService.glyphClass(), "-plus\"></i> Add ") +
|
|
841
841
|
"</button>";
|
|
842
842
|
}
|
|
843
843
|
if (info.noneIndicator) {
|
|
@@ -852,7 +852,7 @@ var fng;
|
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
if (footer !== '') {
|
|
855
|
-
if (
|
|
855
|
+
if (CssFrameworkService.framework() === 'bs3') {
|
|
856
856
|
template += "<div ".concat(hideCond, " class=\"row schema-foot\"><div class=\"col-sm-offset-3\">").concat(footer, "</div></div>");
|
|
857
857
|
}
|
|
858
858
|
else {
|
|
@@ -866,23 +866,23 @@ var fng;
|
|
|
866
866
|
}
|
|
867
867
|
else {
|
|
868
868
|
// Handle arrays here
|
|
869
|
-
var controlDivClasses =
|
|
869
|
+
var controlDivClasses = FormMarkupHelperService.controlDivClasses(options);
|
|
870
870
|
if (info.array) {
|
|
871
871
|
controlDivClasses.push('fng-array');
|
|
872
872
|
if (options.formstyle === 'inline' || options.formstyle === 'stacked') {
|
|
873
873
|
throw new Error('Cannot use arrays in an inline or stacked form');
|
|
874
874
|
}
|
|
875
|
-
template +=
|
|
875
|
+
template += FormMarkupHelperService.label(scope, info, info.type !== 'link', options);
|
|
876
876
|
var stashedHelp = info.help;
|
|
877
877
|
delete info.help;
|
|
878
878
|
var inputHtml = generateInput(info, info.type === 'link' ? null : 'arrayItem.x', true, options);
|
|
879
879
|
info.help = stashedHelp;
|
|
880
|
-
template +=
|
|
880
|
+
template += FormMarkupHelperService.handleArrayInputAndControlDiv(inputHtml, controlDivClasses, scope, info, options);
|
|
881
881
|
}
|
|
882
882
|
else {
|
|
883
883
|
// Single fields here
|
|
884
|
-
template +=
|
|
885
|
-
template +=
|
|
884
|
+
template += FormMarkupHelperService.label(scope, info, null, options);
|
|
885
|
+
template += FormMarkupHelperService.handleInputAndControlDiv(generateInput(info, null, options.required, options), controlDivClasses);
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
template += fieldChrome.closeTag;
|
|
@@ -1197,9 +1197,9 @@ var fng;
|
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
1199
1199
|
$rootScope.$broadcast('formInputDone', attrs.name);
|
|
1200
|
-
if (
|
|
1200
|
+
if (FormGeneratorService.updateDataDependentDisplay && theRecord && Object.keys(theRecord).length > 0) {
|
|
1201
1201
|
// If this is not a test force the data dependent updates to the DOM
|
|
1202
|
-
|
|
1202
|
+
FormGeneratorService.updateDataDependentDisplay(theRecord, null, true, scope);
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
@@ -1243,8 +1243,8 @@ var fng;
|
|
|
1243
1243
|
var controllers;
|
|
1244
1244
|
(function (controllers) {
|
|
1245
1245
|
/*@ngInject*/
|
|
1246
|
-
SearchCtrl.$inject = ["$scope", "$http", "$location", "
|
|
1247
|
-
function SearchCtrl($scope, $http, $location,
|
|
1246
|
+
SearchCtrl.$inject = ["$scope", "$http", "$location", "RoutingService"];
|
|
1247
|
+
function SearchCtrl($scope, $http, $location, RoutingService) {
|
|
1248
1248
|
var lastSearchSent;
|
|
1249
1249
|
var _isNotMobile;
|
|
1250
1250
|
_isNotMobile = (function () {
|
|
@@ -1312,8 +1312,8 @@ var fng;
|
|
|
1312
1312
|
$scope.focus = null;
|
|
1313
1313
|
};
|
|
1314
1314
|
function makeUrlNoHtml5Hash(result) {
|
|
1315
|
-
return result.url ?
|
|
1316
|
-
|
|
1315
|
+
return result.url ? RoutingService.html5hash() + result.url.replace('|id|', result.id) :
|
|
1316
|
+
RoutingService.buildOperationUrl('edit', result.resource, undefined, result.id, result.resourceTab);
|
|
1317
1317
|
}
|
|
1318
1318
|
$scope.$watch('searchTarget', function (newValue) {
|
|
1319
1319
|
if (newValue && newValue.length > 0) {
|
|
@@ -1326,7 +1326,7 @@ var fng;
|
|
|
1326
1326
|
if ($scope.searchTarget.length > 0) {
|
|
1327
1327
|
$scope.results = data.results;
|
|
1328
1328
|
$scope.results.forEach(function (result) {
|
|
1329
|
-
result.href =
|
|
1329
|
+
result.href = RoutingService.html5hash() + makeUrlNoHtml5Hash(result);
|
|
1330
1330
|
});
|
|
1331
1331
|
$scope.moreCount = data.moreCount;
|
|
1332
1332
|
if (data.results.length > 0) {
|
|
@@ -1361,11 +1361,11 @@ var fng;
|
|
|
1361
1361
|
var directives;
|
|
1362
1362
|
(function (directives) {
|
|
1363
1363
|
/*@ngInject*/
|
|
1364
|
-
globalSearch.$inject = ["
|
|
1365
|
-
function globalSearch(
|
|
1364
|
+
globalSearch.$inject = ["CssFrameworkService"];
|
|
1365
|
+
function globalSearch(CssFrameworkService) {
|
|
1366
1366
|
return {
|
|
1367
1367
|
restrict: 'AE',
|
|
1368
|
-
templateUrl: 'search-' +
|
|
1368
|
+
templateUrl: 'search-' + CssFrameworkService.framework() + '.html',
|
|
1369
1369
|
controller: fng.controllers.SearchCtrl
|
|
1370
1370
|
};
|
|
1371
1371
|
}
|
|
@@ -1440,7 +1440,7 @@ var fng;
|
|
|
1440
1440
|
var services;
|
|
1441
1441
|
(function (services) {
|
|
1442
1442
|
/*@ngInject*/
|
|
1443
|
-
function
|
|
1443
|
+
function AddAllService() {
|
|
1444
1444
|
this.getAddAllGroupOptions = function (scope, attrs, classes) {
|
|
1445
1445
|
return getAddAllOptions(scope, attrs, 'Group', classes);
|
|
1446
1446
|
};
|
|
@@ -1503,7 +1503,7 @@ var fng;
|
|
|
1503
1503
|
return classes + options;
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
|
-
services.
|
|
1506
|
+
services.AddAllService = AddAllService;
|
|
1507
1507
|
})(services = fng.services || (fng.services = {}));
|
|
1508
1508
|
})(fng || (fng = {}));
|
|
1509
1509
|
/// <reference path="../../../../node_modules/@types/angular/index.d.ts" />
|
|
@@ -1512,7 +1512,7 @@ var fng;
|
|
|
1512
1512
|
var services;
|
|
1513
1513
|
(function (services) {
|
|
1514
1514
|
/*@ngInject*/
|
|
1515
|
-
function
|
|
1515
|
+
function CssFrameworkService() {
|
|
1516
1516
|
// Bootstrap 3 is now the only supported framework
|
|
1517
1517
|
// Bootstrap 2 can be made to work - an example can be made available if you request on gitter.
|
|
1518
1518
|
var config = {
|
|
@@ -1571,7 +1571,7 @@ var fng;
|
|
|
1571
1571
|
}
|
|
1572
1572
|
};
|
|
1573
1573
|
}
|
|
1574
|
-
services.
|
|
1574
|
+
services.CssFrameworkService = CssFrameworkService;
|
|
1575
1575
|
})(services = fng.services || (fng.services = {}));
|
|
1576
1576
|
})(fng || (fng = {}));
|
|
1577
1577
|
/// <reference path="../../index.d.ts" />
|
|
@@ -1580,7 +1580,7 @@ var fng;
|
|
|
1580
1580
|
var services;
|
|
1581
1581
|
(function (services) {
|
|
1582
1582
|
/*@ngInject*/
|
|
1583
|
-
function
|
|
1583
|
+
function FngModelCtrlService($controller) {
|
|
1584
1584
|
return {
|
|
1585
1585
|
loadControllerAndMenu: function (sharedData, controllerName, level, needDivider, localScope) {
|
|
1586
1586
|
var locals = {}, addThis;
|
|
@@ -1638,8 +1638,8 @@ var fng;
|
|
|
1638
1638
|
}
|
|
1639
1639
|
};
|
|
1640
1640
|
}
|
|
1641
|
-
services.
|
|
1642
|
-
|
|
1641
|
+
services.FngModelCtrlService = FngModelCtrlService;
|
|
1642
|
+
FngModelCtrlService.$inject = ["$controller"];
|
|
1643
1643
|
})(services = fng.services || (fng.services = {}));
|
|
1644
1644
|
})(fng || (fng = {}));
|
|
1645
1645
|
/// <reference path="../../index.d.ts" />
|
|
@@ -1648,8 +1648,8 @@ var fng;
|
|
|
1648
1648
|
var services;
|
|
1649
1649
|
(function (services) {
|
|
1650
1650
|
/*@ngInject*/
|
|
1651
|
-
|
|
1652
|
-
function
|
|
1651
|
+
RoutingService.$inject = ["$injector", "$locationProvider"];
|
|
1652
|
+
function RoutingService($injector, $locationProvider) {
|
|
1653
1653
|
var config = {
|
|
1654
1654
|
// fixedRoutes: [] an array in the same format as builtInRoutes that is matched before the generic routes. Can be omitted
|
|
1655
1655
|
hashPrefix: '',
|
|
@@ -1868,8 +1868,8 @@ var fng;
|
|
|
1868
1868
|
return _buildOperationUrl(config.prefix, operation, modelName, formName, id, tab);
|
|
1869
1869
|
},
|
|
1870
1870
|
redirectTo: function () {
|
|
1871
|
-
return function (operation, scope,
|
|
1872
|
-
|
|
1871
|
+
return function (operation, scope, LocationService, id, tab) {
|
|
1872
|
+
LocationService.search({}); // Lose any search parameters
|
|
1873
1873
|
var urlStr;
|
|
1874
1874
|
if (operation === 'onDelete') {
|
|
1875
1875
|
if (config.onDelete) {
|
|
@@ -1887,14 +1887,14 @@ var fng;
|
|
|
1887
1887
|
else {
|
|
1888
1888
|
urlStr = _buildOperationUrl(config.prefix, operation, scope.modelName, scope.formName, id, tab);
|
|
1889
1889
|
}
|
|
1890
|
-
|
|
1890
|
+
LocationService.path(urlStr);
|
|
1891
1891
|
};
|
|
1892
1892
|
}
|
|
1893
1893
|
};
|
|
1894
1894
|
}
|
|
1895
1895
|
};
|
|
1896
1896
|
}
|
|
1897
|
-
services.
|
|
1897
|
+
services.RoutingService = RoutingService;
|
|
1898
1898
|
})(services = fng.services || (fng.services = {}));
|
|
1899
1899
|
})(fng || (fng = {}));
|
|
1900
1900
|
/// <reference path="../../index.d.ts" />
|
|
@@ -1909,7 +1909,7 @@ var fng;
|
|
|
1909
1909
|
* All methods should be state-less
|
|
1910
1910
|
*
|
|
1911
1911
|
*/
|
|
1912
|
-
function
|
|
1912
|
+
function FormGeneratorService($filter, RoutingService, RecordHandlerService, SecurityService) {
|
|
1913
1913
|
function handleSchema(description, source, destForm, destList, prefix, doRecursion, $scope, ctrlState) {
|
|
1914
1914
|
function handletabInfo(tabName, thisInst) {
|
|
1915
1915
|
var tabTitle = angular.copy(tabName);
|
|
@@ -2017,18 +2017,18 @@ var fng;
|
|
|
2017
2017
|
function handleFieldType(formInstructions, mongooseType, mongooseOptions, $scope, ctrlState) {
|
|
2018
2018
|
var _a;
|
|
2019
2019
|
function performLookupSelect() {
|
|
2020
|
-
formInstructions.options =
|
|
2021
|
-
formInstructions.ids =
|
|
2020
|
+
formInstructions.options = RecordHandlerService.suffixCleanId(formInstructions, 'Options');
|
|
2021
|
+
formInstructions.ids = RecordHandlerService.suffixCleanId(formInstructions, '_ids');
|
|
2022
2022
|
if (!formInstructions.hidden) {
|
|
2023
2023
|
if (mongooseOptions.ref) {
|
|
2024
|
-
|
|
2024
|
+
RecordHandlerService.setUpLookupOptions(mongooseOptions.ref, formInstructions, $scope, ctrlState, handleSchema);
|
|
2025
2025
|
}
|
|
2026
2026
|
else if (mongooseOptions.lookupListRef) {
|
|
2027
|
-
|
|
2027
|
+
RecordHandlerService.setUpLookupListOptions(mongooseOptions.lookupListRef, formInstructions, $scope, ctrlState);
|
|
2028
2028
|
formInstructions.lookupListRef = mongooseOptions.lookupListRef;
|
|
2029
2029
|
}
|
|
2030
2030
|
else if (mongooseOptions.internalRef) {
|
|
2031
|
-
|
|
2031
|
+
RecordHandlerService.handleInternalLookup($scope, formInstructions, mongooseOptions.internalRef);
|
|
2032
2032
|
formInstructions.internalRef = mongooseOptions.internalRef;
|
|
2033
2033
|
}
|
|
2034
2034
|
else if (mongooseOptions.customLookupOptions) {
|
|
@@ -2054,9 +2054,9 @@ var fng;
|
|
|
2054
2054
|
console.log('support for fng-select2 has been removed in 0.8.3 - please convert to fng-ui-select');
|
|
2055
2055
|
}
|
|
2056
2056
|
else {
|
|
2057
|
-
formInstructions.options =
|
|
2057
|
+
formInstructions.options = RecordHandlerService.suffixCleanId(formInstructions, 'Options');
|
|
2058
2058
|
if ((_a = mongooseOptions.form) === null || _a === void 0 ? void 0 : _a.enumLabels) {
|
|
2059
|
-
formInstructions.ids =
|
|
2059
|
+
formInstructions.ids = RecordHandlerService.suffixCleanId(formInstructions, '_ids');
|
|
2060
2060
|
$scope[formInstructions.ids] = mongooseOptions.enum;
|
|
2061
2061
|
$scope[formInstructions.options] = mongooseOptions.form.enumLabels;
|
|
2062
2062
|
}
|
|
@@ -2142,7 +2142,7 @@ var fng;
|
|
|
2142
2142
|
}
|
|
2143
2143
|
}
|
|
2144
2144
|
else {
|
|
2145
|
-
throw new Error('Field ' + formInstructions.name + ' is of unsupported type ' + mongooseType.instance);
|
|
2145
|
+
throw new Error('Field ' + formInstructions.name + ' is of unsupported type "' + mongooseType.instance + '" (typeof ' + typeof mongooseType.instance + ')');
|
|
2146
2146
|
}
|
|
2147
2147
|
if (mongooseOptions.required) {
|
|
2148
2148
|
formInstructions.required = true;
|
|
@@ -2224,11 +2224,11 @@ var fng;
|
|
|
2224
2224
|
var sideParts = side.split('.');
|
|
2225
2225
|
switch (sideParts.length) {
|
|
2226
2226
|
case 1:
|
|
2227
|
-
result =
|
|
2227
|
+
result = RecordHandlerService.getListData(data, side.slice(1));
|
|
2228
2228
|
break;
|
|
2229
2229
|
case 2:
|
|
2230
2230
|
// this is a sub schema element, and the appropriate array element has been passed
|
|
2231
|
-
result =
|
|
2231
|
+
result = RecordHandlerService.getListData(data, sideParts[1]);
|
|
2232
2232
|
break;
|
|
2233
2233
|
default:
|
|
2234
2234
|
throw new Error('Unsupported showIf format');
|
|
@@ -2275,13 +2275,13 @@ var fng;
|
|
|
2275
2275
|
return {
|
|
2276
2276
|
// utility for apps that use forms-angular
|
|
2277
2277
|
generateEditUrl: function generateEditUrl(obj, $scope) {
|
|
2278
|
-
return
|
|
2278
|
+
return RoutingService.buildUrl($scope.modelName + '/' + ($scope.formName ? $scope.formName + '/' : '') + obj._id + '/edit');
|
|
2279
2279
|
},
|
|
2280
2280
|
generateViewUrl: function generateViewUrl(obj, $scope) {
|
|
2281
|
-
return
|
|
2281
|
+
return RoutingService.buildUrl($scope.modelName + '/' + ($scope.formName ? $scope.formName + '/' : '') + obj._id + '/view');
|
|
2282
2282
|
},
|
|
2283
2283
|
generateNewUrl: function generateNewUrl($scope) {
|
|
2284
|
-
return
|
|
2284
|
+
return RoutingService.buildUrl($scope.modelName + '/' + ($scope.formName ? $scope.formName + '/' : '') + 'new');
|
|
2285
2285
|
},
|
|
2286
2286
|
handleFieldType: handleFieldType,
|
|
2287
2287
|
handleSchema: handleSchema,
|
|
@@ -2461,7 +2461,7 @@ var fng;
|
|
|
2461
2461
|
$scope.pageSize = 60;
|
|
2462
2462
|
$scope.pagesLoaded = 0;
|
|
2463
2463
|
sharedData.baseScope = $scope;
|
|
2464
|
-
|
|
2464
|
+
SecurityService.decorateSecurableScope($scope, { pseudoUrl: pseudoUrl });
|
|
2465
2465
|
$scope.generateEditUrl = function (obj) {
|
|
2466
2466
|
return formGeneratorInstance.generateEditUrl(obj, $scope);
|
|
2467
2467
|
};
|
|
@@ -2534,8 +2534,8 @@ var fng;
|
|
|
2534
2534
|
}
|
|
2535
2535
|
};
|
|
2536
2536
|
}
|
|
2537
|
-
services.
|
|
2538
|
-
|
|
2537
|
+
services.FormGeneratorService = FormGeneratorService;
|
|
2538
|
+
FormGeneratorService.$inject = ["$filter", "RoutingService", "RecordHandlerService", "SecurityService"];
|
|
2539
2539
|
})(services = fng.services || (fng.services = {}));
|
|
2540
2540
|
})(fng || (fng = {}));
|
|
2541
2541
|
/// <reference path="../../index.d.ts" />
|
|
@@ -2544,8 +2544,8 @@ var fng;
|
|
|
2544
2544
|
var services;
|
|
2545
2545
|
(function (services) {
|
|
2546
2546
|
/*@ngInject*/
|
|
2547
|
-
|
|
2548
|
-
function
|
|
2547
|
+
FormMarkupHelperService.$inject = ["CssFrameworkService", "InputSizeHelperService", "AddAllService", "SecurityService", "$filter"];
|
|
2548
|
+
function FormMarkupHelperService(CssFrameworkService, InputSizeHelperService, AddAllService, SecurityService, $filter) {
|
|
2549
2549
|
function generateNgShow(showWhen, model) {
|
|
2550
2550
|
function evaluateSide(side) {
|
|
2551
2551
|
var result = side;
|
|
@@ -2573,22 +2573,23 @@ var fng;
|
|
|
2573
2573
|
}
|
|
2574
2574
|
return evaluateSide(showWhen.lhs) + conditionSymbols[conditionPos] + evaluateSide(showWhen.rhs);
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
function isHorizontalStyle(formStyle, includeStacked) {
|
|
2577
2577
|
var exclude = ['vertical', 'inline'];
|
|
2578
2578
|
if (!includeStacked) {
|
|
2579
2579
|
exclude.push('stacked');
|
|
2580
2580
|
}
|
|
2581
2581
|
return (!formStyle || formStyle === 'undefined' || !exclude.includes(formStyle));
|
|
2582
|
-
}
|
|
2582
|
+
}
|
|
2583
|
+
;
|
|
2583
2584
|
function glyphClass() {
|
|
2584
|
-
return (
|
|
2585
|
+
return (CssFrameworkService.framework() === 'bs2' ? 'icon' : 'glyphicon glyphicon');
|
|
2585
2586
|
}
|
|
2586
2587
|
// Generate two strings:
|
|
2587
2588
|
// 1. firstly, attribute(s) that could be added to element(s) representing the field with the given
|
|
2588
2589
|
// parameters to enable or disable it according to the prevailing security rules.
|
|
2589
2590
|
// 2. secondly, attribute(s) that could be added to a element - regardless of whether or not it will
|
|
2590
2591
|
// actually be disabled on this occasion - to identify it as being potentially disableable
|
|
2591
|
-
// This function is a more complicated version of
|
|
2592
|
+
// This function is a more complicated version of SecurityService.generateDisabledAttr, also taking into
|
|
2592
2593
|
// account the fact that fieldInfo.readonly can influence the disabled state of a field.
|
|
2593
2594
|
// nonUniqueId should be required only in cases where a sub-sub schema has been defined in a directive
|
|
2594
2595
|
// as a means of getting around the single-level-of-nesting limitation. in that case, where the
|
|
@@ -2609,7 +2610,7 @@ var fng;
|
|
|
2609
2610
|
function wrapReadOnly() {
|
|
2610
2611
|
return partialFieldInfo.readonly ? " ng-disabled=\"".concat(partialFieldInfo.readonly, "\" ") : "";
|
|
2611
2612
|
}
|
|
2612
|
-
if (!id || !
|
|
2613
|
+
if (!id || !SecurityService.canDoSecurityNow(scope, "disabled")) {
|
|
2613
2614
|
// no security, so we're just concerned about what value fieldInfo.readonly has
|
|
2614
2615
|
return wrapReadOnly();
|
|
2615
2616
|
}
|
|
@@ -2677,7 +2678,7 @@ var fng;
|
|
|
2677
2678
|
return " ng-disabled=\"".concat(oneTimeBinding ? "::" : "").concat(securityFuncStr, "\" ");
|
|
2678
2679
|
}
|
|
2679
2680
|
}
|
|
2680
|
-
return [getActuallyDisabledAttr(),
|
|
2681
|
+
return [getActuallyDisabledAttr(), SecurityService.getDisableableAttrs(id)];
|
|
2681
2682
|
}
|
|
2682
2683
|
function generateArrayElementIdString(idString, info, options) {
|
|
2683
2684
|
if (options.subschema && options.model) {
|
|
@@ -2698,7 +2699,7 @@ var fng;
|
|
|
2698
2699
|
}
|
|
2699
2700
|
}
|
|
2700
2701
|
function genDisableableAncestorStr(id) {
|
|
2701
|
-
return
|
|
2702
|
+
return SecurityService.getDisableableAncestorAttrs(id);
|
|
2702
2703
|
}
|
|
2703
2704
|
function isArrayElement(scope, info, options) {
|
|
2704
2705
|
return scope["$index"] !== undefined || !!options.subschema;
|
|
@@ -2734,7 +2735,7 @@ var fng;
|
|
|
2734
2735
|
idStr = "cg_".concat(info.id.replace(/\./g, '-'));
|
|
2735
2736
|
}
|
|
2736
2737
|
uniqueIdStr = "cg_".concat(uniqueIdStr.replace(/\./g, '-'));
|
|
2737
|
-
var visibility =
|
|
2738
|
+
var visibility = SecurityService.considerVisibility(uniqueIdStr, scope);
|
|
2738
2739
|
if (visibility.omit) {
|
|
2739
2740
|
// we already know this field should be invisible, so we needn't add anything for it
|
|
2740
2741
|
return { omit: true };
|
|
@@ -2757,11 +2758,11 @@ var fng;
|
|
|
2757
2758
|
insert += ' ng-show="' + generateNgShow(info.showWhen, options.model) + '"';
|
|
2758
2759
|
}
|
|
2759
2760
|
}
|
|
2760
|
-
if (
|
|
2761
|
+
if (CssFrameworkService.framework() === 'bs3') {
|
|
2761
2762
|
classes += ' form-group';
|
|
2762
2763
|
if (options.formstyle === 'vertical' && info.size !== 'block-level') {
|
|
2763
2764
|
template += '<div class="row">';
|
|
2764
|
-
classes += ' col-sm-' +
|
|
2765
|
+
classes += ' col-sm-' + InputSizeHelperService.sizeAsNumber(info.size);
|
|
2765
2766
|
closeTag += '</div>';
|
|
2766
2767
|
}
|
|
2767
2768
|
var modelControllerName;
|
|
@@ -2777,12 +2778,12 @@ var fng;
|
|
|
2777
2778
|
else {
|
|
2778
2779
|
modelControllerName = 'f_' + info.name.replace(/\./g, '_');
|
|
2779
2780
|
}
|
|
2780
|
-
template += '<div' +
|
|
2781
|
+
template += '<div' + AddAllService.addAll(scope, 'Group', classes, options) + ' ng-class="{\'has-error\': hasError(\'' + formName + '\',\'' + modelControllerName + '\', $index)}"';
|
|
2781
2782
|
closeTag += '</div>';
|
|
2782
2783
|
}
|
|
2783
2784
|
else {
|
|
2784
2785
|
if (isHorizontalStyle(options.formstyle, true)) {
|
|
2785
|
-
template += '<div' +
|
|
2786
|
+
template += '<div' + AddAllService.addAll(scope, 'Group', 'control-group', options);
|
|
2786
2787
|
closeTag = '</div>';
|
|
2787
2788
|
}
|
|
2788
2789
|
else {
|
|
@@ -2795,7 +2796,7 @@ var fng;
|
|
|
2795
2796
|
},
|
|
2796
2797
|
label: function label(scope, fieldInfo, addButtonMarkup, options) {
|
|
2797
2798
|
var labelHTML = '';
|
|
2798
|
-
if ((
|
|
2799
|
+
if ((CssFrameworkService.framework() === 'bs3' || (!['inline', 'stacked'].includes(options.formstyle) && fieldInfo.label !== '')) || addButtonMarkup) {
|
|
2799
2800
|
labelHTML = '<label';
|
|
2800
2801
|
var classes = 'control-label';
|
|
2801
2802
|
if (isHorizontalStyle(options.formstyle, false)) {
|
|
@@ -2806,7 +2807,7 @@ var fng;
|
|
|
2806
2807
|
// Override default label class (can be empty)
|
|
2807
2808
|
classes += ' ' + fieldInfo.labelDefaultClass;
|
|
2808
2809
|
}
|
|
2809
|
-
else if (
|
|
2810
|
+
else if (CssFrameworkService.framework() === 'bs3') {
|
|
2810
2811
|
classes += ' col-sm-3';
|
|
2811
2812
|
}
|
|
2812
2813
|
}
|
|
@@ -2814,7 +2815,7 @@ var fng;
|
|
|
2814
2815
|
labelHTML += ' for="' + fieldInfo.id + '"';
|
|
2815
2816
|
classes += ' sr-only';
|
|
2816
2817
|
}
|
|
2817
|
-
labelHTML +=
|
|
2818
|
+
labelHTML += AddAllService.addAll(scope, 'Label', null, options) + ' class="' + classes + '">' + fieldInfo.label;
|
|
2818
2819
|
if (addButtonMarkup) {
|
|
2819
2820
|
var disabledAttrs = handleReadOnlyDisabled(fieldInfo, scope);
|
|
2820
2821
|
labelHTML += " <i ".concat(disabledAttrs.join(" "), " id=\"add_").concat(fieldInfo.id, "\" ng-click=\"add('").concat(fieldInfo.name, "', $event)\" class=\"").concat(glyphClass(), "-plus-sign\"></i>");
|
|
@@ -2842,9 +2843,9 @@ var fng;
|
|
|
2842
2843
|
var sizeClassBS3 = '';
|
|
2843
2844
|
var sizeClassBS2 = '';
|
|
2844
2845
|
var formControl = '';
|
|
2845
|
-
if (
|
|
2846
|
+
if (CssFrameworkService.framework() === 'bs3') {
|
|
2846
2847
|
compactClass = (['horizontal', 'vertical', 'inline'].indexOf(options.formstyle) === -1) ? ' input-sm' : '';
|
|
2847
|
-
sizeClassBS3 = 'col-sm-' +
|
|
2848
|
+
sizeClassBS3 = 'col-sm-' + InputSizeHelperService.sizeAsNumber(fieldInfo.size);
|
|
2848
2849
|
formControl = ' form-control';
|
|
2849
2850
|
}
|
|
2850
2851
|
else {
|
|
@@ -2872,7 +2873,7 @@ var fng;
|
|
|
2872
2873
|
if (fieldInfo.ariaLabel) {
|
|
2873
2874
|
common += " aria-label=\"".concat(fieldInfo.ariaLabel, "\"");
|
|
2874
2875
|
}
|
|
2875
|
-
common +=
|
|
2876
|
+
common += AddAllService.addAll(scope, 'Field', null, options);
|
|
2876
2877
|
return {
|
|
2877
2878
|
common: common,
|
|
2878
2879
|
sizeClassBS3: sizeClassBS3,
|
|
@@ -2882,13 +2883,13 @@ var fng;
|
|
|
2882
2883
|
};
|
|
2883
2884
|
},
|
|
2884
2885
|
inputChrome: function inputChrome(value, fieldInfo, options, markupVars) {
|
|
2885
|
-
if (
|
|
2886
|
+
if (CssFrameworkService.framework() === 'bs3' && isHorizontalStyle(options.formstyle, true) && fieldInfo.type !== 'checkbox') {
|
|
2886
2887
|
value = '<div class="bs3-input ' + markupVars.sizeClassBS3 + '">' + value + '</div>';
|
|
2887
2888
|
}
|
|
2888
2889
|
// Hack to cope with inline help in directives
|
|
2889
2890
|
var inlineHelp = (fieldInfo.helpInline || '') + (fieldInfo.helpinline || '');
|
|
2890
2891
|
if (inlineHelp.length > 0) {
|
|
2891
|
-
var helpMarkup =
|
|
2892
|
+
var helpMarkup = CssFrameworkService.framework() === 'bs2' ? { el: 'span', cl: 'help-inline' } : { el: 'div', cl: 'help-block' };
|
|
2892
2893
|
value += "<".concat(helpMarkup.el, " class=\"").concat(helpMarkup.cl, "\">").concat(inlineHelp, "</").concat(helpMarkup.el, ">");
|
|
2893
2894
|
}
|
|
2894
2895
|
// this is a dummy tag identifying where the input ends and the messages block (that is only visible when the form field is $dirty)
|
|
@@ -2915,7 +2916,7 @@ var fng;
|
|
|
2915
2916
|
else if (options.subschema) {
|
|
2916
2917
|
result += "aria-label=\"".concat(fieldInfo.label ? ($filter('titleCase')(options.subschemaroot) + ' ' + fieldInfo.label) : (fieldInfo.popup || fieldInfo.name.replace(/\./g, ' ')), "\" ");
|
|
2917
2918
|
}
|
|
2918
|
-
if (options.formstyle === 'inline' &&
|
|
2919
|
+
if (options.formstyle === 'inline' && CssFrameworkService.framework() === 'bs2' && !fieldInfo.size) {
|
|
2919
2920
|
result += 'class="input-small"';
|
|
2920
2921
|
}
|
|
2921
2922
|
result += ' />';
|
|
@@ -2924,7 +2925,7 @@ var fng;
|
|
|
2924
2925
|
controlDivClasses: function controlDivClasses(options) {
|
|
2925
2926
|
var result = [];
|
|
2926
2927
|
if (isHorizontalStyle(options.formstyle, false)) {
|
|
2927
|
-
result.push(
|
|
2928
|
+
result.push(CssFrameworkService.framework() === 'bs2' ? 'controls' : 'col-sm-9');
|
|
2928
2929
|
}
|
|
2929
2930
|
return result;
|
|
2930
2931
|
},
|
|
@@ -2935,7 +2936,7 @@ var fng;
|
|
|
2935
2936
|
return inputMarkup;
|
|
2936
2937
|
},
|
|
2937
2938
|
handleArrayInputAndControlDiv: function handleArrayInputAndControlDiv(inputMarkup, controlDivClasses, scope, info, options) {
|
|
2938
|
-
var indentStr =
|
|
2939
|
+
var indentStr = CssFrameworkService.framework() === 'bs3' ? 'ng-class="skipCols($index)" ' : "";
|
|
2939
2940
|
var arrayStr = (options.model || 'record') + '.' + info.name;
|
|
2940
2941
|
var result = "";
|
|
2941
2942
|
result += '<div id="' + info.id + 'List" class="' + controlDivClasses.join(' ') + '" ' + indentStr + ' ng-repeat="arrayItem in ' + arrayStr + ' track by $index">';
|
|
@@ -2945,7 +2946,7 @@ var fng;
|
|
|
2945
2946
|
: "";
|
|
2946
2947
|
result += inputMarkup.replace("<dms/>", removeBtn);
|
|
2947
2948
|
result += '</div>';
|
|
2948
|
-
indentStr =
|
|
2949
|
+
indentStr = CssFrameworkService.framework() === 'bs3' ? 'ng-class="skipCols(' + arrayStr + '.length)" ' : "";
|
|
2949
2950
|
if (info.help) {
|
|
2950
2951
|
result += '<div class="array-help-block ' + controlDivClasses.join(' ') + '" ' + indentStr + ' id="empty' + info.id + 'ListHelpBlock">' + info.help + '</div>';
|
|
2951
2952
|
}
|
|
@@ -2965,10 +2966,11 @@ var fng;
|
|
|
2965
2966
|
},
|
|
2966
2967
|
handleReadOnlyDisabled: handleReadOnlyDisabled,
|
|
2967
2968
|
generateArrayElementIdString: generateArrayElementIdString,
|
|
2968
|
-
genDisableableAncestorStr: genDisableableAncestorStr
|
|
2969
|
+
genDisableableAncestorStr: genDisableableAncestorStr,
|
|
2970
|
+
generateNgShow: generateNgShow
|
|
2969
2971
|
};
|
|
2970
2972
|
}
|
|
2971
|
-
services.
|
|
2973
|
+
services.FormMarkupHelperService = FormMarkupHelperService;
|
|
2972
2974
|
})(services = fng.services || (fng.services = {}));
|
|
2973
2975
|
})(fng || (fng = {}));
|
|
2974
2976
|
/// <reference path="../../../../node_modules/@types/angular/index.d.ts" />
|
|
@@ -2977,7 +2979,7 @@ var fng;
|
|
|
2977
2979
|
var services;
|
|
2978
2980
|
(function (services) {
|
|
2979
2981
|
/*@ngInject*/
|
|
2980
|
-
function
|
|
2982
|
+
function InputSizeHelperService() {
|
|
2981
2983
|
var sizeMapping = [1, 2, 4, 6, 8, 10, 12];
|
|
2982
2984
|
var sizeDescriptions = ['mini', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'block-level'];
|
|
2983
2985
|
var defaultSizeOffset = 2; // medium, which was the default for Twitter Bootstrap 2
|
|
@@ -2990,7 +2992,7 @@ var fng;
|
|
|
2990
2992
|
}
|
|
2991
2993
|
};
|
|
2992
2994
|
}
|
|
2993
|
-
services.
|
|
2995
|
+
services.InputSizeHelperService = InputSizeHelperService;
|
|
2994
2996
|
})(services = fng.services || (fng.services = {}));
|
|
2995
2997
|
})(fng || (fng = {}));
|
|
2996
2998
|
/// <reference path="../../../../node_modules/@types/angular/index.d.ts" />
|
|
@@ -3002,8 +3004,8 @@ var fng;
|
|
|
3002
3004
|
A helper service to provide a starting off point for directive plugins
|
|
3003
3005
|
*/
|
|
3004
3006
|
/*@ngInject*/
|
|
3005
|
-
|
|
3006
|
-
function
|
|
3007
|
+
PluginHelperService.$inject = ["FormMarkupHelperService"];
|
|
3008
|
+
function PluginHelperService(FormMarkupHelperService) {
|
|
3007
3009
|
function internalGenDisabledAttrs(scope, id, processedAttrs, idSuffix, params) {
|
|
3008
3010
|
// Though id will already have the value of idSuffix appended, processedAttrs.info.name will not.
|
|
3009
3011
|
// For handleReadOnlyDisabled() to disable "sub-elements" included in a directive template with an idsuffix when their
|
|
@@ -3029,7 +3031,7 @@ var fng;
|
|
|
3029
3031
|
name += ".".concat(idSuffix);
|
|
3030
3032
|
}
|
|
3031
3033
|
}
|
|
3032
|
-
var attrs =
|
|
3034
|
+
var attrs = FormMarkupHelperService.handleReadOnlyDisabled({
|
|
3033
3035
|
id: id,
|
|
3034
3036
|
name: name,
|
|
3035
3037
|
nonUniqueId: processedAttrs.info.nonuniqueid,
|
|
@@ -3063,8 +3065,8 @@ var fng;
|
|
|
3063
3065
|
return result;
|
|
3064
3066
|
}
|
|
3065
3067
|
function makeIdStringUniqueForArrayElements(scope, processedAttrs, idString) {
|
|
3066
|
-
if (
|
|
3067
|
-
return
|
|
3068
|
+
if (FormMarkupHelperService.isArrayElement(scope, processedAttrs.info, processedAttrs.options)) {
|
|
3069
|
+
return FormMarkupHelperService.generateArrayElementIdString(idString, processedAttrs.info, processedAttrs.options);
|
|
3068
3070
|
}
|
|
3069
3071
|
else {
|
|
3070
3072
|
return idString;
|
|
@@ -3187,15 +3189,15 @@ var fng;
|
|
|
3187
3189
|
Object.assign(info, params.fieldInfoOverrides);
|
|
3188
3190
|
}
|
|
3189
3191
|
var options = Object.assign({}, processedAttrs.options, params.optionOverrides);
|
|
3190
|
-
var fieldChrome =
|
|
3192
|
+
var fieldChrome = FormMarkupHelperService.fieldChrome(scope, info, options);
|
|
3191
3193
|
if (fieldChrome.omit) {
|
|
3192
3194
|
return "";
|
|
3193
3195
|
}
|
|
3194
|
-
var controlDivClasses =
|
|
3195
|
-
var elementHtml = fieldChrome.template +
|
|
3196
|
+
var controlDivClasses = FormMarkupHelperService.controlDivClasses(options);
|
|
3197
|
+
var elementHtml = fieldChrome.template + FormMarkupHelperService.label(scope, info, params.addButtons, options);
|
|
3196
3198
|
var idString = info.id;
|
|
3197
3199
|
if (info.array || options.subschema) {
|
|
3198
|
-
idString =
|
|
3200
|
+
idString = FormMarkupHelperService.generateArrayElementIdString(idString, info, options);
|
|
3199
3201
|
}
|
|
3200
3202
|
var modelString = params.addButtons
|
|
3201
3203
|
? "arrayItem" + (params.needsX ? ".x" : "")
|
|
@@ -3216,19 +3218,19 @@ var fng;
|
|
|
3216
3218
|
nameString = info.name.replace(/\./g, "-");
|
|
3217
3219
|
}
|
|
3218
3220
|
}
|
|
3219
|
-
var buildingBlocks =
|
|
3221
|
+
var buildingBlocks = FormMarkupHelperService.allInputsVars(scope, info, options, modelString, idString, nameString);
|
|
3220
3222
|
buildingBlocks.modelString = modelString;
|
|
3221
|
-
buildingBlocks.disableableAncestorStr =
|
|
3223
|
+
buildingBlocks.disableableAncestorStr = FormMarkupHelperService.genDisableableAncestorStr(info.id);
|
|
3222
3224
|
// defer to the calling directive to generate the markup for the input(s)
|
|
3223
3225
|
var inputHtml = generateInputControl(buildingBlocks);
|
|
3224
3226
|
// wrap this in a div that puts it into the correct bootstrap 'column' and adds validation messages and help text
|
|
3225
|
-
var wrappedInputHtml =
|
|
3227
|
+
var wrappedInputHtml = FormMarkupHelperService.inputChrome(inputHtml, info, options, buildingBlocks);
|
|
3226
3228
|
// further wrap this to add the control div classes, and in the case of an array, the button that allows array elements to be removed
|
|
3227
3229
|
if (params.addButtons) {
|
|
3228
|
-
elementHtml +=
|
|
3230
|
+
elementHtml += FormMarkupHelperService.handleArrayInputAndControlDiv(wrappedInputHtml, controlDivClasses, scope, info, options);
|
|
3229
3231
|
}
|
|
3230
3232
|
else {
|
|
3231
|
-
elementHtml +=
|
|
3233
|
+
elementHtml += FormMarkupHelperService.handleInputAndControlDiv(wrappedInputHtml, controlDivClasses);
|
|
3232
3234
|
}
|
|
3233
3235
|
elementHtml += fieldChrome.closeTag;
|
|
3234
3236
|
return elementHtml;
|
|
@@ -3257,11 +3259,11 @@ var fng;
|
|
|
3257
3259
|
},
|
|
3258
3260
|
handlePseudos: handlePseudos,
|
|
3259
3261
|
genDisableableAncestorStr: function genDisableableAncestorStr(processedAttrs) {
|
|
3260
|
-
return
|
|
3262
|
+
return FormMarkupHelperService.genDisableableAncestorStr(processedAttrs.info.id);
|
|
3261
3263
|
}
|
|
3262
3264
|
};
|
|
3263
3265
|
}
|
|
3264
|
-
services.
|
|
3266
|
+
services.PluginHelperService = PluginHelperService;
|
|
3265
3267
|
})(services = fng.services || (fng.services = {}));
|
|
3266
3268
|
})(fng || (fng = {}));
|
|
3267
3269
|
/// <reference path="../../index.d.ts" />
|
|
@@ -3276,8 +3278,8 @@ var fng;
|
|
|
3276
3278
|
*
|
|
3277
3279
|
*/
|
|
3278
3280
|
/*@ngInject*/
|
|
3279
|
-
|
|
3280
|
-
function
|
|
3281
|
+
RecordHandlerService.$inject = ["$location", "$window", "$filter", "$timeout", "$sce", "RoutingService", "CssFrameworkService", "SubmissionsService", "SchemasService"];
|
|
3282
|
+
function RecordHandlerService($location, $window, $filter, $timeout, $sce, RoutingService, CssFrameworkService, SubmissionsService, SchemasService) {
|
|
3281
3283
|
// TODO: Put this in a service
|
|
3282
3284
|
var makeMongoId = function (rnd) {
|
|
3283
3285
|
if (rnd === void 0) { rnd = function (r16) { return Math.floor(r16).toString(16); }; }
|
|
@@ -4016,12 +4018,12 @@ var fng;
|
|
|
4016
4018
|
if (typeof $scope.dataEventFunctions.onAfterDelete === "function") {
|
|
4017
4019
|
$scope.dataEventFunctions.onAfterDelete(ctrlState.master);
|
|
4018
4020
|
}
|
|
4019
|
-
|
|
4021
|
+
RoutingService.redirectTo()("onDelete", $scope, $location);
|
|
4020
4022
|
}, function (err) {
|
|
4021
4023
|
var _a;
|
|
4022
4024
|
if (err.status === 404) {
|
|
4023
4025
|
// Someone already deleted it
|
|
4024
|
-
|
|
4026
|
+
RoutingService.redirectTo()("onDelete", $scope, $location);
|
|
4025
4027
|
}
|
|
4026
4028
|
else if (err.status === 403) {
|
|
4027
4029
|
$scope.showError(((_a = err.data) === null || _a === void 0 ? void 0 : _a.message) || err.message || err.data || err, 'Permission denied');
|
|
@@ -4071,7 +4073,7 @@ var fng;
|
|
|
4071
4073
|
$window.location = options.redirect;
|
|
4072
4074
|
}
|
|
4073
4075
|
else {
|
|
4074
|
-
|
|
4076
|
+
RoutingService.redirectTo()("edit", $scope, $location, data._id);
|
|
4075
4077
|
}
|
|
4076
4078
|
}
|
|
4077
4079
|
else {
|
|
@@ -4345,7 +4347,7 @@ var fng;
|
|
|
4345
4347
|
});
|
|
4346
4348
|
};
|
|
4347
4349
|
$scope.newClick = function () {
|
|
4348
|
-
|
|
4350
|
+
RoutingService.redirectTo()("new", $scope, $location);
|
|
4349
4351
|
};
|
|
4350
4352
|
$scope.$on("$locationChangeStart", function (event, next) {
|
|
4351
4353
|
// let changed = !$scope.isCancelDisabled();
|
|
@@ -4450,7 +4452,7 @@ var fng;
|
|
|
4450
4452
|
if (subFormName) {
|
|
4451
4453
|
$scope.whyDisabled += subFormName + ' ';
|
|
4452
4454
|
}
|
|
4453
|
-
if (
|
|
4455
|
+
if (CssFrameworkService.framework() === "bs2" &&
|
|
4454
4456
|
c.$$element &&
|
|
4455
4457
|
c.$$element.parent() &&
|
|
4456
4458
|
c.$$element.parent().parent() &&
|
|
@@ -4458,7 +4460,7 @@ var fng;
|
|
|
4458
4460
|
c.$$element.parent().parent().find("label").text()) {
|
|
4459
4461
|
$scope.whyDisabled += c.$$element.parent().parent().find("label").text();
|
|
4460
4462
|
}
|
|
4461
|
-
else if (
|
|
4463
|
+
else if (CssFrameworkService.framework() === "bs3" &&
|
|
4462
4464
|
c.$$element &&
|
|
4463
4465
|
c.$$element.parent() &&
|
|
4464
4466
|
c.$$element.parent().parent() &&
|
|
@@ -4620,7 +4622,7 @@ var fng;
|
|
|
4620
4622
|
}
|
|
4621
4623
|
};
|
|
4622
4624
|
}
|
|
4623
|
-
services.
|
|
4625
|
+
services.RecordHandlerService = RecordHandlerService;
|
|
4624
4626
|
})(services = fng.services || (fng.services = {}));
|
|
4625
4627
|
})(fng || (fng = {}));
|
|
4626
4628
|
/// <reference path="../../../../node_modules/@types/angular/index.d.ts" />
|
|
@@ -4646,8 +4648,8 @@ var fng;
|
|
|
4646
4648
|
var services;
|
|
4647
4649
|
(function (services) {
|
|
4648
4650
|
/*@ngInject*/
|
|
4649
|
-
|
|
4650
|
-
function
|
|
4651
|
+
SecurityService.$inject = ["$rootScope"];
|
|
4652
|
+
function SecurityService($rootScope) {
|
|
4651
4653
|
function canDoSecurity(type) {
|
|
4652
4654
|
return (!!fng.formsAngular.elemSecurityFuncBinding &&
|
|
4653
4655
|
((type === "hidden" && !!fng.formsAngular.hiddenSecurityFuncName) ||
|
|
@@ -4660,7 +4662,7 @@ var fng;
|
|
|
4660
4662
|
// currently no security rules to apply); and
|
|
4661
4663
|
// it has provided the callbacks that are specified in the security configuration; and
|
|
4662
4664
|
// the provided scope (if any) has been decorated (by us). pages and popups which aren't form controllers will need to use
|
|
4663
|
-
// (either directly, or through
|
|
4665
|
+
// (either directly, or through FormMarkupHelperService), the decorateSecurableScope() function below
|
|
4664
4666
|
(type === "hidden" &&
|
|
4665
4667
|
$rootScope[fng.formsAngular.hiddenSecurityFuncName] &&
|
|
4666
4668
|
(!scope || !!scope.isSecurelyHidden))
|
|
@@ -4853,7 +4855,7 @@ var fng;
|
|
|
4853
4855
|
},
|
|
4854
4856
|
};
|
|
4855
4857
|
}
|
|
4856
|
-
services.
|
|
4858
|
+
services.SecurityService = SecurityService;
|
|
4857
4859
|
})(services = fng.services || (fng.services = {}));
|
|
4858
4860
|
})(fng || (fng = {}));
|
|
4859
4861
|
/// <reference path="../../../../node_modules/@types/angular/index.d.ts" />
|
|
@@ -5053,8 +5055,8 @@ var fng;
|
|
|
5053
5055
|
var controllers;
|
|
5054
5056
|
(function (controllers) {
|
|
5055
5057
|
/*@ngInject*/
|
|
5056
|
-
BaseCtrl.$inject = ["$scope", "$rootScope", "$location", "$filter", "$uibModal", "
|
|
5057
|
-
function BaseCtrl($scope, $rootScope, $location, $filter, $uibModal,
|
|
5058
|
+
BaseCtrl.$inject = ["$scope", "$rootScope", "$location", "$filter", "$uibModal", "FngModelCtrlService", "RoutingService", "FormGeneratorService", "RecordHandlerService"];
|
|
5059
|
+
function BaseCtrl($scope, $rootScope, $location, $filter, $uibModal /*: angular.ui.bootstrap.IModalService <this is the correct type, but not available*/, FngModelCtrlService, RoutingService, FormGeneratorService, RecordHandlerService) {
|
|
5058
5060
|
$scope.sharedData = {
|
|
5059
5061
|
record: {},
|
|
5060
5062
|
disableFunctions: {},
|
|
@@ -5067,22 +5069,22 @@ var fng;
|
|
|
5067
5069
|
allowLocationChange: true // Set when the data arrives..
|
|
5068
5070
|
};
|
|
5069
5071
|
$scope.errorVisible = false;
|
|
5070
|
-
angular.extend($scope,
|
|
5072
|
+
angular.extend($scope, RoutingService.parsePathFunc()($location.$$path));
|
|
5071
5073
|
// Load context menu. For /person/client/:id/edit we need
|
|
5072
5074
|
// to load PersonCtrl and PersonClientCtrl
|
|
5073
5075
|
var titleCaseModelName = $filter('titleCase')($scope.modelName, true);
|
|
5074
5076
|
var needDivider = false;
|
|
5075
|
-
|
|
5077
|
+
FngModelCtrlService.loadControllerAndMenu($scope.sharedData, titleCaseModelName, 0, needDivider, $scope.$new());
|
|
5076
5078
|
if ($scope.formName) {
|
|
5077
|
-
|
|
5079
|
+
FngModelCtrlService.loadControllerAndMenu($scope.sharedData, titleCaseModelName + $filter('titleCase')($scope.formName, true), 1, needDivider, $scope.$new());
|
|
5078
5080
|
}
|
|
5079
5081
|
$rootScope.$broadcast('fngControllersLoaded', $scope.sharedData, $scope.modelName);
|
|
5080
5082
|
$scope.modelNameDisplay = $scope.sharedData.modelNameDisplay || $filter('titleCase')($scope.modelName);
|
|
5081
5083
|
$rootScope.$broadcast('fngFormLoadStart', $scope);
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
+
FormGeneratorService.decorateScope($scope, FormGeneratorService, RecordHandlerService, $scope.sharedData);
|
|
5085
|
+
RecordHandlerService.decorateScope($scope, $uibModal, RecordHandlerService, ctrlState);
|
|
5084
5086
|
function processTheForm() {
|
|
5085
|
-
|
|
5087
|
+
RecordHandlerService.fillFormWithBackendSchema($scope, FormGeneratorService, RecordHandlerService, ctrlState);
|
|
5086
5088
|
// Tell the 'model controllers' that they can start fiddling with baseScope
|
|
5087
5089
|
for (var i = 0; i < $scope.sharedData.modelControllers.length; i++) {
|
|
5088
5090
|
if ($scope.sharedData.modelControllers[i].onBaseCtrlReady) {
|
|
@@ -5139,8 +5141,8 @@ var fng;
|
|
|
5139
5141
|
var controllers;
|
|
5140
5142
|
(function (controllers) {
|
|
5141
5143
|
/*@ngInject*/
|
|
5142
|
-
ModelCtrl.$inject = ["$scope", "$http", "$location", "
|
|
5143
|
-
function ModelCtrl($scope, $http, $location,
|
|
5144
|
+
ModelCtrl.$inject = ["$scope", "$http", "$location", "RoutingService"];
|
|
5145
|
+
function ModelCtrl($scope, $http, $location, RoutingService) {
|
|
5144
5146
|
$scope.models = [];
|
|
5145
5147
|
$http.get('/api/models').then(function (response) {
|
|
5146
5148
|
$scope.models = response.data;
|
|
@@ -5148,10 +5150,10 @@ var fng;
|
|
|
5148
5150
|
$location.path('/404');
|
|
5149
5151
|
});
|
|
5150
5152
|
$scope.newUrl = function (model) {
|
|
5151
|
-
return
|
|
5153
|
+
return RoutingService.buildUrl(model + '/new');
|
|
5152
5154
|
};
|
|
5153
5155
|
$scope.listUrl = function (model) {
|
|
5154
|
-
return
|
|
5156
|
+
return RoutingService.buildUrl(model);
|
|
5155
5157
|
};
|
|
5156
5158
|
}
|
|
5157
5159
|
controllers.ModelCtrl = ModelCtrl;
|
|
@@ -5163,8 +5165,8 @@ var fng;
|
|
|
5163
5165
|
var controllers;
|
|
5164
5166
|
(function (controllers) {
|
|
5165
5167
|
/*@ngInject*/
|
|
5166
|
-
NavCtrl.$inject = ["$rootScope", "$window", "$scope", "$filter", "
|
|
5167
|
-
function NavCtrl($rootScope, $window, $scope, $filter,
|
|
5168
|
+
NavCtrl.$inject = ["$rootScope", "$window", "$scope", "$filter", "RoutingService", "CssFrameworkService", "SecurityService"];
|
|
5169
|
+
function NavCtrl($rootScope, $window, $scope, $filter, RoutingService, CssFrameworkService, SecurityService) {
|
|
5168
5170
|
function clearContextMenu() {
|
|
5169
5171
|
$scope.items = [];
|
|
5170
5172
|
$scope.contextMenu = undefined;
|
|
@@ -5240,8 +5242,8 @@ var fng;
|
|
|
5240
5242
|
};
|
|
5241
5243
|
$scope.css = function (fn, arg) {
|
|
5242
5244
|
var result;
|
|
5243
|
-
if (typeof
|
|
5244
|
-
result =
|
|
5245
|
+
if (typeof CssFrameworkService[fn] === 'function') {
|
|
5246
|
+
result = CssFrameworkService[fn](arg);
|
|
5245
5247
|
}
|
|
5246
5248
|
else {
|
|
5247
5249
|
result = 'error text-error';
|
|
@@ -5255,11 +5257,11 @@ var fng;
|
|
|
5255
5257
|
// contextMenuId. let's delete this until we know we're ready to evaluate the security
|
|
5256
5258
|
// of the menu items...
|
|
5257
5259
|
$scope.contextMenuId = undefined;
|
|
5258
|
-
|
|
5260
|
+
SecurityService.doSecurityWhenReady(function () {
|
|
5259
5261
|
//... which we now are
|
|
5260
5262
|
$scope.contextMenuId = menuId;
|
|
5261
|
-
$scope.contextMenuHidden =
|
|
5262
|
-
$scope.contextMenuDisabled =
|
|
5263
|
+
$scope.contextMenuHidden = SecurityService.isSecurelyHidden($scope.contextMenuId);
|
|
5264
|
+
$scope.contextMenuDisabled = SecurityService.isSecurelyDisabled($scope.contextMenuId);
|
|
5263
5265
|
});
|
|
5264
5266
|
}
|
|
5265
5267
|
$scope.$on('fngControllersLoaded', function (evt, sharedData, modelName) {
|
|
@@ -5322,7 +5324,7 @@ var fng;
|
|
|
5322
5324
|
return $scope.items[index].isDisabled ? $scope.items[index].isDisabled() : false;
|
|
5323
5325
|
};
|
|
5324
5326
|
$scope.buildUrl = function (path) {
|
|
5325
|
-
return
|
|
5327
|
+
return RoutingService.buildUrl(path);
|
|
5326
5328
|
};
|
|
5327
5329
|
$scope.dropdownClass = function (index) {
|
|
5328
5330
|
var item = $scope.items[index];
|
|
@@ -5392,18 +5394,18 @@ var fng;
|
|
|
5392
5394
|
.filter('camelCase', fng.filters.camelCase)
|
|
5393
5395
|
.filter('titleCase', fng.filters.titleCase)
|
|
5394
5396
|
.filter('extractTimestampFromMongoID', fng.filters.extractTimestampFromMongoID)
|
|
5395
|
-
.service('
|
|
5396
|
-
.provider('
|
|
5397
|
-
.provider('
|
|
5398
|
-
.factory('
|
|
5399
|
-
.factory('
|
|
5400
|
-
.factory('
|
|
5401
|
-
.factory('
|
|
5402
|
-
.factory('
|
|
5403
|
-
.factory('
|
|
5397
|
+
.service('AddAllService', fng.services.AddAllService)
|
|
5398
|
+
.provider('CssFrameworkService', fng.services.CssFrameworkService)
|
|
5399
|
+
.provider('RoutingService', fng.services.RoutingService)
|
|
5400
|
+
.factory('FngModelCtrlService', fng.services.FngModelCtrlService)
|
|
5401
|
+
.factory('FormGeneratorService', fng.services.FormGeneratorService)
|
|
5402
|
+
.factory('FormMarkupHelperService', fng.services.FormMarkupHelperService)
|
|
5403
|
+
.factory('InputSizeHelperService', fng.services.InputSizeHelperService)
|
|
5404
|
+
.factory('PluginHelperService', fng.services.PluginHelperService)
|
|
5405
|
+
.factory('RecordHandlerService', fng.services.RecordHandlerService)
|
|
5404
5406
|
.factory('SchemasService', fng.services.SchemasService)
|
|
5405
5407
|
.factory('SubmissionsService', fng.services.SubmissionsService)
|
|
5406
|
-
.factory('
|
|
5408
|
+
.factory('SecurityService', fng.services.SecurityService);
|
|
5407
5409
|
})(fng || (fng = {}));
|
|
5408
5410
|
// expose the library
|
|
5409
5411
|
var formsAngular = fng.formsAngular;
|