@stackline/angular-multiselect-dropdown 12.0.1 → 13.0.1
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/README.md +15 -15
- package/esm2020/lib/clickOutside.mjs +78 -0
- package/esm2020/lib/list-filter.mjs +33 -0
- package/esm2020/lib/menu-item.mjs +62 -0
- package/esm2020/lib/multiselect.component.mjs +405 -0
- package/esm2020/lib/multiselect.interface.mjs +2 -0
- package/esm2020/lib/multiselect.model.mjs +9 -0
- package/esm2020/public-api.mjs +6 -0
- package/esm2020/stackline-angular-multiselect-dropdown.mjs +5 -0
- package/fesm2015/stackline-angular-multiselect-dropdown.mjs +584 -0
- package/fesm2015/stackline-angular-multiselect-dropdown.mjs.map +1 -0
- package/fesm2020/stackline-angular-multiselect-dropdown.mjs +584 -0
- package/fesm2020/stackline-angular-multiselect-dropdown.mjs.map +1 -0
- package/lib/clickOutside.d.ts +27 -0
- package/lib/list-filter.d.ts +9 -0
- package/lib/menu-item.d.ts +25 -0
- package/lib/multiselect.component.d.ts +80 -0
- package/lib/multiselect.interface.d.ts +23 -0
- package/lib/multiselect.model.d.ts +10 -0
- package/package.json +36 -104
- package/public-api.d.ts +6 -0
- package/stackline-angular-multiselect-dropdown.d.ts +5 -0
- package/angular2-multiselect-dropdown.ts +0 -1
- package/gulpfile.js +0 -68
- package/inline-resources.js +0 -119
- package/multiselect.component.css +0 -759
- package/src/app/angular2-multiselect-dropdown/angular2-multiselect-dropdown.ts +0 -6
- package/src/app/angular2-multiselect-dropdown/clickOutside.ts +0 -60
- package/src/app/angular2-multiselect-dropdown/index.ts +0 -6
- package/src/app/angular2-multiselect-dropdown/list-filter.ts +0 -29
- package/src/app/angular2-multiselect-dropdown/menu-item.ts +0 -55
- package/src/app/angular2-multiselect-dropdown/multiselect.component.html +0 -89
- package/src/app/angular2-multiselect-dropdown/multiselect.component.scss +0 -712
- package/src/app/angular2-multiselect-dropdown/multiselect.component.ts +0 -413
- package/src/app/angular2-multiselect-dropdown/multiselect.interface.ts +0 -22
- package/src/app/angular2-multiselect-dropdown/multiselect.model.ts +0 -13
- package/tsconfig-aot.json +0 -32
- package/tsconfig.json +0 -36
- package/webpack-test.config.ts +0 -70
- package/webpack-umd.config.ts +0 -98
package/inline-resources.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const glob = require('glob');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Simple Promiseify function that takes a Node API and return a version that supports promises.
|
|
10
|
-
* We use promises instead of synchronized functions to make the process less I/O bound and
|
|
11
|
-
* faster. It also simplifies the code.
|
|
12
|
-
*/
|
|
13
|
-
function promiseify(fn) {
|
|
14
|
-
return function () {
|
|
15
|
-
const args = [].slice.call(arguments, 0);
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
fn.apply(this, args.concat([function (err, value) {
|
|
18
|
-
if (err) {
|
|
19
|
-
reject(err);
|
|
20
|
-
} else {
|
|
21
|
-
resolve(value);
|
|
22
|
-
}
|
|
23
|
-
}]));
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const readFile = promiseify(fs.readFile);
|
|
29
|
-
const writeFile = promiseify(fs.writeFile);
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Inline resources in a tsc/ngc compilation.
|
|
33
|
-
* @param projectPath {string} Path to the project.
|
|
34
|
-
*/
|
|
35
|
-
function inlineResources(projectPath) {
|
|
36
|
-
|
|
37
|
-
// Match only TypeScript files in projectPath.
|
|
38
|
-
const files = glob.sync('**/*.ts', {cwd: projectPath});
|
|
39
|
-
|
|
40
|
-
// For each file, inline the templates and styles under it and write the new file.
|
|
41
|
-
return Promise.all(files.map(filePath => {
|
|
42
|
-
const fullFilePath = path.join(projectPath, filePath);
|
|
43
|
-
return readFile(fullFilePath, 'utf-8')
|
|
44
|
-
.then(content => inlineResourcesFromString(content, url => {
|
|
45
|
-
// Resolve the template url.
|
|
46
|
-
return path.join(path.dirname(fullFilePath), url);
|
|
47
|
-
}))
|
|
48
|
-
.then(content => writeFile(fullFilePath, content))
|
|
49
|
-
.catch(err => {
|
|
50
|
-
console.error('An error occured: ', err);
|
|
51
|
-
});
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Inline resources from a string content.
|
|
57
|
-
* @param content {string} The source file's content.
|
|
58
|
-
* @param urlResolver {Function} A resolver that takes a URL and return a path.
|
|
59
|
-
* @returns {string} The content with resources inlined.
|
|
60
|
-
*/
|
|
61
|
-
function inlineResourcesFromString(content, urlResolver) {
|
|
62
|
-
// Curry through the inlining functions.
|
|
63
|
-
return [
|
|
64
|
-
inlineTemplate,
|
|
65
|
-
inlineStyle
|
|
66
|
-
].reduce((content, fn) => fn(content, urlResolver), content);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Inline the templates for a source file. Simply search for instances of `templateUrl: ...` and
|
|
71
|
-
* replace with `template: ...` (with the content of the file included).
|
|
72
|
-
* @param content {string} The source file's content.
|
|
73
|
-
* @param urlResolver {Function} A resolver that takes a URL and return a path.
|
|
74
|
-
* @return {string} The content with all templates inlined.
|
|
75
|
-
*/
|
|
76
|
-
function inlineTemplate(content, urlResolver) {
|
|
77
|
-
return content.replace(/templateUrl:\s*'([^']+?\.html)'/g, function (m, templateUrl) {
|
|
78
|
-
const templateFile = urlResolver(templateUrl);
|
|
79
|
-
const templateContent = fs.readFileSync(templateFile, 'utf-8');
|
|
80
|
-
const shortenedTemplate = templateContent
|
|
81
|
-
.replace(/([\n\r]\s*)+/gm, ' ')
|
|
82
|
-
.replace(/"/g, '\\"');
|
|
83
|
-
return `template: "${shortenedTemplate}"`;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Inline the styles for a source file. Simply search for instances of `styleUrls: [...]` and
|
|
90
|
-
* replace with `styles: [...]` (with the content of the file included).
|
|
91
|
-
* @param urlResolver {Function} A resolver that takes a URL and return a path.
|
|
92
|
-
* @param content {string} The source file's content.
|
|
93
|
-
* @return {string} The content with all styles inlined.
|
|
94
|
-
*/
|
|
95
|
-
function inlineStyle(content, urlResolver) {
|
|
96
|
-
return content.replace(/styleUrls:\s*(\[[\s\S]*?\])/gm, function (m, styleUrls) {
|
|
97
|
-
const urls = eval(styleUrls);
|
|
98
|
-
return 'styles: ['
|
|
99
|
-
+ urls.map(styleUrl => {
|
|
100
|
-
const styleFile = urlResolver(styleUrl);
|
|
101
|
-
const styleContent = fs.readFileSync(styleFile, 'utf-8');
|
|
102
|
-
const shortenedStyle = styleContent
|
|
103
|
-
.replace(/([\n\r]\s*)+/gm, ' ')
|
|
104
|
-
.replace(/"/g, '\\"');
|
|
105
|
-
return `"${shortenedStyle}"`;
|
|
106
|
-
})
|
|
107
|
-
.join(',\n')
|
|
108
|
-
+ ']';
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
module.exports = inlineResources;
|
|
113
|
-
module.exports.inlineResourcesFromString = inlineResourcesFromString;
|
|
114
|
-
|
|
115
|
-
// Run inlineResources if module is being called directly from the CLI with arguments.
|
|
116
|
-
if (require.main === module && process.argv.length > 2) {
|
|
117
|
-
console.log('Inlining resources from project:', process.argv[2]);
|
|
118
|
-
return inlineResources(process.argv[2]);
|
|
119
|
-
}
|