@spartan-ng/cli 0.0.1-alpha.437 → 0.0.1-alpha.438
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/generators.json +5 -0
- package/package.json +1 -1
- package/src/generators/healthcheck/generator.js +2 -2
- package/src/generators/healthcheck/generator.js.map +1 -1
- package/src/generators/healthcheck/healthchecks/brn-toggle-group.d.ts +2 -0
- package/src/generators/healthcheck/healthchecks/brn-toggle-group.js +34 -0
- package/src/generators/healthcheck/healthchecks/brn-toggle-group.js.map +1 -0
- package/src/generators/migrate-brain-imports/import-map.d.ts +1 -0
- package/src/generators/migrate-brain-imports/import-map.js +1 -0
- package/src/generators/migrate-brain-imports/import-map.js.map +1 -1
- package/src/generators/migrate-toggle-group/compat.d.ts +2 -0
- package/src/generators/migrate-toggle-group/compat.js +7 -0
- package/src/generators/migrate-toggle-group/compat.js.map +1 -0
- package/src/generators/migrate-toggle-group/generator.d.ts +4 -0
- package/src/generators/migrate-toggle-group/generator.js +119 -0
- package/src/generators/migrate-toggle-group/generator.js.map +1 -0
- package/src/generators/migrate-toggle-group/schema.d.ts +3 -0
- package/src/generators/migrate-toggle-group/schema.json +14 -0
- package/src/generators/ui/libs/ui-breadcrumb-helm/files/lib/breadcrumb-separator.component.ts.template +3 -4
- package/src/generators/ui/libs/ui-calendar-helm/files/index.ts.template +6 -2
- package/src/generators/ui/libs/ui-calendar-helm/files/lib/hlm-calendar-multi.component.ts.template +178 -0
- package/src/generators/ui/libs/ui-calendar-helm/files/lib/hlm-calendar.component.ts.template +1 -1
- package/src/generators/ui/libs/ui-date-picker-helm/files/index.ts.template +6 -2
- package/src/generators/ui/libs/ui-date-picker-helm/files/lib/hlm-date-picker-multi.component.ts.template +184 -0
- package/src/generators/ui/libs/ui-date-picker-helm/files/lib/hlm-date-picker-multi.token.ts.template +43 -0
- package/src/generators/ui/libs/ui-date-picker-helm/files/lib/hlm-date-picker.component.ts.template +8 -6
- package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-trigger.component.ts.template +1 -1
- package/src/generators/ui/libs/ui-select-helm/files/lib/hlm-select-value.directive.ts.template +1 -1
- package/src/generators/ui/libs/ui-slider-helm/files/index.ts.template +2 -9
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider.component.ts.template +41 -8
- package/src/generators/ui/libs/ui-toggle-group-helm/files/index.ts.template +12 -0
- package/src/generators/ui/libs/ui-toggle-group-helm/files/lib/hlm-toggle-group.directive.ts.template +29 -0
- package/src/generators/ui/libs/ui-toggle-group-helm/files/lib/hlm-toggle-group.token.ts.template +12 -0
- package/src/generators/ui/libs/ui-toggle-group-helm/files/lib/hlm-toggle-item.directive.ts.template +55 -0
- package/src/generators/ui/libs/ui-toggle-group-helm/generator.d.ts +3 -0
- package/src/generators/ui/libs/ui-toggle-group-helm/generator.js +14 -0
- package/src/generators/ui/libs/ui-toggle-group-helm/generator.js.map +1 -0
- package/src/generators/ui/libs/ui-toggle-helm/files/index.ts.template +0 -8
- package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle.directive.ts.template +16 -5
- package/src/generators/ui/supported-ui-libraries.json +55 -37
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-input.directive.ts.template +0 -19
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-thumb.directive.ts.template +0 -27
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-tick-mark.directive.ts.template +0 -29
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-tick-marks.directive.ts.template +0 -17
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track-active-fill.directive.ts.template +0 -26
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track-active.directive.ts.template +0 -20
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track-inactive.directive.ts.template +0 -17
- package/src/generators/ui/libs/ui-slider-helm/files/lib/hlm-slider-track.component.ts.template +0 -54
- package/src/generators/ui/libs/ui-toggle-helm/files/lib/hlm-toggle-group.directive.ts.template +0 -20
package/generators.json
CHANGED
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
"schema": "./src/generators/migrate-radio/schema.json",
|
|
31
31
|
"description": "Migrate brn-radio to hlm-radio"
|
|
32
32
|
},
|
|
33
|
+
"migrate-toggle-group": {
|
|
34
|
+
"factory": "./src/generators/migrate-toggle-group/generator",
|
|
35
|
+
"schema": "./src/generators/migrate-toggle-group/schema.json",
|
|
36
|
+
"description": "Migrate brn-toggle-group from @spartan-ng/brain/toggle to @spartan-ng/brain/toggle-group"
|
|
37
|
+
},
|
|
33
38
|
"migrate-select": {
|
|
34
39
|
"factory": "./src/generators/migrate-select/generator",
|
|
35
40
|
"schema": "./src/generators/migrate-select/schema.json",
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const healthchecks_1 = require("./healthchecks");
|
|
6
6
|
const brain_imports_1 = require("./healthchecks/brain-imports");
|
|
7
7
|
const brn_radio_1 = require("./healthchecks/brn-radio");
|
|
8
|
+
const brn_toggle_group_1 = require("./healthchecks/brn-toggle-group");
|
|
8
9
|
const core_imports_1 = require("./healthchecks/core-imports");
|
|
9
10
|
const hlm_icon_1 = require("./healthchecks/hlm-icon");
|
|
10
11
|
const hlm_scroll_area_1 = require("./healthchecks/hlm-scroll-area");
|
|
@@ -23,8 +24,8 @@ async function healthcheckGenerator(tree, options) {
|
|
|
23
24
|
hlm_scroll_area_1.scrollAreaHealthcheck,
|
|
24
25
|
brn_radio_1.brainRadioHealthcheck,
|
|
25
26
|
hlm_select_1.selectHealthcheck,
|
|
27
|
+
brn_toggle_group_1.brainToggleHealthcheck,
|
|
26
28
|
];
|
|
27
|
-
// store all the failed healthchecks that can be fixed
|
|
28
29
|
const failedReports = [];
|
|
29
30
|
for (const healthcheck of healthchecks) {
|
|
30
31
|
const report = await (0, runner_1.runHealthcheck)(tree, healthcheck);
|
|
@@ -33,7 +34,6 @@ async function healthcheckGenerator(tree, options) {
|
|
|
33
34
|
failedReports.push(report);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
// if there are some failed healthchecks that can be fixed, ask the user if they want to fix them
|
|
37
37
|
for (const report of failedReports) {
|
|
38
38
|
if (report.fixable && (0, healthchecks_1.isHealthcheckFixable)(report.healthcheck)) {
|
|
39
39
|
const fix = options.autoFix || (await (0, prompt_1.promptUser)(report.healthcheck.prompt));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/healthcheck/generator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/healthcheck/generator.ts"],"names":[],"mappings":";;AAeA,oDAsCC;AArDD,uCAAuD;AACvD,iDAAyG;AACzG,gEAAuE;AACvE,wDAAiE;AACjE,sEAAyE;AACzE,8DAAqE;AACrE,sDAA8D;AAC9D,oEAAuE;AACvE,0DAA8D;AAC9D,oDAA4D;AAE5D,2CAA4C;AAC5C,+CAA+C;AAC/C,2CAAgD;AAEzC,KAAK,UAAU,oBAAoB,CAAC,IAAU,EAAE,OAA8D;IACpH,eAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAEvC,MAAM,YAAY,GAAkB;QACnC,4BAAkB;QAClB,uCAAuB;QACvB,qCAAsB;QACtB,8BAAmB;QACnB,uCAAqB;QACrB,iCAAqB;QACrB,8BAAiB;QACjB,yCAAsB;KACtB,CAAC;IAEF,MAAM,aAAa,GAAwB,EAAE,CAAC;IAE9C,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAc,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACvD,IAAA,sBAAW,EAAC,MAAM,CAAC,CAAC;QAEpB,IAAI,MAAM,CAAC,MAAM,KAAK,gCAAiB,CAAC,OAAO,EAAE,CAAC;YACjD,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;IACF,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,OAAO,IAAI,IAAA,mCAAoB,EAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAChE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,MAAM,IAAA,mBAAU,EAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YAE7E,IAAI,GAAG,EAAE,CAAC;gBACT,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;YACxE,CAAC;QACF,CAAC;IACF,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACzB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACzB,CAAC;AACF,CAAC;AAED,kBAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.brainToggleHealthcheck = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const generator_1 = require("../../migrate-toggle-group/generator");
|
|
6
|
+
const healthchecks_1 = require("../healthchecks");
|
|
7
|
+
exports.brainToggleHealthcheck = {
|
|
8
|
+
name: 'Brain Toggle Group',
|
|
9
|
+
async detect(tree, failure) {
|
|
10
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, '/', (file) => {
|
|
11
|
+
// if the file is a .ts or .htlm file, check for helm icons
|
|
12
|
+
if (!file.endsWith('.ts') && !file.endsWith('.html')) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const contents = tree.read(file, 'utf-8');
|
|
16
|
+
if (!contents) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (contents.includes("BrnToggleGroupModule } from '@spartan-ng/brain/toggle'") ||
|
|
20
|
+
contents.includes("import { BrnToggleGroupModule } from '@spartan-ng/brain/toggle'") ||
|
|
21
|
+
(contents.includes('BrnToggleGroupModule') && contents.includes('@spartan-ng/brain/toggle')) ||
|
|
22
|
+
contents.includes("HlmToggleGroupModule } from '@spartan-ng/ui-toggle-helm'") ||
|
|
23
|
+
(contents.includes('HlmToggleGroupModule') && contents.includes('@spartan-ng/ui-toggle-helm'))) {
|
|
24
|
+
failure('The <brn-toggle-group> component from the toggle brain package is deprecated. Please use the <brn-toggle-group> from the toggle-group package instead.', healthchecks_1.HealthcheckSeverity.Error, true);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
fix: async (tree) => {
|
|
29
|
+
await (0, generator_1.migrateToggleGroupGenerator)(tree, { skipFormat: true });
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
prompt: 'Would you like to migrate toggle-group?',
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=brn-toggle-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brn-toggle-group.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/generators/healthcheck/healthchecks/brn-toggle-group.ts"],"names":[],"mappings":";;;AAAA,uCAAkD;AAClD,oEAAmF;AACnF,kDAAmE;AAEtD,QAAA,sBAAsB,GAAgB;IAClD,IAAI,EAAE,oBAAoB;IAC1B,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO;QACzB,IAAA,6BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;YACxC,2DAA2D;YAC3D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtD,OAAO;YACR,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAE1C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,OAAO;YACR,CAAC;YAED,IACC,QAAQ,CAAC,QAAQ,CAAC,wDAAwD,CAAC;gBAC3E,QAAQ,CAAC,QAAQ,CAAC,iEAAiE,CAAC;gBACpF,CAAC,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;gBAC5F,QAAQ,CAAC,QAAQ,CAAC,0DAA0D,CAAC;gBAC7E,CAAC,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,EAC7F,CAAC;gBACF,OAAO,CACN,wJAAwJ,EACxJ,kCAAmB,CAAC,KAAK,EACzB,IAAI,CACJ,CAAC;YACH,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,MAAM,IAAA,uCAA2B,EAAC,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,EAAE,yCAAyC;CACjD,CAAC"}
|
|
@@ -23,6 +23,7 @@ declare const _default: {
|
|
|
23
23
|
'@spartan-ng/ui-table-brain': string;
|
|
24
24
|
'@spartan-ng/ui-tabs-brain': string;
|
|
25
25
|
'@spartan-ng/ui-toggle-brain': string;
|
|
26
|
+
'@spartan-ng/ui-toggle-group-brain': string;
|
|
26
27
|
'@spartan-ng/ui-tooltip-brain': string;
|
|
27
28
|
'@spartan-ng/ui-date-time-brain': string;
|
|
28
29
|
'@spartan-ng/ui-date-time-luxon-brain': string;
|
|
@@ -25,6 +25,7 @@ exports.default = {
|
|
|
25
25
|
'@spartan-ng/ui-table-brain': '@spartan-ng/brain/table',
|
|
26
26
|
'@spartan-ng/ui-tabs-brain': '@spartan-ng/brain/tabs',
|
|
27
27
|
'@spartan-ng/ui-toggle-brain': '@spartan-ng/brain/toggle',
|
|
28
|
+
'@spartan-ng/ui-toggle-group-brain': '@spartan-ng/brain/toggle-group',
|
|
28
29
|
'@spartan-ng/ui-tooltip-brain': '@spartan-ng/brain/tooltip',
|
|
29
30
|
'@spartan-ng/ui-date-time-brain': '@spartan-ng/brain/date-time',
|
|
30
31
|
'@spartan-ng/ui-date-time-luxon-brain': '@spartan-ng/brain/date-time-luxon',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-map.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-brain-imports/import-map.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACd,+BAA+B,EAAE,4BAA4B;IAC7D,6BAA6B,EAAE,0BAA0B;IACzD,gCAAgC,EAAE,6BAA6B;IAC/D,4BAA4B,EAAE,yBAAyB;IACvD,6BAA6B,EAAE,0BAA0B;IACzD,mCAAmC,EAAE,gCAAgC;IACrE,+BAA+B,EAAE,4BAA4B;IAC7D,kCAAkC,EAAE,+BAA+B;IACnE,8BAA8B,EAAE,2BAA2B;IAC3D,6BAA6B,EAAE,0BAA0B;IACzD,iCAAiC,EAAE,8BAA8B;IACjE,4BAA4B,EAAE,yBAAyB;IACvD,iCAAiC,EAAE,8BAA8B;IACjE,2BAA2B,EAAE,wBAAwB;IACrD,8BAA8B,EAAE,2BAA2B;IAC3D,+BAA+B,EAAE,4BAA4B;IAC7D,kCAAkC,EAAE,+BAA+B;IACnE,6BAA6B,EAAE,0BAA0B;IACzD,gCAAgC,EAAE,6BAA6B;IAC/D,4BAA4B,EAAE,yBAAyB;IACvD,6BAA6B,EAAE,0BAA0B;IACzD,4BAA4B,EAAE,yBAAyB;IACvD,2BAA2B,EAAE,wBAAwB;IACrD,6BAA6B,EAAE,0BAA0B;IACzD,8BAA8B,EAAE,2BAA2B;IAC3D,gCAAgC,EAAE,6BAA6B;IAC/D,sCAAsC,EAAE,mCAAmC;CAC3E,CAAC"}
|
|
1
|
+
{"version":3,"file":"import-map.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-brain-imports/import-map.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACd,+BAA+B,EAAE,4BAA4B;IAC7D,6BAA6B,EAAE,0BAA0B;IACzD,gCAAgC,EAAE,6BAA6B;IAC/D,4BAA4B,EAAE,yBAAyB;IACvD,6BAA6B,EAAE,0BAA0B;IACzD,mCAAmC,EAAE,gCAAgC;IACrE,+BAA+B,EAAE,4BAA4B;IAC7D,kCAAkC,EAAE,+BAA+B;IACnE,8BAA8B,EAAE,2BAA2B;IAC3D,6BAA6B,EAAE,0BAA0B;IACzD,iCAAiC,EAAE,8BAA8B;IACjE,4BAA4B,EAAE,yBAAyB;IACvD,iCAAiC,EAAE,8BAA8B;IACjE,2BAA2B,EAAE,wBAAwB;IACrD,8BAA8B,EAAE,2BAA2B;IAC3D,+BAA+B,EAAE,4BAA4B;IAC7D,kCAAkC,EAAE,+BAA+B;IACnE,6BAA6B,EAAE,0BAA0B;IACzD,gCAAgC,EAAE,6BAA6B;IAC/D,4BAA4B,EAAE,yBAAyB;IACvD,6BAA6B,EAAE,0BAA0B;IACzD,4BAA4B,EAAE,yBAAyB;IACvD,2BAA2B,EAAE,wBAAwB;IACrD,6BAA6B,EAAE,0BAA0B;IACzD,mCAAmC,EAAE,gCAAgC;IACrE,8BAA8B,EAAE,2BAA2B;IAC3D,gCAAgC,EAAE,6BAA6B;IAC/D,sCAAsC,EAAE,mCAAmC;CAC3E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const generator_1 = tslib_1.__importDefault(require("./generator"));
|
|
6
|
+
exports.default = (0, devkit_1.convertNxGenerator)(generator_1.default);
|
|
7
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-toggle-group/compat.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAChD,oEAAgD;AAEhD,kBAAe,IAAA,2BAAkB,EAAC,mBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { MigrateToggleGroupGeneratorSchema } from './schema';
|
|
3
|
+
export declare function migrateToggleGroupGenerator(tree: Tree, { skipFormat }: MigrateToggleGroupGeneratorSchema): Promise<void>;
|
|
4
|
+
export default migrateToggleGroupGenerator;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.migrateToggleGroupGenerator = migrateToggleGroupGenerator;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const visit_files_1 = require("../../utils/visit-files");
|
|
6
|
+
async function migrateToggleGroupGenerator(tree, { skipFormat }) {
|
|
7
|
+
updateBrainImports(tree);
|
|
8
|
+
updateHlmImports(tree);
|
|
9
|
+
replaceSelector(tree);
|
|
10
|
+
if (!skipFormat) {
|
|
11
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Update brain imports to migrate from toggle to toggle-group
|
|
16
|
+
*/
|
|
17
|
+
function updateBrainImports(tree) {
|
|
18
|
+
(0, visit_files_1.visitFiles)(tree, '/', (path) => {
|
|
19
|
+
// Filter for TypeScript files that might contain the imports we're interested in
|
|
20
|
+
if (!path.endsWith('.ts'))
|
|
21
|
+
return;
|
|
22
|
+
let content = tree.read(path)?.toString();
|
|
23
|
+
if (!content)
|
|
24
|
+
return;
|
|
25
|
+
// Only proceed if file has BrnToggleGroupModule from toggle but not from toggle-group
|
|
26
|
+
if (content.includes('BrnToggleGroupModule') &&
|
|
27
|
+
content.includes("from '@spartan-ng/brain/toggle'") &&
|
|
28
|
+
!content.includes("from '@spartan-ng/brain/toggle-group'")) {
|
|
29
|
+
// Remove BrnToggleGroupModule from the toggle import
|
|
30
|
+
content = content.replace(/import\s+\{\s*([^{}]*BrnToggleGroupModule[^{}]*)\s*\}\s+from\s+['"]@spartan-ng\/brain\/toggle['"];/g, (_match, importList) => {
|
|
31
|
+
// Remove BrnToggleGroupModule from the import list
|
|
32
|
+
const newImportList = importList
|
|
33
|
+
.split(',')
|
|
34
|
+
.map((item) => item.trim())
|
|
35
|
+
.filter((item) => item !== 'BrnToggleGroupModule')
|
|
36
|
+
.join(', ');
|
|
37
|
+
// If there are still imports remaining, return the modified import statement
|
|
38
|
+
if (newImportList.length > 0) {
|
|
39
|
+
return `import { ${newImportList} } from '@spartan-ng/brain/toggle';`;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// If no imports remain, remove the entire import statement
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// Add the new toggle-group import with BrnToggleGroupComponent and BrnToggleGroupItemDirective
|
|
47
|
+
const importRegex = /import\s+.*?;/g;
|
|
48
|
+
let match;
|
|
49
|
+
let lastImportEndIndex = 0;
|
|
50
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
51
|
+
lastImportEndIndex = match.index + match[0].length;
|
|
52
|
+
}
|
|
53
|
+
// If we found imports, add after the last one
|
|
54
|
+
if (lastImportEndIndex > 0) {
|
|
55
|
+
const newImport = `\nimport { BrnToggleGroupComponent, BrnToggleGroupItemDirective } from '@spartan-ng/brain/toggle-group';`;
|
|
56
|
+
content = content.substring(0, lastImportEndIndex) + newImport + content.substring(lastImportEndIndex);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// If no imports found, add at the beginning
|
|
60
|
+
const newImport = `import { BrnToggleGroupComponent, BrnToggleGroupItemDirective } from '@spartan-ng/brain/toggle-group';\n\n`;
|
|
61
|
+
content = newImport + content;
|
|
62
|
+
}
|
|
63
|
+
// Update component imports to include BrnToggleGroupItemDirective
|
|
64
|
+
content = content.replace(/imports:\s*\[\s*BrnToggleGroupModule\s*,/g, 'imports: [BrnToggleGroupComponent, BrnToggleGroupItemDirective,');
|
|
65
|
+
// Also handle the case where BrnToggleGroupModule is the only import
|
|
66
|
+
content = content.replace(/imports:\s*\[\s*BrnToggleGroupModule\s*\]/g, 'imports: [BrnToggleGroupComponent, BrnToggleGroupItemDirective]');
|
|
67
|
+
tree.write(path, content);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return tree;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Update hlm imports to migrate from toggle to toggle-group
|
|
74
|
+
*/
|
|
75
|
+
function updateHlmImports(tree) {
|
|
76
|
+
(0, visit_files_1.visitFiles)(tree, '/', (path) => {
|
|
77
|
+
// Filter for TypeScript files that might contain the imports we're interested in
|
|
78
|
+
if (!path.endsWith('.ts'))
|
|
79
|
+
return;
|
|
80
|
+
let content = tree.read(path)?.toString();
|
|
81
|
+
if (!content)
|
|
82
|
+
return;
|
|
83
|
+
// Only proceed if file has imports from ui-toggle-helm but not from ui-toggle-group-helm
|
|
84
|
+
if (content.includes("from '@spartan-ng/ui-toggle-helm'") &&
|
|
85
|
+
!content.includes("from '@spartan-ng/ui-toggle-group-helm'")) {
|
|
86
|
+
// Replace HlmToggleDirective and HlmToggleGroupModule with the directives
|
|
87
|
+
// Handle case with HlmToggleDirective
|
|
88
|
+
content = content.replace(/import\s+\{\s*HlmToggleDirective\s*,\s*HlmToggleGroupModule\s*\}\s+from\s+['"]@spartan-ng\/ui-toggle-helm['"];/g, "import { HlmToggleGroupDirective, HlmToggleGroupItemDirective } from '@spartan-ng/ui-toggle-group-helm';");
|
|
89
|
+
// Also handle case with just HlmToggleGroupModule
|
|
90
|
+
content = content.replace(/import\s+\{\s*HlmToggleGroupModule\s*\}\s+from\s+['"]@spartan-ng\/ui-toggle-helm['"];/g, "import { HlmToggleGroupDirective, HlmToggleGroupItemDirective } from '@spartan-ng/ui-toggle-group-helm';");
|
|
91
|
+
// Update the imports array to replace HlmToggleGroupModule with the directives
|
|
92
|
+
// For the case where HlmToggleGroupModule is in the middle of other imports
|
|
93
|
+
content = content.replace('HlmToggleGroupModule', 'HlmToggleGroupDirective, HlmToggleGroupItemDirective');
|
|
94
|
+
tree.write(path, content);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return tree;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Replace brnToggle with hlmToggleGroupItem inside the brn-toggle-group
|
|
101
|
+
*/
|
|
102
|
+
function replaceSelector(_tree) {
|
|
103
|
+
(0, visit_files_1.visitFiles)(_tree, '/', (path) => {
|
|
104
|
+
if (!path.endsWith('.html') && !path.endsWith('.ts')) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
let content = _tree.read(path)?.toString();
|
|
108
|
+
if (!content)
|
|
109
|
+
return;
|
|
110
|
+
// if file contains @spartan-ng/ui-toggle-group-helm
|
|
111
|
+
if (content.includes('@spartan-ng/ui-toggle-group-helm')) {
|
|
112
|
+
content = content.replace(/brnToggle/g, 'hlmToggleGroupItem');
|
|
113
|
+
}
|
|
114
|
+
_tree.write(path, content);
|
|
115
|
+
});
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
exports.default = migrateToggleGroupGenerator;
|
|
119
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/generators/migrate-toggle-group/generator.ts"],"names":[],"mappings":";;AAIA,kEAQC;AAZD,uCAA+C;AAC/C,yDAAqD;AAG9C,KAAK,UAAU,2BAA2B,CAAC,IAAU,EAAE,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G,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;QAC/D,CAAC;QAED,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACb,CAAC;AAED,kBAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "MigrateRadio",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skipFormat": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"default": false,
|
|
10
|
+
"description": "Skip formatting files"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"required": []
|
|
14
|
+
}
|
|
@@ -2,13 +2,12 @@ import { Component, computed, input } from '@angular/core';
|
|
|
2
2
|
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
3
3
|
import { lucideChevronRight } from '@ng-icons/lucide';
|
|
4
4
|
import { hlm } from '@spartan-ng/brain/core';
|
|
5
|
-
import { HlmIconDirective } from '@spartan-ng/ui-icon-helm';
|
|
6
5
|
import type { ClassValue } from 'clsx';
|
|
7
6
|
|
|
8
7
|
@Component({
|
|
9
8
|
// eslint-disable-next-line @angular-eslint/component-selector
|
|
10
9
|
selector: '[hlmBreadcrumbSeparator]',
|
|
11
|
-
imports: [NgIcon
|
|
10
|
+
imports: [NgIcon],
|
|
12
11
|
providers: [provideIcons({ lucideChevronRight })],
|
|
13
12
|
host: {
|
|
14
13
|
role: 'presentation',
|
|
@@ -17,7 +16,7 @@ import type { ClassValue } from 'clsx';
|
|
|
17
16
|
},
|
|
18
17
|
template: `
|
|
19
18
|
<ng-content>
|
|
20
|
-
<ng-icon
|
|
19
|
+
<ng-icon name="lucideChevronRight" />
|
|
21
20
|
</ng-content>
|
|
22
21
|
`,
|
|
23
22
|
})
|
|
@@ -25,6 +24,6 @@ export class HlmBreadcrumbSeparatorComponent {
|
|
|
25
24
|
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
26
25
|
|
|
27
26
|
protected readonly _computedClass = computed(() =>
|
|
28
|
-
hlm('[&>ng-icon]:
|
|
27
|
+
hlm('[&>ng-icon]:text-[14px] [&>ng-icon]:flex!', this.userClass()),
|
|
29
28
|
);
|
|
30
29
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
+
import { HlmCalendarMultiComponent } from './lib/hlm-calendar-multi.component';
|
|
2
3
|
import { HlmCalendarComponent } from './lib/hlm-calendar.component';
|
|
3
4
|
|
|
5
|
+
export * from './lib/hlm-calendar-multi.component';
|
|
4
6
|
export * from './lib/hlm-calendar.component';
|
|
5
7
|
|
|
8
|
+
export const HlmCalendarImports = [HlmCalendarComponent, HlmCalendarMultiComponent] as const;
|
|
9
|
+
|
|
6
10
|
@NgModule({
|
|
7
|
-
imports: [
|
|
8
|
-
exports: [
|
|
11
|
+
imports: [...HlmCalendarImports],
|
|
12
|
+
exports: [...HlmCalendarImports],
|
|
9
13
|
})
|
|
10
14
|
export class HlmCalendarModule {}
|
package/src/generators/ui/libs/ui-calendar-helm/files/lib/hlm-calendar-multi.component.ts.template
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { Component, booleanAttribute, computed, input, model, numberAttribute, viewChild } from '@angular/core';
|
|
3
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
4
|
+
import { lucideChevronLeft, lucideChevronRight } from '@ng-icons/lucide';
|
|
5
|
+
import {
|
|
6
|
+
BrnCalendarCellButtonDirective,
|
|
7
|
+
BrnCalendarCellDirective,
|
|
8
|
+
BrnCalendarGridDirective,
|
|
9
|
+
BrnCalendarHeaderDirective,
|
|
10
|
+
BrnCalendarMultiDirective,
|
|
11
|
+
BrnCalendarNextButtonDirective,
|
|
12
|
+
BrnCalendarPreviousButtonDirective,
|
|
13
|
+
BrnCalendarWeekDirective,
|
|
14
|
+
BrnCalendarWeekdayDirective,
|
|
15
|
+
Weekday,
|
|
16
|
+
injectBrnCalendarI18n,
|
|
17
|
+
} from '@spartan-ng/brain/calendar';
|
|
18
|
+
import { hlm } from '@spartan-ng/brain/core';
|
|
19
|
+
import { injectDateAdapter } from '@spartan-ng/brain/date-time';
|
|
20
|
+
import { buttonVariants } from '@spartan-ng/ui-button-helm';
|
|
21
|
+
import { HlmIconDirective } from '@spartan-ng/ui-icon-helm';
|
|
22
|
+
import type { ClassValue } from 'clsx';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'hlm-calendar-multi',
|
|
26
|
+
imports: [
|
|
27
|
+
BrnCalendarMultiDirective,
|
|
28
|
+
BrnCalendarHeaderDirective,
|
|
29
|
+
BrnCalendarNextButtonDirective,
|
|
30
|
+
BrnCalendarPreviousButtonDirective,
|
|
31
|
+
BrnCalendarWeekdayDirective,
|
|
32
|
+
BrnCalendarWeekDirective,
|
|
33
|
+
BrnCalendarCellButtonDirective,
|
|
34
|
+
BrnCalendarCellDirective,
|
|
35
|
+
BrnCalendarGridDirective,
|
|
36
|
+
NgIcon,
|
|
37
|
+
HlmIconDirective,
|
|
38
|
+
],
|
|
39
|
+
viewProviders: [provideIcons({ lucideChevronLeft, lucideChevronRight })],
|
|
40
|
+
template: `
|
|
41
|
+
<div
|
|
42
|
+
brnCalendarMulti
|
|
43
|
+
[min]="min()"
|
|
44
|
+
[max]="max()"
|
|
45
|
+
[minSelection]="minSelection()"
|
|
46
|
+
[maxSelection]="maxSelection()"
|
|
47
|
+
[disabled]="disabled()"
|
|
48
|
+
[(date)]="date"
|
|
49
|
+
[dateDisabled]="dateDisabled()"
|
|
50
|
+
[weekStartsOn]="weekStartsOn()"
|
|
51
|
+
[defaultFocusedDate]="defaultFocusedDate()"
|
|
52
|
+
[class]="_computedCalenderClass()"
|
|
53
|
+
>
|
|
54
|
+
<div class="inline-flex flex-col space-y-4">
|
|
55
|
+
<!-- Header -->
|
|
56
|
+
<div class="space-y-4">
|
|
57
|
+
<div class="relative flex items-center justify-center pt-1">
|
|
58
|
+
<div brnCalendarHeader class="text-sm font-medium">
|
|
59
|
+
{{ heading() }}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="flex items-center space-x-1">
|
|
63
|
+
<button
|
|
64
|
+
brnCalendarPreviousButton
|
|
65
|
+
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute left-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
66
|
+
>
|
|
67
|
+
<ng-icon hlm name="lucideChevronLeft" size="sm" />
|
|
68
|
+
</button>
|
|
69
|
+
|
|
70
|
+
<button
|
|
71
|
+
brnCalendarNextButton
|
|
72
|
+
class="ring-offset-background focus-visible:ring-ring border-input hover:bg-accent hover:text-accent-foreground absolute right-1 inline-flex h-7 w-7 items-center justify-center whitespace-nowrap rounded-md border bg-transparent p-0 text-sm font-medium opacity-50 transition-colors hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
73
|
+
>
|
|
74
|
+
<ng-icon hlm name="lucideChevronRight" size="sm" />
|
|
75
|
+
</button>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<table class="w-full border-collapse space-y-1" brnCalendarGrid>
|
|
81
|
+
<thead>
|
|
82
|
+
<tr class="flex">
|
|
83
|
+
<th
|
|
84
|
+
*brnCalendarWeekday="let weekday"
|
|
85
|
+
scope="col"
|
|
86
|
+
class="text-muted-foreground w-9 rounded-md text-[0.8rem] font-normal"
|
|
87
|
+
[attr.aria-label]="i18n.labelWeekday(weekday)"
|
|
88
|
+
>
|
|
89
|
+
{{ i18n.formatWeekdayName(weekday) }}
|
|
90
|
+
</th>
|
|
91
|
+
</tr>
|
|
92
|
+
</thead>
|
|
93
|
+
|
|
94
|
+
<tbody role="rowgroup">
|
|
95
|
+
<tr *brnCalendarWeek="let week" class="mt-2 flex w-full">
|
|
96
|
+
@for (date of week; track dateAdapter.getTime(date)) {
|
|
97
|
+
<td
|
|
98
|
+
brnCalendarCell
|
|
99
|
+
class="data-[selected]:data-[outside]:bg-accent/50 data-[selected]:bg-accent relative h-9 w-9 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:data-[selected]:rounded-l-md last:data-[selected]:rounded-r-md [&:has([aria-selected].day-range-end)]:rounded-r-md"
|
|
100
|
+
>
|
|
101
|
+
<button brnCalendarCellButton [date]="date" [class]="btnClass">
|
|
102
|
+
{{ dateAdapter.getDate(date) }}
|
|
103
|
+
</button>
|
|
104
|
+
</td>
|
|
105
|
+
}
|
|
106
|
+
</tr>
|
|
107
|
+
</tbody>
|
|
108
|
+
</table>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
`,
|
|
112
|
+
})
|
|
113
|
+
export class HlmCalendarMultiComponent<T> {
|
|
114
|
+
public readonly calendarClass = input<ClassValue>('');
|
|
115
|
+
|
|
116
|
+
protected readonly _computedCalenderClass = computed(() => hlm('rounded-md border p-3', this.calendarClass()));
|
|
117
|
+
|
|
118
|
+
/** Access the calendar i18n */
|
|
119
|
+
protected readonly i18n = injectBrnCalendarI18n();
|
|
120
|
+
|
|
121
|
+
/** Access the date time adapter */
|
|
122
|
+
protected readonly dateAdapter = injectDateAdapter<T>();
|
|
123
|
+
|
|
124
|
+
/** The minimum date that can be selected.*/
|
|
125
|
+
public readonly min = input<T>();
|
|
126
|
+
|
|
127
|
+
/** The maximum date that can be selected. */
|
|
128
|
+
public readonly max = input<T>();
|
|
129
|
+
|
|
130
|
+
/** The minimum selectable dates. */
|
|
131
|
+
public readonly minSelection = input<number, NumberInput>(undefined, {
|
|
132
|
+
transform: numberAttribute,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/** The maximum selectable dates. */
|
|
136
|
+
public readonly maxSelection = input<number, NumberInput>(undefined, {
|
|
137
|
+
transform: numberAttribute,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
/** Determine if the date picker is disabled. */
|
|
141
|
+
public readonly disabled = input<boolean, BooleanInput>(false, {
|
|
142
|
+
transform: booleanAttribute,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
/** The selected value. */
|
|
146
|
+
public readonly date = model<T[]>();
|
|
147
|
+
|
|
148
|
+
/** Whether a specific date is disabled. */
|
|
149
|
+
public readonly dateDisabled = input<(date: T) => boolean>(() => false);
|
|
150
|
+
|
|
151
|
+
/** The day the week starts on */
|
|
152
|
+
public readonly weekStartsOn = input<Weekday, NumberInput>(0, {
|
|
153
|
+
transform: (v: unknown) => numberAttribute(v) as Weekday,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
/** The default focused date. */
|
|
157
|
+
public readonly defaultFocusedDate = input<T>();
|
|
158
|
+
|
|
159
|
+
/** Access the calendar directive */
|
|
160
|
+
private readonly _calendar = viewChild.required(BrnCalendarMultiDirective);
|
|
161
|
+
|
|
162
|
+
/** Get the heading for the current month and year */
|
|
163
|
+
protected heading = computed(() =>
|
|
164
|
+
this.i18n.formatHeader(
|
|
165
|
+
this.dateAdapter.getMonth(this._calendar().focusedDate()),
|
|
166
|
+
this.dateAdapter.getYear(this._calendar().focusedDate()),
|
|
167
|
+
),
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
protected readonly btnClass = hlm(
|
|
171
|
+
buttonVariants({ variant: 'ghost' }),
|
|
172
|
+
'h-9 w-9 p-0 font-normal aria-selected:opacity-100',
|
|
173
|
+
'data-[outside]:text-muted-foreground data-[outside]:opacity-50 data-[outside]:aria-selected:bg-accent/50 data-[outside]:aria-selected:text-muted-foreground data-[outside]:aria-selected:opacity-30',
|
|
174
|
+
'data-[today]:bg-accent data-[today]:text-accent-foreground',
|
|
175
|
+
'data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:hover:bg-primary data-[selected]:hover:text-primary-foreground data-[selected]:focus:bg-primary data-[selected]:focus:text-primary-foreground',
|
|
176
|
+
'data-[disabled]:text-muted-foreground data-[disabled]:opacity-50',
|
|
177
|
+
);
|
|
178
|
+
}
|
package/src/generators/ui/libs/ui-calendar-helm/files/lib/hlm-calendar.component.ts.template
CHANGED
|
@@ -122,7 +122,7 @@ export class HlmCalendarComponent<T> {
|
|
|
122
122
|
/** The minimum date that can be selected.*/
|
|
123
123
|
public readonly min = input<T>();
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
/** The maximum date that can be selected. */
|
|
126
126
|
public readonly max = input<T>();
|
|
127
127
|
|
|
128
128
|
/** Determine if the date picker is disabled. */
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
+
import { HlmDatePickerMultiComponent } from './lib/hlm-date-picker-multi.component';
|
|
2
3
|
import { HlmDatePickerComponent } from './lib/hlm-date-picker.component';
|
|
3
4
|
|
|
4
5
|
export * from './lib/hlm-date-picker.token';
|
|
5
6
|
|
|
7
|
+
export * from './lib/hlm-date-picker-multi.component';
|
|
6
8
|
export * from './lib/hlm-date-picker.component';
|
|
7
9
|
|
|
10
|
+
export const HlmDatePickerImports = [HlmDatePickerComponent, HlmDatePickerMultiComponent] as const;
|
|
11
|
+
|
|
8
12
|
@NgModule({
|
|
9
|
-
imports: [
|
|
10
|
-
exports: [
|
|
13
|
+
imports: [...HlmDatePickerImports],
|
|
14
|
+
exports: [...HlmDatePickerImports],
|
|
11
15
|
})
|
|
12
16
|
export class HlmDatePickerModule {}
|