Skip to content

Commit

Permalink
Added new packages: @primeng/core and @primeng/icons
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Nov 11, 2024
1 parent b2e43fd commit 5b73754
Show file tree
Hide file tree
Showing 465 changed files with 2,828 additions and 2,434 deletions.
1 change: 1 addition & 0 deletions apps/showcase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@primeng/themes": "workspace:*",
"@primeuix/styled": "catalog:",
"@primeuix/utils": "catalog:",
"@angular/cdk": "catalog:angular18",
"@stackblitz/sdk": "1.9.0",
"@types/express": "^4.17.17",
"@types/jasmine": "~4.3.1",
Expand Down
8 changes: 4 additions & 4 deletions apps/showcase/src/app/showcase/doc/button/buttondoc.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppCodeModule } from '@layout/doc/app.code.component';
import { AppDocModule } from '@layout/doc/app.doc.module';
import { WindowMaximizeIcon } from '@primeng/icons';
import { ButtonModule } from 'primeng/button';
import { ButtonGroupModule } from 'primeng/buttongroup';
import { RippleModule } from 'primeng/ripple';
import { AppDocModule } from '@layout/doc/app.doc.module';
import { AppCodeModule } from '@layout/doc/app.code.component';
import { AccessibilityDoc } from './accessibilitydoc';
import { BadgeDoc } from './badgedoc';
import { BasicDoc } from './basicdoc';
import { ButtonGroupDoc } from './buttongroupdoc';
import { ButtonsetDoc } from './buttonsetdoc';
import { DirectiveDoc } from './directivedoc';
import { DisabledDoc } from './disableddoc';
Expand All @@ -26,8 +28,6 @@ import { SizesDoc } from './sizesdoc';
import { StyleDoc } from './styledoc';
import { TemplateDoc } from './templatedoc';
import { TextDoc } from './textdoc';
import { ButtonGroupDoc } from './buttongroupdoc';
import { WindowMaximizeIcon } from 'primeng/icons/windowmaximize';

@NgModule({
imports: [CommonModule, AppCodeModule, AppDocModule, ButtonModule, ButtonGroupModule, RippleModule, RouterModule, WindowMaximizeIcon],
Expand Down
9 changes: 9 additions & 0 deletions apps/showcase/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"strict": false,
"paths": {
"@primeng/themes/*": ["../../packages/themes/src/presets/*"],
"@primeng/themes": ["../../packages/themes/src/index.ts"],
"@primeng/icons/*": ["../../packages/icons/src/*/public_api"],
"@primeng/icons": ["../../packages/icons/src/public_api"],
"@primeng/core/*": ["../../packages/core/src/*/public_api"],
"@primeng/core": ["../../packages/core/src/public_api"],
"primeng/*": ["../../packages/primeng/src/*/public_api"],

"@pages/*": ["src/app/showcase/pages/*"],
"@data/*": ["src/assets/showcase/data/*"],
"@doc/*": ["src/app/showcase/doc/*"],
Expand All @@ -16,6 +22,9 @@
}
},
"angularCompilerOptions": {
"disableTypeScriptVersionCheck": true,
"fullTemplateTypeCheck": false,
"annotateForClosureCompiler": false,
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": false,
"strictInputAccessModifiers": false,
Expand Down
1 change: 1 addition & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# PrimeNG Core
20 changes: 20 additions & 0 deletions packages/core/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "../../node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"primeng-core": {
"root": "src",
"projectType": "library",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "src/ng-package.json",
"tsConfig": "src/tsconfig.lib.json"
}
}
}
}
}
}
74 changes: 74 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "@primeng/core",
"version": "4.2.1",
"author": "PrimeTek Informatics",
"description": "",
"homepage": "https://primeng.org/",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/primefaces/primeng.git",
"directory": "packages/core"
},
"bugs": {
"url": "https://github.com/primefaces/primeng/issues"
},
"main": "./src/index.js",
"module": "./src/index.js",
"types": "./src/index.d.ts",
"exports": {
"./api": "./src/api/Api.js",
"./base/style": "./src/base/style/BaseStyle.js",
"./base": "./src/base/Base.js",
"./basecomponent/style": "./src/basecomponent/style/BaseComponentStyle.js",
"./basecomponent": "./src/basecomponent/BaseComponent.vue",
"./basedirective": "./src/basedirective/BaseDirective.js",
"./baseeditableholder": "./src/baseeditableholder/BaseEditableHolder.vue",
"./baseinput": "./src/baseinput/BaseInput.vue",
"./config": "./src/config/PrimeVue.js",
"./service": "./src/service/PrimeVueService.js",
"./usestyle": "./src/usestyle/UseStyle.js",
"./utils": "./src/utils/Utils.js"
},
"publishConfig": {
"main": "./index.mjs",
"module": "./index.mjs",
"types": "./index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.mjs",
"default": "./index.mjs"
},
"./*": {
"types": "./*/index.d.ts",
"import": "./*/index.mjs",
"default": "./*/index.mjs"
}
},
"directory": "dist",
"linkDirectory": false,
"access": "public"
},
"scripts": {
"build": "NODE_ENV=production INPUT_DIR=src/ OUTPUT_DIR=dist/ pnpm run build:package",
"build:package": "pnpm run build:prebuild && ng build primeng-core && pnpm run build:postbuild",
"build:prebuild": "node ./scripts/prebuild.mjs",
"build:postbuild": "node ./scripts/postbuild.mjs",
"dev:link": "pnpm link --global && npm link"
},
"dependencies": {
"@primeuix/styled": "catalog:",
"@primeuix/utils": "catalog:"
},
"devDependencies": {
"@angular/animations": "^17.0.0 || ^18.0.0",
"@angular/cdk": "^17.0.0 || ^18.0.0",
"@angular/common": "^17.0.0 || ^18.0.0",
"@angular/core": "^17.0.0 || ^18.0.0",
"@angular/forms": "^17.0.0 || ^18.0.0",
"@angular/router": "^17.0.0 || ^18.0.0",
"rxjs": "^6.0.0 || ^7.8.1",
"zone.js": "~0.14.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/*
@todo: Update the test suite below
import { FilterService } from './filterservice';
describe('FilterService Suite', () => {
let data: any = [
{ brand: 'VW', year: 2012, color: { name: 'Orange' }, vin: 'dsad231ff', price: '1000.0' },
Expand Down Expand Up @@ -117,3 +121,4 @@ describe('FilterService Suite', () => {
expect(filteredValue.length).toEqual(0);
});
});
*/
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { ObjectUtils } from 'primeng/utils';
import { equals, removeAccents, resolveFieldData } from '@primeuix/utils';

@Injectable({ providedIn: 'root' })
export class FilterService {
Expand All @@ -9,7 +9,7 @@ export class FilterService {
if (value) {
for (let item of value) {
for (let field of fields) {
let fieldValue = ObjectUtils.resolveFieldData(item, field);
let fieldValue = resolveFieldData(item, field);

if (this.filters[filterMatchMode](fieldValue, filterValue, filterLocale)) {
filteredItems.push(item);
Expand All @@ -32,8 +32,8 @@ export class FilterService {
return false;
}

let filterValue = ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
let filterValue = removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = removeAccents(value.toString()).toLocaleLowerCase(filterLocale);

return stringValue.slice(0, filterValue.length) === filterValue;
},
Expand All @@ -47,8 +47,8 @@ export class FilterService {
return false;
}

let filterValue = ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
let filterValue = removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = removeAccents(value.toString()).toLocaleLowerCase(filterLocale);

return stringValue.indexOf(filterValue) !== -1;
},
Expand All @@ -62,8 +62,8 @@ export class FilterService {
return false;
}

let filterValue = ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
let filterValue = removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = removeAccents(value.toString()).toLocaleLowerCase(filterLocale);

return stringValue.indexOf(filterValue) === -1;
},
Expand All @@ -77,8 +77,8 @@ export class FilterService {
return false;
}

let filterValue = ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale);
let filterValue = removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
let stringValue = removeAccents(value.toString()).toLocaleLowerCase(filterLocale);

return stringValue.indexOf(filterValue, stringValue.length - filterValue.length) !== -1;
},
Expand All @@ -94,7 +94,7 @@ export class FilterService {

if (value.getTime && filter.getTime) return value.getTime() === filter.getTime();
else if (value == filter) return true;
else return ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale) == ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
else return removeAccents(value.toString()).toLocaleLowerCase(filterLocale) == removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
},

notEquals: (value: any, filter: any, filterLocale?: any): boolean => {
Expand All @@ -108,7 +108,7 @@ export class FilterService {

if (value.getTime && filter.getTime) return value.getTime() !== filter.getTime();
else if (value == filter) return false;
else return ObjectUtils.removeAccents(value.toString()).toLocaleLowerCase(filterLocale) != ObjectUtils.removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
else return removeAccents(value.toString()).toLocaleLowerCase(filterLocale) != removeAccents(filter.toString()).toLocaleLowerCase(filterLocale);
},

in: (value: any, filter: any[]): boolean => {
Expand All @@ -117,7 +117,7 @@ export class FilterService {
}

for (let i = 0; i < filter.length; i++) {
if (ObjectUtils.equals(value, filter[i])) {
if (equals(value, filter[i])) {
return true;
}
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
import { ToastMessageOptions } from './toastmessage';

@Injectable({ providedIn: 'root' })
export class OverlayService {
private clickSource = new Subject<ToastMessageOptions | ToastMessageOptions[]>();
private clickSource = new Subject<any>();

clickObservable = this.clickSource.asObservable();

Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions packages/core/src/api/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export * from './filtermatchmode';
export * from './filtermetadata';
export * from './filteroperator';
export * from './filterservice';
export * from './overlayoptions';
export * from './overlayservice';
export * from './primeicons';
export * from './shared';
export * from './sortevent';
export * from './sortmeta';
export * from './themeprovider';
export * from './translation';
export * from './translationkeys';
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DOCUMENT } from '@angular/common';
import { effect, inject, Inject, Injectable, signal, untracked } from '@angular/core';
import { BaseStyle } from '@primeng/core/base';
import { PRIME_NG_THEME, PrimeNgFeature } from '@primeng/core/config';
import { Theme, ThemeService } from '@primeuix/styled';
import { BaseStyle } from 'primeng/base';
import { PRIME_NG_CONFIG, PrimeNgConfigProps } from './provideprimengconfig';

@Injectable({ providedIn: 'root' })
export class ThemeProvider {
Expand All @@ -15,7 +15,7 @@ export class ThemeProvider {

baseStyle: BaseStyle = inject(BaseStyle);

constructor(@Inject(PRIME_NG_CONFIG) private config: PrimeNgConfigProps) {
constructor(@Inject(PRIME_NG_THEME) private config: PrimeNgFeature) {
if (config.theme) {
this.theme.set(config.theme);
}
Expand Down Expand Up @@ -56,8 +56,6 @@ export class ThemeProvider {
}

loadCommonTheme() {
if (this.theme() === 'none') return;

// common
if (!Theme.isStyleNameLoaded('common')) {
const { primitive, semantic } = this.baseStyle.getCommonTheme?.() || {};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { inject, Injectable } from '@angular/core';
import { UseStyle } from '@primeng/core/usestyle';
import { dt, Theme } from '@primeuix/styled';
import { UseStyle } from 'primeng/usestyle';
import { ObjectUtils } from 'primeng/utils';
import { minifyCSS, resolve } from '@primeuix/utils';

const theme = ({ dt }) => `
* {
Expand Down Expand Up @@ -202,8 +202,8 @@ export class BaseStyle {
inlineStyles = {};

load = (style, options = {}, transform = (cs) => cs) => {
const computedStyle = transform(ObjectUtils.getItemValue(style, { dt }));
return computedStyle ? this.useStyle.use(ObjectUtils.minifyCSS(computedStyle), { name: this.name, ...options }) : {};
const computedStyle = transform(resolve(style, { dt }));
return computedStyle ? this.useStyle.use(minifyCSS(computedStyle), { name: this.name, ...options }) : {};
};

loadCSS = (options = {}) => {
Expand Down Expand Up @@ -236,8 +236,8 @@ export class BaseStyle {

getStyleSheet = (extendedCSS = '', props = {}) => {
if (this.css) {
const _css = ObjectUtils.getItemValue(this.css, { dt });
const _style = ObjectUtils.minifyCSS(`${_css}${extendedCSS}`);
const _css = resolve(this.css, { dt });
const _style = minifyCSS(`${_css}${extendedCSS}`);
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');
Expand All @@ -257,8 +257,8 @@ export class BaseStyle {

if (this.theme) {
const name = this.name === 'base' ? 'global-style' : `${this.name}-style`;
const _css = ObjectUtils.getItemValue(this.theme, { dt });
const _style = ObjectUtils.minifyCSS(Theme.transformCSS(name, _css));
const _css = resolve(this.theme, { dt });
const _style = minifyCSS(Theme.transformCSS(name, _css));
const _props = Object.entries(props)
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
.join(' ');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DOCUMENT, isPlatformServer } from '@angular/common';
import { ChangeDetectorRef, ContentChildren, Directive, ElementRef, inject, Injector, Input, PLATFORM_ID, QueryList, Renderer2, SimpleChanges } from '@angular/core';
import { PrimeTemplate } from '@primeng/core/api';
import { Base, BaseStyle } from '@primeng/core/base';
import { PrimeNGConfig } from '@primeng/core/config';
import { Theme, ThemeService } from '@primeuix/styled';
import { getKeyValue } from '@primeuix/utils/object';
import { PrimeNGConfig, PrimeTemplate } from 'primeng/api';
import { Base, BaseStyle } from 'primeng/base';
import { UniqueComponentId } from 'primeng/utils';
import { getKeyValue, uuid } from '@primeuix/utils';
import { BaseComponentStyle } from './style/basecomponentstyle';

@Directive({ standalone: true, providers: [BaseComponentStyle, BaseStyle] })
Expand Down Expand Up @@ -45,7 +45,7 @@ export class BaseComponent {
return this['_componentStyle'];
}

attrSelector = UniqueComponentId('pc');
attrSelector = uuid('pc');

_getHostInstance(instance) {
if (instance) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BaseStyle } from 'primeng/base';
import { Injectable } from '@angular/core';
import { BaseStyle } from '@primeng/core/base';

@Injectable({ providedIn: 'root' })
export class BaseComponentStyle extends BaseStyle {
Expand Down
File renamed without changes.
Loading

0 comments on commit 5b73754

Please sign in to comment.