@smartsoft001/crud-shell-nestjs 2.107.0 → 2.109.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.
Files changed (2) hide show
  1. package/index.js +28 -1
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -119,6 +119,31 @@ var PasswordService = class _PasswordService {
119
119
  }
120
120
  };
121
121
 
122
+ // packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
123
+ var RemoveHtmlService = class {
124
+ /**
125
+ * Remove HTML tags and decode HTML entities from text
126
+ * - Removes HTML tags
127
+ * - Decodes common named entities ( , ", etc.)
128
+ * - Decodes numeric entities ({ or «)
129
+ * - Removes any remaining unrecognized entities
130
+ */
131
+ static create(val) {
132
+ if (!val) {
133
+ return "";
134
+ }
135
+ let result = val;
136
+ result = result.replace(/<[^>]*(>|$)/g, "");
137
+ result = result.replace(/&nbsp;/g, " ").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&bdquo;/g, "\u201E").replace(/&rdquo;/g, '"').replace(/&ldquo;/g, '"').replace(/&laquo;/g, "\xAB").replace(/&raquo;/g, "\xBB").replace(/&zwnj;/g, "");
138
+ result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
139
+ /&#x([0-9a-f]+);/gi,
140
+ (match, hex) => String.fromCharCode(parseInt(hex, 16))
141
+ );
142
+ result = result.replace(/&[a-z]+;/gi, "");
143
+ return result;
144
+ }
145
+ };
146
+
122
147
  // packages/shared/utils/src/lib/services/slug/slug.service.ts
123
148
  var SlugService = class _SlugService {
124
149
  static {
@@ -145,6 +170,7 @@ var SlugService = class _SlugService {
145
170
  }
146
171
  /**
147
172
  * Convert text to URL-friendly slug
173
+ * - Removes HTML tags and entities
148
174
  * - Replaces Polish characters with English equivalents
149
175
  * - Converts to lowercase
150
176
  * - Replaces spaces and special characters with hyphens
@@ -155,7 +181,8 @@ var SlugService = class _SlugService {
155
181
  if (!text) {
156
182
  return "";
157
183
  }
158
- let slug = text.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
184
+ let slug = RemoveHtmlService.create(text);
185
+ slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
159
186
  slug = slug.toLowerCase();
160
187
  slug = slug.replace(/[^a-z0-9]+/g, "-");
161
188
  slug = slug.replace(/-+/g, "-");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/crud-shell-nestjs",
3
- "version": "2.107.0",
3
+ "version": "2.109.0",
4
4
  "description": "Utils to crud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,9 +17,9 @@
17
17
  "url": "https://github.com/emiljuchnikowski/smartsoft/issues"
18
18
  },
19
19
  "peerDependencies": {
20
- "@smartsoft001/crud-shell-app-services": "2.107.0",
20
+ "@smartsoft001/crud-shell-app-services": "2.109.0",
21
21
  "@smartsoft001/crud-shell-dto": "*",
22
- "@smartsoft001/domain-core": "2.107.0"
22
+ "@smartsoft001/domain-core": "2.109.0"
23
23
  },
24
24
  "homepage": "https://github.com/emiljuchnikowski/smartsoft#readme"
25
25
  }