@apipass/schemas 0.2.5-alpha.2 → 0.2.5-alpha.21
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/bundles/apipass-schemas.umd.js +122 -82
- package/bundles/apipass-schemas.umd.js.map +1 -1
- package/bundles/apipass-schemas.umd.min.js +1 -1
- package/bundles/apipass-schemas.umd.min.js.map +1 -1
- package/esm2015/public-api.js +2 -2
- package/esm2015/schema-form-render.module.js +6 -3
- package/esm2015/type-script-compile/type-script-compile.base.js +112 -0
- package/fesm2015/apipass-schemas.js +116 -81
- package/fesm2015/apipass-schemas.js.map +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
- package/type-script-compile/type-script-compile.base.d.ts +17 -0
- package/esm2015/type-script-compile.js +0 -77
- package/type-script-compile.d.ts +0 -10
|
@@ -2018,6 +2018,121 @@
|
|
|
2018
2018
|
}] });
|
|
2019
2019
|
})();
|
|
2020
2020
|
|
|
2021
|
+
var TypeScriptCompileBase = /** @class */ (function () {
|
|
2022
|
+
function TypeScriptCompileBase() {
|
|
2023
|
+
}
|
|
2024
|
+
TypeScriptCompileBase.prototype.getTranslate = function (text) {
|
|
2025
|
+
return text;
|
|
2026
|
+
};
|
|
2027
|
+
TypeScriptCompileBase.prototype.addItemToFormProperties = function (formProperties, item, key) {
|
|
2028
|
+
this.translateProperties(item);
|
|
2029
|
+
if (item.minLength && item.minLength > 0) {
|
|
2030
|
+
formProperties[key] = new i3.FormControl([null, [i3.Validators.required]]);
|
|
2031
|
+
}
|
|
2032
|
+
else {
|
|
2033
|
+
formProperties[key] = new i3.FormControl([null]);
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
TypeScriptCompileBase.prototype.compileProperties = function (input) {
|
|
2037
|
+
var compiledProperties = [];
|
|
2038
|
+
var formProperties = {};
|
|
2039
|
+
var inputData = {};
|
|
2040
|
+
var inputToCompile = JSON.parse(JSON.stringify(input));
|
|
2041
|
+
this.translateProperties(inputToCompile);
|
|
2042
|
+
if (inputToCompile.properties) {
|
|
2043
|
+
if (inputToCompile.type === 'array') {
|
|
2044
|
+
inputData = [];
|
|
2045
|
+
}
|
|
2046
|
+
if (inputToCompile.type === 'object') {
|
|
2047
|
+
inputData = {};
|
|
2048
|
+
}
|
|
2049
|
+
inputToCompile.id = 'inputData';
|
|
2050
|
+
this.proccessProperties(inputToCompile, formProperties, 'inputData');
|
|
2051
|
+
this.translateProperties(inputToCompile);
|
|
2052
|
+
compiledProperties.push(inputToCompile);
|
|
2053
|
+
}
|
|
2054
|
+
else if (inputToCompile.type === 'array') {
|
|
2055
|
+
inputToCompile.id = 'inputData';
|
|
2056
|
+
inputData = [];
|
|
2057
|
+
this.addItemToFormProperties(formProperties, inputToCompile, 'inputData');
|
|
2058
|
+
compiledProperties.push(inputToCompile);
|
|
2059
|
+
}
|
|
2060
|
+
else if (!inputToCompile.type) {
|
|
2061
|
+
for (var index = 0; index < Object.keys(inputToCompile).length; index++) {
|
|
2062
|
+
var key = Object.keys(inputToCompile)[index];
|
|
2063
|
+
var item = inputToCompile[key];
|
|
2064
|
+
item.id = key;
|
|
2065
|
+
if (item.type === 'array') {
|
|
2066
|
+
inputData[item.id] = [];
|
|
2067
|
+
}
|
|
2068
|
+
if (item.type === 'object') {
|
|
2069
|
+
inputData[item.id] = {};
|
|
2070
|
+
}
|
|
2071
|
+
this.proccessProperties(item, formProperties, key);
|
|
2072
|
+
this.translateProperties(item);
|
|
2073
|
+
compiledProperties.push(item);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
compiledProperties.sort(function (a, b) { return a.propertyOrder - b.propertyOrder; });
|
|
2077
|
+
return { compiledProperties: compiledProperties, formProperties: formProperties, inputData: inputData };
|
|
2078
|
+
};
|
|
2079
|
+
TypeScriptCompileBase.prototype.translateProperties = function (input) {
|
|
2080
|
+
var _this = this;
|
|
2081
|
+
if (input === null || input === void 0 ? void 0 : input.title) {
|
|
2082
|
+
input.title = this.getTranslate(input.title);
|
|
2083
|
+
}
|
|
2084
|
+
if (input === null || input === void 0 ? void 0 : input.description) {
|
|
2085
|
+
input.description = this.getTranslate(input.description);
|
|
2086
|
+
}
|
|
2087
|
+
if ((input === null || input === void 0 ? void 0 : input.options) instanceof Array) {
|
|
2088
|
+
input === null || input === void 0 ? void 0 : input.options.forEach(function (option) { return option.value = _this.getTranslate(option.value); });
|
|
2089
|
+
}
|
|
2090
|
+
};
|
|
2091
|
+
TypeScriptCompileBase.prototype.proccessProperties = function (item, formProperties, key) {
|
|
2092
|
+
this.translateProperties(item);
|
|
2093
|
+
if (this.hasProperties(item)) {
|
|
2094
|
+
var arFieldsChild = [];
|
|
2095
|
+
for (var indexChild = 0; indexChild < Object.keys(item.properties).length; indexChild++) {
|
|
2096
|
+
var keyChild = Object.keys(item.properties)[indexChild];
|
|
2097
|
+
var itemChild = item.properties[keyChild];
|
|
2098
|
+
itemChild.id = keyChild;
|
|
2099
|
+
if (this.hasProperties(itemChild)) {
|
|
2100
|
+
this.proccessProperties(itemChild, formProperties, keyChild);
|
|
2101
|
+
arFieldsChild.push(itemChild);
|
|
2102
|
+
}
|
|
2103
|
+
else {
|
|
2104
|
+
this.addItemToFormProperties(formProperties, itemChild, keyChild);
|
|
2105
|
+
arFieldsChild.push(itemChild);
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
item.properties = arFieldsChild;
|
|
2109
|
+
}
|
|
2110
|
+
else {
|
|
2111
|
+
this.addItemToFormProperties(formProperties, item, key);
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2114
|
+
TypeScriptCompileBase.prototype.hasProperties = function (item) {
|
|
2115
|
+
return item.type === 'object' || (item.type === 'array' && item.properties);
|
|
2116
|
+
};
|
|
2117
|
+
return TypeScriptCompileBase;
|
|
2118
|
+
}());
|
|
2119
|
+
TypeScriptCompileBase.ɵfac = function TypeScriptCompileBase_Factory(t) { return new (t || TypeScriptCompileBase)(); };
|
|
2120
|
+
TypeScriptCompileBase.ɵprov = i0.ɵɵdefineInjectable({ token: TypeScriptCompileBase, factory: TypeScriptCompileBase.ɵfac, providedIn: 'root' });
|
|
2121
|
+
/*@__PURE__*/ (function () {
|
|
2122
|
+
i0.ɵsetClassMetadata(TypeScriptCompileBase, [{
|
|
2123
|
+
type: i0.Injectable,
|
|
2124
|
+
args: [{ providedIn: 'root' }]
|
|
2125
|
+
}], null, null);
|
|
2126
|
+
})();
|
|
2127
|
+
function APIPASS_TYPESCRIPT_COMPILE_BASE_PROVIDER_FACTORY(parentIntl) {
|
|
2128
|
+
return parentIntl || new TypeScriptCompileBase();
|
|
2129
|
+
}
|
|
2130
|
+
var APIPASS_TYPESCRIPT_COMPILE_INTL_PROVIDER = {
|
|
2131
|
+
provide: TypeScriptCompileBase,
|
|
2132
|
+
deps: [[new i0.Optional(), new i0.SkipSelf(), TypeScriptCompileBase]],
|
|
2133
|
+
useFactory: APIPASS_TYPESCRIPT_COMPILE_BASE_PROVIDER_FACTORY,
|
|
2134
|
+
};
|
|
2135
|
+
|
|
2021
2136
|
var SchemaFormRenderModule = /** @class */ (function () {
|
|
2022
2137
|
function SchemaFormRenderModule() {
|
|
2023
2138
|
}
|
|
@@ -2025,7 +2140,8 @@
|
|
|
2025
2140
|
}());
|
|
2026
2141
|
SchemaFormRenderModule.ɵmod = i0.ɵɵdefineNgModule({ type: SchemaFormRenderModule });
|
|
2027
2142
|
SchemaFormRenderModule.ɵinj = i0.ɵɵdefineInjector({ factory: function SchemaFormRenderModule_Factory(t) { return new (t || SchemaFormRenderModule)(); }, providers: [
|
|
2028
|
-
SchemaFieldsService
|
|
2143
|
+
SchemaFieldsService,
|
|
2144
|
+
APIPASS_TYPESCRIPT_COMPILE_INTL_PROVIDER
|
|
2029
2145
|
], imports: [[
|
|
2030
2146
|
i1.CommonModule,
|
|
2031
2147
|
i2.DndModule,
|
|
@@ -2098,7 +2214,8 @@
|
|
|
2098
2214
|
SchemaCustomAttributesComponent
|
|
2099
2215
|
],
|
|
2100
2216
|
providers: [
|
|
2101
|
-
SchemaFieldsService
|
|
2217
|
+
SchemaFieldsService,
|
|
2218
|
+
APIPASS_TYPESCRIPT_COMPILE_INTL_PROVIDER
|
|
2102
2219
|
]
|
|
2103
2220
|
}]
|
|
2104
2221
|
}], null, null);
|
|
@@ -2115,89 +2232,12 @@
|
|
|
2115
2232
|
SchemaFormComponent,
|
|
2116
2233
|
SchemaCustomAttributesComponent], [i1.AsyncPipe, i1.UpperCasePipe, i1.LowerCasePipe, i1.JsonPipe, i1.SlicePipe, i1.DecimalPipe, i1.PercentPipe, i1.TitleCasePipe, i1.CurrencyPipe, i1.DatePipe, i1.I18nPluralPipe, i1.I18nSelectPipe, i1.KeyValuePipe]);
|
|
2117
2234
|
|
|
2118
|
-
var TypeScriptCompile = /** @class */ (function () {
|
|
2119
|
-
function TypeScriptCompile() {
|
|
2120
|
-
}
|
|
2121
|
-
TypeScriptCompile.addItemToFormProperties = function (formProperties, item, key) {
|
|
2122
|
-
if (item.minLength && item.minLength > 0) {
|
|
2123
|
-
formProperties[key] = new i3.FormControl([null, [i3.Validators.required]]);
|
|
2124
|
-
}
|
|
2125
|
-
else {
|
|
2126
|
-
formProperties[key] = new i3.FormControl([null]);
|
|
2127
|
-
}
|
|
2128
|
-
};
|
|
2129
|
-
TypeScriptCompile.compileProperties = function (input) {
|
|
2130
|
-
var compiledProperties = [];
|
|
2131
|
-
var formProperties = {};
|
|
2132
|
-
var inputData = {};
|
|
2133
|
-
var inputToCompile = JSON.parse(JSON.stringify(input));
|
|
2134
|
-
if (inputToCompile.properties) {
|
|
2135
|
-
if (inputToCompile.type === 'array') {
|
|
2136
|
-
inputData = [];
|
|
2137
|
-
}
|
|
2138
|
-
if (inputToCompile.type === 'object') {
|
|
2139
|
-
inputData = {};
|
|
2140
|
-
}
|
|
2141
|
-
inputToCompile.id = 'inputData';
|
|
2142
|
-
this.proccessProperties(inputToCompile, formProperties, 'inputData');
|
|
2143
|
-
compiledProperties.push(inputToCompile);
|
|
2144
|
-
}
|
|
2145
|
-
else if (inputToCompile.type === 'array') {
|
|
2146
|
-
inputToCompile.id = 'inputData';
|
|
2147
|
-
inputData = [];
|
|
2148
|
-
TypeScriptCompile.addItemToFormProperties(formProperties, inputToCompile, 'inputData');
|
|
2149
|
-
compiledProperties.push(inputToCompile);
|
|
2150
|
-
}
|
|
2151
|
-
else if (!inputToCompile.type) {
|
|
2152
|
-
for (var index = 0; index < Object.keys(inputToCompile).length; index++) {
|
|
2153
|
-
var key = Object.keys(inputToCompile)[index];
|
|
2154
|
-
var item = inputToCompile[key];
|
|
2155
|
-
item.id = key;
|
|
2156
|
-
if (item.type === 'array') {
|
|
2157
|
-
inputData[item.id] = [];
|
|
2158
|
-
}
|
|
2159
|
-
if (item.type === 'object') {
|
|
2160
|
-
inputData[item.id] = {};
|
|
2161
|
-
}
|
|
2162
|
-
this.proccessProperties(item, formProperties, key);
|
|
2163
|
-
compiledProperties.push(item);
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2166
|
-
compiledProperties.sort(function (a, b) { return a.propertyOrder - b.propertyOrder; });
|
|
2167
|
-
return { compiledProperties: compiledProperties, formProperties: formProperties, inputData: inputData };
|
|
2168
|
-
};
|
|
2169
|
-
TypeScriptCompile.proccessProperties = function (item, formProperties, key) {
|
|
2170
|
-
if (this.hasProperties(item)) {
|
|
2171
|
-
var arFieldsChild = [];
|
|
2172
|
-
for (var indexChild = 0; indexChild < Object.keys(item.properties).length; indexChild++) {
|
|
2173
|
-
var keyChild = Object.keys(item.properties)[indexChild];
|
|
2174
|
-
var itemChild = item.properties[keyChild];
|
|
2175
|
-
itemChild.id = keyChild;
|
|
2176
|
-
if (this.hasProperties(itemChild)) {
|
|
2177
|
-
this.proccessProperties(itemChild, formProperties, keyChild);
|
|
2178
|
-
arFieldsChild.push(itemChild);
|
|
2179
|
-
}
|
|
2180
|
-
else {
|
|
2181
|
-
TypeScriptCompile.addItemToFormProperties(formProperties, itemChild, keyChild);
|
|
2182
|
-
arFieldsChild.push(itemChild);
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
item.properties = arFieldsChild;
|
|
2186
|
-
}
|
|
2187
|
-
else {
|
|
2188
|
-
TypeScriptCompile.addItemToFormProperties(formProperties, item, key);
|
|
2189
|
-
}
|
|
2190
|
-
};
|
|
2191
|
-
TypeScriptCompile.hasProperties = function (item) {
|
|
2192
|
-
return item.type === 'object' || (item.type === 'array' && item.properties);
|
|
2193
|
-
};
|
|
2194
|
-
return TypeScriptCompile;
|
|
2195
|
-
}());
|
|
2196
|
-
|
|
2197
2235
|
/**
|
|
2198
2236
|
* Generated bundle index. Do not edit.
|
|
2199
2237
|
*/
|
|
2200
2238
|
|
|
2239
|
+
exports.APIPASS_TYPESCRIPT_COMPILE_BASE_PROVIDER_FACTORY = APIPASS_TYPESCRIPT_COMPILE_BASE_PROVIDER_FACTORY;
|
|
2240
|
+
exports.APIPASS_TYPESCRIPT_COMPILE_INTL_PROVIDER = APIPASS_TYPESCRIPT_COMPILE_INTL_PROVIDER;
|
|
2201
2241
|
exports.ArraySessionComponent = ArraySessionComponent;
|
|
2202
2242
|
exports.BaseSchemaComponent = BaseSchemaComponent;
|
|
2203
2243
|
exports.BooleanInputComponent = BooleanInputComponent;
|
|
@@ -2213,7 +2253,7 @@
|
|
|
2213
2253
|
exports.SchemaInputComponent = SchemaInputComponent;
|
|
2214
2254
|
exports.SchemaObjectComponent = SchemaObjectComponent;
|
|
2215
2255
|
exports.SchemaValidationField = SchemaValidationField;
|
|
2216
|
-
exports.
|
|
2256
|
+
exports.TypeScriptCompileBase = TypeScriptCompileBase;
|
|
2217
2257
|
|
|
2218
2258
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2219
2259
|
|