Skip to content

Commit

Permalink
chore: merge branch 'master' into ng17
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Nov 9, 2023
2 parents 2ed48ad + f83ea57 commit 17e5c21
Show file tree
Hide file tree
Showing 198 changed files with 2,731 additions and 1,166 deletions.
4 changes: 1 addition & 3 deletions _mock/user.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { MockStatusError, MockRequest } from '@delon/mock';
import { MockStatusError, MockRequest, r } from '@delon/mock';
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
// import * as Mock from 'mockjs';

const r = (min: number, max: number): number => Math.floor(Math.random() * (max - min + 1) + min);

export const USERS = {
// 支持值为 Object 和 Array
'GET /users': (req: MockRequest) => {
Expand Down
12 changes: 12 additions & 0 deletions docs/getting-started.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ npm start
# Or use HMR mode by: npm run hmr
```

**Multiple projects**

```bash
yarn global add @angular/cli
ng new my-workspace --no-create-application --package-manager yarn
cd my-workspace
ng g application mgr --style less --routing
ng add ng-alain
yarn mgr:start
# Or use HMR mode by: yarn run mgr:hmr
```

> Please refer to [Schematics](/cli) for more details.
### Clone the Git Repository
Expand Down
8 changes: 7 additions & 1 deletion docs/getting-started.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,23 @@ NG-ALAIN 必须先创建一个全新的 Angular 项目,可以通过终端窗

```bash
ng new my-project --style less --routing
cd my-project
# 或多重项目
ng new my-workspace --no-create-application
cd my-workspace
ng g application mgr --style less --routing
```

> 如果你想了解 `--style``--routing` 参数,请参考 [ng new](https://angular.io/cli/new#options) 文档。
接下来只需要将 NG-ALAIN 添加到 `my-project` 项目中即可,在 `my-project` 目录下通过终端窗口中运行:

```bash
cd my-project
ng add ng-alain
```

> 若多重项目时,需要提供具体的项目名称。
NG-ALAIN 会询问是否需要一些额外的插件,一开始完全可以一路回车,这些插件都是可插拔,后期可以自行添加与移除。

> 以上只会生成干净的项目,可以直接用于生产环境中。你可能在[预览](https://ng-alain.gitee.io/)上看到许多示例页,它们全都可以在 [Github](https://github.com/ng-alain/ng-alain) 查看到源代码,当然也可以通过 Git 克隆代码的形式获得:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"@nguniversal/express-engine": "^16.2.0",
"express": "^4.18.2",
"isutf8": "^4.0.0",
"@github/hotkey": "^2.3.0"
"@github/hotkey": "^2.3.0",
"ng-antd-color-picker": "^0.0.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.0",
Expand Down Expand Up @@ -152,7 +153,7 @@
"less-bundle-promise": "^1.0.11",
"ng-alain-codelyzer": "^0.0.1",
"ng-alain-sts": "^0.0.2",
"ng-alain-plugin-theme": "^15.0.1",
"ng-alain-plugin-theme": "^16.0.0",
"tsconfig-paths": "^4.2.0",
"@nguniversal/builders": "^16.2.0",
"@types/express": "^4.17.21",
Expand Down
10 changes: 6 additions & 4 deletions packages/abc/date-picker/range.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ export class RangePickerDirective implements OnDestroy, AfterViewInit {
@Host() @Optional() private nativeComp: NzRangePickerComponent,
private vcr: ViewContainerRef
) {
assert(
!!nativeComp,
`It should be attached to nz-range-picker component, for example: '<nz-range-picker [(ngModel)]="i.start" extend [(ngModelEnd)]="i.end" shortcut></nz-range-picker>'`
);
if (typeof ngDevMode === 'undefined' || ngDevMode) {
assert(
!!nativeComp,
`It should be attached to nz-range-picker component, for example: '<nz-range-picker [(ngModel)]="i.start" extend [(ngModelEnd)]="i.end" shortcut></nz-range-picker>'`
);
}
const cog = configSrv.merge('dataRange', {
nzFormat: 'yyyy-MM-dd',
nzAllowClear: true,
Expand Down
11 changes: 1 addition & 10 deletions packages/form/docs/customize.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type: Documents

## Foreword

`@delon/form` try our best to meet the needs of different environments, in addition to the built-in basic component widgets, you can further expand the requirements in two ways:
`@delon/form` try our best to meet the needs of different environments, in addition to the built-in basic widgets (Some require manual registration), you can further expand the requirements in two ways:

## Custom widget in sf

Expand All @@ -18,15 +18,6 @@ Making a set of widgets for project can lead to faster development work.

### How to making widget

**Third-party library**

By default `@delon/form` implements some common third-party library widgets, which are called third-party component widgets. This widget exists in [widgets-third](https://github.com/ng-alain /delon/tree/master/packages/form/widgets-third) directory; you can use directly.

| Name | Description | Document | Source |
| ---- | ----------- | -------- | ------ |
| `markdown` | Markdown Editor | [Document](/form/markdown) | [Source](https://github.com/ng-alain/delon/tree/master/packages/form/widgets-third/markdown) |
| `tinymce` | Tinymce Editor | [Document](/form/tinymce) | [Source](https://github.com/ng-alain/delon/tree/master/packages/form/widgets-third/tinymce) |

**Create widgets**

A widget is a component. You only need to inherit `ControlWidget` to create a widget. For example:
Expand Down
13 changes: 1 addition & 12 deletions packages/form/docs/customize.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type: Documents

## 写在前面

`@delon/form` 尽可能满足不同需求,除现有内置的十几种基础组件小部件外,可以通过以下两种方式进一步扩展需求:
`@delon/form` 尽可能满足不同需求,除现有内置的十几种基础小部件(部分需要手动注册)外,可以通过以下两种方式进一步扩展需求:

## 自定义小部件

Expand All @@ -18,17 +18,6 @@ type: Documents

### 编写小部件

**常见小部件库**

默认情况下 @delon/form 实现了一些常见需求,但需要额外类库支持的,称它为第三方组件小部件,这一部分小部件存在于[widgets-third](https://github.com/ng-alain/delon/tree/master/packages/form/widgets-third)目录里;你可以直接复制使用。

这些组件包括:

| 名称 | 描述 | 文档 | 源代码 |
| --- | ---- | ---- | ---- |
| `markdown` | Markdown 编辑器 | [文档](/form/markdown) | [源代码](https://github.com/ng-alain/delon/tree/master/packages/form/widgets-third/markdown) |
| `tinymce` | Tinymce 富文本框 | [文档](/form/tinymce) | [源代码](https://github.com/ng-alain/delon/tree/master/packages/form/widgets-third/tinymce) |

**自己创建小部件**

小部件就是一个组件,你只需要继承 `ControlWidget` 就相当于构建一个小部件,其结构如下:
Expand Down
10 changes: 8 additions & 2 deletions packages/form/spec/base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ export function builder(options?: {
};
}

export function configureSFTestSuite(): void {
export function configureSFTestSuite(options?: { imports?: NzSafeAny[] }): void {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [NoopAnimationsModule, AlainThemeModule.forRoot(), DelonFormModule.forRoot(), HttpClientTestingModule],
imports: [
NoopAnimationsModule,
AlainThemeModule.forRoot(),
DelonFormModule.forRoot(),
HttpClientTestingModule,
...(options?.imports ?? [])
],
declarations: [TestFormComponent]
});
});
Expand Down
42 changes: 1 addition & 41 deletions packages/form/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,39 @@ import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule, NgZone } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { NzAutocompleteModule } from 'ng-zorro-antd/auto-complete';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzCardModule } from 'ng-zorro-antd/card';
import { NzCascaderModule } from 'ng-zorro-antd/cascader';
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
import { NzFormModule } from 'ng-zorro-antd/form';
import { NzGridModule } from 'ng-zorro-antd/grid';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzInputModule } from 'ng-zorro-antd/input';
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
import { NzMentionModule } from 'ng-zorro-antd/mention';
import { NzModalModule } from 'ng-zorro-antd/modal';
import { NzRadioModule } from 'ng-zorro-antd/radio';
import { NzRateModule } from 'ng-zorro-antd/rate';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { NzSliderModule } from 'ng-zorro-antd/slider';
import { NzSwitchModule } from 'ng-zorro-antd/switch';
import { NzTagModule } from 'ng-zorro-antd/tag';
import { NzTimePickerModule } from 'ng-zorro-antd/time-picker';
import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { NzTransferModule } from 'ng-zorro-antd/transfer';
import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select';
import { NzUploadModule } from 'ng-zorro-antd/upload';

import { DelonLocaleModule } from '@delon/theme';
import { AlainConfigService } from '@delon/util/config';

const ZORROS = [
NzAutocompleteModule,
NzButtonModule,
NzCardModule,
NzCascaderModule,
NzCheckboxModule,
NzDatePickerModule,
NzFormModule,
NzGridModule,
NzIconModule,
NzInputModule,
NzInputNumberModule,
NzMentionModule,
NzModalModule,
NzRadioModule,
NzRateModule,
NzSelectModule,
NzSliderModule,
NzSwitchModule,
NzTagModule,
NzTimePickerModule,
NzToolTipModule,
NzTransferModule,
NzTreeSelectModule,
NzUploadModule
NzToolTipModule
];

import { SFFixedDirective } from './sf-fixed.directive';
Expand All @@ -71,50 +51,30 @@ const COMPONENTS = [SFComponent, SFItemComponent, SFItemWrapComponent, SFTemplat

import { WidgetRegistry } from './widget.factory';
import { ArrayWidget } from './widgets/array/array.widget';
import { AutoCompleteWidget } from './widgets/autocomplete/autocomplete.widget';
import { BooleanWidget } from './widgets/boolean/boolean.widget';
import { CascaderWidget } from './widgets/cascader/cascader.widget';
import { CheckboxWidget } from './widgets/checkbox/checkbox.widget';
import { CustomWidget } from './widgets/custom/custom.widget';
import { DateWidget } from './widgets/date/date.widget';
import { MentionWidget } from './widgets/mention/mention.widget';
import { NumberWidget } from './widgets/number/number.widget';
import { NzWidgetRegistry } from './widgets/nz-widget.registry';
import { ObjectWidget } from './widgets/object/object.widget';
import { RadioWidget } from './widgets/radio/radio.widget';
import { RateWidget } from './widgets/rate/rate.widget';
import { SelectWidget } from './widgets/select/select.widget';
import { SliderWidget } from './widgets/slider/slider.widget';
import { StringWidget } from './widgets/string/string.widget';
import { TagWidget } from './widgets/tag/tag.widget';
import { TextWidget } from './widgets/text/text.widget';
import { TextareaWidget } from './widgets/textarea/textarea.widget';
import { TimeWidget } from './widgets/time/time.widget';
import { TransferWidget } from './widgets/transfer/transfer.widget';
import { TreeSelectWidget } from './widgets/tree-select/tree-select.widget';
import { UploadWidget } from './widgets/upload/upload.widget';

const WIDGETS = [
ObjectWidget,
ArrayWidget,
StringWidget,
NumberWidget,
DateWidget,
TimeWidget,
RadioWidget,
CheckboxWidget,
BooleanWidget,
TextareaWidget,
SelectWidget,
TreeSelectWidget,
TagWidget,
UploadWidget,
TransferWidget,
SliderWidget,
RateWidget,
AutoCompleteWidget,
CascaderWidget,
MentionWidget,
CustomWidget,
TextWidget
];
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/array/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: array
subtitle: Array
type: Widgets
order: 2
---

Create array object, it's only valid when `schema.type="array"`.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/array/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: array
subtitle: 数组
type: Widgets
order: 2
---

创建对象数组,只对 `schema.type="array"` 时有效。
Expand Down
27 changes: 0 additions & 27 deletions packages/form/src/widgets/autocomplete/autocomplete.widget.html

This file was deleted.

1 change: 1 addition & 0 deletions packages/form/src/widgets/boolean/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: boolean
subtitle: Switch
type: Widgets
order: 4
---

Switching Selector.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/boolean/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: boolean
subtitle: 开关
type: Widgets
order: 4
---

开关选择器
Expand Down
28 changes: 0 additions & 28 deletions packages/form/src/widgets/cascader/cascader.widget.html

This file was deleted.

3 changes: 2 additions & 1 deletion packages/form/src/widgets/checkbox/demo/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Simplest of usage.

```ts
import { Component } from '@angular/core';
import { SFCascaderWidgetSchema, SFCheckboxWidgetSchema, SFSchema } from '@delon/form';
import { SFCheckboxWidgetSchema, SFSchema } from '@delon/form';
import type { SFCascaderWidgetSchema } from '@delon/form/widgets/cascader';
import { NzMessageService } from 'ng-zorro-antd/message';
import { of, delay } from 'rxjs';

Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/widgets/custom/demo/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
</div>
</ng-template>
<ng-template sf-template="qr" let-i let-ui="ui" let-schema="schema">
<qr [value]="i.value"></qr>
<nz-qrcode [nzValue]="i.value" />
</ng-template>
</sf>
`
Expand Down
Loading

0 comments on commit 17e5c21

Please sign in to comment.