1.0.34 • Published 5 months ago

kindoit v1.0.34

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

Kindoit

This is an Angular component that represents a login form. It imports several services and components from various modules and libraries such as MService, IService, CService, Subject, FormBuilder, FormGroup, Validators, TextBoxComponent, AService, skipUntil, skipWhile, takeUntil, Router, and EventEmitter.

AComponent: The AComponent class implements several Angular lifecycle hooks such as OnInit, AfterViewInit, and OnDestroy. It also defines several properties and methods such as form, tp, opened, success_link, login, textbox, destroy$, constructor(), ngOnInit(), ngAfterViewInit(), ngOnDestroy(), close(), and toggleVisibility().

In the constructor, it initializes the form property with a FormGroup that has two FormControl objects representing the username and password fields. It also sets up some default values for the login form's title, username label, password label, and login button label. It also subscribes to an auth$ observable from the AService, and a dcodeNotify$ observable from the CService. The auth$ observable emits a boolean value that indicates whether the user is authenticated or not. The dcodeNotify$ observable emits a boolean value when a certain condition is met. When both observables emit, it either navigates to a success link or emits a successful login event depending on whether a success link was provided or not.

The ngAfterViewInit() method sets the type of the password input field to "password" using the TextboxComponent's input property.

The close() method is called when the login button is clicked. It checks if the form is valid and then calls the authl() method of the AService to authenticate the user.

The toggleVisibility() method toggles the visibility of the password input field.

C2Component: The C2Component has the following input properties:

oapi: a boolean value indicating whether the API URL should include a prefix (rdb/oorm/). api_parent: a string representing the API endpoint for retrieving the parent items. pname: a string representing the name of the parent select control. cname: a string representing the name of the child select control. plabel: a string representing the label for the parent select control. clabel: a string representing the label for the child select control. searchKey: an object representing the search key used to retrieve the items. pvKey: an object representing the key used to retrieve the parent values. cvKey: an object representing the key used to retrieve the child values. autoVal: a boolean value indicating whether the component should automatically set the initial value for the select controls. selInitDesc: a string representing the description for the initial value of the select control. form: a FormGroup instance representing the parent form. The C2Component has the following output properties:

pselect: an EventEmitter instance that emits the selected parent value. cselect: an EventEmitter instance that emits the selected child value. The C2Component initializes the kindoc components by setting their input properties and subscribing to their select output events. It also retrieves the items for the parent and child select controls using the CService getCodeOrm method. If the autoVal input property is true, it also retrieves the initial values for the select controls using the getCodeOrm method.

When a parent value is selected, the C2Component emits the value using the pselect output property and retrieves the child items using the initItem method. The initItem method is also called when the component is initialized to retrieve the items for the parent select control. If the autoVal input property is true, the initItem method also sets the initial value for the select controls.

Overall, the C2Component is a complex component that utilizes custom components and the CService to retrieve and set data.

GComponent: the GComponent class, which implements the OnInit interface. This class is exported so that it can be used in other parts of the application.

ngOnInit(): void {...} - implements the OnInit interface method, which is called when the component is initialized. In this case, the method is empty.

@Input() exportname:string='sample' - defines an input property called exportname that can be set by a parent component. The default value is 'sample'.

@Input() heads:GHeadModel[]=[] - defines an input property called heads that can be set by a parent component. The default value is an empty array of GHeadModel objects.

@Input() view!:Observable; - defines an input property called view that can be set by a parent component. The property is of type Observable, which means it can emit values of any type. The ! operator tells TypeScript that this property will be initialized later.

@Input() dtlbl='...' - defines an input property called dtlbl that can be set by a parent component. The default value is '...'.

@Input() dtlWidth=0 - defines an input property called dtlWidth that can be set by a parent component. The default value is 0.

@Output() dblclick = new EventEmitter(); - defines an output property called dblclick that emits an event when the user double-clicks on an element. The EventEmitter class is used to create the event.

@Output() click = new EventEmitter(); - defines an output property called click that emits an event when the user clicks on an element.

@Output() dtlCmd = new EventEmitter(); - defines an output property called dtlCmd that emits an event when the user performs an action in the detail view.

cellClick(event:any){...} - defines a method called cellClick that is called when the user clicks on a cell. The method emits a click event with the dataItem property of the event object.

edit(e:any){...} - defines a method called edit that is called when the user performs an action in the detail view. The method emits a dtlCmd event with the dataItem property of the e object.

TComponent: hasChildren(item: any): This function takes an item from the tree view and returns a boolean value indicating whether the item has any children or not. This function creates an instance of TCkModel class and checks whether the ttype property of this instance is equal to 'D' (which stands for directory). If it is, the function returns true, indicating that the item has children.

icon(item:any): This function takes an item from the tree view and returns an icon class name based on the type of the item. This function creates an instance of TCkModel class and checks whether the ttype property of this instance is equal to 'D' (which stands for directory). If it is, the function returns "k-icon k-i-folder", which is the icon class for a folder. Otherwise, the function returns "k-icon k-i-file", which is the icon class for a file.

fetchChildren = (item: any):Observable<object[]> => {}: This function takes an item from the tree view and returns an observable that emits an array of child items. This function creates an instance of TCkModel class and gets the level and ID of the item to form the new CK value. This new CK value is then used to call the getCode() method of cdsvc instance to fetch the child items.

onSelectionChange(event: TreeItem, tree: TreeViewComponent): void: This function is called when a node is selected in the tree view. This function creates an instance of TCkModel class to get the type of the selected item. If the item is a directory, the function expands the selected node. Otherwise, the function emits the selected item using the choice output property of the component.

Regenerate response

Code scaffolding

Run ng generate component component-name --project kindoit to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project kindoit.

Note: Don't forget to add --project kindoit or else it will be added to the default project in your angular.json file.

Build

Run ng build kindoit to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build kindoit, go to the dist folder cd dist/kindoit and run npm publish.

Running unit tests

Run ng test kindoit to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

1.0.29

6 months ago

1.0.28

6 months ago

1.0.33

6 months ago

1.0.32

6 months ago

1.0.31

6 months ago

1.0.30

6 months ago

1.0.34

5 months ago

1.0.27

1 year ago

1.0.26

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

1.1.44

1 year ago

1.0.42

1 year ago

1.0.43

1 year ago