@ihk-gfi/lux-components-update 14.8.0 → 15.0.0
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 +4 -2
- package/add-lux-components/files/app/app.component.html +34 -0
- package/{src/add-lux-components → add-lux-components}/files/app/app.component.spec.ts +4 -2
- package/{src/add-lux-components → add-lux-components}/files/app/app.component.ts +1 -1
- package/add-lux-components/files/src/main.ts +17 -0
- package/{src/add-lux-components → add-lux-components}/index.js +29 -30
- package/add-lux-components/schema.json +23 -0
- package/collection.json +35 -0
- package/package.json +27 -27
- package/{src/theme → theme}/change-theme-to-authentic/index.js +0 -1
- package/theme/change-theme-to-authentic/schema.json +23 -0
- package/{src/theme → theme}/change-to-lux-icons/index.js +0 -1
- package/theme/change-to-lux-icons/schema.json +23 -0
- package/{src/update-dependencies → update-dependencies}/index.d.ts +1 -0
- package/update-dependencies/index.js +92 -0
- package/update-dependencies/schema.json +23 -0
- package/{src/update-en-messages → update-en-messages}/index.js +0 -1
- package/update-en-messages/schema.json +23 -0
- package/updates/15.0.0/index.d.ts +8 -0
- package/updates/15.0.0/index.js +109 -0
- package/updates/15.0.0/schema.json +23 -0
- package/{src/utility → utility}/dependencies.js +0 -1
- package/{src/utility → utility}/files.js +0 -1
- package/{src/utility → utility}/html/hit.js +0 -1
- package/{src/utility → utility}/html/html-manipulator.js +0 -1
- package/{src/utility → utility}/html/manipulator-functions.js +0 -1
- package/{src/utility → utility}/json.d.ts +2 -0
- package/{src/utility → utility}/json.js +16 -8
- package/{src/utility → utility}/logging.js +0 -1
- package/{src/utility → utility}/test.js +0 -1
- package/{src/utility → utility}/typescript.js +0 -1
- package/{src/utility → utility}/util.js +0 -1
- package/{src/utility → utility}/validation.js +0 -1
- package/src/add-lux-components/files/app/app.component.html +0 -32
- package/src/add-lux-components/files/app/base/license-hint/license-hint.component.html +0 -7
- package/src/add-lux-components/files/app/base/license-hint/license-hint.component.ts +0 -18
- package/src/add-lux-components/files/app/error/error.component.html +0 -10
- package/src/add-lux-components/files/app/error/error.component.scss +0 -3
- package/src/add-lux-components/files/app/error/error.component.spec.ts +0 -49
- package/src/add-lux-components/files/app/error/error.component.ts +0 -17
- package/src/add-lux-components/files/app/home/home.component.html +0 -7
- package/src/add-lux-components/files/app/home/home.component.scss +0 -3
- package/src/add-lux-components/files/app/home/home.component.ts +0 -13
- package/src/add-lux-components/files/app/profil/profil.component.html +0 -1
- package/src/add-lux-components/files/app/profil/profil.component.scss +0 -0
- package/src/add-lux-components/files/app/profil/profil.component.spec.ts +0 -24
- package/src/add-lux-components/files/app/profil/profil.component.ts +0 -11
- package/src/add-lux-components/files/assets/svg/Example.svg +0 -6
- package/src/add-lux-components/files/assets/svg/android.svg +0 -2
- package/src/add-lux-components/files/assets/svg/box.svg +0 -690
- package/src/add-lux-components/files/assets/svg/demoAppLogo.svg +0 -1
- package/src/add-lux-components/files/assets/svg/red_power_button.svg +0 -67
- package/src/add-lux-components/files/assets/svg/svg2009.svg +0 -57457
- package/src/add-lux-components/files/src/polyfills.ts +0 -58
- package/src/add-lux-components/index.js.map +0 -1
- package/src/add-lux-components/index.ts +0 -293
- package/src/add-lux-components/index_spec.d.ts +0 -1
- package/src/add-lux-components/index_spec.js +0 -51
- package/src/add-lux-components/index_spec.js.map +0 -1
- package/src/add-lux-components/index_spec.ts +0 -55
- package/src/add-lux-components/schema.json +0 -23
- package/src/collection.json +0 -75
- package/src/theme/change-theme-to-authentic/index.js.map +0 -1
- package/src/theme/change-theme-to-authentic/index.ts +0 -131
- package/src/theme/change-theme-to-authentic/index_spec.d.ts +0 -1
- package/src/theme/change-theme-to-authentic/index_spec.js +0 -300
- package/src/theme/change-theme-to-authentic/index_spec.js.map +0 -1
- package/src/theme/change-theme-to-authentic/index_spec.ts +0 -321
- package/src/theme/change-theme-to-authentic/schema.json +0 -23
- package/src/theme/change-to-lux-icons/index.js.map +0 -1
- package/src/theme/change-to-lux-icons/index.ts +0 -392
- package/src/theme/change-to-lux-icons/index_spec.d.ts +0 -1
- package/src/theme/change-to-lux-icons/index_spec.js +0 -128
- package/src/theme/change-to-lux-icons/index_spec.js.map +0 -1
- package/src/theme/change-to-lux-icons/index_spec.ts +0 -130
- package/src/theme/change-to-lux-icons/schema.json +0 -23
- package/src/update-dependencies/index.js +0 -88
- package/src/update-dependencies/index.js.map +0 -1
- package/src/update-dependencies/index.ts +0 -86
- package/src/update-dependencies/schema.json +0 -23
- package/src/update-en-messages/index.js.map +0 -1
- package/src/update-en-messages/index.ts +0 -83
- package/src/update-en-messages/index_spec.d.ts +0 -1
- package/src/update-en-messages/index_spec.js +0 -174
- package/src/update-en-messages/index_spec.js.map +0 -1
- package/src/update-en-messages/index_spec.ts +0 -182
- package/src/update-en-messages/schema.json +0 -23
- package/src/updates/update140000/files/src/polyfills.ts +0 -70
- package/src/updates/update140000/index.d.ts +0 -14
- package/src/updates/update140000/index.js +0 -95
- package/src/updates/update140000/index.js.map +0 -1
- package/src/updates/update140000/index.ts +0 -110
- package/src/updates/update140000/index_spec.d.ts +0 -1
- package/src/updates/update140000/index_spec.js +0 -165
- package/src/updates/update140000/index_spec.js.map +0 -1
- package/src/updates/update140000/index_spec.ts +0 -171
- package/src/updates/update140000/schema.json +0 -23
- package/src/updates/update140100/index.d.ts +0 -5
- package/src/updates/update140100/index.js +0 -62
- package/src/updates/update140100/index.js.map +0 -1
- package/src/updates/update140100/index.ts +0 -60
- package/src/updates/update140100/index_spec.d.ts +0 -1
- package/src/updates/update140100/index_spec.js +0 -124
- package/src/updates/update140100/index_spec.js.map +0 -1
- package/src/updates/update140100/index_spec.ts +0 -137
- package/src/updates/update140100/schema.json +0 -23
- package/src/updates/update140200/index.d.ts +0 -8
- package/src/updates/update140200/index.js +0 -40
- package/src/updates/update140200/index.js.map +0 -1
- package/src/updates/update140200/index.ts +0 -38
- package/src/updates/update140200/index_spec.d.ts +0 -1
- package/src/updates/update140200/index_spec.js +0 -75
- package/src/updates/update140200/index_spec.js.map +0 -1
- package/src/updates/update140200/index_spec.ts +0 -81
- package/src/updates/update140200/schema.json +0 -23
- package/src/updates/update140300/index.d.ts +0 -10
- package/src/updates/update140300/index.js +0 -85
- package/src/updates/update140300/index.js.map +0 -1
- package/src/updates/update140300/index.ts +0 -86
- package/src/updates/update140300/index_spec.d.ts +0 -1
- package/src/updates/update140300/index_spec.js +0 -145
- package/src/updates/update140300/index_spec.js.map +0 -1
- package/src/updates/update140300/index_spec.ts +0 -177
- package/src/updates/update140300/schema.json +0 -23
- package/src/updates/update140400/index.d.ts +0 -2
- package/src/updates/update140400/index.js +0 -22
- package/src/updates/update140400/index.js.map +0 -1
- package/src/updates/update140400/index.ts +0 -18
- package/src/updates/update140400/index_spec.d.ts +0 -1
- package/src/updates/update140400/index_spec.js +0 -75
- package/src/updates/update140400/index_spec.js.map +0 -1
- package/src/updates/update140400/index_spec.ts +0 -81
- package/src/updates/update140400/schema.json +0 -23
- package/src/updates/update140500/index.d.ts +0 -2
- package/src/updates/update140500/index.js +0 -21
- package/src/updates/update140500/index.js.map +0 -1
- package/src/updates/update140500/index.ts +0 -17
- package/src/updates/update140500/index_spec.d.ts +0 -1
- package/src/updates/update140500/index_spec.js +0 -73
- package/src/updates/update140500/index_spec.js.map +0 -1
- package/src/updates/update140500/index_spec.ts +0 -78
- package/src/updates/update140500/schema.json +0 -23
- package/src/updates/update140600/index.d.ts +0 -2
- package/src/updates/update140600/index.js +0 -39
- package/src/updates/update140600/index.js.map +0 -1
- package/src/updates/update140600/index.ts +0 -35
- package/src/updates/update140600/index_spec.d.ts +0 -1
- package/src/updates/update140600/index_spec.js +0 -71
- package/src/updates/update140600/index_spec.js.map +0 -1
- package/src/updates/update140600/index_spec.ts +0 -75
- package/src/updates/update140600/schema.json +0 -23
- package/src/updates/update140700/index.d.ts +0 -2
- package/src/updates/update140700/index.js +0 -22
- package/src/updates/update140700/index.js.map +0 -1
- package/src/updates/update140700/index.ts +0 -18
- package/src/updates/update140700/index_spec.d.ts +0 -1
- package/src/updates/update140700/index_spec.js +0 -75
- package/src/updates/update140700/index_spec.js.map +0 -1
- package/src/updates/update140700/index_spec.ts +0 -79
- package/src/updates/update140700/schema.json +0 -23
- package/src/updates/update140800/index.d.ts +0 -2
- package/src/updates/update140800/index.js +0 -22
- package/src/updates/update140800/index.js.map +0 -1
- package/src/updates/update140800/index.ts +0 -18
- package/src/updates/update140800/index_spec.d.ts +0 -1
- package/src/updates/update140800/index_spec.js +0 -76
- package/src/updates/update140800/index_spec.js.map +0 -1
- package/src/updates/update140800/index_spec.ts +0 -82
- package/src/updates/update140800/schema.json +0 -23
- package/src/utility/dependencies.js.map +0 -1
- package/src/utility/dependencies.ts +0 -144
- package/src/utility/files.js.map +0 -1
- package/src/utility/files.ts +0 -368
- package/src/utility/html/hit.js.map +0 -1
- package/src/utility/html/hit.ts +0 -28
- package/src/utility/html/html-manipulator.js.map +0 -1
- package/src/utility/html/html-manipulator.ts +0 -156
- package/src/utility/html/html_spec.d.ts +0 -1
- package/src/utility/html/html_spec.js +0 -692
- package/src/utility/html/html_spec.js.map +0 -1
- package/src/utility/html/html_spec.ts +0 -751
- package/src/utility/html/manipulator-functions.js.map +0 -1
- package/src/utility/html/manipulator-functions.ts +0 -149
- package/src/utility/json.js.map +0 -1
- package/src/utility/json.ts +0 -288
- package/src/utility/json_spec.d.ts +0 -1
- package/src/utility/json_spec.js +0 -326
- package/src/utility/json_spec.js.map +0 -1
- package/src/utility/json_spec.ts +0 -446
- package/src/utility/logging.js.map +0 -1
- package/src/utility/logging.ts +0 -80
- package/src/utility/test.js.map +0 -1
- package/src/utility/test.ts +0 -24
- package/src/utility/typescript.js.map +0 -1
- package/src/utility/typescript.ts +0 -598
- package/src/utility/typescript_spec.d.ts +0 -1
- package/src/utility/typescript_spec.js +0 -1005
- package/src/utility/typescript_spec.js.map +0 -1
- package/src/utility/typescript_spec.ts +0 -1265
- package/src/utility/util.js.map +0 -1
- package/src/utility/util.ts +0 -145
- package/src/utility/validation.js.map +0 -1
- package/src/utility/validation.ts +0 -48
- package/tsconfig.json +0 -35
- /package/{src/add-lux-components → add-lux-components}/files/app/app-routing.module.ts +0 -0
- /package/{src/add-lux-components → add-lux-components}/files/app/app.module.ts +0 -0
- /package/{src/add-lux-components → add-lux-components}/files/environments/environment.prod.ts +0 -0
- /package/{src/add-lux-components → add-lux-components}/files/environments/environment.ts +0 -0
- /package/{src/add-lux-components → add-lux-components}/files/locale/messages.en.xlf +0 -0
- /package/{src/add-lux-components → add-lux-components}/files/locale/messages.xlf +0 -0
- /package/{src/add-lux-components → add-lux-components}/files/src/index.html +0 -0
- /package/{src/add-lux-components → add-lux-components}/index.d.ts +0 -0
- /package/{src/theme → theme}/change-theme-to-authentic/index.d.ts +0 -0
- /package/{src/theme → theme}/change-to-lux-icons/index.d.ts +0 -0
- /package/{src/update-en-messages → update-en-messages}/index.d.ts +0 -0
- /package/{src/utility → utility}/dependencies.d.ts +0 -0
- /package/{src/utility → utility}/files.d.ts +0 -0
- /package/{src/utility → utility}/html/hit.d.ts +0 -0
- /package/{src/utility → utility}/html/html-manipulator.d.ts +0 -0
- /package/{src/utility → utility}/html/manipulator-functions.d.ts +0 -0
- /package/{src/utility → utility}/logging.d.ts +0 -0
- /package/{src/utility → utility}/test.d.ts +0 -0
- /package/{src/utility → utility}/typescript.d.ts +0 -0
- /package/{src/utility → utility}/util.d.ts +0 -0
- /package/{src/utility → utility}/validation.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manipulator-functions.js","sourceRoot":"","sources":["manipulator-functions.ts"],"names":[],"mappings":";;;AAAA,kCAAmD;AAQnD;;;;;;;;;GASG;AACI,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE;IACvD,OAAO,CAAC,GAAQ,EAAE,EAAE;QAClB,GAAG,CAAC,cAAc,GAAG,IAAA,mBAAY,EAAC,GAAG,CAAC,cAAc,EAAE,IAAI,GAAG,CAAC,QAAQ,EAAE,EAAE,IAAI,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,GAAG,GAAG,CAAC,CAAC;IACjF,CAAC,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEF;;;;;;;;;GASG;AACI,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,EAAE;IAChE,OAAO,CAAC,GAAQ,EAAE,EAAE;QAClB,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,oBAAoB,GAAG,IAAI,GAAG,oCAAoC,EAAE,GAAG,CAAC,CAAC;QACpG,GAAG,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,WAAW,GAAG,GAAG,CAAC,CAAC;IACzF,CAAC,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEF;;;;;;;;GAQG;AACI,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,OAAO,CAAC,GAAQ,EAAE,EAAE;QAClB,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,mBAAmB,GAAG,IAAI,GAAG,mCAAmC,EAAE,GAAG,CAAC,CAAC;QAClG,GAAG,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { replaceAll, replaceFirst } from '../util';
|
|
2
|
-
import { Hit } from './hit';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef ManipulatorFn Eine Manipulator-Funktion transformiert den HTML-Inhalt eines {@link Element}s.
|
|
6
|
-
*/
|
|
7
|
-
export declare type ManipulatorFn = (hit: Hit) => void;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Diese Funktion fügt dem Element ein neues Attribut hinzu. Das neue Attribut wird direkt hinter dem Tag als erstes Attribut hinzugefügt.
|
|
11
|
-
*
|
|
12
|
-
* @example Neues Attribut "luxHint"
|
|
13
|
-
* Input: <lux-input luxLabel="Lorem ipsum"></lux-input>
|
|
14
|
-
* Output: <lux-input luxHint="Hint" luxLabel="Lorem ipsum"></lux-input>
|
|
15
|
-
*
|
|
16
|
-
* @param name Ein Attributname.
|
|
17
|
-
* @param value Ein Attributwert.
|
|
18
|
-
*/
|
|
19
|
-
export const addAttrFn = (name: string, value: string) => {
|
|
20
|
-
return (hit: Hit) => {
|
|
21
|
-
hit.elementContent = replaceFirst(hit.elementContent, `<${hit.selector}`, `<${hit.selector} ${name}="${value}"`);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Diese Funktion löscht das gesamte Element.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* Input: <lux-input luxLabel="Lorem ipsum"></lux-input>
|
|
30
|
-
* Output:
|
|
31
|
-
*
|
|
32
|
-
* @param hit Ein {@link Hit}.
|
|
33
|
-
*/
|
|
34
|
-
export const removeElementFn = (hit: Hit) => {
|
|
35
|
-
hit.elementContent = '';
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Diese Funktion benennt das Element um.
|
|
40
|
-
*
|
|
41
|
-
* @example Neuer Name "lux-input-ac"
|
|
42
|
-
* Input: <lux-input luxLabel="Lorem ipsum"></lux-input>
|
|
43
|
-
* Output: <lux-input-ac luxLabel="Lorem ipsum"></lux-input-ac>
|
|
44
|
-
*
|
|
45
|
-
* @param newName Der neue Name.
|
|
46
|
-
*/
|
|
47
|
-
export const renameElementFn = (newName: string) => {
|
|
48
|
-
return (hit: Hit) => {
|
|
49
|
-
hit.elementContent = replaceAll(hit.elementContent, `<${hit.selector}>`, `<${newName}>`);
|
|
50
|
-
hit.elementContent = replaceAll(hit.elementContent, `<${hit.selector} `, `<${newName} `);
|
|
51
|
-
hit.elementContent = replaceAll(hit.elementContent, `<${hit.selector}\n`, `<${newName}\n`);
|
|
52
|
-
hit.elementContent = replaceAll(hit.elementContent, `</${hit.selector}>`, `</${newName}>`);
|
|
53
|
-
hit.elementContent = replaceAll(hit.elementContent, `</${hit.selector} `, `</${newName} `);
|
|
54
|
-
hit.elementContent = replaceAll(hit.elementContent, `<${hit.selector}\n`, `<${newName}\n`);
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Diese Funktion benennt ein Attribut um.
|
|
60
|
-
*
|
|
61
|
-
* @example Alter Name "luxSelectedFiles", neuer Name "luxSelected"
|
|
62
|
-
* Input: <lux-file-list (luxSelectedFiles)="..."></lux-file-list>
|
|
63
|
-
* Output: <lux-file-list (luxSelected)="..."></lux-file-list>
|
|
64
|
-
*
|
|
65
|
-
* @param oldName Ein alter Name.
|
|
66
|
-
* @param newName Ein neuer Name.
|
|
67
|
-
*/
|
|
68
|
-
export const renameAttrFn = (oldName: string, newName: string) => {
|
|
69
|
-
return (hit: Hit) => {
|
|
70
|
-
const pattern = new RegExp('((\\(|\\[|\\[\\()?)' + oldName + '((\\)|\\]|\\)\\])?)\\s*=\\s*"(.*?)"', 'm');
|
|
71
|
-
hit.elementContent = hit.elementContent.replace(pattern, '$1' + newName + '$3="$5"');
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Diese Funktion aktualisiert den Attributwert nur, wenn dieser mit dem alten Wert übereinstimmt.
|
|
77
|
-
*
|
|
78
|
-
* @example Name "luxLabel", alter Wert "Vorname" und neuer Wert "Name" (alter Wert stimmt überein und der neue Wert wird gesetzt)
|
|
79
|
-
* Input: <lux-input luxLabel="Vorname"></lux-input>
|
|
80
|
-
* Output: <lux-input luxLabel="Name"></lux-input>
|
|
81
|
-
*
|
|
82
|
-
* @example Name "luxLabel", alter Wert "Name" und neuer Wert "Nachname" (alter Wert stimmt nicht überein und der HTML-Inhalt bleibt unverändert)
|
|
83
|
-
* Input: <lux-input luxLabel="Vorname"></lux-input>
|
|
84
|
-
* Output: <lux-input luxLabel="Vorname"></lux-input>
|
|
85
|
-
*
|
|
86
|
-
* @param name Ein Attributname.
|
|
87
|
-
* @param oldValue Ein alter Attributwert.
|
|
88
|
-
* @param newValue Ein neuer Attributwert.
|
|
89
|
-
*/
|
|
90
|
-
export const updateAttrIfFn = (name: string, oldValue: string, newValue: string) => {
|
|
91
|
-
return (hit: Hit) => {
|
|
92
|
-
const pattern = new RegExp('((\\(|\\[|\\[\\()?' + name + '(\\)|\\]|\\)\\])?)\\s*=\\s*"(' + oldValue + ')"', 'm');
|
|
93
|
-
hit.elementContent = hit.elementContent.replace(pattern, '$1="' + newValue + '"');
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Diese Funktion aktualisiert den Attributwert, wenn es das Attribut gibt. D.h. wenn es das Attribut nicht gibt, wird es auch nicht angelegt.
|
|
99
|
-
*
|
|
100
|
-
* @example Name "luxLabel", Wert "Vorname" (Attribut vorhanden und der Wert wird gesetzt)
|
|
101
|
-
* Input: <lux-input luxLabel="Name"></lux-input>
|
|
102
|
-
* Output: <lux-input luxLabel="Vorname"></lux-input>
|
|
103
|
-
*
|
|
104
|
-
* @example Name "luxLabel", Wert "Vorname" (Attribut nicht vorhanden und der HTML-Inhalt bleibt unverändert)
|
|
105
|
-
* Input: <lux-input></lux-input>
|
|
106
|
-
* Output: <lux-input></lux-input>
|
|
107
|
-
*
|
|
108
|
-
* @param name Ein Attributname.
|
|
109
|
-
* @param value Ein Attributwert.
|
|
110
|
-
*/
|
|
111
|
-
export const updateAttrFn = (name: string, value: string) => {
|
|
112
|
-
return (hit: Hit) => {
|
|
113
|
-
const pattern = new RegExp('((\\(|\\[|\\[\\()?' + name + '(\\)|\\]|\\)\\])?)\\s*=\\s*"(.*?)"', 'm');
|
|
114
|
-
hit.elementContent = hit.elementContent.replace(pattern, '$1="' + value + '"');
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Diese Funktion hängt den Wert hinten an, wenn es das Attribut gibt.
|
|
120
|
-
*
|
|
121
|
-
* @example Name "luxLabel", Wert " (*)"
|
|
122
|
-
* Input: <lux-input luxLabel="Nachname"></lux-input>
|
|
123
|
-
* Output: <lux-input luxLabel="Nachname (*)"></lux-input>
|
|
124
|
-
*
|
|
125
|
-
* @param name Ein Attributname.
|
|
126
|
-
* @param appendValue Ein anzuhängender Wert.
|
|
127
|
-
*/
|
|
128
|
-
export const appendAttrFn = (name: string, appendValue: string) => {
|
|
129
|
-
return (hit: Hit) => {
|
|
130
|
-
const pattern = new RegExp('((\\(|\\[|\\[\\()?' + name + '(\\)|\\]|\\)\\])?)\\s*=\\s*"(.*?)"', 'm');
|
|
131
|
-
hit.elementContent = hit.elementContent.replace(pattern, '$1="$4' + appendValue + '"');
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Diese Funktion löscht ein Attribut.
|
|
137
|
-
*
|
|
138
|
-
* @example Attribut "luxHint"
|
|
139
|
-
* Input: <lux-input luxLabel="Name" luxHint="Lorem ipsum"></lux-input>
|
|
140
|
-
* Output: <lux-input luxLabel="Name"></lux-input>
|
|
141
|
-
*
|
|
142
|
-
* @param name Ein Attributname.
|
|
143
|
-
*/
|
|
144
|
-
export const removeAttrFn = (name: string) => {
|
|
145
|
-
return (hit: Hit) => {
|
|
146
|
-
const pattern = new RegExp('(\\(|\\[|\\[\\()?' + name + '(\\)|\\]|\\)\\])?\\s*=\\s*"(.*?)"', 'm');
|
|
147
|
-
hit.elementContent = hit.elementContent.replace(pattern, '');
|
|
148
|
-
};
|
|
149
|
-
};
|
package/src/utility/json.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["json.ts"],"names":[],"mappings":";;;AACA,+CAA0G;AAC1G,uCAAkE;AAErD,QAAA,qBAAqB,GAAs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AAC,CAAC;SAClB;KACF;AACH,CAAC;AAhBD,wCAgBC;AAED,SAAS,WAAW,CAAC,KAAU;IAC7B,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAErC,OAAO,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,GAAG,CAAC;AACrG,CAAC"}
|
package/src/utility/json.ts
DELETED
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
-
import { applyEdits, findNodeAtLocation, FormattingOptions, modify, Node, parseTree } from 'jsonc-parser';
|
|
3
|
-
import { formattedSchematicsException, logInfo } from './logging';
|
|
4
|
-
|
|
5
|
-
export const jsonFormattingOptions: FormattingOptions = {
|
|
6
|
-
insertSpaces: true,
|
|
7
|
-
tabSize: 2,
|
|
8
|
-
eol: '\n'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
13
|
-
* in einem falschen Format sein.
|
|
14
|
-
* @param context
|
|
15
|
-
* @param tree
|
|
16
|
-
*/
|
|
17
|
-
export function readJson(tree: Tree, filePath: string): Node {
|
|
18
|
-
const buffer = tree.read(filePath);
|
|
19
|
-
if (buffer === null) {
|
|
20
|
-
throw formattedSchematicsException(`Konnte die Datei ${filePath} nicht lesen.`);
|
|
21
|
-
}
|
|
22
|
-
const content = buffer.toString();
|
|
23
|
-
|
|
24
|
-
let result = parseTree(content) as Node;
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Liest die Json-Datei aus und wirft Fehlermeldungen, sollte die Json-Datei nicht gefunden oder
|
|
30
|
-
* in einem falschen Format sein.
|
|
31
|
-
* @param context
|
|
32
|
-
* @param tree
|
|
33
|
-
*/
|
|
34
|
-
export function readJsonAsString(tree: Tree, filePath: string): string {
|
|
35
|
-
const buffer = tree.read(filePath);
|
|
36
|
-
if (buffer === null) {
|
|
37
|
-
throw formattedSchematicsException(`Konnte die Datei ${filePath} nicht lesen.`);
|
|
38
|
-
}
|
|
39
|
-
return buffer.toString();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Diese Methode fügt dem Skript den Teil am Index hinzu.
|
|
44
|
-
* Beispiel 1:
|
|
45
|
-
* script: 'ng build --aot && npm run move-de-files'
|
|
46
|
-
* part: ' --localize'
|
|
47
|
-
* Ergebnis: 'ng build --aot --localize && npm run move-de-files'
|
|
48
|
-
*
|
|
49
|
-
* Beispiel 2:
|
|
50
|
-
* script: 'ng build --aot && npm run move-de-files'
|
|
51
|
-
* part: ' --localize'
|
|
52
|
-
* index: 1
|
|
53
|
-
* Ergebnis: 'ng build --aot && npm run move-de-files --localize'
|
|
54
|
-
* @param script Ein NPM-Skript aus der Datei "package.json" (z.B 'ng build --aot && npm run move-de-files').
|
|
55
|
-
* @param part Ein Teil (z.B. --localize).
|
|
56
|
-
* @param index Ein Index (z.B. 0).
|
|
57
|
-
*/
|
|
58
|
-
export function appendScript(script: string, part: string, index?: number) {
|
|
59
|
-
let newSkript = '';
|
|
60
|
-
|
|
61
|
-
const splitArr = script.split(' && ');
|
|
62
|
-
if (splitArr.length === 1) {
|
|
63
|
-
newSkript = script + part;
|
|
64
|
-
} else {
|
|
65
|
-
splitArr[index ? index : 0] = splitArr[index ? index : 0] + part;
|
|
66
|
-
newSkript = splitArr.join(' && ');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return newSkript;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function updateJsonValue(
|
|
73
|
-
filePath: string,
|
|
74
|
-
jsonPath: string[],
|
|
75
|
-
value: any,
|
|
76
|
-
onlyUpdate = false
|
|
77
|
-
): Rule {
|
|
78
|
-
return (tree: Tree, _context: SchematicContext) => {
|
|
79
|
-
const found = findNodeAtLocation(readJson(tree, filePath), jsonPath);
|
|
80
|
-
|
|
81
|
-
if (!onlyUpdate || (onlyUpdate && found)) {
|
|
82
|
-
const jsonFile = readJsonAsString(tree, filePath);
|
|
83
|
-
const edits = modify(jsonFile, jsonPath, value, {
|
|
84
|
-
formattingOptions: jsonFormattingOptions,
|
|
85
|
-
isArrayInsertion: false
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (edits) {
|
|
89
|
-
tree.overwrite(filePath, applyEdits(jsonFile, edits));
|
|
90
|
-
|
|
91
|
-
if (value) {
|
|
92
|
-
logInfo(`Wert ${getLogValue(value)} an der Stelle "${jsonPath.join('.')}" eingetragen.`);
|
|
93
|
-
} else {
|
|
94
|
-
logInfo(`Wert an der Stelle "${jsonPath.join('.')}" gelöscht.`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function updateJsonArray(
|
|
102
|
-
filePath: string,
|
|
103
|
-
jsonPath: string[],
|
|
104
|
-
value: any,
|
|
105
|
-
onlyUpdate = false,
|
|
106
|
-
findFn?: (value: Node) => boolean
|
|
107
|
-
): Rule {
|
|
108
|
-
return (tree: Tree, _context: SchematicContext) => {
|
|
109
|
-
// Gibt es bereits eine passende Stelle?
|
|
110
|
-
let foundIndex = -1;
|
|
111
|
-
let childrenCount = -1;
|
|
112
|
-
|
|
113
|
-
const node = findNodeAtLocation(readJson(tree, filePath), jsonPath);
|
|
114
|
-
if (node && node.children) {
|
|
115
|
-
childrenCount = node.children.length;
|
|
116
|
-
|
|
117
|
-
if (!findFn && typeof value === 'string') {
|
|
118
|
-
// Sollte der Wert bereits im Array enthalten sein,
|
|
119
|
-
// kann man an dieser Stelle abbrechen und die
|
|
120
|
-
// Methode verlassen.
|
|
121
|
-
foundIndex = findStringIndexInArray(node, value);
|
|
122
|
-
if (foundIndex >= 0) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (findFn) {
|
|
128
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
129
|
-
if (findFn(node.children[i])) {
|
|
130
|
-
foundIndex = i;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (!onlyUpdate || (onlyUpdate && foundIndex >= 0)) {
|
|
138
|
-
const jsonFile = readJsonAsString(tree, filePath);
|
|
139
|
-
const edits = modify(
|
|
140
|
-
jsonFile,
|
|
141
|
-
[...jsonPath, foundIndex >= 0 ? foundIndex : childrenCount !== -1 ? childrenCount : 0],
|
|
142
|
-
value,
|
|
143
|
-
{ formattingOptions: jsonFormattingOptions, isArrayInsertion: foundIndex === -1 }
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
if (edits) {
|
|
147
|
-
tree.overwrite(filePath, applyEdits(jsonFile, edits));
|
|
148
|
-
logInfo(`"${JSON.stringify(value)}" an der Stelle "${jsonPath.join('.')}" hinzugefügt.`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Diese Methode liefert den Index im Array des Objekts mit der übergebenen Property zurück.
|
|
156
|
-
*
|
|
157
|
-
* Beispiel: findObjectIndexInArray(node, 'glob', '*.css') = 1
|
|
158
|
-
* ```json
|
|
159
|
-
* 'assets': [
|
|
160
|
-
* 'src/assets',
|
|
161
|
-
* {
|
|
162
|
-
* 'glob': '*.css',
|
|
163
|
-
* 'input': './node_modules/@ihk-gfi/lux-components-theme/prebuilt-themes',
|
|
164
|
-
* 'output': './assets/themes'
|
|
165
|
-
* },
|
|
166
|
-
* 'src/favicon.ico',
|
|
167
|
-
* ]
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* @param arrayNode Ein Konten, der ein Array als Wert hat.
|
|
171
|
-
* @param propertyName Ein Propertyname (z.B. glob).
|
|
172
|
-
* @param propertyValue Ein Propertywert (z.B. *.css).
|
|
173
|
-
*/
|
|
174
|
-
export function findObjectIndexInArray(arrayNode: Node, propertyName: string, propertyValue: string): number {
|
|
175
|
-
let arrayIndex = -1;
|
|
176
|
-
if (arrayNode.children) {
|
|
177
|
-
for (let i = 0; i < arrayNode.children.length; i++) {
|
|
178
|
-
const assetChild = arrayNode.children[i];
|
|
179
|
-
|
|
180
|
-
if (assetChild.type === 'object' && assetChild.children && assetChild.children.length > 0) {
|
|
181
|
-
const assetObjectChildren = assetChild.children;
|
|
182
|
-
if (assetObjectChildren) {
|
|
183
|
-
for (let j = 0; j < assetObjectChildren.length; j++) {
|
|
184
|
-
if (assetObjectChildren[j].type === 'property') {
|
|
185
|
-
const propertyChildren = assetObjectChildren[j].children ?? [];
|
|
186
|
-
if (
|
|
187
|
-
propertyChildren.length > 1 &&
|
|
188
|
-
propertyChildren[0].value === propertyName &&
|
|
189
|
-
propertyChildren[1].value === propertyValue
|
|
190
|
-
) {
|
|
191
|
-
arrayIndex = i;
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
} else if (assetChild.type === 'string' && assetChild.value === propertyValue) {
|
|
198
|
-
arrayIndex = i;
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return arrayIndex;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export function findObjectPropertyInArray(node: Node, propertyName: string, propertyValue: string): boolean {
|
|
208
|
-
let found = false;
|
|
209
|
-
|
|
210
|
-
if (node.type === 'object' && node.children && node.children.length > 0) {
|
|
211
|
-
const assetObjectChildren = node.children;
|
|
212
|
-
if (assetObjectChildren) {
|
|
213
|
-
for (let j = 0; j < assetObjectChildren.length; j++) {
|
|
214
|
-
if (assetObjectChildren[j].type === 'property') {
|
|
215
|
-
const propertyChildren = assetObjectChildren[j].children ?? [];
|
|
216
|
-
if (
|
|
217
|
-
propertyChildren.length > 1 &&
|
|
218
|
-
propertyChildren[0].value === propertyName &&
|
|
219
|
-
propertyChildren[1].value === propertyValue
|
|
220
|
-
) {
|
|
221
|
-
found = true;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return found;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Diese Methode liefert den Index im Array des Werts zurück.
|
|
234
|
-
*
|
|
235
|
-
* Beispiel: findStringIndexInArray(node, 'src/favicon.ico') = 2
|
|
236
|
-
* ```json
|
|
237
|
-
* 'assets': [
|
|
238
|
-
* 'src/assets',
|
|
239
|
-
* {
|
|
240
|
-
* 'glob': '*.css',
|
|
241
|
-
* 'input': './node_modules/@ihk-gfi/lux-components-theme/prebuilt-themes',
|
|
242
|
-
* 'output': './assets/themes'
|
|
243
|
-
* },
|
|
244
|
-
* 'src/favicon.ico',
|
|
245
|
-
* ]
|
|
246
|
-
* ```
|
|
247
|
-
*
|
|
248
|
-
* @param arrayNode Ein Konten, der ein Array als Wert hat.
|
|
249
|
-
* @param value Ein Wert (z.B. 'src/favicon.ico').
|
|
250
|
-
*/
|
|
251
|
-
export function findStringIndexInArray(arrayNode: Node, value: string): number {
|
|
252
|
-
let arrayIndex = -1;
|
|
253
|
-
if (arrayNode.children) {
|
|
254
|
-
for (let i = 0; i < arrayNode.children.length; i++) {
|
|
255
|
-
const assetChild = arrayNode.children[i];
|
|
256
|
-
if (assetChild.type === 'string' && assetChild.value === value) {
|
|
257
|
-
arrayIndex = i;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return arrayIndex;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export function removeJsonNode(
|
|
267
|
-
tree: Tree,
|
|
268
|
-
filePath: string,
|
|
269
|
-
jsonPath: (string | any)[],
|
|
270
|
-
message = `Den Abschnitt "${JSON.stringify(jsonPath)}" gelöscht.`
|
|
271
|
-
) {
|
|
272
|
-
const contentAsNode = readJson(tree, filePath);
|
|
273
|
-
const testAssetsNode = findNodeAtLocation(contentAsNode, jsonPath);
|
|
274
|
-
if (testAssetsNode) {
|
|
275
|
-
const angularJson = readJsonAsString(tree, filePath);
|
|
276
|
-
const edits = modify(angularJson, jsonPath, void 0, { formattingOptions: jsonFormattingOptions });
|
|
277
|
-
if (edits) {
|
|
278
|
-
tree.overwrite(filePath, applyEdits(angularJson, edits));
|
|
279
|
-
logInfo(message);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function getLogValue(value: any): string {
|
|
285
|
-
let logValue = JSON.stringify(value);
|
|
286
|
-
|
|
287
|
-
return logValue && logValue.startsWith('"') && logValue.endsWith('"') ? logValue : `"${logValue}"`;
|
|
288
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|