@tachybase/plugin-field-bank-card-number 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +64 -0
- package/README.zh-CN.md +63 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/BankCardFieldInterface.d.ts +56 -0
- package/dist/client/BankCardInput.d.ts +2 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +1 -0
- package/dist/client/locale.d.ts +2 -0
- package/dist/client/plugin.d.ts +7 -0
- package/dist/externalVersion.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +5 -0
- package/dist/locale/zh-CN.json +5 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/plugin.d.ts +11 -0
- package/dist/server/plugin.js +45 -0
- package/package.json +23 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2023-2025] [Tego team]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Bank Card Number Field Plugin
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
This is a field plugin for displaying and inputting bank card numbers, providing formatted display, smart input, and smart copy features.
|
|
6
|
+
|
|
7
|
+
## Bank Card Number Format Description
|
|
8
|
+
|
|
9
|
+
### Common Bank Card Number Digits
|
|
10
|
+
|
|
11
|
+
Different banks have different card number lengths and display formats:
|
|
12
|
+
|
|
13
|
+
- **16 digits**: Common, typically displayed as **4-4-4-4** on the card
|
|
14
|
+
- Example: `6222 0000 0000 0000`
|
|
15
|
+
- **19 digits**: Common, typically displayed as **6-13** on the card
|
|
16
|
+
- Example: `622200 0000000000000`
|
|
17
|
+
- **15 digits**: Uncommon, such as American Express, displayed as **4-6-5** on the card
|
|
18
|
+
- Example: `3782 822463 10005`
|
|
19
|
+
- **18 digits**: Uncommon, such as Industrial Bank, displayed as **6-6-6** on the card
|
|
20
|
+
- Example: `622909 000000 000000`
|
|
21
|
+
|
|
22
|
+
### Design of This Plugin
|
|
23
|
+
|
|
24
|
+
To provide a unified and simple user experience, this plugin follows the design philosophy of Alipay and WeChat:
|
|
25
|
+
|
|
26
|
+
- **Unified Format**: All bank card numbers are uniformly displayed in **groups of 4 digits**
|
|
27
|
+
- **Maximum Length**: Although the standard maximum length for bank card numbers is 19 digits, following Alipay's design, this plugin supports up to **21 digits** to accommodate potential special card numbers
|
|
28
|
+
- **Last Group**: When the card number has 21 digits, the format is **4-4-4-4-5** (the last group has 5 digits)
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
### Key Features
|
|
33
|
+
|
|
34
|
+
- **Formatted Display**: Bank card numbers are automatically formatted into groups of 4 digits
|
|
35
|
+
- 16 digits: `1234 5678 9012 3456`
|
|
36
|
+
- 19 digits: `1234 5678 9012 3456 789`
|
|
37
|
+
- 21 digits: `1234 5678 9012 3456 78901`
|
|
38
|
+
|
|
39
|
+
- **Smart Input**: Spaces are automatically added as separators during input, no manual spacing required
|
|
40
|
+
|
|
41
|
+
- **Smart Copy**: When copying bank card numbers, spaces are automatically removed, copying only pure digits
|
|
42
|
+
- Display: `6222 0000 0000 0000`
|
|
43
|
+
- Copy: `6222000000000000`
|
|
44
|
+
- Convenient for pasting into other systems (such as bank websites, payment platforms, etc.)
|
|
45
|
+
|
|
46
|
+
- **Data Storage**: Database stores pure numeric format (without spaces)
|
|
47
|
+
|
|
48
|
+
- **Length Limit**: Supports up to 21 digits
|
|
49
|
+
|
|
50
|
+
- **Auto Filtering**: Automatically filters non-numeric characters during input
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
1. Enable the "Bank Card Number Field" plugin in plugin management
|
|
55
|
+
2. When creating or editing a data table, add a new field and select "Bank Card Number" as the field type
|
|
56
|
+
3. Configure the field name, display name, and other basic information
|
|
57
|
+
4. Save and the field can be used in forms
|
|
58
|
+
|
|
59
|
+
### User Experience
|
|
60
|
+
|
|
61
|
+
- **During Input**: Enter digits directly, system automatically adds space separators
|
|
62
|
+
- **During Display**: Automatically formatted into readable groups
|
|
63
|
+
- **During Copy**: Ctrl+C or right-click copy automatically removes spaces
|
|
64
|
+
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# 银行卡号字段插件
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
|
|
5
|
+
这是一个用于显示和输入银行卡号的字段插件,提供格式化显示、智能输入和智能复制功能。
|
|
6
|
+
|
|
7
|
+
## 银行卡号格式说明
|
|
8
|
+
|
|
9
|
+
### 常见银行卡号位数
|
|
10
|
+
|
|
11
|
+
不同银行的银行卡号位数和显示格式各不相同:
|
|
12
|
+
|
|
13
|
+
- **16位**:常见,卡面通常显示为 **4-4-4-4**
|
|
14
|
+
- 示例:`6222 0000 0000 0000`
|
|
15
|
+
- **19位**:常见,卡面通常显示为 **6-13**
|
|
16
|
+
- 示例:`622200 0000000000000`
|
|
17
|
+
- **15位**:不常见,如美国运通卡,卡面显示为 **4-6-5**
|
|
18
|
+
- 示例:`3782 822463 10005`
|
|
19
|
+
- **18位**:不常见,如兴业银行,卡面显示为 **6-6-6**
|
|
20
|
+
- 示例:`622909 000000 000000`
|
|
21
|
+
|
|
22
|
+
### 本插件的设计
|
|
23
|
+
|
|
24
|
+
为了提供统一、简洁的用户体验,本插件参考支付宝和微信的设计理念:
|
|
25
|
+
|
|
26
|
+
- **统一格式**:所有银行卡号统一采用 **4位一组** 的显示方式
|
|
27
|
+
- **最大长度**:虽然银行卡号标准最长为 19位,但参考支付宝的设计,本插件支持最长 **21位**,以兼容可能的特殊卡号
|
|
28
|
+
- **最后一组**:当卡号为 21位时,格式为 **4-4-4-4-5**(最后一组为5位)
|
|
29
|
+
|
|
30
|
+
## 功能特性
|
|
31
|
+
|
|
32
|
+
### 主要特点
|
|
33
|
+
|
|
34
|
+
- **格式化显示**:银行卡号自动格式化为每4位一组的形式
|
|
35
|
+
- 16位:`1234 5678 9012 3456`
|
|
36
|
+
- 19位:`1234 5678 9012 3456 789`
|
|
37
|
+
- 21位:`1234 5678 9012 3456 78901`
|
|
38
|
+
|
|
39
|
+
- **智能输入**:输入时自动添加空格分隔符,无需手动输入空格
|
|
40
|
+
|
|
41
|
+
- **智能复制**:复制银行卡号时自动去除空格,只复制纯数字
|
|
42
|
+
- 显示:`6222 0000 0000 0000`
|
|
43
|
+
- 复制:`6222000000000000`
|
|
44
|
+
- 方便粘贴到其他系统(如银行网站、支付平台等)
|
|
45
|
+
|
|
46
|
+
- **数据存储**:数据库中存储纯数字格式(不含空格)
|
|
47
|
+
|
|
48
|
+
- **长度限制**:支持最长21位银行卡号
|
|
49
|
+
|
|
50
|
+
- **自动过滤**:输入时自动过滤非数字字符
|
|
51
|
+
|
|
52
|
+
## 使用方法
|
|
53
|
+
|
|
54
|
+
1. 在插件管理中启用"银行卡号字段"插件
|
|
55
|
+
2. 在创建或编辑数据表时,添加新字段,选择字段类型为"银行卡号"
|
|
56
|
+
3. 配置字段名称、显示名称等基本信息
|
|
57
|
+
4. 保存后即可在表单中使用该字段
|
|
58
|
+
|
|
59
|
+
### 用户体验
|
|
60
|
+
|
|
61
|
+
- **输入时**:直接输入数字,系统自动添加空格分隔
|
|
62
|
+
- **显示时**:自动格式化为易读的分组形式
|
|
63
|
+
- **复制时**:Ctrl+C 或右键复制时,自动去除空格
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CollectionFieldInterface } from '@tachybase/client';
|
|
2
|
+
export declare class BankCardFieldInterface extends CollectionFieldInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
group: string;
|
|
6
|
+
order: number;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
default: {
|
|
10
|
+
type: string;
|
|
11
|
+
uiSchema: {
|
|
12
|
+
type: string;
|
|
13
|
+
'x-component': string;
|
|
14
|
+
'x-component-props': {};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
availableTypes: string[];
|
|
18
|
+
hasDefaultValue: boolean;
|
|
19
|
+
properties: {
|
|
20
|
+
'uiSchema.title': {
|
|
21
|
+
type: string;
|
|
22
|
+
title: string;
|
|
23
|
+
required: boolean;
|
|
24
|
+
"x-decorator": string;
|
|
25
|
+
"x-component": string;
|
|
26
|
+
};
|
|
27
|
+
name: {
|
|
28
|
+
type: string;
|
|
29
|
+
title: string;
|
|
30
|
+
required: boolean;
|
|
31
|
+
"x-disabled": string;
|
|
32
|
+
"x-decorator": string;
|
|
33
|
+
"x-component": string;
|
|
34
|
+
"x-validator": string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
filterable: {
|
|
39
|
+
operators: ({
|
|
40
|
+
label: string;
|
|
41
|
+
value: string;
|
|
42
|
+
selected: boolean;
|
|
43
|
+
noValue?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
label: string;
|
|
46
|
+
value: string;
|
|
47
|
+
selected?: undefined;
|
|
48
|
+
noValue?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
label: string;
|
|
51
|
+
value: string;
|
|
52
|
+
noValue: boolean;
|
|
53
|
+
selected?: undefined;
|
|
54
|
+
})[];
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/schema")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/schema"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@tachybase/plugin-field-bank-card-number"]={},e["@tachybase/client"],e.jsxRuntime,e["@tachybase/schema"]))})(this,function(e,t,n,a){"use strict";var F=Object.defineProperty,A=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var S=(e,t,n)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t)=>{for(var n in t||(t={}))P.call(t,n)&&S(e,n,t[n]);if(m)for(var n of m(t))T.call(t,n)&&S(e,n,t[n]);return e},D=(e,t)=>A(e,E(t));var $=(e,t)=>{var n={};for(var a in e)P.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&m)for(var a of m(e))t.indexOf(a)<0&&T.call(e,a)&&(n[a]=e[a]);return n};var x=(e,t,n)=>new Promise((a,d)=>{var u=r=>{try{c(n.next(r))}catch(p){d(p)}},b=r=>{try{c(n.throw(r))}catch(p){d(p)}},c=r=>r.done?a(r.value):Promise.resolve(r.value).then(u,b);c((n=n.apply(e,t)).next())});const d="field-bank-card-number";function u(s){return`{{t('${s}', { ns: '${d}', nsMode: 'fallback' })}}`}class b extends t.CollectionFieldInterface{constructor(){super(...arguments),this.name="bankCard",this.type="string",this.group="basic",this.order=6,this.title=u("Bank Card Number"),this.description=u("Bank card number field, formatted display in groups of 4 digits"),this.default={type:"string",uiSchema:{type:"string","x-component":"BankCardInput","x-component-props":{}}},this.availableTypes=["string"],this.hasDefaultValue=!0,this.properties=C({},t.defaultProps),this.filterable={operators:[{label:'{{t("is")}}',value:"$eq",selected:!0},{label:'{{t("is not")}}',value:"$ne"},{label:'{{t("contains")}}',value:"$includes"},{label:'{{t("does not contain")}}',value:"$notIncludes"},{label:'{{t("exists")}}',value:"$exists",noValue:!0},{label:'{{t("not exists")}}',value:"$notExists",noValue:!0}]}}}const c=s=>{if(!s)return"";const l=s.replace(/\D/g,"").slice(0,21),o=[];for(let i=0;i<l.length;i+=4)o.push(l.slice(i,i+4));return o.join(" ")},r=s=>s?s.replace(/\s/g,""):"",p=s=>{const g=s,{value:f,onChange:l}=g,o=$(g,["value","onChange"]),i=h=>{const y=h.target.value,k=r(y),v=c(k);h.target.value=v,l==null||l(k)},I=h=>{h.preventDefault();const y=window.getSelection();if(y){const v=y.toString().replace(/\s/g,"");h.clipboardData.setData("text/plain",v)}};return n.jsx(t.Input,D(C({},o),{value:c(f),onChange:i,onCopy:I,placeholder:o.placeholder||"请输入银行卡号",maxLength:25}))},j=s=>{const{value:f}=s,l=o=>{o.preventDefault();const i=window.getSelection();if(i){const g=i.toString().replace(/\s/g,"");o.clipboardData.setData("text/plain",g)}};return n.jsx("span",{onCopy:l,style:{userSelect:"text"},children:c(f)})},B=a.connect(p,a.mapProps((s,f)=>C({},s)),a.mapReadPretty(j));class M extends t.Plugin{afterAdd(){return x(this,null,function*(){})}beforeLoad(){return x(this,null,function*(){})}load(){return x(this,null,function*(){this.app.addComponents({BankCardInput:B}),this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaces([b])})}}e.BankCardFieldInterface=b,e.BankCardInput=B,e.NAMESPACE=d,e.default=M,e.tval=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
default: () => import_server.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
__reExport(index_exports, require("./server"), module.exports);
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
...require("./server")
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var server_exports = {};
|
|
29
|
+
__export(server_exports, {
|
|
30
|
+
default: () => import_plugin.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(server_exports);
|
|
33
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from '@tego/server';
|
|
2
|
+
export declare class PluginPluginFieldBankCardNumber extends Plugin {
|
|
3
|
+
afterAdd(): Promise<void>;
|
|
4
|
+
beforeLoad(): Promise<void>;
|
|
5
|
+
load(): Promise<void>;
|
|
6
|
+
install(): Promise<void>;
|
|
7
|
+
afterEnable(): Promise<void>;
|
|
8
|
+
afterDisable(): Promise<void>;
|
|
9
|
+
remove(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export default PluginPluginFieldBankCardNumber;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var plugin_exports = {};
|
|
19
|
+
__export(plugin_exports, {
|
|
20
|
+
PluginPluginFieldBankCardNumber: () => PluginPluginFieldBankCardNumber,
|
|
21
|
+
default: () => plugin_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
24
|
+
var import_server = require("@tego/server");
|
|
25
|
+
class PluginPluginFieldBankCardNumber extends import_server.Plugin {
|
|
26
|
+
async afterAdd() {
|
|
27
|
+
}
|
|
28
|
+
async beforeLoad() {
|
|
29
|
+
}
|
|
30
|
+
async load() {
|
|
31
|
+
}
|
|
32
|
+
async install() {
|
|
33
|
+
}
|
|
34
|
+
async afterEnable() {
|
|
35
|
+
}
|
|
36
|
+
async afterDisable() {
|
|
37
|
+
}
|
|
38
|
+
async remove() {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
var plugin_default = PluginPluginFieldBankCardNumber;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
PluginPluginFieldBankCardNumber
|
|
45
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachybase/plugin-field-bank-card-number",
|
|
3
|
+
"displayName": "Collection field: Bank Card Number",
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"description": "Bank card number field with formatted display (4 digits per group), smart input and smart copy. Supports up to 21 digits.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"Collection fields",
|
|
8
|
+
"Bank Card",
|
|
9
|
+
"Card Number",
|
|
10
|
+
"Payment",
|
|
11
|
+
"Format"
|
|
12
|
+
],
|
|
13
|
+
"main": "dist/server/index.js",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@tachybase/test": "1.3.52",
|
|
16
|
+
"@tego/client": "1.3.52",
|
|
17
|
+
"@tego/server": "1.3.52",
|
|
18
|
+
"@tachybase/schema": "1.3.52",
|
|
19
|
+
"@tachybase/client": "1.4.0"
|
|
20
|
+
},
|
|
21
|
+
"description.zh-CN": "银行卡号字段,提供格式化显示(每4位一组)、智能输入和智能复制功能。支持最长21位银行卡号。",
|
|
22
|
+
"displayName.zh-CN": "数据表字段:银行卡号"
|
|
23
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|