├── .eslintignore
├── .eslintrc
├── .github
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .npmrc
├── .stylelintrc
├── CHANGELOG.md
├── LICENSE
├── README.md
├── babel.config.js
├── components
├── _util
│ └── fmtEvent.ts
├── am-checkbox
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── am-icon
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── amount-input
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── badge
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── calendar
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── card
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── collapse
│ ├── collapse-item
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
│ ├── index.axml
│ ├── index.json
│ ├── index.md
│ └── index.ts
├── face-detection
│ ├── index.axml
│ ├── index.json
│ ├── index.md
│ └── index.ts
├── filter
│ ├── filter-item
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ ├── index.ts
│ └── mixins
│ │ └── lifecycle.ts
├── flex
│ ├── flex-item
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ ├── index.sjs
│ └── index.ts
├── footer
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── grid
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── input-item
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── list
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ ├── index.ts
│ └── list-item
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
├── message
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── modal
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── notice
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── page-result
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── pagination
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ ├── index.sjs
│ └── index.ts
├── picker-item
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── popover
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ ├── index.ts
│ └── popover-item
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
├── popup
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── search-bar
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── stepper
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── steps
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── style
│ ├── mixins
│ │ └── hairline.less
│ └── themes
│ │ └── default.less
├── swipe-action
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ └── index.ts
├── tabs
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ ├── index.ts
│ ├── tab-content
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
│ └── util.sjs
├── tips
│ ├── index.md
│ ├── tips-dialog
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
│ └── tips-plain
│ │ ├── index.axml
│ │ ├── index.json
│ │ ├── index.less
│ │ └── index.ts
└── vtabs
│ ├── index.axml
│ ├── index.json
│ ├── index.less
│ ├── index.md
│ ├── index.ts
│ └── vtab-content
│ ├── index.axml
│ ├── index.json
│ └── index.ts
├── examples
├── app.acss
├── app.js
├── app.json
└── pages
│ ├── am-checkbox
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── am-icon
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── amount-input
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── badge
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── calendar
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── card
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── collapse
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── face-detection
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── filter
│ ├── alternative
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ ├── index.json
│ └── single
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── flex
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── footer
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── grid
│ ├── 2
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── 3
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── 4
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── 5
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── input-item
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── list
│ ├── app.acss
│ ├── app.axml
│ ├── app.js
│ ├── app.json
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── message
│ ├── fail
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ ├── index.json
│ ├── info
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── success
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── waiting
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ └── warn
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── modal
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── notice
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── page-result
│ ├── busy
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── empty
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── error
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ ├── index.json
│ ├── local-busy
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── local-empty
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── local-error
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── local-logoff
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── local-network
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── log-off
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ └── network
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── pagination
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── picker-item
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── popover
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── popup
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── search-bar
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── stepper
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── steps
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── swipe-action
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── tabs
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ ├── tips
│ ├── 1
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── 2
│ │ ├── index.acss
│ │ ├── index.axml
│ │ ├── index.js
│ │ └── index.json
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
│ └── vtabs
│ ├── index.acss
│ ├── index.axml
│ ├── index.js
│ └── index.json
├── package.json
├── scripts
├── compiler.js
└── pub.js
├── tsconfig.json
└── yarn.lock
/.eslintignore:
--------------------------------------------------------------------------------
1 | types/**/*.ts
2 | es/**/*.js
3 | examples/es/**/*.js
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "eslint-config-ali",
3 | "globals": {
4 | "my": true,
5 | "App": true,
6 | "Component": true,
7 | "Page": true
8 | },
9 | "parser": "typescript-eslint-parser",
10 | "plugins": [
11 | "typescript"
12 | ],
13 | "rules": {
14 | "typescript/class-name-casing": "error",
15 | "typescript/type-annotation-spacing": "error"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Do you want to request a feature or report a bug?
2 |
3 | What is the current behavior?
4 |
5 | If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code.
6 |
7 | What is the expected behavior?
8 |
9 | Which versions of ``mini-antui``, and which version of ``Alipay`` are affected by this issue? Did this work in previous versions of ``mini-antui``?
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | First of all, thank you for your contribution! :-)
2 |
3 | Please makes sure that these checkboxes are checked before submitting your PR, thank you!
4 |
5 | * [ ] Rebase before creating a PR to keep commit history clear.
6 | * [ ] Add some descriptions and refer relative issues for you PR.
7 |
8 | Extra checklist:
9 |
10 | **if** *isNewFeature* **:**
11 |
12 | * [ ] Update API docs for the component.
13 | * [ ] Update/Add demo to demonstrate new feature.
14 | * [ ] Update TypeScript definition for the component.
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.log
3 | .idea
4 | .entry
5 | .ipr
6 | .iws
7 | *~
8 | ~*
9 | *.diff
10 | *.patch
11 | *.bak
12 | .DS_Store
13 | package-lock.json
14 | Thumbs.db
15 | .project
16 | .*proj
17 | .svn
18 | *.swp
19 | *.swo
20 | *.pyc
21 | *.pyo
22 | node_modules
23 | .cache
24 | .vscode
25 | *.xcworkspace
26 | .tea
27 | .entry
28 | /build/
29 | /lib/
30 | /es/
31 | /examples/es/
32 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | package-lock=false
--------------------------------------------------------------------------------
/.stylelintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "stylelint-config-standard",
3 | "rules": {
4 | at-rule-empty-line-before: null,
5 | at-rule-name-space-after: null,
6 | at-rule-no-unknown: null,
7 | comment-empty-line-before: null,
8 | declaration-bang-space-before: null,
9 | declaration-empty-line-before: null,
10 | function-comma-newline-after: null,
11 | function-name-case: null,
12 | function-parentheses-newline-inside: null,
13 | function-max-empty-lines: null,
14 | function-whitespace-after: null,
15 | indentation: null,
16 | number-leading-zero: null,
17 | number-no-trailing-zeros: null,
18 | rule-empty-line-before: null,
19 | selector-combinator-space-after: null,
20 | selector-list-comma-newline-after: null,
21 | selector-pseudo-element-colon-notation: null,
22 | unit-no-unknown: null,
23 | value-list-max-empty-lines: null,
24 | unit-case: null,
25 | color-hex-case: null,
26 | }
27 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT LICENSE
2 |
3 | Copyright (c) 2018-present Alipay.com, https://www.alipay.com/
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | [
4 | '@babel/preset-env',
5 | {
6 | loose: true,
7 | modules: false,
8 | },
9 | ],
10 | '@babel/preset-typescript',
11 | ],
12 | plugins: ['@babel/plugin-syntax-dynamic-import'],
13 | };
14 |
--------------------------------------------------------------------------------
/components/_util/fmtEvent.ts:
--------------------------------------------------------------------------------
1 | export default function fmtEvent(props, e) {
2 | const dataset = {};
3 | for (const key in props) {
4 | if ((/data-/gi).test(key)) {
5 | dataset[key.replace(/data-/gi, '')] = props[key];
6 | }
7 | }
8 | return Object.assign({}, e, {
9 | currentTarget: { dataset },
10 | target: { dataset, targetDataset: dataset },
11 | });
12 | }
13 |
--------------------------------------------------------------------------------
/components/am-checkbox/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/components/am-checkbox/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/am-checkbox/index.less:
--------------------------------------------------------------------------------
1 | @import "../style/themes/default.less";
2 |
3 | .am-checkbox {
4 | position: relative;
5 | height: 22px;
6 | width: 22px;
7 | display: inline-block;
8 |
9 | &-value {
10 | position: absolute;
11 | z-index: 1;
12 | border-radius: 50%;
13 | opacity: 0;
14 | }
15 | }
16 |
17 | .am-checkbox-synthetic {
18 | position: absolute;
19 | z-index: 2;
20 | pointer-events: none;
21 | top: 0;
22 | left: 0;
23 | border-radius: 50%;
24 | height: 100%;
25 | width: 100%;
26 | }
27 |
28 | .am-checkbox-synthetic::before {
29 | position: absolute;
30 | left: 0;
31 | top: 0;
32 | height: 200%;
33 | width: 200%;
34 | display: block;
35 | box-sizing: border-box;
36 | border-radius: 50%;
37 | content: '';
38 | transform-origin: 0 0;
39 | transform: scale(0.5);
40 | border: 1px solid #c9c9c9;
41 | }
42 |
43 | .am-checkbox-value.a-checkbox-checked + .am-checkbox-synthetic::before {
44 | background-color: #108ee9;
45 | border-color: #108ee9;
46 | border-width: 0;
47 | }
48 |
49 | .am-checkbox-value.a-checkbox-checked + .am-checkbox-synthetic::after {
50 | position: absolute;
51 | display: block;
52 | z-index: 999;
53 | content: '';
54 | top: 4px;
55 | right: 8px;
56 | width: 5px;
57 | height: 10px;
58 | border: 2px solid #fff;
59 | border-width: 0 1px 1px 0;
60 | transform: rotate(45deg);
61 | }
62 |
63 | .am-checkbox-value.a-checkbox-disabled + .am-checkbox-synthetic::before {
64 | border: 1px solid #ccc;
65 | background-color: #e1e1e1;
66 | }
67 |
68 | .am-checkbox-value.a-checkbox-disabled + .am-checkbox-synthetic::after {
69 | border-color: #adadad;
70 | }
--------------------------------------------------------------------------------
/components/am-checkbox/index.ts:
--------------------------------------------------------------------------------
1 | import fmtEvent from '../_util/fmtEvent';
2 |
3 | Component({
4 | props: {
5 | value: '',
6 | checked: false,
7 | disabled: false,
8 | onChange: () => {},
9 | id: '',
10 | },
11 | methods: {
12 | onChange(e) {
13 | const event = fmtEvent(this.props, e);
14 | this.props.onChange(event);
15 | },
16 | },
17 | });
18 |
--------------------------------------------------------------------------------
/components/am-icon/index.axml:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/components/am-icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/am-icon/index.md:
--------------------------------------------------------------------------------
1 | # AMIcon
2 |
3 | 图标。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
10 | | ---- | ---- | ---- | ---- | ---- |
11 | | type | icon类型 | String | | true |
12 | | size | icon 大小,单位px | String | | false |
13 | | color | icon 颜色,同css的color | String | | false |
14 |
15 |
16 | | 图标风格 | type有效值 |
17 | | ---- | ---- |
18 | | 基础类型 | `arrow-left`、 `arrow-up`、 `arrow-right`、 `arrow-down`、`cross`、`plus` |
19 | | 描边风格 | `close-o`、`dislike-o`、`heart-o`、`help-o`、`like-o`、`location-o`、`info-o`、`success-o`、`wait-o`、`warning-o`、`star-o`、`download`、`friends`、`circle`、`delete`、`charge`、`card`、`notice`、`qrcode`、`reload`、`scan`、`money`、`search`、`setting`、`share`、`zoom-in`、`zoom-out` |
20 | | 实心风格 | `close`、`dislike`、`heart`、`help`、`like`、`location`、`info`、`success`、`wait`、`warning`、`star` |
21 |
22 | ## 示例
23 |
24 | ```json
25 | {
26 | "defaultTitle": "小程序AntUI组件库",
27 | "usingComponents": {
28 | "am-icon": "mini-antui/es/am-icon/index",
29 | }
30 | }
31 | ```
32 |
33 | ```html
34 |
35 |
36 |
37 | ```
--------------------------------------------------------------------------------
/components/am-icon/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | type: '',
4 | size: 23,
5 | color: '#333',
6 | className: '',
7 | ariaHidden: undefined,
8 | },
9 | });
10 |
--------------------------------------------------------------------------------
/components/amount-input/index.axml:
--------------------------------------------------------------------------------
1 |
2 | {{title}}
3 |
4 |
5 | ¥
6 | {{placeholder}}
7 |
8 |
19 |
20 |
21 |
22 |
23 |
27 |
--------------------------------------------------------------------------------
/components/amount-input/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/amount-input/index.ts:
--------------------------------------------------------------------------------
1 | import fmtEvent from '../_util/fmtEvent';
2 |
3 | Component({
4 | props: {
5 | type: 'number',
6 | className: '',
7 | focus: false,
8 | placeholder: '',
9 | value: '',
10 | controlled: false,
11 | },
12 | data: {
13 | _focus: false,
14 | },
15 | methods: {
16 | onInput(e) {
17 | const event = fmtEvent(this.props, e);
18 | if (this.props.onInput) {
19 | this.props.onInput(event);
20 | }
21 | },
22 | onConfirm(e) {
23 | const event = fmtEvent(this.props, e);
24 | if (this.props.onConfirm) {
25 | this.props.onConfirm(event);
26 | }
27 | },
28 | onButtonClick() {
29 | if (this.onButtonClick) {
30 | this.props.onButtonClick();
31 | }
32 | },
33 | onFocus(e) {
34 | this.setData({
35 | _focus: true,
36 | });
37 | const event = fmtEvent(this.props, e);
38 | if (this.props.onFocus) {
39 | this.props.onFocus(event);
40 | }
41 | },
42 | onBlur(e) {
43 | this.setData({
44 | _focus: false,
45 | });
46 | const event = fmtEvent(this.props, e);
47 | if (this.props.onBlur) {
48 | this.props.onBlur(event);
49 | }
50 | },
51 | onClearTap() {
52 | if (this.props.onClear) {
53 | this.props.onClear('');
54 | }
55 | },
56 | },
57 | });
58 |
--------------------------------------------------------------------------------
/components/badge/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 | {{typeof text === 'number' && text > overflowCount ? overflowCount + '+' : text }}
7 | {{typeof text === 'number' && text > overflowCount ? overflowCount + '+' : text }}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/components/badge/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/badge/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/themes/default.less';
2 |
3 | .am-badge {
4 | display: inline-block;
5 | position: relative;
6 | vertical-align: middle;
7 | line-height: 1;
8 |
9 | &-text {
10 | display: inline-block;
11 | position: absolute;
12 | right: 0;
13 | transform: translate(50%, -50%);
14 | top: 0;
15 | min-width: 16px;
16 | padding: 0;
17 | height: 16px;
18 | text-align: center;
19 | background-color: @brand-error;
20 | border-radius: 16px;
21 | color: #fff;
22 |
23 | &-padding {
24 | font-size: 10px;
25 | opacity: 0;
26 | }
27 |
28 | &-inner {
29 | position: absolute;
30 | top: 50%;
31 | left: 50%;
32 | font-size: 20px;
33 | transform: translate(-50%, -50%) scale(0.5);
34 | white-space: nowrap;
35 | }
36 |
37 | &.am-badge-double {
38 | padding: 0 4px;
39 | }
40 | }
41 |
42 | &-not-a-wrapper .am-badge-text {
43 | position: relative;
44 | top: auto;
45 | right: auto;
46 | transform: translateX(0);
47 | }
48 |
49 | &-text.is-dot {
50 | padding: 0;
51 | width: 10px;
52 | min-width: 10px;
53 | height: 10px;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/components/badge/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | overflowCount: 99,
5 | text: '',
6 | dot: false,
7 | },
8 | });
9 |
--------------------------------------------------------------------------------
/components/calendar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/calendar/index.md:
--------------------------------------------------------------------------------
1 | # Calendar 日历
2 |
3 | 日历。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
11 | | ---- | ---- | ---- | ---- | ---- |
12 | | type | 选择类型 `single`: 单日 `range`: 日期区间 | String | single | false
13 | | haveYear | 是否展示年份控制箭头 | Boolean | false | false
14 | | tagData | 标记数据,其中包括日期`date`,标记`tag`,是否禁用`disable`,标记颜色`tagColor`,tagColor有4个可选值,1.#f5a911,2.#e8541e 3.#07a89b 4.#108ee9,5.#b5b5b5 | Array | | false
15 | | onSelect | 选择区间回调 | ([startDate, endDate]) => void | | false
16 | | onMonthChange | 点击切换月份时回调,带两个参数currentMonth切换后月份和prevMonth切换前月份 | (currentMonth, prevMonth) => void | | false |
17 | | onSelectHasDisableDate | 选择区间包含不可用日期 | (currentMonth, prevMonth) => void | | false |
18 |
19 | ## 示例
20 |
21 | ```json
22 | {
23 | "defaultTitle": "小程序AntUI组件库",
24 | "usingComponents":{
25 | "calendar": "mini-antui/es/calendar/index"
26 | }
27 | }
28 | ```
29 |
30 | ```html
31 |
32 |
40 |
41 | ```
42 |
43 | ```javascript
44 | Page({
45 | data: {
46 | tagData: [
47 | { date: '2019-09-14', tag: '还房贷', tagColor: 5 },
48 | { date: '2019-09-28', tag: '公积金', tagColor: 2 },
49 | { date: '2019-09-18', tag: 'xx', disable: true },
50 | ],
51 | },
52 | handleSelect() {},
53 | onMonthChange() {},
54 | onYearChange() {},
55 | onSelectHasDisableDate() {
56 | my.alert({
57 | content: 'SelectHasDisableDate',
58 | });
59 | },
60 | });
61 | ```
--------------------------------------------------------------------------------
/components/card/index.axml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 | {{title}}
10 | {{subTitle}}
11 | {{title}}
12 |
13 |
14 |
15 |
19 |
20 |
--------------------------------------------------------------------------------
/components/card/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/card/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/themes/default.less';
2 |
3 | .am-card {
4 | display: flex;
5 | background-color: @fill-base;
6 | border-radius: 4px;
7 | margin: 6px 10px;
8 | align-items: center;
9 | min-height: 81px;
10 | flex-direction: column;
11 | padding: 0 16px;
12 | &.am-card-active {
13 | background: #D9D9D9;
14 | }
15 | &-body {
16 | display: flex;
17 | align-items: center;
18 | width: 100%;
19 | padding: 16px 0;
20 | }
21 | &-content {
22 | flex: 1;
23 | min-width: 100px;
24 | }
25 | &-title {
26 | font-size: 18px;
27 | line-height: 25px;
28 | color: @color-text-title;
29 | margin-bottom: 4px;
30 | }
31 | &-subtitle {
32 | font-size: 14px;
33 | line-height: 20px;
34 | color: @color-text-caption;
35 | margin-bottom: 2px;
36 | }
37 | &-thumb {
38 | margin-right: 10px;
39 | width: 48px;
40 | height: 48px;
41 | border-radius: 2px;
42 | }
43 | &-arrow {
44 | width: 13px;
45 | height: 13px;
46 | background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAaCAYAAAC+aNwHAAAAkElEQVR4AWJwL/BhAJRWByYAgkAUhmdpkDZxlJZqD9UpXCPyBUTEga9+4IkI94F1XaWUTdH+a67inPOhjP2OgD+IFoTcm1GY3khrbfGAGFG6kBmAkPCw1rq6iBYb0VkEzJD+hHQWAz6iJBtQdP8YiQEbUQNiAF0BP0T+Gnkj8VbmHxMq5gOFjzQ+VPlYxz+WEyrVzhdMcxADAAAAAElFTkSuQmCC") center center no-repeat;
47 | background-size: 8px 13px;
48 | }
49 | &-footer {
50 | display: flex;
51 | width: 100%;
52 | align-items: center;
53 | border-top: 1rpx solid @border-color-base;
54 | padding: 10px 0;
55 | margin: -4px 0 0;
56 | font-size: 14px;
57 | line-height: 20px;
58 | color: @color-text-caption;
59 | image {
60 | width: 14px;
61 | height: 14px;
62 | margin-right: 4px;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/components/card/index.md:
--------------------------------------------------------------------------------
1 | # Card 卡片
2 |
3 | 卡片。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
10 | | ---- | ---- | ---- | ---- | ---- |
11 | | thumb | Card缩略图地址 | String | | false |
12 | | title | Card标题 | String | | true |
13 | | subTitle | Card副标题 | String | | false |
14 | | footer | footer文字 | String | | false |
15 | | footerImg | footer图片地址 | String | | false |
16 | | onCardClick | Card点击的回调 | (info: Object) => void | | false |
17 | | info | 用于点击卡片时往外传递数据 | String | | false |
18 |
19 | ## 示例
20 |
21 | ```json
22 | {
23 | "defaultTitle": "小程序AntUI组件库",
24 | "usingComponents": {
25 | "card": "mini-antui/es/card/index"
26 | }
27 | }
28 | ```
29 |
30 | ```html
31 |
40 | ```
41 |
42 | ```javascript
43 | Page({
44 | data: {
45 | tagData: [
46 | { date: '2018-05-14', tag: '还房贷', tagColor: 5 },
47 | { date: '2018-05-28', tag: '公积金', tagColor: 2 },
48 | ],
49 | },
50 | handleSelect() {},
51 | onMonthChange() {},
52 | });
53 | ```
--------------------------------------------------------------------------------
/components/card/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | title: '',
4 | onClick: () => {},
5 | info: '',
6 | },
7 | methods:{
8 | onCardClick() {
9 | const { info, onClick } = this.props;
10 | onClick({info});
11 | },
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/components/collapse/collapse-item/index.axml:
--------------------------------------------------------------------------------
1 |
5 |
12 |
13 |
14 |
15 | {{header}}
16 |
17 |
18 |
25 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/components/collapse/collapse-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "am-icon": "../../am-icon/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/components/collapse/collapse-item/index.less:
--------------------------------------------------------------------------------
1 | @import '../../style/mixins/hairline.less';
2 |
3 | .am-collapse-item {
4 | border-radius: 4px;
5 | background-color: #fff;
6 | &-title-container {
7 | width: 100%;
8 | display: flex;
9 | color: #333;
10 | font-size: 17px;
11 | line-height: 24px;
12 | position: relative;
13 | text-align: justify;
14 | align-items: center;
15 | padding: 0 16px 14px 0;
16 | justify-content: space-between;
17 | transition: all 0.3s ease-in-out;
18 | .hairline('bottom', #fff);
19 | }
20 |
21 | &--disabled .am-collapse-title {
22 | opacity: 0.5;
23 | }
24 |
25 | &-title {
26 | background-color: #fff;
27 | padding: 14px 16px 0 16px;
28 | border-top: 1px solid #eee;
29 | &.title--active .am-collapse-item-title-container {
30 | .hairline('bottom');
31 | }
32 | }
33 |
34 | &-title-text-wrapper {
35 | padding-right: 16px;
36 | }
37 | &-content-wrapper {
38 | overflow-y: hidden;
39 | box-sizing: border-box;
40 | will-change: max-height;
41 | transition: max-height 0.3s ease-in-out;
42 | }
43 | &-title-arrow {
44 | transform: rotate(0deg);
45 | transition: all 0.2s ease-out;
46 | }
47 | .arrow--down {
48 | transform: rotate(180deg);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/components/collapse/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/components/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/face-detection/index.axml:
--------------------------------------------------------------------------------
1 |
8 | appName and serviceName is required
--------------------------------------------------------------------------------
/components/face-detection/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/filter/filter-item/index.axml:
--------------------------------------------------------------------------------
1 |
2 | {{value}}
3 |
4 |
--------------------------------------------------------------------------------
/components/filter/filter-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/filter/filter-item/index.ts:
--------------------------------------------------------------------------------
1 | import lifecycle from '../mixins/lifecycle';
2 |
3 | Component({
4 | mixins: [lifecycle],
5 | data: {
6 | confirmStyle: '',
7 | },
8 |
9 | props: {
10 | className: '',
11 | item: '',
12 | id: '',
13 | value: '',
14 | selected: false,
15 | onChange: () => {},
16 | },
17 |
18 | didMount() {
19 | const { results, items } = this.data;
20 | const { selected, id, value } = this.props;
21 | if (selected) {
22 | results.push({ id, value });
23 | items.push({ id, value, setData: this.setData });
24 | this.setData({
25 | confirmStyle: true,
26 | });
27 | }
28 | },
29 |
30 | methods: {
31 | handleClick() {
32 | const { id, value, onChange } = this.props;
33 | let { confirmStyle } = this.data;
34 | const { results, items, commonProps } = this.data;
35 | if (commonProps.max === 1) {
36 | if (confirmStyle === '') {
37 | items.forEach((element) => {
38 | element.setData({
39 | confirmStyle: '',
40 | });
41 | });
42 | results.splice(0, results.length);
43 | confirmStyle = true;
44 | results.push({ id, value });
45 | items.push({ id, value, setData: this.setData });
46 | onChange(results);
47 | }
48 | this.setData({
49 | confirmStyle,
50 | });
51 | return;
52 | }
53 | if (confirmStyle === '' && results.length < commonProps.max) {
54 | confirmStyle = true;
55 | results.push({ id, value });
56 | items.push({ id, value, setData: this.setData });
57 | } else {
58 | confirmStyle = '';
59 | results.some((key, index) => {
60 | if (JSON.stringify(key) === JSON.stringify({ id, value })) {
61 | results.splice(index, 1);
62 | return true;
63 | } else {
64 | return false;
65 | }
66 | });
67 | }
68 | this.setData({
69 | confirmStyle,
70 | });
71 | },
72 | },
73 | });
74 |
--------------------------------------------------------------------------------
/components/filter/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/components/filter/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/filter/index.less:
--------------------------------------------------------------------------------
1 | .am-filter {
2 | &-show {
3 | height: 100vh;
4 | display: block;
5 | position: relative;
6 | }
7 |
8 | &-hide {
9 | display: none;
10 | }
11 |
12 | &-mask, &-document {
13 | position: absolute;
14 | top: 0;
15 | left: 0;
16 | right: 0;
17 | }
18 |
19 | &-mask {
20 | bottom: 0;
21 | background: rgba(0, 0, 0, 0.65);
22 | }
23 |
24 | &-content {
25 | background: #fff;
26 | display: flex;
27 | flex-direction: column;
28 | overflow-x: hidden;
29 | overflow-y: scroll;
30 | }
31 |
32 | &-list {
33 | flex: 1;
34 | padding: 10px 5px 23px;
35 | overflow-x: hidden;
36 | min-height: 200px;
37 | overflow-y: scroll;
38 | max-height: 415px;
39 | box-sizing: border-box;
40 | }
41 |
42 | &-btn {
43 | width: 100%;
44 | display: flex;
45 | }
46 |
47 | &-default, &-primary {
48 | flex: 1;
49 | height: 48px;
50 | font-size: 18px;
51 | box-sizing: border-box;
52 | width: 50%;
53 | border: 0;
54 | border-radius: 0;
55 | }
56 |
57 | &-default {
58 | border-top: 1px solid #eee;
59 | border-right: none;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/components/filter/index.md:
--------------------------------------------------------------------------------
1 | # Filter 筛选
2 |
3 | 用作标签卡筛选。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 | ## filter
10 |
11 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
12 | | ---- | ---- | ---- | ---- | ---- |
13 | | show | 是否显示 可选值 `show` `hide` | String | hide | false |
14 | | max | 可选数量最大值,1为单选 | Number | 10000 | false |
15 | | onChange | 多选时提交选中回调 | (e: Object) => void | | false |
16 | | onMaskTap | 点击遮罩层时触发,可用于关闭 filter | () => void | | false |
17 |
18 | ## filter-item
19 |
20 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
21 | | ---- | ---- | ---- | ---- | ---- |
22 | | className | 自定义样式 | String | | false |
23 | | value | 值 | String | | true |
24 | | id | 自定义标识符 | String | | false |
25 | | selected | 默认选中 | Boolean | false | false |
26 | | onChange | 单选时提交选中回调 | (e: Object) => void | | false |
27 |
28 | ## 示例
29 |
30 | ```json
31 | {
32 | "defaultTitle": "小程序AntUI组件库",
33 | "usingComponents": {
34 | "filter": "mini-antui/es/filter/index",
35 | "filter-item": "mini-antui/es/filter/filter-item/index"
36 | }
37 | }
38 | ```
39 |
40 | ```html
41 |
42 |
43 |
44 |
45 |
46 | ```
47 |
48 | ```javascript
49 | Page({
50 | data: {
51 | show: true,
52 | items: [
53 | { id: 1, value: '衣服', selected: true },
54 | { id: 1, value: '橱柜' },
55 | { id: 1, value: '衣架' },
56 | { id: 3, value: '数码产品' },
57 | { id: 4, value: '防盗门' },
58 | { id: 5, value: '椅子' },
59 | { id: 7, value: '显示器' },
60 | { id: 6, value: '某最新款电子产品' },
61 | { id: 8, value: '某某某某某牌电视游戏底座' },
62 | ]
63 | },
64 | handleCallBack(data) {
65 | my.alert({
66 | content: data
67 | });
68 | },
69 | toggleFilter() {
70 | this.setData({
71 | show: !this.data.show,
72 | });
73 | }
74 | });
75 | ```
76 |
--------------------------------------------------------------------------------
/components/filter/index.ts:
--------------------------------------------------------------------------------
1 | import lifecycle from './mixins/lifecycle';
2 |
3 | Component({
4 | mixins: [lifecycle],
5 | data: {
6 | maxHeight: 0,
7 | },
8 | props: {
9 | className: '',
10 | onChange: () => {},
11 | max: 10000,
12 | },
13 | didMount() {
14 | const { commonProps } = this.data;
15 | const { max } = this.props;
16 | commonProps.max = max;
17 | },
18 | methods: {
19 | resetFn() {
20 | const { items, results } = this.data;
21 | items.forEach((element) => {
22 | element.setData({
23 | confirmStyle: '',
24 | });
25 | });
26 | results.splice(0, results.length);
27 | },
28 | confirmFn() {
29 | const { onChange } = this.props;
30 | const { results } = this.data;
31 | onChange(results);
32 | },
33 | maskTap() {
34 | if (this.props.onMaskTap) {
35 | this.props.onMaskTap();
36 | }
37 | },
38 | },
39 | });
40 |
--------------------------------------------------------------------------------
/components/filter/mixins/lifecycle.ts:
--------------------------------------------------------------------------------
1 | export default {
2 | data: {
3 | results: [],
4 | items: [],
5 | commonProps: {
6 | max: 10000,
7 | }
8 | },
9 |
10 | didUnmount() {
11 | let { items, results } = this.data;
12 | results.splice(0, results.length);
13 | items.splice(0, items.length);
14 | },
15 | };
--------------------------------------------------------------------------------
/components/flex/flex-item/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/components/flex/flex-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/flex/flex-item/index.less:
--------------------------------------------------------------------------------
1 | .am-flexbox-item {
2 | box-sizing: border-box;
3 | flex: 1;
4 | min-width: 10px;
5 | margin-left: 8px;
6 |
7 | &:first-child {
8 | margin-left: 0;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/components/flex/flex-item/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 |
3 | });
4 |
--------------------------------------------------------------------------------
/components/flex/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/components/flex/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/flex/index.less:
--------------------------------------------------------------------------------
1 | .am-flexbox {
2 | display: flex;
3 |
4 | &-dir-row {
5 | flex-direction: row;
6 | }
7 |
8 | &-dir-row-reverse {
9 | flex-direction: row-reverse;
10 | }
11 |
12 | &-dir-column {
13 | flex-direction: column;
14 | }
15 |
16 | &-dir-column-reverse {
17 | flex-direction: column-reverse;
18 | }
19 |
20 | &-nowrap {
21 | flex-wrap: nowrap;
22 | }
23 |
24 | &-wrap {
25 | flex-wrap: wrap;
26 | }
27 |
28 | &-wrap-reverse {
29 | flex-wrap: wrap-reverse;
30 | }
31 |
32 | &-justify-start {
33 | justify-content: flex-start;
34 | }
35 |
36 | &-justify-center {
37 | justify-content: center;
38 | }
39 |
40 | &-justify-end {
41 | justify-content: flex-end;
42 | }
43 |
44 | &-justify-between {
45 | justify-content: space-between;
46 | }
47 |
48 | &-justify-around {
49 | justify-content: space-around;
50 | }
51 | &-align-start {
52 | align-items: flex-start;
53 | }
54 |
55 | &-align-end {
56 | align-items: flex-end;
57 | }
58 |
59 | &-align-center {
60 | align-items: center;
61 | }
62 |
63 | &-align-stretch {
64 | align-items: stretch;
65 | }
66 |
67 | &-align-baseline {
68 | align-items: baseline;
69 | }
70 |
71 | &-align-content-start {
72 | align-content: flex-start;
73 | }
74 |
75 | &-align-content-end {
76 | align-content: flex-end;
77 | }
78 |
79 | &-align-content-center {
80 | align-content: center;
81 | }
82 |
83 | &-align-content-between {
84 | align-content: space-between;
85 | }
86 |
87 | &-align-content-around {
88 | align-content: space-around;
89 | }
90 |
91 | &-align-content-stretch {
92 | align-content: stretch;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/components/flex/index.sjs:
--------------------------------------------------------------------------------
1 | export default function classnames(dir, wrap, justify, align, alignContent) {
2 | const prefixCls = 'am-flexbox';
3 | const classes = [];
4 |
5 | const dirMaps = {
6 | row: `${prefixCls}-dir-row`,
7 | 'row-reverse': `${prefixCls}-dir-row-reverse`,
8 | column: `${prefixCls}-dir-column`,
9 | 'column-reverse': `${prefixCls}-dir-column-reverse`,
10 | };
11 |
12 | const wrapMaps = {
13 | nowrap: `${prefixCls}-nowrap`,
14 | wrap: `${prefixCls}-wrap`,
15 | 'wrap-reverse': `${prefixCls}-wrap-reverse`,
16 | };
17 |
18 | const justifyMaps = {
19 | start: `${prefixCls}-justify-start`,
20 | end: `${prefixCls}-justify-end`,
21 | center: `${prefixCls}-justify-center`,
22 | between: `${prefixCls}-justify-between`,
23 | around: `${prefixCls}-justify-around`,
24 | };
25 |
26 | const alignMaps = {
27 | start: `${prefixCls}-align-start`,
28 | center: `${prefixCls}-align-center`,
29 | end: `${prefixCls}-align-end`,
30 | baseline: `${prefixCls}-align-baseline`,
31 | stretch: `${prefixCls}-align-stretch`,
32 | };
33 |
34 | const alignContentMaps = {
35 | start: `${prefixCls}-align-content-start`,
36 | end: `${prefixCls}-align-content-end`,
37 | center: `${prefixCls}-align-content-center`,
38 | between: `${prefixCls}-align-content-between`,
39 | around: `${prefixCls}-align-content-around`,
40 | stretch: `${prefixCls}-align-content-stretch`,
41 | };
42 |
43 | if (dirMaps[dir]) {
44 | classes.push(dirMaps[dir]);
45 | }
46 |
47 | if (wrapMaps[wrap]) {
48 | classes.push(wrapMaps[wrap]);
49 | }
50 |
51 | if (justifyMaps[justify]) {
52 | classes.push(justifyMaps[justify]);
53 | }
54 |
55 | if (alignMaps[align]) {
56 | classes.push(alignMaps[align]);
57 | }
58 |
59 | if (alignContentMaps[alignContent]) {
60 | classes.push(alignContentMaps[alignContent]);
61 | }
62 |
63 | return classes.join(' ');
64 | }
65 |
--------------------------------------------------------------------------------
/components/flex/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | direction: 'row',
5 | wrap: 'nowrap',
6 | justify: 'start',
7 | align: 'center',
8 | alignContent: 'stretch',
9 | },
10 | });
11 |
--------------------------------------------------------------------------------
/components/footer/index.axml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/footer/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/footer/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/themes/default.less';
2 |
3 | .am-footer {
4 | &-links {
5 | display: flex;
6 | justify-content: center;
7 | }
8 | &-link {
9 | height: 17px;
10 | line-height: 17px;
11 | color: @color-link;
12 | font-size: 12px;
13 | &::after {
14 | content: '|';
15 | padding: 0 5px;
16 | height: 17px;
17 | color: @color-text-dark;
18 | }
19 | &:last-child {
20 | &::after {
21 | display: none;
22 | }
23 | }
24 | }
25 | &-copyright {
26 | margin-top: 3px;
27 | height: 17px;
28 | line-height: 17px;
29 | color: @color-text-dark;
30 | font-size: 14px;
31 | text-align: center;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/components/footer/index.md:
--------------------------------------------------------------------------------
1 | # Footer 页脚
2 |
3 | 显示页面页脚。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
11 | | ---- | ---- | ---- | ---- | ---- |
12 | | copyright | 版权信息 | String | | false |
13 | | links | 页脚链接 | Array | | false |
14 |
15 | ## 示例
16 |
17 | ```json
18 | {
19 | "defaultTitle": "小程序AntUI组件库",
20 | "usingComponents":{
21 | "footer": "mini-antui/es/footer/index"
22 | }
23 | }
24 | ```
25 |
26 | ```html
27 |
28 |
31 |
32 | ```
33 |
34 | ```javascript
35 | Page({
36 | data: {
37 | copyright: '© 2004-2017 Alipay.com. All rights reserved.',
38 | links: [
39 | { text: '底部链接', url: '../../list/demo/index' },
40 | { text: '底部链接', url: '../../card/demo/index' },
41 | ],
42 | },
43 | });
44 | ```
45 |
--------------------------------------------------------------------------------
/components/footer/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | },
5 | });
6 |
--------------------------------------------------------------------------------
/components/grid/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | {{item.text}}
19 | {{item.desc}}
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/components/grid/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/grid/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | data: {
3 | bottomIndex: 0,
4 | },
5 | props: {
6 | columnNum: 3,
7 | circular: false,
8 | list: [],
9 | onGridItemClick: () => {},
10 | hasLine: true,
11 | },
12 | didMount() {
13 | const { list, columnNum } = this.props;
14 | const rows = list.length / columnNum;
15 | this.setData({
16 | bottomIndex: Math.floor(rows) === rows ? (rows - 1) * columnNum : Math.floor(rows) * columnNum,
17 | });
18 | },
19 | methods: {
20 | onGridItemClick(e) {
21 | this.props.onGridItemClick({
22 | detail: {
23 | index: e.target.dataset.index,
24 | },
25 | });
26 | },
27 | },
28 | });
29 |
--------------------------------------------------------------------------------
/components/input-item/index.axml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/components/input-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/input-item/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/mixins/hairline.less';
2 |
3 | .am-input {
4 | &-item {
5 | display: flex;
6 | align-items: center;
7 | background: #fff;
8 | padding-left: 15px;
9 |
10 | .a-input-content {
11 | padding-left: 2px;
12 | }
13 | }
14 |
15 | &-line {
16 | position: relative;
17 | flex: 1;
18 | display: flex;
19 | align-items: center;
20 | padding-right: 15px;
21 | min-height: 47px;
22 | overflow: hidden;
23 | }
24 |
25 | &-label {
26 | min-width: 80px;
27 | margin-right: 2px;
28 | color: #333;
29 | }
30 |
31 | &-content {
32 | flex: 1;
33 | display: flex;
34 | height: 33px;
35 | color: #000;
36 | text-align: left;
37 | }
38 |
39 | &-content .a-input-wrap {
40 | flex: 1;
41 | }
42 |
43 | &-clear {
44 | display: flex;
45 | height: 33px;
46 | width: 33px;
47 | justify-content: center;
48 | align-items: center;
49 | }
50 |
51 | &-clear.show {
52 | visibility: visible;
53 | }
54 |
55 | &-clear.hidden {
56 | visibility: hidden;
57 | pointer-events: none;
58 | }
59 |
60 | &-line-bottom {
61 | .hairline('bottom');
62 | }
63 |
64 | /* 最后一行 */
65 | &-item.last .am-input-line-bottom::after {
66 | display: none;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/components/input-item/index.ts:
--------------------------------------------------------------------------------
1 | import fmtEvent from '../_util/fmtEvent';
2 |
3 | Component({
4 | props: {
5 | className: '',
6 | labelCls: '',
7 | inputCls: '',
8 | last: false,
9 | value: '',
10 | name: '',
11 | type: 'text',
12 | password: false,
13 | placeholder: '',
14 | placeholderClass: '',
15 | placeholderStyle: '',
16 | disabled: false,
17 | maxlength: 140,
18 | focus: false,
19 | clear: false, // 是否带清除功能
20 | syncInput: false,
21 | enableNative: false, // 兼容安卓input的输入bug
22 | onInput: () => {},
23 | onConfirm: () => {},
24 | onFocus: () => {},
25 | onBlur: () => {},
26 | onClear: () => {},
27 | },
28 | data: {
29 | _focus: false,
30 | _native: false,
31 | },
32 | didMount() {
33 | this.setData({
34 | _native: this.renderer === 'native',
35 | _focus: this.props.focus,
36 | });
37 | },
38 | methods: {
39 | onBlur(e) {
40 | this.setData({
41 | _focus: false,
42 | });
43 | const event = fmtEvent(this.props, e);
44 | this.props.onBlur(event);
45 | },
46 | onConfirm(e) {
47 | const event = fmtEvent(this.props, e);
48 | this.props.onConfirm(event);
49 | },
50 | onFocus(e) {
51 | this.setData({
52 | _focus: true,
53 | });
54 | const event = fmtEvent(this.props, e);
55 | this.props.onFocus(event);
56 | },
57 | onInput(e) {
58 | const event = fmtEvent(this.props, e);
59 | this.props.onInput(event);
60 | },
61 | onClear(e) {
62 | const event = fmtEvent(this.props, e);
63 | this.props.onClear(event);
64 | },
65 | },
66 | });
67 |
--------------------------------------------------------------------------------
/components/list/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 | {{loadContent[0]?loadContent[0]:''}}
9 | {{loadContent[1]?loadContent[1]:''}}
10 |
13 |
14 |
--------------------------------------------------------------------------------
/components/list/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/list/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/mixins/hairline.less';
2 |
3 | .am-list {
4 | &-header,&-footer {
5 | font-size: 14px;
6 | color: #888;
7 | }
8 | &-header {
9 | padding: 16px 16px 8px;
10 | }
11 | &-body {
12 | position: relative;
13 | .hairline('top');
14 | .hairline('bottom');
15 | }
16 | &-footer {
17 | padding: 8px 16px 16px 16px;
18 | }
19 | &-load-more {
20 | text-align: center;
21 | background: #fff;
22 | padding: 10px 16px;
23 | font-size: 15px;
24 | line-height: 1.4;
25 | color: @color-text-title;
26 | &-txt {
27 | padding: 0 10px;
28 | }
29 | }
30 | &-load-over {
31 | display: block;
32 | padding: 10px 16px;
33 | font-size: 10px;
34 | text-align: center;
35 | color: #ccc;
36 | text-shadow: 1px 1px #f0f0f0;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/components/list/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | loadMore: false,
5 | loadContent: [
6 | '',
7 | '',
8 | ],
9 | },
10 | data: {
11 | loadContent: [
12 | '加载更多...',
13 | '-- 数据加载完了 --',
14 | ],
15 | },
16 | didMount() {
17 | const loadTxt = this.props.loadContent[0] ? this.props.loadContent[0] : this.data.loadContent[0];
18 | const overTxt = this.props.loadContent[1] ? this.props.loadContent[1] : this.data.loadContent[1];
19 | this.setData({
20 | loadContent: [loadTxt, overTxt],
21 | });
22 | },
23 | didUpdate() {
24 | const loadTxt = this.props.loadContent[0] ? this.props.loadContent[0] : this.data.loadContent[0];
25 | const overTxt = this.props.loadContent[1] ? this.props.loadContent[1] : this.data.loadContent[1];
26 | if (loadTxt !== this.data.loadContent[0] || overTxt !== this.data.loadContent[1]) {
27 | this.setData({
28 | loadContent: [loadTxt, overTxt],
29 | });
30 | }
31 | },
32 | });
33 |
--------------------------------------------------------------------------------
/components/list/list-item/index.axml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/components/list/list-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/list/list-item/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | align: false,
5 | disabled: false,
6 | multipleLine: false,
7 | wrap: false,
8 | },
9 | didMount() {
10 | this._updateDataSet();
11 | },
12 | didUpdate() {
13 | this._updateDataSet();
14 | },
15 | methods: {
16 | _updateDataSet() {
17 | this.dataset = {};
18 | for (const key in this.props) {
19 | if ((/data-/gi).test(key)) {
20 | this.dataset[key.replace(/data-/gi, '')] = this.props[key];
21 | }
22 | }
23 | },
24 | onItemTap(ev) {
25 | const { onClick, disabled } = this.props;
26 | if (onClick && !disabled) {
27 | onClick({
28 | index: ev.target.dataset.index,
29 | target: { dataset: this.dataset },
30 | });
31 | }
32 | },
33 | },
34 | });
35 |
--------------------------------------------------------------------------------
/components/message/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{title}}
5 |
6 |
7 | {{subTitle}}
8 |
9 |
10 |
11 |
19 |
27 |
28 |
--------------------------------------------------------------------------------
/components/message/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/message/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/themes/default.less';
2 | @import '../style/mixins/hairline.less';
3 |
4 | .am-message {
5 | background-color: #fff;
6 | margin-bottom: 30px;
7 | padding: 30px 15px;
8 | text-align: center;
9 | height: 199px;
10 | box-sizing: border-box;
11 | position: relative;
12 | .hairline('bottom');
13 |
14 | & .am-icon {
15 | display: block;
16 | }
17 |
18 | &-main {
19 | font-size: @font-size-page-result;
20 | margin: 16px 0 9px;
21 | line-height: 28px;
22 | }
23 |
24 | &-sub {
25 | padding: 0 30px;
26 | font-size: @font-size-caption;
27 | line-height: 19px;
28 | margin-top: 6px;
29 | color: @color-text-caption;
30 | }
31 |
32 | &-button-wrap {
33 | padding: 0 15px;
34 |
35 | & .a-button {
36 | margin-bottom: 15px;
37 | }
38 |
39 | & .a-button:last-child {
40 | margin-bottom: 0;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/components/message/index.md:
--------------------------------------------------------------------------------
1 | ## Message 结果页
2 |
3 | 结果页。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
11 | | ----- | ----- | ----- | ---- | ---- |
12 | | className| 自定义的class | String | | false |
13 | | type | 有success、fail、info、warn、waiting、info五种状态类型,默认为success | String | success | false |
14 | | title | 主标题 | String | | true |
15 | | subTitle | 副标题 | String | | false |
16 | | mainButton | 主按钮的文本和可用性相关 | Object | | false |
17 | | subButton | 副按钮的文本和可用性相关 | Object | | false |
18 | | onTapMain | 主按钮的点击函数 | () => {} | | false |
19 | | onTapSub | 副按钮的点击函数 | () => {} | | false |
20 |
21 | ## 示例
22 |
23 | ```json
24 | {
25 | "defaultTitle": "小程序AntUI组件库",
26 | "usingComponents": {
27 | "message": "mini-antui/es/message/index"
28 | }
29 | }
30 | ```
31 |
32 | ```html
33 |
34 |
41 |
42 |
43 | ```
44 |
45 | ```javascript
46 | Page({
47 | data: {
48 | title: "操作成功",
49 | subTitle: "内容详情可折行,建议不超过两行",
50 | messageButton: {
51 | mainButton: {
52 | buttonText: "主要操作"
53 | },
54 | subButton: {
55 | buttonText: "辅助操作"
56 | }
57 | }
58 | },
59 | goBack() {
60 | my.navigateBack();
61 | }
62 | });
63 | ```
--------------------------------------------------------------------------------
/components/message/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: "",
4 | type: "success",
5 | title: "",
6 | onTapMain: () => {},
7 | onTapSub: () => {}
8 | },
9 | methods: {
10 | tapMain() {
11 | this.props.onTapMain();
12 | },
13 | tapSub() {
14 | this.props.onTapSub();
15 | }
16 | }
17 | });
--------------------------------------------------------------------------------
/components/modal/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/components/modal/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/modal/index.md:
--------------------------------------------------------------------------------
1 | ## Modal 对话框
2 |
3 | 对话框。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 | | 属性名 | 描述 | 类型 | 默认值 |
10 | | ---- | ---- | ---- | ---- |
11 | | className| 自定义class | String| |
12 | | show | 是否展示`modal` | Boolean | false |
13 | | showClose | 是否渲染`关闭` | Boolean | true |
14 | | closeType | 关闭图表类型 0:灰色图标 1:白色图标 | String | 0 |
15 | | onModalClick | 点击`footer`部分的回调 | () => void | |
16 | | onModalClose | 点击`关闭`的回调, `showClose`为false时无需设置 | () => void | |
17 | | topImage | 顶部图片 | String | |
18 | | topImageSize | 顶部图片规则,可选值:`lg`、`md`、`sm` | String | md |
19 | | advice| 是否是运营类弹窗 | Boolean | false |
20 | | disableScroll | modal展示时是否禁止页面滚动(**以真机效果为准**) | Boolean | true | false |
21 |
22 | ## slots
23 |
24 | | slotName | 说明 |
25 | | ---- | ---- |
26 | | header | 可选,modal头部 |
27 | | footer | 可选,modal尾部 |
28 |
29 |
30 | ## 示例
31 |
32 | ```json
33 | {
34 | "defaultTitle": "小程序AntUI组件库",
35 | "usingComponents": {
36 | "modal": "mini-antui/es/modal/index"
37 | }
38 | }
39 | ```
40 |
41 | ```html
42 |
43 |
44 |
50 | 标题单行
51 | 说明当前状态、提示用户解决方案,最好不要超过两行。
52 | 确定
53 |
54 |
55 | ```
56 |
57 | ```javascript
58 | Page({
59 | data: {
60 | modalOpened: false,
61 | },
62 | openModal() {
63 | this.setData({
64 | modalOpened: true,
65 | });
66 | },
67 | onModalClick() {
68 | this.setData({
69 | modalOpened: false,
70 | });
71 | },
72 | onModalClose() {
73 | this.setData({
74 | modalOpened: false,
75 | });
76 | }
77 | });
78 | ```
79 |
--------------------------------------------------------------------------------
/components/modal/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | topImageSize: 'md',
5 | showClose: true,
6 | closeType: '0',
7 | disableScroll: true,
8 | },
9 | methods: {
10 | onModalClick() {
11 | const { onModalClick } = this.props;
12 | if (onModalClick) {
13 | onModalClick();
14 | }
15 | },
16 | onModalClose() {
17 | const { onModalClose } = this.props;
18 | if (onModalClose) {
19 | onModalClose();
20 | }
21 | },
22 | },
23 | });
24 |
--------------------------------------------------------------------------------
/components/notice/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
17 |
18 |
19 |
20 |
21 | {{action}}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/components/notice/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/page-result/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{title}}
4 | {{brief}}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/components/page-result/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/page-result/index.md:
--------------------------------------------------------------------------------
1 | # PageResult 异常页面
2 |
3 | 异常页面。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
11 | | ---- | ---- | ---- | ---- | ---- |
12 | | type | 异常页面类型,可选,网络异常`network`,服务繁忙`busy`,服务异常`error`,空状态`empty`,用户注销`logoff` | String | network | false |
13 | | local | 是否是局部异常内容 | Boolean | false | false |
14 | | title | 错误提示标题 | String | | false |
15 | | brief | 错误提示简要 | String | | false |
16 |
17 | ## 示例
18 |
19 | ```json
20 | {
21 | "defaultTitle": "异常反馈",
22 | "usingComponents": {
23 | "page-result": "mini-antui/es/page-result/index"
24 | }
25 | }
26 | ```
27 |
28 | ```html
29 |
34 |
39 |
40 | 回到首页
41 | 示例按钮
42 |
43 |
44 | ```
45 |
--------------------------------------------------------------------------------
/components/page-result/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | type: 'network',
5 | local: false,
6 | }
7 | });
8 |
--------------------------------------------------------------------------------
/components/pagination/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/components/pagination/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/pagination/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/mixins/hairline.less';
2 |
3 | .am-pagination {
4 | &-container {
5 | width: 100%;
6 | height: 50px;
7 | display: flex;
8 | font-size: 14px;
9 | line-height: 50px;
10 | padding: 0 20px;
11 | align-items: center;
12 | box-sizing: border-box;
13 | background-color: #fff;
14 | justify-content: space-between;
15 | }
16 | &-page {
17 | width: 30%;
18 | padding: 0 7px;
19 | text-align: center;
20 | box-sizing: border-box;
21 | }
22 | &-content {
23 | width: 35%;
24 | display: flex;
25 | box-sizing: border-box;
26 | align-items: center;
27 | }
28 | &-arrow {
29 | width: 7px;
30 | height: 7px;
31 | flex-basis: 10px;
32 | position: relative;
33 | display: inline-block;
34 | border: 1px solid #444;
35 | border-color: transparent #444 #444 transparent;
36 | &.arrow {
37 | &-left {
38 | left: 5px;
39 | transform: rotate(135deg);
40 | }
41 | &-right {
42 | right: 5px;
43 | transform: rotate(-45deg);
44 | }
45 | }
46 | }
47 | &-button {
48 | &-left, &-right {
49 | color: #108ee9;
50 | width: 100%;
51 | .button-text-disabled {
52 | color: rgba(0, 0, 0, 0.25);
53 | }
54 | }
55 | &-left {
56 | text-align: left;
57 | }
58 | &-right {
59 | text-align: right;
60 | }
61 | }
62 | &-prev {
63 | justify-content: flex-start;
64 | }
65 | &-next {
66 | justify-content: flex-end;
67 | }
68 | &-text-ellipsis {
69 | overflow: hidden;
70 | white-space: nowrap;
71 | text-overflow: ellipsis;
72 | }
73 |
74 | &-border-top {
75 | position: relative;
76 | border: none;
77 | .hairline('top');
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/components/pagination/index.md:
--------------------------------------------------------------------------------
1 | ## Pagination 分页
2 |
3 | 分页
4 |
5 | | 属性名 | 描述 | 类型 | 默认值 |
6 | | ---- | ---- | ---- | ---- |
7 | | mode | 按钮的形态可选类型:`text`、`icon`| String | text |
8 | | total | 总页数 | Number | 0 |
9 | | current | 当前页数 | Number | 0 |
10 | | simple | 是否隐藏数值 | Boolean |false|
11 | | disabled | 禁用状态 | Boolean | false |
12 | | prevText | 前翻分页按钮文案 | String | 上一页 |
13 | | nextText | 后翻分页按钮文案 | String | 下一页 |
14 | | btnClass | 分页按钮样式,限于文字类型按钮 | String | |
15 | | onChange | 翻页回调函数 | (index: Number) => void | 无 |
16 |
17 | `prevText`和`nextText`当且仅当mode为`text`时生效。
18 |
19 | ## 示例
20 |
21 | ```json
22 | {
23 | "defaultTitle": "小程序AntUI组件库",
24 | "usingComponents": {
25 | "pagination": "mini-antui/es/pagination/index"
26 | }
27 | }
28 | ```
29 |
30 | ```html
31 |
32 | 基础用法
33 |
34 | 箭头按钮
35 |
36 | 简单模式
37 |
38 | 按钮禁用
39 |
40 | 自定义按钮文案
41 |
42 |
43 | ```
44 |
45 | ```javascript
46 | Page({})
47 | ```
48 |
--------------------------------------------------------------------------------
/components/pagination/index.sjs:
--------------------------------------------------------------------------------
1 | const calcCurrent = (propsCurrent, current) => (typeof current === 'number' ? current : propsCurrent);
2 |
3 | export default {
4 | calcCurrent,
5 | };
6 |
--------------------------------------------------------------------------------
/components/pagination/index.ts:
--------------------------------------------------------------------------------
1 | const noop = () => {};
2 |
3 | Component({
4 | props: {
5 | mode: 'text',
6 | simple: false,
7 | disabled: false,
8 | current: 0,
9 | total: 0,
10 | prevText: '上一页',
11 | nextText: '下一页',
12 | onChange: noop,
13 | className: '',
14 | btnClass: '',
15 | },
16 |
17 | didMount() {
18 | const { current } = this.props;
19 | this.setData({
20 | currentPage: current,
21 | });
22 | },
23 |
24 | methods: {
25 | onTapPrev() {
26 | const { currentPage } = this.data;
27 | const { disabled } = this.props;
28 | if (currentPage - 1 > 0 && !disabled) {
29 | this.setData({
30 | currentPage: currentPage - 1,
31 | });
32 | this.props.onChange(this.data.currentPage);
33 | }
34 | },
35 | onTapNext() {
36 | const { disabled, total } = this.props;
37 | const { currentPage } = this.data;
38 | if (currentPage + 1 <= total && !disabled) {
39 | this.setData({
40 | currentPage: currentPage + 1,
41 | });
42 | this.props.onChange(this.data.currentPage);
43 | }
44 | },
45 | },
46 | });
47 |
--------------------------------------------------------------------------------
/components/picker-item/index.axml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | {{value.length > 0 ? value : placeholder}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/components/picker-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/picker-item/index.less:
--------------------------------------------------------------------------------
1 | @import '../style/mixins/hairline.less';
2 |
3 | .am-picker {
4 | &-item {
5 | display: flex;
6 | align-items: center;
7 | background: #fff;
8 | padding-left: 15px;
9 | }
10 |
11 | &-line {
12 | position: relative;
13 | flex: 1;
14 | display: flex;
15 | align-items: center;
16 | padding-right: 15px;
17 | min-height: 47px;
18 | overflow: hidden;
19 | }
20 |
21 | &-label {
22 | min-width: 80px;
23 | margin-right: 2px;
24 | color: #333;
25 | }
26 |
27 | &-wrapper {
28 | display: flex;
29 | flex: 1;
30 | height: 33px;
31 | align-items: center;
32 | overflow: hidden;
33 | }
34 |
35 | &-content {
36 | flex: 1;
37 | display: flex;
38 | align-items: center;
39 | height: 33px;
40 | color: #000;
41 | text-align: left;
42 | overflow: hidden;
43 | white-space: nowrap;
44 | }
45 |
46 | &-clear {
47 | display: flex;
48 | }
49 |
50 | &-line-bottom {
51 | .hairline('bottom');
52 | }
53 |
54 | /* 最后一行 */
55 | &-item.last .am-picker-line-bottom::after {
56 | display: none;
57 | }
58 |
59 | &-text {
60 | padding-left: 8px;
61 | }
62 |
63 | &-content-placeholder {
64 | color: #ccc;
65 | }
66 |
67 | &-content-value {
68 | color: #333;
69 | }
70 |
71 | &-arrow {
72 | display: block;
73 | width: 13px;
74 | height: 13px;
75 | margin-left: 8px;
76 | background-image: url('https://gw.alipayobjects.com/zos/rmsportal/nGMpTwTjtKMbOeeQIucS.png');
77 | background-size: contain;
78 | background-repeat: no-repeat;
79 | background-position: 50% 50%;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/components/picker-item/index.md:
--------------------------------------------------------------------------------
1 | ## PickerItem 选择输入
2 |
3 | 文本输入。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 | 选择输入。
10 |
11 | | 属性名 | 描述 | 类型 | 默认值 |
12 | | ---- | ---- | ---- | ---- |
13 | | className | 自定义的class | String| |
14 | | labelCls | 自定义label的class | String | |
15 | | pickerCls | 自定义选择区域的class | String | |
16 | | last| 是否最后一行 | Boolean | false |
17 | | value| 初始内容 | String | |
18 | | name| 组件名字,用于表单提交获取数据 | String | |
19 | | placeholder | 占位符 | String | |
20 | | onPickerTap | 点击pickeritem时触发 | (e: Object) => void | |
21 |
22 | ## slots
23 |
24 | | slotname | 说明 |
25 | | ---- | ---- |
26 | | extra | 可选,用于渲染picker-item项右边说明 |
27 |
28 | ## 示例
29 |
30 | ```json
31 | {
32 | "defaultTitle": "小程序AntUI组件库",
33 | "usingComponents": {
34 | "list": "mini-antui/es/list/index",
35 | "list-item": "mini-antui/es/list/list-item/index",
36 | "picker-item": "mini-antui/es/picker-item/index",
37 | "input-item": "mini-antui/es/input-item/index"
38 | }
39 | }
40 | ```
41 |
42 | ```axml
43 |
44 |
45 |
50 | 密码
51 |
52 |
58 | 发卡银行
59 |
60 |
61 |
62 | ```
63 |
64 | ```javascript
65 | const banks = ['网商银行', '建设银行', '工商银行', '浦发银行'];
66 |
67 | Page({
68 | data: {
69 | bank: '',
70 | },
71 | onSelect() {
72 | my.showActionSheet({
73 | title: '选择发卡银行',
74 | items: banks,
75 | success: (res) => {
76 | this.setData({
77 | bank: banks[res.index],
78 | });
79 | },
80 | });
81 | },
82 | });
83 | ```
--------------------------------------------------------------------------------
/components/picker-item/index.ts:
--------------------------------------------------------------------------------
1 | import fmtEvent from '../_util/fmtEvent';
2 |
3 | Component({
4 | props: {
5 | className: '',
6 | value: '',
7 | placeholder: '',
8 | onSelect: () => {},
9 | labelCls: '',
10 | pickerCls: '',
11 | },
12 | methods: {
13 | onPickerTap(e) {
14 | const event = fmtEvent(this.props, e);
15 | this.props.onPickerTap(event);
16 | },
17 | },
18 | });
19 |
--------------------------------------------------------------------------------
/components/popover/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/components/popover/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/popover/index.md:
--------------------------------------------------------------------------------
1 | # Popover 气泡
2 |
3 | 气泡。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | ## popover
11 |
12 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
13 | | ---- | ---- | ---- | ---- | ---- |
14 | | className | 最外层覆盖样式 | String | | false |
15 | | show | 气泡是否展示 | Boolean | false | true |
16 | | showMask | 蒙层是否展示 | Boolean | true | false |
17 | | position | 气泡位置可选值:`top`、`topRight`、`topLeft`、`bottom`、`bottomLeft`、`bottomRight`、`right`、`rightTop`、`rightBottom`、`left`、`leftBottom`、 `leftTop` | String | bottomRight | false |
18 |
19 | ## popover-item
20 |
21 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
22 | | ---- | ---- | ---- | ---- | ----|
23 | | className | 单项样式 | String | | false |
24 | | onItemClick | 单项点击事件 | () => void | | false |
25 |
26 | ## 示例
27 |
28 | ```json
29 | {
30 | "usingComponents": {
31 | "popover": "mini-antui/es/popover/index",
32 | "popover-item": "mini-antui/es/popover/popover-item/index"
33 | }
34 | }
35 | ```
36 |
37 | ```html
38 |
44 | 点击显示
45 |
46 |
47 | line1
48 |
49 |
50 | line2
51 |
52 |
53 |
54 | ```
55 |
56 | ```javascript
57 | Page({
58 | data: {
59 | position: 'bottomRight',
60 | show: false,
61 | showMask: true,
62 | },
63 | onMaskClick() {
64 | this.setData({
65 | show: false,
66 | });
67 | },
68 | onShowPopoverTap() {
69 | this.setData({
70 | show: true,
71 | });
72 | },
73 | itemTap1() {
74 | my.alert({
75 | content: '点击1',
76 | });
77 | },
78 | });
79 | ```
--------------------------------------------------------------------------------
/components/popover/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | show: false,
4 | className: '',
5 | showMask: true,
6 | position: 'bottomRight',
7 | },
8 | methods: {
9 | onMaskClick() {
10 | if (this.props.onMaskClick && typeof this.props.onMaskClick === 'function') {
11 | this.props.onMaskClick();
12 | }
13 | },
14 | },
15 | });
16 |
17 |
--------------------------------------------------------------------------------
/components/popover/popover-item/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/components/popover/popover-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/popover/popover-item/index.less:
--------------------------------------------------------------------------------
1 | .am-popover-item {
2 | min-width: 80px;
3 | max-width: 170px;
4 | height: 39px;
5 | margin: 0 10px;
6 | line-height: 39px;
7 | font-size: 14px;
8 | white-space: nowrap;
9 | overflow: hidden;
10 | text-overflow: ellipsis;
11 | color: #333;
12 | text-align: center;
13 | }
14 | .am-popover-item:not(:last-child) {
15 | border-bottom: 1px solid #eee;
16 | }
17 |
--------------------------------------------------------------------------------
/components/popover/popover-item/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | },
5 | methods: {
6 | onItemClick() {
7 | if (this.props.onItemClick && typeof this.props.onItemClick === 'function') {
8 | this.props.onItemClick();
9 | }
10 | },
11 | },
12 | });
13 |
--------------------------------------------------------------------------------
/components/popup/index.axml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/components/popup/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/popup/index.less:
--------------------------------------------------------------------------------
1 | .am-popup {
2 | &-content {
3 | position: fixed;
4 | }
5 |
6 | &-mask {
7 | visibility: hidden;
8 | position: fixed;
9 | top: 0;
10 | bottom: 0;
11 | left: 0;
12 | right: 0;
13 | background-color: rgba(0, 0, 0, 0.75);
14 | opacity: 0;
15 | }
16 |
17 | &-left {
18 | transform: translateX(-100%);
19 | left: 0;
20 | top: 0;
21 | bottom: 0;
22 | }
23 |
24 | &-right {
25 | transform: translateX(100%);
26 | right: 0;
27 | top: 0;
28 | bottom: 0;
29 | }
30 |
31 | &-top {
32 | top: 0;
33 | width: 100vw;
34 | transform: translateY(-100%);
35 | }
36 |
37 | &-bottom {
38 | bottom: 0;
39 | width: 100vw;
40 | transform: translateY(100%);
41 | }
42 |
43 | &-show &-content {
44 | transform: none;
45 | }
46 |
47 | &-show &-mask {
48 | visibility: visible;
49 | opacity: 1;
50 | }
51 |
52 | &.animation &-content {
53 | transition: all 200ms linear;
54 | }
55 |
56 | &.animation &-mask {
57 | transition: all 200ms linear;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/components/popup/index.md:
--------------------------------------------------------------------------------
1 | # Popup 弹出菜单
2 |
3 | 弹出菜单。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
11 | | ---- | ---- | ---- | ---- | ---- |
12 | | className | 自定义class | String | | false |
13 | | show | 是否显示菜单 | Boolean | false | false |
14 | | animation | 是否开启动画 | Boolean | true | false |
15 | | mask | 是否显示mask,不显示时点击外部不会触发onClose | Boolean| true | true |
16 | | position | 控制从什么方向弹出菜单,bottom表示底部,left表示左侧,top表示顶部,right表示右侧 | String | bottom | false |
17 | | disableScroll | 展示mask时是否禁止页面滚动 | Boolean | true | false |
18 | | zIndex | 定义popup的层级 | Number | 0 | false |
19 |
20 | ## slots
21 |
22 | 可以在popup组件中定义要展示部分,具体可参看下面示例。
23 |
24 | ## 示例
25 |
26 | ```json
27 | {
28 | "defaultTitle": "小程序AntUI组件库",
29 | "usingComponents": {
30 | "popup": "mini-antui/es/popup/index"
31 | }
32 | }
33 | ```
34 |
35 | ```html
36 |
37 |
38 |
39 |
40 |
41 | hello world
42 |
43 |
44 | ```
45 |
46 | ```javascript
47 | Page({
48 | data: {
49 | showTop: false,
50 | },
51 | onTopBtnTap() {
52 | this.setData({
53 | showTop: true,
54 | });
55 | },
56 | onPopupClose() {
57 | this.setData({
58 | showTop: false,
59 | });
60 | },
61 | });
62 | ```
63 |
--------------------------------------------------------------------------------
/components/popup/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | show: false,
5 | position: 'bottom',
6 | mask: true,
7 | animation: true,
8 | disableScroll: true,
9 | },
10 | methods: {
11 | onMaskTap() {
12 | const { onClose, animation } = this.props;
13 |
14 | if (onClose) {
15 | if (animation) {
16 | onClose();
17 | } else {
18 | setTimeout(() => {
19 | onClose();
20 | }, 200);
21 | }
22 | }
23 | },
24 | },
25 | });
26 |
--------------------------------------------------------------------------------
/components/search-bar/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{placeholder}}
7 |
8 |
9 |
22 |
23 |
24 |
25 |
26 | 取消
29 |
30 |
--------------------------------------------------------------------------------
/components/search-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/search-bar/index.less:
--------------------------------------------------------------------------------
1 | .am-search {
2 | height: 44px;
3 | display: flex;
4 | align-items: center;
5 | padding: 0 0 0 12px;
6 | background: #fff;
7 | overflow: hidden;
8 |
9 | &-input {
10 | display: flex;
11 | position: relative;
12 | height: 28px;
13 | line-height: 28px;
14 | flex: 1;
15 | background: rgba(0, 0, 0, 0.05);
16 | border-radius: 2px;
17 | }
18 |
19 | &-synthetic {
20 | display: flex;
21 | position: absolute;
22 | left: 0;
23 | top: 0;
24 | height: 28px;
25 | line-height: 28px;
26 | padding-left: 14px;
27 | }
28 |
29 | &-synthetic-placeholder {
30 | font-size: 14px;
31 | color: #999;
32 | }
33 |
34 | &-synthetic-icon {
35 | height: 14px;
36 | width: 14px;
37 | display: inline-block;
38 | background-image: url(https://mdn.alipayobjects.com/huamei_eyzuti/afts/img/A*tLN6QrLj5zwAAAAAAAAAAAAADlPaAQ/original);
39 | background-size: contain;
40 | margin-right: 6px;
41 | vertical-align: -2px;
42 | }
43 |
44 | &-value {
45 | flex: 1;
46 | height: 28px;
47 | font-size: 14px;
48 | padding: 0 0 0 34px;
49 | background: transparent;
50 | box-sizing: border-box;
51 | }
52 |
53 | &-clear {
54 | position: relative;
55 | visibility: hidden;
56 | width: 28px;
57 | height: 28px;
58 | }
59 |
60 | // stylelint-disable selector-type-no-unknown
61 | &-clear icon {
62 | display: flex;
63 | height: 100%;
64 | justify-content: center;
65 | align-items: center;
66 | }
67 |
68 | &-clear-show {
69 | visibility: visible;
70 | }
71 |
72 | &-cancel {
73 | margin-right: -48px;
74 | opacity: 0;
75 | color: #108ee9;
76 | font-size: 16px;
77 | width: 64px;
78 | height: 28px;
79 | line-height: 28px;
80 | text-align: center;
81 | }
82 |
83 | &-anim {
84 | transition: margin-right 0.3s, opacity 0.3s;
85 | }
86 |
87 | &-repos {
88 | margin-right: 0;
89 | opacity: 1;
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/components/search-bar/index.md:
--------------------------------------------------------------------------------
1 | # SearchBar 搜索栏
2 |
3 | 搜索栏。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
11 | | ---- | ---- | ---- | ---- | ---- |
12 | | value | 搜索框的当前值 | String | | false |
13 | | placeholder | placeholder | String | | false |
14 | | focus | 自动获取光标 | Boolean | false | false |
15 | | onInput | 键盘输入时触发 | (value: String) => void | | false |
16 | | onClear | 点击 clear 图标触发 | (val: String) => void | | false |
17 | | onFocus | 获取焦点时触发 | () => void | | false |
18 | | onBlur | 失去焦点时触发 | () => void | | false |
19 | | onCancel | 点击取消时触发 | () => void | | false |
20 | | onSubmit | 点击键盘的 enter 时触发 | (val: String) => void | | false |
21 | | disabled | 设置禁用 | Boolean | | false |
22 | | maxLength | 最多允许输入的字符个数 | Number | | false |
23 | | showCancelButton | 是否一直显示取消按钮 | Boolean | | false |
24 |
25 | ## 示例
26 |
27 | ```json
28 | {
29 | "defaultTitle": "小程序AntUI组件库",
30 | "usingComponents": {
31 | "search-bar": "mini-antui/es/search-bar/index"
32 | }
33 | }
34 | ```
35 |
36 | ```html
37 |
38 |
48 |
49 | ```
50 |
51 | ```javascript
52 | Page({
53 | data: {
54 | value: '美食',
55 | },
56 | handleInput(value) {
57 | this.setData({
58 | value,
59 | });
60 | },
61 | handleClear(value) {
62 | this.setData({
63 | value: '',
64 | });
65 | },
66 | handleFocus() {},
67 | handleBlur() {},
68 | handleCancel() {
69 | this.setData({
70 | value: '',
71 | });
72 | },
73 | handleSubmit(value) {
74 | my.alert({
75 | content: value,
76 | });
77 | },
78 | });
79 | ```
80 |
--------------------------------------------------------------------------------
/components/stepper/index.axml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
19 |
20 |
--------------------------------------------------------------------------------
/components/stepper/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/steps/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/steps/index.md:
--------------------------------------------------------------------------------
1 | # steps 步骤进度条
2 |
3 | 根据步骤显示的进度条。
4 |
5 | 扫码体验:
6 |
7 |
8 |
9 |
10 | | 属性名 | 描述 | 类型 | 默认值 | 必选 |
11 | | ---- | ---- | ---- | ---- | ---- |
12 | | className | 最外层覆盖样式 | String | | false |
13 | | activeIndex | 当前激活步骤 | Number | 1 | true |
14 | | failIndex | 当前失败步骤(只在vertical模式下生效) | Number | 0 | false |
15 | | direction | 显示方向,可选值:`vertical`、`horizontal` | String | horizontal | false |
16 | | size | 统一的icon大小,单位为px | Number | 0 | false |
17 | | items | 步骤详情 | Array[{title, description, icon, activeIcon, size}] | [] | true |
18 |
19 | items属性详细描述
20 |
21 | | 属性名 | 描述 | 类型 | 默认值 | 必须 |
22 | | ---- | ---- | ---- | ---- | ---- |
23 | | items.title | 步骤详情标题 | String | | true |
24 | | items.description | 步骤详情描述 | String | | true |
25 | | items.icon | 尚未到达步骤的icon(只在vertical模式下生效) | String | | true |
26 | | items.activeIcon | 已到达步骤的icon(只在vertical模式下生效) | String | | true |
27 | | items.size | 已到达步骤icon的图标大小,单位为px(只在vertical模式下生效) | Number | | true |
28 |
29 |
30 | ## 示例
31 |
32 | ```json
33 | {
34 | "usingComponents": {
35 | "steps": "mini-antui/es/steps/index"
36 | }
37 | }
38 | ```
39 |
40 | ```html
41 |
45 | ```
46 |
47 | ```javascript
48 | Page({
49 | data: {
50 | activeIndex: 1,
51 | items: [{
52 | title: '步骤1',
53 | description: '这是步骤1',
54 | }, {
55 | title: '步骤2',
56 | description: '这是步骤2',
57 | }, {
58 | title: '步骤3',
59 | description: '这是步骤3',
60 | }]
61 | }
62 | });
63 | ```
--------------------------------------------------------------------------------
/components/steps/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | className: '',
4 | activeIndex: 1,
5 | failIndex: 0,
6 | size: 0,
7 | direction: 'horizontal',
8 | items: [],
9 | },
10 | });
11 |
12 |
--------------------------------------------------------------------------------
/components/style/mixins/hairline.less:
--------------------------------------------------------------------------------
1 | @import '../themes/default.less';
2 |
3 | .scale-hairline-common(@color, @top, @right, @bottom, @left) {
4 | content: '';
5 | position: absolute;
6 | background-color: @color;
7 | display: block;
8 | top: @top;
9 | right: @right;
10 | bottom: @bottom;
11 | left: @left;
12 | }
13 |
14 | .hairline(@direction, @color: @border-color-base) when (@direction = 'top') {
15 | &::before {
16 | .scale-hairline-common(@color, 0, 0, auto, 0);
17 | height: 1px;
18 | transform: scaleY(0.5);
19 | }
20 | }
21 |
22 | .hairline(@direction, @color: @border-color-base) when (@direction = 'right') {
23 | &::after {
24 | .scale-hairline-common(@color, 0, 0, 0, auto);
25 | width: 1px;
26 | transform: scaleX(0.5);
27 | }
28 | }
29 |
30 | .hairline(@direction, @color: @border-color-base) when (@direction = 'bottom') {
31 | &::after {
32 | .scale-hairline-common(@color, auto, 0, 0, 0);
33 | height: 1px;
34 | transform: scaleY(0.5);
35 | }
36 | }
37 |
38 | .hairline(@direction, @color: @border-color-base) when (@direction = 'left') {
39 | &::before {
40 | .scale-hairline-common(@color, 0, auto, 0, 0);
41 | width: 1px;
42 | transform: scaleX(0.5);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/components/style/themes/default.less:
--------------------------------------------------------------------------------
1 | // 文字色
2 | @color-text-base: #000; // 基本文字
3 | @color-link: @brand-primary; // 链接
4 | @color-text-title: #333; // 标题
5 | @color-text-caption: #999; // 副文本
6 | @color-text-dark: #ccc; // 暗文字
7 |
8 | // 全局/品牌色
9 | @brand-primary: #108ee9;
10 | @brand-error: #ff3b30; // 错误提示
11 | @brand-emphasis: #f24724; // 强调色
12 | @brand-gradient: #0a73cf; // 渐变品牌色
13 |
14 | // 背景色
15 | @fill-base: #fff;
16 | @fill-body: #f5f5f5; // 页面背景
17 | @fill-mask: rgba(0, 0, 0, 0.65); // 蒙层背景
18 |
19 | // 边框色
20 | @border-color-base: #eee;
21 |
22 | // 按钮
23 | @btn-primary: @brand-primary; // 主按钮色
24 | @btn-disabled: rgba(16, 142, 232, 0.6); // 按钮不可点击
25 | @btn-tap: #0b71ba; // 按钮按下
26 |
27 | // 字体大小
28 | @font-size-base: 12px; // 常规文本
29 | @font-size-caption: 14px; // 副文本
30 | @font-size-title-sm: 17px; // 控件中主操作标题
31 | @font-size-title-lg: 18px; // 需要强调标题
32 | @font-size-page-result: 20px; // 结果页标题、异常页面标题
33 | @font-size-amount: 48px; // 输入金额
34 |
35 | // 投影色
36 | @box-shadow-primary: #999; // 白色卡片投影
37 |
38 | // 圆角
39 | @radius-xs: 2px;
40 | @radius-sm: 3px;
41 | @radius-md: 4px;
42 | @radius-circle: 50%;
43 |
44 | // z-index
45 | @popover-zindex: 1999;
46 | @picker-zindex: 1000;
47 | @popup-zindex: 999;
48 | @modal-zindex: 999;
49 |
--------------------------------------------------------------------------------
/components/swipe-action/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/swipe-action/index.less:
--------------------------------------------------------------------------------
1 | .am-swipe {
2 | position: relative;
3 | overflow: hidden;
4 |
5 | &-content {
6 | position: relative;
7 | transition: all 250ms;
8 | }
9 |
10 | &-right {
11 | position: absolute;
12 | top: 0;
13 | bottom: 0;
14 | display: flex;
15 | right: 0;
16 | }
17 |
18 | &-btn {
19 | padding: 0 14px;
20 | justify-content: center;
21 | align-items: center;
22 | display: flex;
23 | color: #fff;
24 |
25 | &-delete {
26 | background-color: rgb(244, 51, 60);
27 | }
28 |
29 | &-edit {
30 | background-color: #108ee9;
31 | }
32 | }
33 | //=== v2 ===
34 | &-movable {
35 |
36 | &-area {
37 | position: absolute;
38 | }
39 |
40 | &-area .am-swipe-content {
41 | transition: none;
42 | }
43 | }
44 | }
45 |
46 | .am-swiping .am-swipe-content {
47 | transition: none;
48 | }
49 |
--------------------------------------------------------------------------------
/components/tabs/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "badge": "../badge/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/components/tabs/index.ts:
--------------------------------------------------------------------------------
1 | const { windowWidth } = my.getSystemInfoSync();
2 |
3 | Component({
4 | props: {
5 | className: '',
6 | activeCls: '',
7 | tabBarUnderlineColor: '#108ee9', // 选中选项卡下划线颜色
8 | tabBarActiveTextColor: '#108ee9', // 选中选项卡字体颜色
9 | tabBarInactiveTextColor: '#333333', // 未选中选项卡字体颜色
10 | tabBarBackgroundColor: '#ffffff', // 选项卡背景颜色
11 | showPlus: false,
12 | swipeable: true,
13 | activeTab: 0, // 当前激活tab
14 | animation: true,
15 | tabBarCls: '', // tabbar的自定义样式class
16 | duration: 500,
17 | },
18 | data: {
19 | windowWidth,
20 | tabWidth: 0.25,
21 | autoplay: false,
22 | animation: false,
23 | version: my.SDKVersion,
24 | _native: false,
25 | },
26 | didMount() {
27 | const { tabs, animation } = this.props;
28 | this.setData({
29 | _native: this.renderer === 'native',
30 | tabWidth: tabs.length > 3 ? 0.25 : 1 / tabs.length,
31 | animation,
32 | autoplay: true,
33 | });
34 | },
35 | didUpdate(prevProps) {
36 | const { tabs } = this.props;
37 | if (prevProps.tabs.length !== tabs.length) {
38 | this.setData({
39 | tabWidth: tabs.length > 3 ? 0.25 : 1 / tabs.length,
40 | });
41 | }
42 | },
43 | methods: {
44 | handleSwiperChange(e) {
45 | const { current } = e.detail;
46 |
47 | if (this.props.onChange) {
48 | this.props.onChange({ index: current });
49 | }
50 | },
51 | handleTabClick(e) {
52 | const { index } = e.target.dataset;
53 |
54 | if (this.props.onTabClick) {
55 | this.props.onTabClick({ index });
56 | }
57 | },
58 | handlePlusClick() {
59 | if (this.props.onPlusClick) {
60 | this.props.onPlusClick();
61 | }
62 | },
63 | },
64 | });
65 |
--------------------------------------------------------------------------------
/components/tabs/tab-content/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/components/tabs/tab-content/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
4 |
--------------------------------------------------------------------------------
/components/tabs/tab-content/index.less:
--------------------------------------------------------------------------------
1 | .am-tabs-pane-wrap {
2 | width: 100vw;
3 | height: auto;
4 | flex-shrink: 0;
5 | }
6 |
7 | .fix .am-tabs-pane-wrap {
8 | position: static;
9 | }
10 |
11 | .am-tabs-pane-wrap-swiper-item {
12 | position: absolute;
13 | top: 0;
14 | left: 0;
15 | }
16 |
--------------------------------------------------------------------------------
/components/tabs/tab-content/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | tabId: '',
4 | activeTab: '',
5 | },
6 | });
7 |
--------------------------------------------------------------------------------
/components/tabs/util.sjs:
--------------------------------------------------------------------------------
1 | function toIntArray(v) {
2 | const ret = [];
3 | const version = v.split('.');
4 |
5 | for (let i = 0; i < version.length; i++) {
6 | ret.push(parseInt(version[i], 10));
7 | }
8 |
9 | return ret;
10 | }
11 |
12 | const calcScrollLeft = (windowWidth, tabWidth, current) => {
13 | let scrollInit = current * windowWidth * tabWidth;
14 |
15 | if (current <= 2) {
16 | scrollInit = 0;
17 | } else {
18 | scrollInit = (current - 2) * windowWidth * tabWidth;
19 | }
20 |
21 | return scrollInit;
22 | };
23 |
24 | const compareVersion = (v) => {
25 | const targetVersion = toIntArray('1.10.0');
26 | const version = toIntArray(v);
27 | let ret = 0;
28 |
29 | for (let i = 0, n1, n2; i < version.length; i++) {
30 | n1 = targetVersion[i];
31 | n2 = version[i];
32 |
33 | if (n1 > n2) {
34 | ret = -1;
35 | break
36 | }
37 |
38 | if (n1 < n2) {
39 | ret = 1;
40 | break;
41 | }
42 | }
43 |
44 | return ret;
45 | }
46 |
47 | export default {
48 | calcScrollLeft,
49 | compareVersion,
50 | };
51 |
--------------------------------------------------------------------------------
/components/tips/tips-dialog/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/components/tips/tips-dialog/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/tips/tips-dialog/index.less:
--------------------------------------------------------------------------------
1 | @import '../../style/themes/default.less';
2 |
3 | .am-tips-dialog {
4 | position: relative;
5 | height: 55px;
6 | width: 100%;
7 | padding: 0 6px;
8 | box-sizing: border-box;
9 |
10 | &-wrap {
11 | display: flex;
12 | align-items: center;
13 | background: #2093E7;
14 | box-shadow: 0 3px 3px rgba(0, 127, 255, .24);
15 | border-radius: @radius-xs;
16 | padding: 0 24px 0 12px;
17 | height: 100%;
18 | }
19 |
20 | &-wrap::before {
21 | content: '';
22 | position: absolute;
23 | bottom: -5px;
24 | left: 40px;
25 | border-left: 10px solid transparent;
26 | border-right: 10px solid transparent;
27 | border-top: 10px solid rgb(32, 147, 231);
28 | }
29 |
30 | &-wrap &-rectangle {
31 | padding: 0 16px 0 6px;
32 | }
33 |
34 | &-wrap::before &-rectangle {
35 | display: none;
36 | }
37 |
38 | &-close {
39 | margin-left: 5px;
40 | margin-right: 11px;
41 | height: 20px;
42 | width: 20px;
43 | background-image: url(https://gw.alipayobjects.com/zos/rmsportal/YtkqfRVfNxhpKWnrJRUJ.png);
44 | background-size: 50%;
45 | background-position: center;
46 | background-repeat: no-repeat;
47 | }
48 |
49 | &-icon {
50 | height: 35px;
51 | width: 35px;
52 | background-color: #fff;
53 | border-radius: @radius-xs;
54 | margin-right: 9px;
55 | }
56 |
57 | &-icon image {
58 | width: 35px;
59 | height: 35px;
60 | }
61 |
62 | &-content {
63 | flex: 1;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/components/tips/tips-dialog/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | props: {
3 | show: true,
4 | className: '',
5 | type: 'dialog',
6 | },
7 | methods: {
8 | onCloseTap() {
9 | const { onCloseTap } = this.props;
10 |
11 | if (onCloseTap) {
12 | onCloseTap();
13 | }
14 | },
15 | },
16 | });
17 |
--------------------------------------------------------------------------------
/components/tips/tips-plain/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/components/tips/tips-plain/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/tips/tips-plain/index.less:
--------------------------------------------------------------------------------
1 | @import '../../style/themes/default.less';
2 |
3 | .am-tips-plain-favorite {
4 | position: fixed;
5 | bottom: 10px;
6 | padding: 7px 10px;
7 | box-sizing: border-box;
8 | font-size: @font-size-base;
9 |
10 | &-wrap {
11 | position: relative;
12 | background: #2093E7;
13 | box-shadow: 0 3px 3px rgba(0, 127, 255, .24);
14 | border-radius: @radius-xs;
15 | color: #fff;
16 | padding: 10px;
17 | min-height: 10px;
18 | }
19 |
20 | &-content {
21 | line-height: @font-size-base;
22 | overflow: hidden;
23 | height: @font-size-base;
24 | }
25 |
26 | &-action:active {
27 | background: #0B71BA;
28 | }
29 |
30 | &-wrap::before {
31 | content: '';
32 | position: absolute;
33 | bottom: -5px;
34 | left: 50%;
35 | margin-left: -10px;
36 | border-left: 10px solid transparent;
37 | border-right: 10px solid transparent;
38 | border-top: 10px solid #2093E7;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/components/tips/tips-plain/index.ts:
--------------------------------------------------------------------------------
1 | Component({
2 | data: {
3 | show: true
4 | },
5 | props: {
6 | className: '',
7 | time: 5000,
8 | onClose: () => {}
9 | },
10 | didMount() {
11 | let { show } = this.data;
12 | let { time } = this.props;
13 | setTimeout(() => {
14 | this.setData({
15 | show: false
16 | });
17 | }, time);
18 | },
19 | methods: {
20 | onClose() {
21 | this.setData({
22 | show: false
23 | });
24 | this.props.onClose();
25 | }
26 | }
27 | });
--------------------------------------------------------------------------------
/components/vtabs/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
23 |
24 | {{item.title}}
25 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/components/vtabs/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true,
3 | "usingComponents": {
4 | "badge": "../badge/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/components/vtabs/index.less:
--------------------------------------------------------------------------------
1 | .am-vtabs {
2 | width: 100vw;
3 | height: 100vh;
4 | display: flex;
5 | flex-direction: row;
6 |
7 | &-bar {
8 | width: 110px;
9 | overflow: hidden;
10 | }
11 |
12 | &-bar-content {
13 | height: 100%;
14 | width: 120px;
15 | }
16 |
17 | &-bar-tab {
18 | box-sizing: border-box;
19 | height: 55px;
20 | width: 110px;
21 | text-align: center;
22 | line-height: 55px;
23 | font-size: 14px;
24 | border-left-width: 4px;
25 | border-left-style: solid;
26 | border-left-color: transparent;
27 | border-right-width: 4px;
28 | border-right-style: solid;
29 | border-right-color: transparent;
30 | white-space: nowrap;
31 | overflow: hidden;
32 | }
33 |
34 | &-bar-title {
35 | position: relative;
36 | display: inline-block;
37 | }
38 |
39 | &-bar-badge.dot {
40 | position: absolute;
41 | top: 11px;
42 | right: 0;
43 | transform: translateX(8px);
44 | }
45 |
46 | &-bar-badge.text {
47 | position: absolute;
48 | top: 8px;
49 | right: 2px;
50 | transform: translateX(100%);
51 | }
52 |
53 | &-content-wrap {
54 | overflow: hidden;
55 | flex: 1;
56 | height: 100%;
57 | background-color: #fff;
58 | }
59 |
60 | &-slides {
61 | height: 100%;
62 | }
63 |
64 | &-slides.animate {
65 | transition-duration: 500ms;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/components/vtabs/vtab-content/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/components/vtabs/vtab-content/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/components/vtabs/vtab-content/index.ts:
--------------------------------------------------------------------------------
1 | Component({});
2 |
--------------------------------------------------------------------------------
/examples/app.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/app.acss
--------------------------------------------------------------------------------
/examples/app.js:
--------------------------------------------------------------------------------
1 | App({
2 | onLaunch() {},
3 | onShow() {},
4 | onHide() {},
5 | });
6 |
--------------------------------------------------------------------------------
/examples/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/list/app",
4 | "pages/list/index",
5 | "pages/amount-input/index",
6 | "pages/am-icon/index",
7 | "pages/picker-item/index",
8 | "pages/input-item/index",
9 | "pages/badge/index",
10 | "pages/card/index",
11 | "pages/calendar/index",
12 | "pages/am-checkbox/index",
13 | "pages/face-detection/index",
14 | "pages/footer/index",
15 | "pages/modal/index",
16 | "pages/swipe-action/index",
17 | "pages/tabs/index",
18 | "pages/vtabs/index",
19 | "pages/stepper/index",
20 | "pages/steps/index",
21 | "pages/popover/index",
22 | "pages/grid/index",
23 | "pages/tips/index",
24 | "pages/tips/1/index",
25 | "pages/tips/2/index",
26 | "pages/grid/2/index",
27 | "pages/grid/3/index",
28 | "pages/grid/4/index",
29 | "pages/grid/5/index",
30 | "pages/notice/index",
31 | "pages/filter/index",
32 | "pages/filter/single/index",
33 | "pages/filter/alternative/index",
34 | "pages/flex/index",
35 | "pages/search-bar/index",
36 | "pages/page-result/index",
37 | "pages/page-result/network/index",
38 | "pages/page-result/local-network/index",
39 | "pages/page-result/busy/index",
40 | "pages/page-result/local-busy/index",
41 | "pages/page-result/error/index",
42 | "pages/page-result/local-error/index",
43 | "pages/page-result/log-off/index",
44 | "pages/page-result/local-logoff/index",
45 | "pages/page-result/empty/index",
46 | "pages/page-result/local-empty/index",
47 | "pages/popup/index",
48 | "pages/message/index",
49 | "pages/message/success/index",
50 | "pages/message/fail/index",
51 | "pages/message/info/index",
52 | "pages/message/waiting/index",
53 | "pages/message/warn/index",
54 | "pages/pagination/index",
55 | "pages/collapse/index"
56 | ],
57 | "window": {
58 | "enableWK": "YES",
59 | "enableDSL": "YES",
60 | "enableJSC": "YES",
61 | "defaultTitle": "小程序版AntUI",
62 | "backgroundColor": "#F5F5F9",
63 | "pullRefresh": false,
64 | "allowsBounceVertical": true
65 | },
66 | "debug": true
67 | }
68 |
--------------------------------------------------------------------------------
/examples/pages/am-checkbox/index.acss:
--------------------------------------------------------------------------------
1 | /* required by usingComponents */
--------------------------------------------------------------------------------
/examples/pages/am-checkbox/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 列表+复选框
4 |
5 |
6 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 协议
23 |
24 |
25 |
29 |
30 |
31 |
32 |
48 |
49 |
--------------------------------------------------------------------------------
/examples/pages/am-checkbox/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | items: [
4 | { checked: true, disabled: false, value: 'a', title: '复选框-默认选中', id: 'checkbox1' },
5 | { checked: false, disabled: false, value: 'b', title: '复选框-默认未选中', id: 'checkbox2' },
6 | { checked: true, disabled: true, value: 'c', title: '复选框-默认选中disabled', id: 'checkbox3' },
7 | { checked: false, disabled: true, value: 'd', title: '复选框-默认未选中disabled', id: 'checkbox4' },
8 | ],
9 | items2: [
10 | { name: 'react', value: 'React', checked: true },
11 | { name: 'vue', value: 'Vue.js' },
12 | { name: 'ember', value: 'Ember.js' },
13 | { name: 'backbone', value: 'Backbone.js', disabled: true },
14 | ],
15 | },
16 | onSubmit(e) {
17 | my.alert({
18 | content: `你选择的框架是 ${e.detail.value.libs.join(', ')}`,
19 | });
20 | },
21 | onReset() {},
22 | onChange() {},
23 | });
24 |
--------------------------------------------------------------------------------
/examples/pages/am-checkbox/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "am-checkbox": "../../es/am-checkbox/index",
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/pages/am-icon/index.acss:
--------------------------------------------------------------------------------
1 | .icon-title {
2 | margin-top: 20px;
3 | margin-bottom: 10px;
4 | margin-left: 10px;
5 | color: #333;
6 | font-size: 16px;
7 | }
8 |
9 | .icon-list {
10 | background: #fff;
11 | }
12 |
13 | .icon-item {
14 | display: inline-flex;
15 | width: 33.33333%;
16 | height: 80px;
17 | align-items: center;
18 | flex-direction: column;
19 | justify-content: center;
20 | }
21 |
22 | .icon-desc {
23 | margin-top: 10px;
24 | }
25 |
--------------------------------------------------------------------------------
/examples/pages/am-icon/index.axml:
--------------------------------------------------------------------------------
1 |
2 | 基础
3 |
4 |
5 |
6 |
7 | {{item}}
8 |
9 |
10 |
11 | 描边风格
12 |
13 |
14 |
15 |
16 | {{item}}
17 |
18 |
19 |
20 | 实心风格
21 |
22 |
23 |
24 |
25 | {{item}}
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/examples/pages/am-icon/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | basicTypes: [
4 | 'arrow-left',
5 | 'arrow-up',
6 | 'arrow-right',
7 | 'arrow-down',
8 | 'cross',
9 | 'plus',
10 | ],
11 | strokeTypes: [
12 | 'close-o',
13 | 'dislike-o',
14 | 'heart-o',
15 | 'help-o',
16 | 'like-o',
17 | 'location-o',
18 | 'info-o',
19 | 'success-o',
20 | 'wait-o',
21 | 'warning-o',
22 | 'star-o',
23 | 'download',
24 | 'friends',
25 | 'circle',
26 | 'delete',
27 | 'charge',
28 | 'card',
29 | 'notice',
30 | 'qrcode',
31 | 'reload',
32 | 'scan',
33 | 'money',
34 | 'search',
35 | 'setting',
36 | 'share',
37 | 'zoom-in',
38 | 'zoom-out',
39 | ],
40 | solidTypes: [
41 | 'close',
42 | 'dislike',
43 | 'heart',
44 | 'help',
45 | 'like',
46 | 'location',
47 | 'info',
48 | 'success',
49 | 'wait',
50 | 'warning',
51 | 'star',
52 | ],
53 | },
54 | });
55 |
--------------------------------------------------------------------------------
/examples/pages/am-icon/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "am-icon": "../../es/am-icon/index"
4 | }
5 | }
--------------------------------------------------------------------------------
/examples/pages/amount-input/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/amount-input/index.acss
--------------------------------------------------------------------------------
/examples/pages/amount-input/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
--------------------------------------------------------------------------------
/examples/pages/amount-input/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | value: 200,
4 | },
5 | onInputClear() {
6 | this.setData({
7 | value: '',
8 | });
9 | },
10 | onInputConfirm(e) {
11 | console.log(e);
12 | my.alert({
13 | content: 'confirmed',
14 | });
15 | },
16 | onInput(e) {
17 | console.log(e);
18 | const { value } = e.detail;
19 | this.setData({
20 | value,
21 | });
22 | },
23 | onButtonClick() {
24 | my.alert({
25 | content: 'button clicked',
26 | });
27 | },
28 | onInputFocus(e) {
29 | console.log(e);
30 | },
31 | onInputBlur(e) {
32 | console.log(e);
33 | },
34 | });
35 |
--------------------------------------------------------------------------------
/examples/pages/amount-input/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "amount-input",
3 | "usingComponents":{
4 | "amount-input": "../../es/amount-input/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/badge/index.acss:
--------------------------------------------------------------------------------
1 | /* required by usingComponents */
--------------------------------------------------------------------------------
/examples/pages/badge/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
14 | {{item.intro}}
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/pages/badge/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | items: [
4 | {
5 | dot: true,
6 | text: '',
7 | isWrap: true,
8 | intro: 'Dot Badge',
9 | },
10 | {
11 | dot: false,
12 | text: 1,
13 | isWrap: true,
14 | intro: 'Text Badge',
15 | },
16 | {
17 | dot: false,
18 | text: 99,
19 | isWrap: false,
20 | intro: '数字',
21 | },
22 | {
23 | dot: false,
24 | text: 100,
25 | overflowCount: 99,
26 | isWrap: false,
27 | intro: '数字超过overflowCount',
28 | },
29 | {
30 | dot: false,
31 | text: 'new',
32 | isWrap: false,
33 | intro: '文字',
34 | },
35 | {
36 | dot: false,
37 | text: '新',
38 | isWrap: false,
39 | intro: '中文',
40 | },
41 | ],
42 | },
43 | });
44 |
--------------------------------------------------------------------------------
/examples/pages/badge/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "徽标",
3 | "usingComponents": {
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index",
6 | "badge": "../../es/badge/index"
7 | }
8 | }
--------------------------------------------------------------------------------
/examples/pages/calendar/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/calendar/index.acss
--------------------------------------------------------------------------------
/examples/pages/calendar/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/pages/calendar/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | tagData: [
4 | { date: '2019-09-14', tag: '还房贷', tagColor: 5 },
5 | { date: '2019-09-28', tag: '公积金', tagColor: 2 },
6 | { date: '2019-09-18', tag: 'xx', disable: true },
7 | ],
8 | },
9 | handleSelect() {},
10 | onMonthChange() {},
11 | onYearChange() {},
12 | onSelectHasDisableDate() {
13 | my.alert({
14 | content: 'SelectHasDisableDate',
15 | });
16 | },
17 | });
18 |
--------------------------------------------------------------------------------
/examples/pages/calendar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Calendar",
3 | "usingComponents":{
4 | "calendar":"../../es/calendar/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/card/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/card/index.acss
--------------------------------------------------------------------------------
/examples/pages/card/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
26 |
27 |
--------------------------------------------------------------------------------
/examples/pages/card/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | thumb: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
4 | footerImg: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
5 | },
6 | onCardClick(ev) {
7 | my.showToast({
8 | content: ev.info,
9 | });
10 | },
11 | });
12 |
--------------------------------------------------------------------------------
/examples/pages/card/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Card",
3 | "usingComponents":{
4 | "card":"../../es/card/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/collapse/index.acss:
--------------------------------------------------------------------------------
1 | .item-content {
2 | padding: 14px 16px;
3 | font-size: 17px;
4 | color: #333;
5 | line-height: 24px;
6 | }
7 |
8 | .content1 {
9 | height: 200px;
10 | }
11 |
12 | .content2 {
13 | height: 50px;
14 | }
15 |
16 | .content3 {
17 | height: 100px;
18 | }
19 |
20 | .demo-title {
21 | padding: 14px 16px;
22 | color: #999;
23 | }
24 |
25 | .demo-collapse {
26 | border-bottom: 1px solid #eee;
27 | }
--------------------------------------------------------------------------------
/examples/pages/collapse/index.axml:
--------------------------------------------------------------------------------
1 |
2 | 基础用法
3 |
9 |
10 |
11 | 内容区域
12 |
13 |
14 |
15 |
16 | 内容区域
17 |
18 |
19 |
20 |
21 | 内容区域
22 |
23 |
24 |
25 | 手风琴模式
26 |
33 |
34 |
35 | 内容区域
36 |
37 |
38 |
39 |
40 | 内容区域
41 |
42 |
43 |
44 |
45 | 内容区域
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/examples/pages/collapse/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/collapse/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Collapse",
3 | "usingComponents": {
4 | "collapse": "../../es/collapse/index",
5 | "collapse-item": "../../es/collapse/collapse-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/pages/face-detection/index.acss:
--------------------------------------------------------------------------------
1 | /* required by usingComponents */
--------------------------------------------------------------------------------
/examples/pages/face-detection/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/examples/pages/face-detection/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | onFaceStatusChange(data, context) {
3 | console.log('data', data);
4 | return new Promise((resolve, reject) => {
5 | context.doLeftFaceCheck().then((leftImageBase64) => {
6 | console.log(leftImageBase64);
7 | context.doRightFaceCheck().then((rightImageBase64) => {
8 | console.log(rightImageBase64);
9 | resolve();
10 | }).catch(() => {
11 | reject();
12 | });
13 | }).catch(() => {
14 | reject();
15 | });
16 | });
17 | },
18 | onFail(error) {
19 | console.log('error', error);
20 | },
21 | onSuccessBtnTap() {
22 | my.alert({
23 | content: 'success',
24 | });
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/examples/pages/face-detection/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "人脸检测",
3 | "usingComponents": {
4 | "face-detection": "../../es/face-detection/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/examples/pages/filter/alternative/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/filter/alternative/index.acss
--------------------------------------------------------------------------------
/examples/pages/filter/alternative/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/pages/filter/alternative/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | show: true,
4 | items: [
5 | { id: 1, value: '衣服', selected: true },
6 | { id: 1, value: '橱柜' },
7 | { id: 1, value: '衣架' },
8 | { id: 3, value: '数码产品' },
9 | { id: 4, value: '防盗门' },
10 | { id: 5, value: '椅子' },
11 | { id: 7, value: '显示器' },
12 | { id: 6, value: '某最新款电子产品' },
13 | { id: 8, value: '某某某某某牌电视游戏底座' },
14 | ],
15 | },
16 | handleCallBack(data) {
17 | my.alert({
18 | content: data,
19 | });
20 | },
21 | toggleFilter() {
22 | this.setData({
23 | show: !this.data.show,
24 | });
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/examples/pages/filter/alternative/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "多选",
3 | "usingComponents": {
4 | "filter": "../../../es/filter/index",
5 | "filter-item": "../../../es/filter/filter-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/pages/filter/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/filter/index.acss
--------------------------------------------------------------------------------
/examples/pages/filter/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 单选
5 |
6 |
7 | 多选
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/pages/filter/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/filter/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "筛选",
3 | "usingComponents": {
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/pages/filter/single/index.acss:
--------------------------------------------------------------------------------
1 | /* required by usingComponents */
--------------------------------------------------------------------------------
/examples/pages/filter/single/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/pages/filter/single/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | show: true,
4 | items: [
5 | { id: 1, value: '衣服', selected: true },
6 | { id: 1, value: '橱柜' },
7 | { id: 1, value: '衣架' },
8 | { id: 3, value: '数码产品' },
9 | { id: 4, value: '防盗门' },
10 | { id: 5, value: '椅子' },
11 | { id: 7, value: '显示器' },
12 | { id: 6, value: '某最新款电子产品' },
13 | { id: 8, value: '某某某某某牌电视游戏底座' },
14 | ],
15 | },
16 | handleCallBack(data) {
17 | my.alert({
18 | content: data,
19 | });
20 | },
21 | toggleFilter() {
22 | this.setData({
23 | show: !this.data.show,
24 | });
25 | },
26 | });
27 |
--------------------------------------------------------------------------------
/examples/pages/filter/single/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "单选",
3 | "usingComponents": {
4 | "filter": "../../../es/filter/index",
5 | "filter-item": "../../../es/filter/filter-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/pages/flex/index.acss:
--------------------------------------------------------------------------------
1 | .flex-container {
2 | padding: 10px;
3 | }
4 |
5 | .sub-title {
6 | color: #888;
7 | font-size: 14px;
8 | padding: 30px 0 18px 0;
9 | }
10 |
11 | .placeholder {
12 | background-color: #ebebef;
13 | color: #bbb;
14 | text-align: center;
15 | height: 30px;
16 | line-height: 30px;
17 | width: 100%;
18 | }
19 |
20 | .placeholder.inline {
21 | width: 80px;
22 | margin: 9px 9px 9px 0;
23 | }
24 |
25 | .placeholder.small {
26 | height: 20px;
27 | line-height: 20px
28 | }
--------------------------------------------------------------------------------
/examples/pages/flex/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/flex/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "flex": "../../es/flex/index",
4 | "flex-item": "../../es/flex/flex-item/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/examples/pages/footer/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/footer/index.acss
--------------------------------------------------------------------------------
/examples/pages/footer/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
9 |
10 |
13 |
14 |
16 |
--------------------------------------------------------------------------------
/examples/pages/footer/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | copyright: '© 2004-2017 Alipay.com. All rights reserved.',
4 | links: [
5 | { text: '底部链接', url: '../../list/demo/index' },
6 | { text: '底部链接', url: '../../card/demo/index' },
7 | ],
8 | singleLink: [
9 | { text: '底部链接', url: '../../list/demo/index' },
10 | ],
11 | },
12 | });
13 |
--------------------------------------------------------------------------------
/examples/pages/footer/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "footer": "../../es/footer/index"
4 | }
5 | }
--------------------------------------------------------------------------------
/examples/pages/grid/2/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/grid/2/index.acss
--------------------------------------------------------------------------------
/examples/pages/grid/2/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{props.item.text}}
9 | {{props.item.desc}}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/examples/pages/grid/2/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | list1: [
4 | {
5 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
6 | text: '标题文字',
7 | desc: '描述文字最多一行',
8 | },
9 | {
10 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
11 | text: '标题文字',
12 | desc: '描述文字最多一行',
13 | },
14 | {
15 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
16 | text: '标题文字',
17 | desc: '描述文字最多一行',
18 | },
19 | {
20 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
21 | text: '标题文字',
22 | desc: '描述文字最多一行',
23 | },
24 | {
25 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
26 | text: '标题文字',
27 | desc: '描述文字最多一行',
28 | },
29 | ],
30 | list2: [
31 | {
32 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
33 | text: '标题文字',
34 | },
35 | {
36 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
37 | text: '标题文字',
38 | },
39 | {
40 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
41 | text: '标题文字',
42 | },
43 | {
44 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
45 | text: '标题文字',
46 | },
47 | {
48 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
49 | text: '标题文字',
50 | },
51 | ],
52 | },
53 | onItemClick(ev) {
54 | my.alert({
55 | content: ev.detail.index,
56 | });
57 | },
58 | });
59 |
--------------------------------------------------------------------------------
/examples/pages/grid/2/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "2列宫格",
3 | "usingComponents":{
4 | "grid":"../../../es/grid/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/grid/3/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/grid/3/index.acss
--------------------------------------------------------------------------------
/examples/pages/grid/3/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/examples/pages/grid/3/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "3列宫格",
3 | "usingComponents":{
4 | "grid":"../../../es/grid/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/grid/4/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/grid/4/index.acss
--------------------------------------------------------------------------------
/examples/pages/grid/4/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/pages/grid/4/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "4列宫格",
3 | "usingComponents":{
4 | "grid":"../../../es/grid/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/grid/5/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/grid/5/index.acss
--------------------------------------------------------------------------------
/examples/pages/grid/5/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/examples/pages/grid/5/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | list5: [
4 | {
5 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
6 | text: '标题文字',
7 | },
8 | {
9 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
10 | text: '标题文字',
11 | },
12 | {
13 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
14 | text: '标题文字',
15 | },
16 | {
17 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
18 | text: '标题文字',
19 | },
20 | {
21 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
22 | text: '标题文字',
23 | },
24 | {
25 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
26 | text: '标题文字',
27 | },
28 | {
29 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
30 | text: '标题文字',
31 | },
32 | {
33 | icon: 'https://gw.alipayobjects.com/zos/rmsportal/VBqNBOiGYkCjqocXjdUj.png',
34 | text: '标题文字',
35 | },
36 | ],
37 | },
38 | onItemClick(ev) {
39 | my.alert({
40 | content: ev.detail.index,
41 | });
42 | },
43 | });
44 |
--------------------------------------------------------------------------------
/examples/pages/grid/5/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "5列宫格",
3 | "usingComponents":{
4 | "grid":"../../../es/grid/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/grid/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/grid/index.acss
--------------------------------------------------------------------------------
/examples/pages/grid/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2列宫格
5 |
6 |
7 | 3列宫格
8 |
9 |
10 | 4列宫格
11 |
12 |
13 | 5列宫格
14 |
15 |
16 |
--------------------------------------------------------------------------------
/examples/pages/grid/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/grid/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "宫格",
3 | "usingComponents":{
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index",
6 | "grid":"../../es/grid/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/examples/pages/input-item/index.acss:
--------------------------------------------------------------------------------
1 | .extra {
2 | background-image: url('https://gw.alipayobjects.com/zos/rmsportal/dOfSJfWQvYdvsZiJStvg.svg');
3 | background-size: contain;
4 | background-repeat: no-repeat;
5 | background-position: right center;
6 | opacity: 0.2;
7 | height: 20px;
8 | width: 20px;
9 | padding-left: 10px;
10 | }
--------------------------------------------------------------------------------
/examples/pages/input-item/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 | 卡号
18 |
19 |
20 |
26 | 发卡银行
27 |
28 |
37 | 姓名
38 |
39 |
44 | 密码
45 |
46 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/examples/pages/input-item/index.js:
--------------------------------------------------------------------------------
1 | const banks = ['网商银行', '建设银行', '工商银行', '浦发银行'];
2 |
3 | Page({
4 | data: {
5 | cardNo: '1234****',
6 | inputFocus: true,
7 | bank: '',
8 | name: '',
9 | },
10 | onAutoFocus() {
11 | this.setData({
12 | inputFocus: true,
13 | });
14 | },
15 | onExtraTap() {
16 | my.alert({
17 | content: 'extra tapped',
18 | });
19 | },
20 | onItemInput(e) {
21 | this.setData({
22 | [e.target.dataset.field]: e.detail.value,
23 | });
24 | },
25 | onItemFocus() {
26 | this.setData({
27 | inputFocus: false,
28 | });
29 | },
30 | onItemBlur() {},
31 | onItemConfirm() {},
32 | onClear(e) {
33 | this.setData({
34 | [e.target.dataset.field]: '',
35 | });
36 | },
37 | onPickerTap() {
38 | my.showActionSheet({
39 | title: '选择发卡银行',
40 | items: banks,
41 | success: (res) => {
42 | this.setData({
43 | bank: banks[res.index],
44 | });
45 | },
46 | });
47 | },
48 | });
49 |
--------------------------------------------------------------------------------
/examples/pages/input-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "input-item",
3 | "usingComponents":{
4 | "list": "../../es/list/index",
5 | "input-item": "../../es/input-item/index",
6 | "picker-item": "../../es/picker-item/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/examples/pages/list/app.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/list/app.acss
--------------------------------------------------------------------------------
/examples/pages/list/app.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{item.name}}
6 | {{item.nameZN}}
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/pages/list/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "小程序AntUI组件库",
3 | "usingComponents":{
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/pages/list/index.acss:
--------------------------------------------------------------------------------
1 | .dyt-list {
2 | margin-top: 0;
3 | }
4 | .dyt-list .am-list-item-thumb {
5 | border-radius: 5px;
6 | }
7 | .dyt-list .am-list-brief {
8 | color: #909090;
9 | }
10 |
11 | .dyt-list .am-list-extra {
12 | color: #000;
13 | }
14 |
15 | .am-list-sticky {
16 | position: sticky;
17 | top: 0;
18 | z-index: 2;
19 | }
--------------------------------------------------------------------------------
/examples/pages/list/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "List",
3 | "usingComponents":{
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/pages/message/fail/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/message/fail/index.acss
--------------------------------------------------------------------------------
/examples/pages/message/fail/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/examples/pages/message/fail/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | title: '无法完成操作',
4 | messageButton: {
5 | mainButton: {
6 | buttonText: '返回首页',
7 | },
8 | subButton: {
9 | buttonText: 'DO NOTHING',
10 | },
11 | },
12 | },
13 | goBack() {
14 | my.navigateBack();
15 | },
16 | doNothing() {
17 | my.alert({
18 | title: 'do nothing',
19 | });
20 | },
21 | });
22 |
--------------------------------------------------------------------------------
/examples/pages/message/fail/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "信息状态-失败",
3 | "usingComponents": {
4 | "message": "../../../es/message/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/message/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/message/index.acss
--------------------------------------------------------------------------------
/examples/pages/message/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 | success状态(默认)
4 |
5 |
6 | fail状态
7 |
8 |
9 | info状态
10 |
11 |
12 | warn状态
13 |
14 |
15 | waiting状态
16 |
17 |
18 |
--------------------------------------------------------------------------------
/examples/pages/message/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/message/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "信息状态",
3 | "usingComponents": {
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/pages/message/info/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/message/info/index.acss
--------------------------------------------------------------------------------
/examples/pages/message/info/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/examples/pages/message/info/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | title: '提示信息',
4 | messageButton: {
5 | mainButton: {
6 | buttonText: '返回首页',
7 | },
8 | subButton: {
9 | buttonText: 'DO NOTHING',
10 | },
11 | },
12 | },
13 | goBack() {
14 | my.navigateBack();
15 | },
16 | });
17 |
--------------------------------------------------------------------------------
/examples/pages/message/info/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "信息状态-提示",
3 | "usingComponents": {
4 | "message": "../../../es/message/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/message/success/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/message/success/index.acss
--------------------------------------------------------------------------------
/examples/pages/message/success/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/examples/pages/message/success/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | title: '操作成功',
4 | subTitle: '内容详情可折行,建议不超过两行',
5 | messageButton: {
6 | mainButton: {
7 | buttonText: '主要操作',
8 | },
9 | subButton: {
10 | buttonText: '辅助操作',
11 | },
12 | },
13 | },
14 | goBack() {
15 | my.navigateBack();
16 | },
17 | });
18 |
--------------------------------------------------------------------------------
/examples/pages/message/success/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "信息状态-成功",
3 | "usingComponents": {
4 | "message": "../../../es/message/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/message/waiting/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/message/waiting/index.acss
--------------------------------------------------------------------------------
/examples/pages/message/waiting/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/pages/message/waiting/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | title: '等待中',
4 | messageButton: {
5 | mainButton: {
6 | buttonText: '返回首页',
7 | },
8 | subButton: {
9 | buttonText: 'DO NOTHING',
10 | },
11 | },
12 | },
13 | goBack() {
14 | my.navigateBack();
15 | },
16 | });
17 |
--------------------------------------------------------------------------------
/examples/pages/message/waiting/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "信息状态-等待",
3 | "usingComponents": {
4 | "message": "../../../es/message/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/examples/pages/message/warn/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/message/warn/index.acss
--------------------------------------------------------------------------------
/examples/pages/message/warn/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/pages/message/warn/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | title: '警告',
4 | messageButton: {
5 | mainButton: {
6 | buttonText: '返回首页',
7 | },
8 | subButton: {
9 | buttonText: 'DO NOTHING',
10 | },
11 | },
12 | },
13 | goBack() {
14 | my.navigateBack();
15 | },
16 | });
17 |
--------------------------------------------------------------------------------
/examples/pages/message/warn/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "信息状态-警告",
3 | "usingComponents": {
4 | "message": "../../../es/message/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/modal/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/modal/index.acss
--------------------------------------------------------------------------------
/examples/pages/modal/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | modalOpened: false,
4 | modalOpened2: false,
5 | modalOpened21: false,
6 | modalOpened22: false,
7 | modalOpened3: false,
8 | modalOpened4: false,
9 | },
10 | openModal() {
11 | this.setData({
12 | modalOpened: true,
13 | });
14 | },
15 | onModalClick() {
16 | this.setData({
17 | modalOpened: false,
18 | });
19 | },
20 | onModalClose() {
21 | this.setData({
22 | modalOpened: false,
23 | });
24 | },
25 | openModal2() {
26 | this.setData({
27 | modalOpened2: true,
28 | });
29 | },
30 | onModalClick2() {
31 | this.setData({
32 | modalOpened2: false,
33 | });
34 | },
35 | onModalClose2() {
36 | this.setData({
37 | modalOpened2: false,
38 | });
39 | },
40 | openModal21() {
41 | this.setData({
42 | modalOpened21: true,
43 | });
44 | },
45 | onModalClick21() {
46 | this.setData({
47 | modalOpened21: false,
48 | });
49 | },
50 | onModalClose21() {
51 | this.setData({
52 | modalOpened21: false,
53 | });
54 | },
55 | openModal22() {
56 | this.setData({
57 | modalOpened22: true,
58 | });
59 | },
60 | onModalClick22() {
61 | this.setData({
62 | modalOpened22: false,
63 | });
64 | },
65 | onModalClose22() {
66 | this.setData({
67 | modalOpened22: false,
68 | });
69 | },
70 | openModal3() {
71 | this.setData({
72 | modalOpened3: true,
73 | });
74 | },
75 | onModalClick3() {
76 | this.setData({
77 | modalOpened3: false,
78 | });
79 | },
80 | openModal4() {
81 | this.setData({
82 | modalOpened4: true,
83 | });
84 | },
85 | onModalClick4() {
86 | this.setData({
87 | modalOpened4: false,
88 | });
89 | },
90 | });
91 |
--------------------------------------------------------------------------------
/examples/pages/modal/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Modal",
3 | "usingComponents":{
4 | "modal": "../../es/modal/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/notice/index.acss:
--------------------------------------------------------------------------------
1 | .demo-title {
2 | font-size: 15px;
3 | font-weight: 500;
4 | padding: 10px 5px;
5 | border-bottom: 1px solid #ccc;
6 | }
7 | .demo-item {
8 | margin-bottom: 10px;
9 | }
10 |
11 | .nomore-notice {
12 | color: #999;
13 | }
--------------------------------------------------------------------------------
/examples/pages/notice/index.axml:
--------------------------------------------------------------------------------
1 | NoticeBar 通告栏
2 |
3 |
6 | Notice: The arrival time of incomes and transfers of Yu 'E Bao will be delayed during National Day.
7 |
8 |
9 |
10 |
14 | 因全国公民身份系统升级,添加银行卡银行卡银行卡银行卡
15 |
16 |
17 |
18 |
22 | 因全国公民身份系统升级,添加银行卡银行卡银行卡银行卡
23 |
24 |
25 |
26 |
30 | 因全国公民身份系统升级,添加银行卡银行卡银行卡银行卡
31 |
32 |
33 |
34 |
40 | 因全国公民身份系统升级,添加银行卡银行卡银行卡银行卡
41 |
42 |
--------------------------------------------------------------------------------
/examples/pages/notice/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | closeShow: true,
4 | closeActionShow: true,
5 | marqueeProps: {
6 | loop: true,
7 | leading: 1000,
8 | trailing: 800,
9 | fps: 40,
10 | },
11 | },
12 | linkClick() {
13 | my.showToast({
14 | content: '你点击了图标Link NoticeBar',
15 | duration: 3000,
16 | });
17 | },
18 | closableClick() {
19 | this.setData({
20 | closeShow: false,
21 | });
22 | my.showToast({
23 | content: '你点击了图标close NoticeBar',
24 | duration: 3000,
25 | });
26 | },
27 | linkActionClick() {
28 | my.showToast({
29 | content: '你点击了文本Link NoticeBar',
30 | duration: 3000,
31 | });
32 | },
33 | closableActionClick() {
34 | this.setData({
35 | closeActionShow: false,
36 | });
37 | my.showToast({
38 | content: '你点击了文本close NoticeBar',
39 | duration: 3000,
40 | });
41 | },
42 | });
43 |
--------------------------------------------------------------------------------
/examples/pages/notice/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Notice-公告",
3 | "usingComponents":{
4 | "notice": "../../es/notice/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/busy/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/busy/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/busy/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/busy/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/busy/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/empty/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/empty/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/empty/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/pages/page-result/empty/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/empty/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/error/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/error/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/error/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/error/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/error/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{item.nameZN}}
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/examples/pages/page-result/index.js:
--------------------------------------------------------------------------------
1 |
2 | Page({
3 | data: {
4 | components: [
5 | {
6 | name: 'network',
7 | nameZN: '网络',
8 | path: './network/index',
9 | },
10 | {
11 | name: 'local-network',
12 | nameZN: '局部网络',
13 | path: './local-network/index',
14 | },
15 | {
16 | name: 'busy',
17 | nameZN: '服务繁忙',
18 | path: './busy/index',
19 | },
20 | {
21 | name: 'local-busy',
22 | nameZN: '局部服务繁忙',
23 | path: './local-busy/index',
24 | },
25 | {
26 | name: 'error',
27 | nameZN: '系统错误',
28 | path: './error/index',
29 | },
30 | {
31 | name: 'local-error',
32 | nameZN: '局部系统错误',
33 | path: './local-error/index',
34 | },
35 | {
36 | name: 'logoff',
37 | nameZN: '用户已注销',
38 | path: './log-off/index',
39 | },
40 | {
41 | name: 'local-logoff',
42 | nameZN: '局部用户已注销',
43 | path: './local-logoff/index',
44 | },
45 | {
46 | name: 'empty',
47 | nameZN: '页面空状态',
48 | path: './empty/index',
49 | },
50 | {
51 | name: 'local-empty',
52 | nameZN: '局部空状态',
53 | path: './local-empty/index',
54 | },
55 | ],
56 | },
57 | });
58 |
--------------------------------------------------------------------------------
/examples/pages/page-result/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-busy/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/local-busy/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/local-busy/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-busy/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-busy/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-empty/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/local-empty/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/local-empty/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-empty/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-empty/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-error/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/local-error/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/local-error/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-error/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-error/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-logoff/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/local-logoff/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/local-logoff/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-logoff/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-logoff/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-network/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/local-network/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/local-network/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-network/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/local-network/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/log-off/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/page-result/log-off/index.acss
--------------------------------------------------------------------------------
/examples/pages/page-result/log-off/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/pages/page-result/log-off/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/page-result/log-off/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/page-result/network/index.acss:
--------------------------------------------------------------------------------
1 | .am-page-result {
2 | display: flex;
3 | flex-direction: column;
4 | }
5 | .am-page-result-btns {
6 | flex: 1;
7 | display: flex;
8 | flex-direction: column;
9 | justify-content: flex-end;
10 | align-content: center;
11 | padding-bottom: 100rpx;
12 | }
13 | .am-page-result-btns > view {
14 | color: #108EE9;
15 | font-size: 40rpx;
16 | margin-top: 52rpx;
17 | text-align: center;
18 | }
--------------------------------------------------------------------------------
/examples/pages/page-result/network/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | 回到首页
9 | 示例按钮
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/pages/page-result/network/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | backHome() {
3 | my.reLaunch({
4 | url: '/list/demo/app',
5 | });
6 | },
7 | });
8 |
--------------------------------------------------------------------------------
/examples/pages/page-result/network/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "异常反馈",
3 | "usingComponents":{
4 | "page-result": "../../../es/page-result/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/pagination/index.acss:
--------------------------------------------------------------------------------
1 | .demo-title {
2 | color: #333;
3 | padding: 15px;
4 | font-size: 14px;
5 | }
--------------------------------------------------------------------------------
/examples/pages/pagination/index.axml:
--------------------------------------------------------------------------------
1 |
2 | 基础用法
3 |
4 | 箭头按钮
5 |
6 | 简单模式
7 |
8 | 按钮禁用
9 |
10 | 自定义按钮文案
11 |
12 |
--------------------------------------------------------------------------------
/examples/pages/pagination/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/pagination/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Pagination",
3 | "usingComponents": {
4 | "pagination": "../../es/pagination/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/picker-item/index.acss:
--------------------------------------------------------------------------------
1 | /* required by usingComponents */
--------------------------------------------------------------------------------
/examples/pages/picker-item/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 | 密码
9 |
10 |
16 | 发卡银行
17 |
18 |
19 |
--------------------------------------------------------------------------------
/examples/pages/picker-item/index.js:
--------------------------------------------------------------------------------
1 | const banks = ['网商银行', '建设银行', '工商银行', '浦发银行'];
2 |
3 | Page({
4 | data: {
5 | bank: '',
6 | },
7 | onPickerTap() {
8 | my.showActionSheet({
9 | title: '选择发卡银行',
10 | items: banks,
11 | success: (res) => {
12 | this.setData({
13 | bank: banks[res.index],
14 | });
15 | },
16 | });
17 | },
18 | });
19 |
--------------------------------------------------------------------------------
/examples/pages/picker-item/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "list": "../../es/list/index",
4 | "input-item": "../../es/input-item/index",
5 | "picker-item": "../../es/picker-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/pages/popover/index.acss:
--------------------------------------------------------------------------------
1 | .demo-popover {
2 | display: flex;
3 | align-items: center;
4 | justify-content: center;
5 | width: 100%;
6 | height: 400px;
7 | }
8 | .demo-popover-btn {
9 | width: 100px;
10 | height: 100px;
11 | line-height: 100px;
12 | text-align: center;
13 | background-color: #fff;
14 | border: 1px solid #dddddd;
15 | border-radius: 2px;
16 | }
17 | .demo-popover-test-btns {
18 | display: flex;
19 | justify-content: space-around;
20 | }
21 | .demo-popover-test-btn {
22 | width: 45%;
23 | }
--------------------------------------------------------------------------------
/examples/pages/popover/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
8 | 点击{{show ? '隐藏' : '显示'}}
9 |
10 |
11 | {{position}}
12 |
13 |
14 | line2
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/pages/popover/index.js:
--------------------------------------------------------------------------------
1 | const position = ['top', 'topRight', 'rightTop', 'right', 'rightBottom', 'bottomRight', 'bottom', 'bottomLeft', 'leftBottom', 'left', 'leftTop', 'topLeft'];
2 | Page({
3 | data: {
4 | position: position[0],
5 | show: false,
6 | showMask: true,
7 | },
8 | onShowPopoverTap() {
9 | this.setData({
10 | show: !this.data.show,
11 | });
12 | },
13 | onNextPositionTap() {
14 | let index = position.indexOf(this.data.position);
15 | index = index >= position.length - 1 ? 0 : index + 1;
16 | this.setData({
17 | show: true,
18 | position: position[index],
19 | });
20 | },
21 | onMaskChangeTap() {
22 | this.setData({
23 | showMask: !this.data.showMask,
24 | });
25 | },
26 | onMaskClick() {
27 | this.setData({
28 | show: false,
29 | });
30 | },
31 | itemTap1() {
32 | my.alert({
33 | content: '点击1',
34 | });
35 | },
36 | itemTap2() {
37 | my.alert({
38 | content: '点击2',
39 | });
40 | },
41 | });
42 |
--------------------------------------------------------------------------------
/examples/pages/popover/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Popover气泡",
3 | "usingComponents": {
4 | "popover": "../../es/popover/index",
5 | "popover-item": "../../es/popover/popover-item/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/pages/popup/index.acss:
--------------------------------------------------------------------------------
1 | .btn-container {
2 | width: 100%;
3 | height: 100vh;
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 | }
9 |
10 | .btn-container button {
11 | width: 250px;
12 | }
13 |
14 | .box.top, .box.bottom {
15 | height: 200px;
16 | }
17 |
18 | .box.left, .box.right {
19 | width: 200px;
20 | height: 100%;
21 | }
22 |
23 | .box {
24 | background-color: #fff;
25 | display: flex;
26 | justify-content: center;
27 | align-items: center;
28 | }
--------------------------------------------------------------------------------
/examples/pages/popup/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | hello world
10 |
11 |
12 |
13 | hello world
14 |
15 |
16 |
17 |
18 |
19 |
20 | hello world
21 |
22 |
23 | hello world
24 |
25 |
--------------------------------------------------------------------------------
/examples/pages/popup/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | showLeft: false,
4 | showRight: false,
5 | showTop: false,
6 | showBottom: false,
7 | },
8 | onTopBtnTap() {
9 | this.setData({
10 | showTop: true,
11 | });
12 | },
13 | onRightBtnTap() {
14 | this.setData({
15 | showRight: true,
16 | });
17 | },
18 | onLeftBtnTap() {
19 | this.setData({
20 | showLeft: true,
21 | });
22 | },
23 | onButtomBtnTap() {
24 | this.setData({
25 | showBottom: true,
26 | });
27 | },
28 | onPopupClose() {
29 | this.setData({
30 | showLeft: false,
31 | showRight: false,
32 | showTop: false,
33 | showBottom: false,
34 | });
35 | },
36 | });
37 |
--------------------------------------------------------------------------------
/examples/pages/popup/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "popup 弹出菜单",
3 | "usingComponents": {
4 | "popup": "../../es/popup/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/search-bar/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/search-bar/index.acss
--------------------------------------------------------------------------------
/examples/pages/search-bar/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
--------------------------------------------------------------------------------
/examples/pages/search-bar/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | value: '美食',
4 | },
5 | handleInput(value) {
6 | this.setData({
7 | value,
8 | });
9 | },
10 | handleClear() {
11 | this.setData({
12 | value: '',
13 | });
14 | },
15 | handleFocus() {},
16 | handleBlur() {},
17 | handleCancel() {
18 | this.setData({
19 | value: '',
20 | });
21 | },
22 | handleSubmit(value) {
23 | my.alert({
24 | content: value,
25 | });
26 | },
27 | });
28 |
--------------------------------------------------------------------------------
/examples/pages/search-bar/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "搜索框",
3 | "usingComponents":{
4 | "search-bar":"../../es/search-bar/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/stepper/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/stepper/index.acss
--------------------------------------------------------------------------------
/examples/pages/stepper/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Show number value
4 |
5 |
14 |
15 |
16 |
17 | step: 0.01
18 |
19 |
28 |
29 |
30 |
31 | Do not show number value
32 |
33 |
41 |
42 |
43 |
44 | Disabled
45 |
46 |
54 |
55 |
56 |
57 | readOnly
58 |
59 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/examples/pages/stepper/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | value: 8,
4 | },
5 | callBackFn(value) {
6 | console.log(value);
7 | },
8 | modifyValue() {
9 | this.setData({
10 | value: 9,
11 | });
12 | },
13 | });
14 |
--------------------------------------------------------------------------------
/examples/pages/stepper/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Stepper",
3 | "usingComponents":{
4 | "stepper":"../../es/stepper/index",
5 | "list":"../../es/list/index",
6 | "list-item":"../../es/list/list-item/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/examples/pages/steps/index.acss:
--------------------------------------------------------------------------------
1 | .demo-steps-class {
2 | margin: 20px 0;
3 | border-bottom: 1px solid #e5e5e5;
4 | }
5 | .demo-btn-container {
6 | display: flex;
7 | justify-content: space-between;
8 | margin: 20px;
9 | }
10 | .demo-btn {
11 | width: 47%;
12 | }
13 |
--------------------------------------------------------------------------------
/examples/pages/steps/index.axml:
--------------------------------------------------------------------------------
1 |
6 |
11 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/examples/pages/steps/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | activeIndex: 1,
4 | failIndex: 0,
5 | size: 0,
6 | items: [{
7 | title: '步骤1',
8 | }, {
9 | title: '步骤2',
10 | }, {
11 | title: '步骤3',
12 | }],
13 | items2: [{
14 | title: '步骤1',
15 | description: '这是步骤1的描述文档,文字足够多的时候会换行,设置了成功的icon',
16 | activeIcon: 'https://i.alipayobjects.com/common/favicon/favicon.ico',
17 | size: 32,
18 | }, {
19 | title: '步骤2 如果标题足够长的话也会换行的',
20 | description: '这是步骤2,同时设置了两种状态的icon',
21 | icon: 'https://gw.alipayobjects.com/mdn/miniProgram_mendian/afts/img/A*lVojToO-qZIAAAAAAAAAAABjAQAAAQ/original',
22 | activeIcon: 'https://i.alipayobjects.com/common/favicon/favicon.ico',
23 | }, {
24 | title: '步骤3',
25 | description: '这是步骤3',
26 | }, {
27 | title: '步骤4',
28 | description: '不超过六个字',
29 | }],
30 | },
31 | nextStep() {
32 | this.setData({
33 | activeIndex: this.data.activeIndex + 1,
34 | });
35 | },
36 | preStep() {
37 | this.setData({
38 | activeIndex: this.data.activeIndex - 1,
39 | });
40 | },
41 | setFailIndex() {
42 | this.setData({
43 | failIndex: 3,
44 | });
45 | },
46 | cancelFailIndex() {
47 | this.setData({
48 | failIndex: 0,
49 | });
50 | },
51 | setIconSizeAdd() {
52 | this.setData({
53 | size: this.data.size < 30 && this.data.size > 14 ? this.data.size + 1 : 15,
54 | });
55 | },
56 | setIconSizeReduce() {
57 | this.setData({
58 | size: this.data.size > 15 ? this.data.size - 1 : 15,
59 | });
60 | },
61 | });
62 |
--------------------------------------------------------------------------------
/examples/pages/steps/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Steps",
3 | "usingComponents": {
4 | "steps": "../../es/steps/index"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/examples/pages/swipe-action/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/swipe-action/index.acss
--------------------------------------------------------------------------------
/examples/pages/swipe-action/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
20 | {{item.content}}
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/examples/pages/swipe-action/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "Swipe-Action",
3 | "usingComponents":{
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index",
6 | "swipe-action": "../../es/swipe-action/index"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/examples/pages/tabs/index.acss:
--------------------------------------------------------------------------------
1 | .tab-content {
2 | display: flex;
3 | justify-content: center;
4 | align-items: center;
5 | padding: 40rpx;
6 | /* 如果 swipeable="{{true}}",需要增加 height */
7 | /* height: 350px; */
8 | }
9 |
--------------------------------------------------------------------------------
/examples/pages/tabs/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | 高度为 100px {{item.title}}
14 |
15 |
16 | 改变 tab-content 高度为 200px {{item.title}}
17 |
18 |
19 | content of {{item.title}}
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/examples/pages/tabs/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | tabs: [
4 | {
5 | title: '选项',
6 | badgeType: 'text',
7 | badgeText: '6',
8 | },
9 | {
10 | title: '选项二',
11 | badgeType: 'dot',
12 | },
13 | { title: '3 Tab' },
14 | { title: '4 Tab' },
15 | { title: '5 Tab' },
16 | ],
17 | activeTab: 2,
18 | },
19 | handleTabClick({ index }) {
20 | this.setData({
21 | activeTab: index,
22 | });
23 | },
24 | handleTabChange({ index }) {
25 | this.setData({
26 | activeTab: index,
27 | });
28 | },
29 | handlePlusClick() {
30 | my.alert({
31 | content: 'plus clicked',
32 | });
33 | },
34 | });
35 |
--------------------------------------------------------------------------------
/examples/pages/tabs/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "小程序AntUI组件库",
3 | "usingComponents":{
4 | "tabs":"../../es/tabs/index",
5 | "tab-content": "../../es/tabs/tab-content/index"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/pages/tips/1/index.acss:
--------------------------------------------------------------------------------
1 | .rectangle {
2 | position: fixed;
3 | bottom: 100px;
4 | }
5 |
6 | .dialog {
7 | position: fixed;
8 | bottom: 10px;
9 | }
10 |
11 | .content {
12 | font-size: 14px;
13 | color: #fff;
14 | }
15 |
16 | .opt-button {
17 | width: 51px;
18 | height: 27px;
19 | display: flex;
20 | justify-content: center;
21 | align-items: center;
22 | color: #fff;
23 | font-size: 12px;
24 | border: #68BAF7 solid 1rpx;
25 | }
26 |
27 | .add-home {
28 | width: 72px;
29 | height: 27px;
30 | display: flex;
31 | justify-content: center;
32 | align-items: center;
33 | background-color: #56ADEB;
34 | color: #fff;
35 | font-size: 14px;
36 | }
--------------------------------------------------------------------------------
/examples/pages/tips/1/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | hello,
9 | 欢迎使用小程序扩展组件库mini-antui
10 |
11 | 知道了
12 |
13 |
19 |
20 | 把“城市服务”添加到首页
21 |
22 | 立即添加
23 |
24 |
--------------------------------------------------------------------------------
/examples/pages/tips/1/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | showRectangle: true,
4 | showDialog: true,
5 | },
6 | onCloseTap() {
7 | this.setData({
8 | showRectangle: false,
9 | });
10 | },
11 | onRectangleTap() {
12 | my.alert({
13 | content: 'do something',
14 | });
15 | },
16 | onDialogTap() {
17 | this.setData({
18 | showDialog: false,
19 | });
20 | },
21 | });
22 |
--------------------------------------------------------------------------------
/examples/pages/tips/1/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "小程序AntUI组件库",
3 | "usingComponents": {
4 | "tips-dialog": "../../../es/tips/tips-dialog/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/examples/pages/tips/2/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/tips/2/index.acss
--------------------------------------------------------------------------------
/examples/pages/tips/2/index.axml:
--------------------------------------------------------------------------------
1 | {{content}}
2 |
--------------------------------------------------------------------------------
/examples/pages/tips/2/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | content: '我知道了',
4 | time: 2000,
5 | },
6 | onClose() {
7 | my.alert({
8 | title: '12321',
9 | });
10 | },
11 | });
12 |
--------------------------------------------------------------------------------
/examples/pages/tips/2/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "小程序AntUI组件库",
3 | "usingComponents": {
4 | "tips-plain": "../../../es/tips/tips-plain/index"
5 | }
6 | }
--------------------------------------------------------------------------------
/examples/pages/tips/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/tips/index.acss
--------------------------------------------------------------------------------
/examples/pages/tips/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 提示1
5 |
6 |
7 | 提示2
8 |
9 |
10 |
--------------------------------------------------------------------------------
/examples/pages/tips/index.js:
--------------------------------------------------------------------------------
1 | Page({});
2 |
--------------------------------------------------------------------------------
/examples/pages/tips/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "小程序AntUI组件库",
3 | "usingComponents": {
4 | "list": "../../es/list/index",
5 | "list-item": "../../es/list/list-item/index"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/pages/vtabs/index.acss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ant-mini-program/mini-antui/5a41b42e88518ea6c7b9d491f3181e20aae0d384/examples/pages/vtabs/index.acss
--------------------------------------------------------------------------------
/examples/pages/vtabs/index.axml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 | content of {{item.title}}
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/examples/pages/vtabs/index.js:
--------------------------------------------------------------------------------
1 | Page({
2 | data: {
3 | activeTab: 2,
4 | tabs: [
5 | { title: '选项二', anchor: 'a', badgeType: 'dot' },
6 | { title: '选项', anchor: 'b', badgeType: 'text', badgeText: '新' },
7 | { title: '不超过五字', anchor: 'c' },
8 | { title: '选项四', anchor: 'd' },
9 | { title: '选项五', anchor: 'e' },
10 | { title: '选项六', anchor: 'f' },
11 | ],
12 | },
13 | handleChange(index) {
14 | this.setData({
15 | activeTab: index,
16 | });
17 | },
18 | onChange(index) {
19 | this.setData({
20 | activeTab: index,
21 | });
22 | },
23 | });
24 |
--------------------------------------------------------------------------------
/examples/pages/vtabs/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "defaultTitle": "纵向选项卡",
3 | "usingComponents": {
4 | "vtabs": "../../es/vtabs/index",
5 | "vtab-content": "../../es/vtabs/vtab-content/index"
6 | },
7 | "allowsBounceVertical": false
8 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mini-antui",
3 | "version": "0.5.1",
4 | "description": "小程序版AntUI",
5 | "repository": {
6 | "type": "git",
7 | "url": "git@github.com:ant-mini-program/mini-antui.git"
8 | },
9 | "files": [
10 | "es"
11 | ],
12 | "keywords": [
13 | "antui",
14 | "mini-program"
15 | ],
16 | "license": "MIT",
17 | "devDependencies": {
18 | "@babel/core": "^7.1.6",
19 | "@babel/plugin-syntax-dynamic-import": "^7.0.0",
20 | "@babel/preset-env": "^7.1.6",
21 | "@babel/preset-typescript": "^7.1.0",
22 | "eslint": "^5.16.0",
23 | "eslint-config-ali": "^3.1.0",
24 | "eslint-plugin-import": "^2.11.0",
25 | "eslint-plugin-typescript": "^0.14.0",
26 | "gulp": "^3.9.1",
27 | "gulp-babel": "^8.0.0",
28 | "gulp-clean-css": "^4.0.0",
29 | "gulp-if": "^2.0.2",
30 | "gulp-less": "^4.0.1",
31 | "gulp-rename": "^1.2.3",
32 | "lint-staged": "^8.2.0",
33 | "mini-types": "^0.0.1",
34 | "pre-commit": "^1.2.2",
35 | "stylelint": "^10.1.0",
36 | "stylelint-config-standard": "^18.2.0",
37 | "typescript": "^3.2.4",
38 | "typescript-eslint-parser": "^22.0.0"
39 | },
40 | "scripts": {
41 | "lint-staged": "lint-staged",
42 | "build": "yarn && NODE_ENV=production node scripts/compiler.js",
43 | "pub": "npm run build && node scripts/pub.js",
44 | "dev": "yarn && node scripts/compiler.js"
45 | },
46 | "pre-commit": [
47 | "lint-staged"
48 | ],
49 | "lint-staged": {
50 | "*.ts": [
51 | "eslint --ext .ts",
52 | "git add"
53 | ],
54 | "*.js": [
55 | "eslint",
56 | "git add"
57 | ],
58 | "*.less": [
59 | "stylelint --syntax less"
60 | ]
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/scripts/compiler.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const gulp = require('gulp');
3 | const less = require('gulp-less');
4 | const rename = require('gulp-rename');
5 | const cleanCss = require('gulp-clean-css');
6 | const babel = require('gulp-babel');
7 | const gulpif = require('gulp-if');
8 |
9 | const isProduction = process.env.NODE_ENV === 'production';
10 | const dist = isProduction ? path.join(__dirname, '../es') : path.join(__dirname, '../examples/es');
11 | const src = path.join(__dirname, '../components');
12 | const extTypes = ['ts', 'less', 'json', 'axml', 'sjs'];
13 |
14 | gulp.task('less', () => {
15 | gulp.src(`${src}/**/*.less`)
16 | .pipe(less())
17 | .pipe(gulpif(isProduction, cleanCss()))
18 | .pipe(rename({
19 | extname: '.acss',
20 | }))
21 | .pipe(gulp.dest(dist));
22 | });
23 |
24 | gulp.task('ts', () => {
25 | gulp.src(`${src}/**/*.ts`)
26 | .pipe(babel())
27 | .on('error', (err) => {
28 | console.log(err);
29 | })
30 | .pipe(gulp.dest(dist));
31 | });
32 |
33 | gulp.task('json', () => {
34 | gulp.src(`${src}/**/*.json`)
35 | .pipe(gulp.dest(dist));
36 | });
37 |
38 | gulp.task('axml', () => {
39 | gulp.src(`${src}/**/*.axml`)
40 | .pipe(gulp.dest(dist));
41 | });
42 |
43 | gulp.task('sjs', () => {
44 | gulp.src(`${src}/**/*.sjs`)
45 | .pipe(gulp.dest(dist));
46 | });
47 |
48 | gulp.task('build', extTypes);
49 | gulp.start('build');
50 |
51 | if (!isProduction) {
52 | extTypes.forEach((type) => {
53 | const watcher = gulp.watch(`${src}/**/*` + type, [type]);
54 | watcher.on('change', (event) => {
55 | console.log('File ' + event.path + ' was ' + event.type);
56 | });
57 | });
58 | }
59 |
--------------------------------------------------------------------------------
/scripts/pub.js:
--------------------------------------------------------------------------------
1 | const { execSync, spawn } = require('child_process');
2 |
3 | const packageJson = require(`${process.cwd()}/package.json`);
4 | const { version } = packageJson;
5 | const runner = spawn('npm', ['publish']);
6 |
7 | runner.on('close', () => {
8 | execSync(`git tag ${version}`);
9 | execSync(`git push origin ${version}:${version}`);
10 | execSync('git push origin master:master');
11 | });
12 |
13 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "target": "es6",
5 | "noImplicitThis": true,
6 | "noImplicitUseStrict": true,
7 | "types": ["mini-types"]
8 | },
9 | "include": [
10 | "types/**/*",
11 | "components/**/*"
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------