@ng-formworks/daisyui 15.2.7

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.
@@ -0,0 +1,10 @@
1
+ import { InjectionToken } from '@angular/core';
2
+
3
+
4
+
5
+ /**
6
+ * @const DUIOPTIONS
7
+ * Injection token for the environment interface to be provided by the applications.
8
+ */
9
+ export const DUIOPTIONS: InjectionToken<any> = new InjectionToken('DUIOPTIONS');
10
+
@@ -0,0 +1,92 @@
1
+ import { Component, Input, OnInit } from '@angular/core';
2
+ import { JsonSchemaFormService } from '@ng-formworks/core';
3
+
4
+
5
+
6
+ @Component({
7
+ // tslint:disable-next-line:component-selector
8
+ selector: 'tabs-widget',
9
+ template: `
10
+ <div
11
+ [class]="options?.labelHtmlClass || ''">
12
+ <a *ngFor="let item of layoutNode?.items; let i = index"
13
+ [class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
14
+ (' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
15
+ (' ' + options?.style?.unselected))"
16
+ >
17
+ <span *ngIf="showAddTab || item.type !== '$ref'"
18
+ [class]="(selectedItem === i ? (' ' + options?.activeClass + ' ' + options?.style?.selected) :
19
+ (' ' + options?.style?.unselected))"
20
+ [innerHTML]="setTabTitle(item, i)"
21
+ (click)="select(i)"></span>
22
+ </a>
23
+
24
+ </div>
25
+
26
+ <!--
27
+ <div class="tabs tabs-boxed">
28
+ <a class="tab">Tab 1</a>
29
+ <a class="tab tab-active">Tab 2</a>
30
+ <a class="tab">Tab 3</a>
31
+ </div>
32
+ -->
33
+
34
+ <div *ngFor="let layoutItem of layoutNode?.items; let i = index"
35
+ [class]="options?.htmlClass || ''">
36
+
37
+ <select-framework-widget *ngIf="selectedItem === i"
38
+ [class]="(options?.fieldHtmlClass || '') +
39
+ ' ' + (options?.activeClass || '') +
40
+ ' ' + (options?.style?.selected || '')"
41
+ [dataIndex]="layoutNode?.dataType === 'array' ? (dataIndex || []).concat(i) : dataIndex"
42
+ [layoutIndex]="(layoutIndex || []).concat(i)"
43
+ [layoutNode]="layoutItem"></select-framework-widget>
44
+
45
+ </div>`,
46
+ styles: [` a { cursor: pointer; } `],
47
+ })
48
+ export class DaisyUITabsComponent implements OnInit {
49
+ options: any;
50
+ itemCount: number;
51
+ selectedItem = 0;
52
+ showAddTab = true;
53
+ @Input() layoutNode: any;
54
+ @Input() layoutIndex: number[];
55
+ @Input() dataIndex: number[];
56
+
57
+ constructor(
58
+ private jsf: JsonSchemaFormService
59
+ ) { }
60
+
61
+ ngOnInit() {
62
+ this.options = this.layoutNode.options || {};
63
+ this.itemCount = this.layoutNode.items.length - 1;
64
+ this.updateControl();
65
+ }
66
+
67
+ select(index) {
68
+ if (this.layoutNode.items[index].type === '$ref') {
69
+ this.itemCount = this.layoutNode.items.length;
70
+ this.jsf.addItem({
71
+ layoutNode: this.layoutNode.items[index],
72
+ layoutIndex: this.layoutIndex.concat(index),
73
+ dataIndex: this.dataIndex.concat(index)
74
+ });
75
+ this.updateControl();
76
+ }
77
+ this.selectedItem = index;
78
+ }
79
+
80
+ updateControl() {
81
+ const lastItem = this.layoutNode.items[this.layoutNode.items.length - 1];
82
+ if (lastItem.type === '$ref' &&
83
+ this.itemCount >= (lastItem.options.maxItems || 1000)
84
+ ) {
85
+ this.showAddTab = false;
86
+ }
87
+ }
88
+
89
+ setTabTitle(item: any, index: number): string {
90
+ return this.jsf.setArrayItemTitle(this, item, index);
91
+ }
92
+ }
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Public API Surface of @ng-formworks/daisyui
3
+ */
4
+
5
+ export * from './lib/daisyui-framework.component';
6
+ export * from './lib/daisyui-framework.module';
7
+ export * from './lib/daisyui-framework.prefixed.component';
8
+ export * from './lib/daisyui-framework.service';
9
+ export * from './lib/daisyui.framework';
10
+ export * from './lib/tokens.defs';
11
+ export { DaisyUITabsComponent } from './lib/widgets/daisyui-tabs.component';
12
+
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,24 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ /** @type {import('tailwindcss').Config} */
3
+ module.exports = {
4
+ content: [
5
+ "./src/**/*.{html,ts}",
6
+ "./projects/ng-formworks-daisyui/**/*.{html,ts,css}"
7
+ ],
8
+ theme: {
9
+ extend: {},
10
+ },
11
+ plugins: [require("daisyui")],
12
+ daisyui: {
13
+ themes: ["light", "dark", "cupcake", "cmyk", "pastel",
14
+ {
15
+ daisyui_default: {
16
+ ...require("daisyui/src/theming/themes")["light"]
17
+ },
18
+ daisyui_leaf: {
19
+ ...require("daisyui/src/theming/themes")["light"]
20
+ }
21
+ }
22
+ ]
23
+ },
24
+ }
@@ -0,0 +1,26 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ /** @type {import('tailwindcss').Config} */
3
+ module.exports = {
4
+ content: [
5
+ "./src/**/*.{html,ts}",
6
+ "./projects/ng-formworks-daisyui/**/*.{html,ts,css}"
7
+ ],
8
+ theme: {
9
+ extend: {},
10
+ },
11
+ plugins: [require("daisyui")],
12
+ daisyui: {
13
+ themes: ["light", "dark", "cupcake", "cmyk", "pastel",
14
+ {
15
+ daisyui_default: {
16
+ ...require("daisyui/src/theming/themes")["light"]
17
+ },
18
+ daisyui_leaf: {
19
+ ...require("daisyui/src/theming/themes")["light"]
20
+ }
21
+ }
22
+ ],
23
+ prefix: "dui-"
24
+ },
25
+ prefix: "tw-"
26
+ }
@@ -0,0 +1,21 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "inlineSources": true,
9
+ "types": []
10
+ },
11
+ "angularCompilerOptions": {
12
+ "skipTemplateCodegen": true,
13
+ "strictMetadataEmit": true,
14
+ "fullTemplateTypeCheck": true,
15
+ "strictInjectionParameters": true,
16
+ "enableResourceInlining": true
17
+ },
18
+ "exclude": [
19
+ "**/*.spec.ts"
20
+ ]
21
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "include": [
11
+ "**/*.spec.ts",
12
+ "**/*.d.ts"
13
+ ]
14
+ }