form-driver 0.1.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.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/dist/m3.css +310 -0
  4. package/dist/m3.js +1 -0
  5. package/es/m3.css +310 -0
  6. package/es/m3.js +20919 -0
  7. package/lib/m3.css +310 -0
  8. package/lib/m3.js +20959 -0
  9. package/package.json +132 -0
  10. package/src/.DS_Store +0 -0
  11. package/src/framework/Ajax.ts +96 -0
  12. package/src/framework/Assembly.tsx +165 -0
  13. package/src/framework/Init.tsx +196 -0
  14. package/src/framework/M3.tsx +94 -0
  15. package/src/framework/MContext.ts +15 -0
  16. package/src/framework/MFieldViewer.tsx +32 -0
  17. package/src/framework/MUtil.tsx +653 -0
  18. package/src/framework/MViewer.less +128 -0
  19. package/src/framework/MViewer.tsx +180 -0
  20. package/src/framework/MViewerDebug.tsx +95 -0
  21. package/src/framework/Persistant.ts +90 -0
  22. package/src/framework/Schema.ts +386 -0
  23. package/src/framework/SchemaFunc.ts +30 -0
  24. package/src/framework/Validator.ts +160 -0
  25. package/src/framework/editorMap.ts +109 -0
  26. package/src/index.ts +33 -0
  27. package/src/types/MArrayType.ts +73 -0
  28. package/src/types/MCascadeType.ts +35 -0
  29. package/src/types/MCnAddressType.ts +54 -0
  30. package/src/types/MDateRangeType.ts +52 -0
  31. package/src/types/MDateTimeType.ts +53 -0
  32. package/src/types/MDecorationType.ts +6 -0
  33. package/src/types/MEnumType.ts +65 -0
  34. package/src/types/MExperienceType.ts +81 -0
  35. package/src/types/MFloatType.ts +10 -0
  36. package/src/types/MGB2260Type.ts +56 -0
  37. package/src/types/MIntDiffType.ts +6 -0
  38. package/src/types/MIntType.ts +44 -0
  39. package/src/types/MKvSetType.ts +50 -0
  40. package/src/types/MMatrixType.ts +52 -0
  41. package/src/types/MObjectType.ts +89 -0
  42. package/src/types/MSetType.ts +220 -0
  43. package/src/types/MStringType.ts +27 -0
  44. package/src/types/MTelType.ts +14 -0
  45. package/src/types/MType.ts +77 -0
  46. package/src/types/MVLPairType.ts +35 -0
  47. package/src/types/gb2260.json +1 -0
  48. package/src/ui/BaseViewer.tsx +110 -0
  49. package/src/ui/editor/.DS_Store +0 -0
  50. package/src/ui/editor/basic/.DS_Store +0 -0
  51. package/src/ui/editor/basic/ACascadePicker.tsx +114 -0
  52. package/src/ui/editor/basic/ACheckBox.tsx +104 -0
  53. package/src/ui/editor/basic/ADatetimePicker.tsx +76 -0
  54. package/src/ui/editor/basic/AGB2260.tsx +52 -0
  55. package/src/ui/editor/basic/AInputBox.tsx +59 -0
  56. package/src/ui/editor/basic/AIntBox.tsx +39 -0
  57. package/src/ui/editor/basic/AKvSet.less +9 -0
  58. package/src/ui/editor/basic/AKvSet.tsx +90 -0
  59. package/src/ui/editor/basic/ARadio.tsx +86 -0
  60. package/src/ui/editor/basic/ARangePicker.tsx +129 -0
  61. package/src/ui/editor/basic/ARate.less +8 -0
  62. package/src/ui/editor/basic/ARate.tsx +37 -0
  63. package/src/ui/editor/basic/ARemoteSelector.tsx +116 -0
  64. package/src/ui/editor/basic/ASelector.tsx +88 -0
  65. package/src/ui/editor/basic/ASetSelector.tsx +65 -0
  66. package/src/ui/editor/basic/ASpecInputBox.tsx +20 -0
  67. package/src/ui/editor/basic/ATreeSelect.tsx +41 -0
  68. package/src/ui/editor/basic/AUpload.tsx +119 -0
  69. package/src/ui/editor/basic/NPS.less +21 -0
  70. package/src/ui/editor/basic/NPS.tsx +47 -0
  71. package/src/ui/editor/complex/AArray.less +10 -0
  72. package/src/ui/editor/complex/AArray.tsx +104 -0
  73. package/src/ui/editor/complex/AArrayGrid.tsx +115 -0
  74. package/src/ui/editor/complex/ACnAddress.less +15 -0
  75. package/src/ui/editor/complex/ACnAddress.tsx +61 -0
  76. package/src/ui/editor/complex/ADialogForm.tsx +45 -0
  77. package/src/ui/editor/complex/AExperience.tsx +85 -0
  78. package/src/ui/editor/complex/AForm.less +35 -0
  79. package/src/ui/editor/complex/AForm.tsx +340 -0
  80. package/src/ui/editor/complex/AIntDiff.tsx +77 -0
  81. package/src/ui/editor/complex/AMatrix.less +18 -0
  82. package/src/ui/editor/complex/AMatrix.tsx +242 -0
  83. package/src/ui/editor/complex/ATable.less +4 -0
  84. package/src/ui/editor/complex/ATable.tsx +33 -0
  85. package/src/ui/editor/complex/JsonEditor.tsx +37 -0
  86. package/src/ui/readable/A.tsx +33 -0
  87. package/src/ui/readable/ArrayViewer.tsx +46 -0
  88. package/src/ui/readable/DecorationViewer.tsx +76 -0
  89. package/src/ui/readable/DivViewer.tsx +11 -0
  90. package/src/ui/widget/Collapsible.tsx +156 -0
  91. package/src/ui/widget/Segment.less +39 -0
  92. package/src/ui/widget/Segment.tsx +40 -0
  93. package/src/ui/widget/SegmentEditSwitch.tsx +46 -0
  94. package/src/ui/widget/SelectBox.tsx +43 -0
  95. package/src/ui/widget/UnderlineInputBox.less +47 -0
  96. package/src/ui/widget/UnderlineInputBox.tsx +10 -0
  97. package/types/framework/Ajax.d.ts +5 -0
  98. package/types/framework/Assembly.d.ts +59 -0
  99. package/types/framework/Init.d.ts +4 -0
  100. package/types/framework/M3.d.ts +6 -0
  101. package/types/framework/MContext.d.ts +11 -0
  102. package/types/framework/MFieldViewer.d.ts +8 -0
  103. package/types/framework/MUtil.d.ts +180 -0
  104. package/types/framework/MViewer.d.ts +75 -0
  105. package/types/framework/MViewerDebug.d.ts +11 -0
  106. package/types/framework/Persistant.d.ts +17 -0
  107. package/types/framework/Schema.d.ts +306 -0
  108. package/types/framework/SchemaFunc.d.ts +14 -0
  109. package/types/framework/Validator.d.ts +53 -0
  110. package/types/framework/editorMap.d.ts +107 -0
  111. package/types/index.d.ts +21 -0
  112. package/types/types/MArrayType.d.ts +2 -0
  113. package/types/types/MCascadeType.d.ts +11 -0
  114. package/types/types/MCnAddressType.d.ts +2 -0
  115. package/types/types/MDateRangeType.d.ts +7 -0
  116. package/types/types/MDateTimeType.d.ts +11 -0
  117. package/types/types/MDecorationType.d.ts +7 -0
  118. package/types/types/MEnumType.d.ts +2 -0
  119. package/types/types/MExperienceType.d.ts +5 -0
  120. package/types/types/MFloatType.d.ts +2 -0
  121. package/types/types/MGB2260Type.d.ts +9 -0
  122. package/types/types/MIntDiffType.d.ts +2 -0
  123. package/types/types/MIntType.d.ts +2 -0
  124. package/types/types/MKvSetType.d.ts +11 -0
  125. package/types/types/MMatrixType.d.ts +5 -0
  126. package/types/types/MObjectType.d.ts +11 -0
  127. package/types/types/MSetType.d.ts +7 -0
  128. package/types/types/MStringType.d.ts +2 -0
  129. package/types/types/MTelType.d.ts +4 -0
  130. package/types/types/MType.d.ts +46 -0
  131. package/types/types/MVLPairType.d.ts +5 -0
  132. package/types/ui/BaseViewer.d.ts +45 -0
  133. package/types/ui/editor/basic/ACascadePicker.d.ts +11 -0
  134. package/types/ui/editor/basic/ACheckBox.d.ts +17 -0
  135. package/types/ui/editor/basic/ADatetimePicker.d.ts +15 -0
  136. package/types/ui/editor/basic/AGB2260.d.ts +10 -0
  137. package/types/ui/editor/basic/AInputBox.d.ts +8 -0
  138. package/types/ui/editor/basic/AIntBox.d.ts +9 -0
  139. package/types/ui/editor/basic/AKvSet.d.ts +19 -0
  140. package/types/ui/editor/basic/ARadio.d.ts +14 -0
  141. package/types/ui/editor/basic/ARangePicker.d.ts +30 -0
  142. package/types/ui/editor/basic/ARate.d.ts +13 -0
  143. package/types/ui/editor/basic/ARemoteSelector.d.ts +15 -0
  144. package/types/ui/editor/basic/ASelector.d.ts +14 -0
  145. package/types/ui/editor/basic/ASetSelector.d.ts +10 -0
  146. package/types/ui/editor/basic/ASpecInputBox.d.ts +9 -0
  147. package/types/ui/editor/basic/ATreeSelect.d.ts +18 -0
  148. package/types/ui/editor/basic/AUpload.d.ts +33 -0
  149. package/types/ui/editor/basic/NPS.d.ts +13 -0
  150. package/types/ui/editor/complex/AArray.d.ts +11 -0
  151. package/types/ui/editor/complex/AArrayGrid.d.ts +13 -0
  152. package/types/ui/editor/complex/ACnAddress.d.ts +10 -0
  153. package/types/ui/editor/complex/ADialogForm.d.ts +11 -0
  154. package/types/ui/editor/complex/AExperience.d.ts +16 -0
  155. package/types/ui/editor/complex/AForm.d.ts +46 -0
  156. package/types/ui/editor/complex/AIntDiff.d.ts +14 -0
  157. package/types/ui/editor/complex/AMatrix.d.ts +48 -0
  158. package/types/ui/editor/complex/ATable.d.ts +9 -0
  159. package/types/ui/editor/complex/JsonEditor.d.ts +9 -0
  160. package/types/ui/readable/A.d.ts +5 -0
  161. package/types/ui/readable/ArrayViewer.d.ts +5 -0
  162. package/types/ui/readable/DecorationViewer.d.ts +3 -0
  163. package/types/ui/readable/DivViewer.d.ts +5 -0
  164. package/types/ui/widget/Collapsible.d.ts +46 -0
  165. package/types/ui/widget/Segment.d.ts +18 -0
  166. package/types/ui/widget/SegmentEditSwitch.d.ts +20 -0
  167. package/types/ui/widget/SelectBox.d.ts +13 -0
  168. package/types/ui/widget/UnderlineInputBox.d.ts +6 -0
package/lib/m3.css ADDED
@@ -0,0 +1,310 @@
1
+ .MEditor {
2
+ /* max-width:900px; */
3
+ /* margin:auto; */
4
+ --MViewerBorder: 1px solid #d9d9d9;
5
+ /** TODO 在这里扩展吧 */
6
+ }
7
+ .MEditor .submitBar {
8
+ background: white;
9
+ box-shadow: 0 0 10px #d0cfcf;
10
+ padding: 25px;
11
+ margin: 25px 0 25px 0;
12
+ text-align: center;
13
+ }
14
+ .MEditor .AForm_removeBtn:focus,
15
+ .MEditor .AForm_removeBtn:hover {
16
+ color: #40a9ff;
17
+ }
18
+ .MEditor .AForm_removeBtn_disabled {
19
+ color: lightgray;
20
+ }
21
+ .MEditor_p {
22
+ max-width: 900px;
23
+ margin: auto;
24
+ --MViewerBorder: 1px solid #d9d9d9;
25
+ /** TODO 在这里扩展吧 */
26
+ }
27
+ .MEditor_p .submitBar {
28
+ background: white;
29
+ box-shadow: 0 0 10px #d0cfcf;
30
+ padding: 15px;
31
+ margin: 25px 0 25px 0;
32
+ text-align: center;
33
+ }
34
+ .MEditor_p .AForm_removeBtn:focus,
35
+ .MEditor .AForm_removeBtn:hover {
36
+ color: #40a9ff;
37
+ }
38
+ .MEditor_p .AForm_removeBtn_disabled {
39
+ color: lightgray;
40
+ }
41
+ /** 回填字段的样式,例如日期选择/gb2260选项下,带下划线的,显示被选中值的一行字 */
42
+ .MEditor_p .backfill {
43
+ border-bottom: 1px solid #d9d9d9;
44
+ }
45
+ .MEditor_p .backfill_empty {
46
+ border-bottom: 1px solid #d9d9d9;
47
+ color: gray;
48
+ }
49
+ .MEditor_p input,
50
+ .MEditor_p textarea {
51
+ font-size: 16px;
52
+ /** ios上,字小于16px的输入框,输入时页面会放大,这个体验及其糟糕,只能通过改大字体解决 */
53
+ }
54
+ table.M3_table {
55
+ border: var(--MViewerBorder);
56
+ border-spacing: 0;
57
+ }
58
+ table.M3_table tr,
59
+ table.M3_table th {
60
+ border-bottom: var(--MViewerBorder);
61
+ }
62
+ table.M3_table td,
63
+ table.M3_table th {
64
+ border-right: var(--MViewerBorder);
65
+ border-bottom: var(--MViewerBorder);
66
+ padding: 5px 0 5px 0;
67
+ }
68
+ table.M3_table td .ant-select-selector,
69
+ table.M3_table th .ant-select-selector {
70
+ border: none !important;
71
+ }
72
+ table.M3_table th {
73
+ font-weight: normal;
74
+ text-align: center;
75
+ }
76
+ table.M3_table tr td:last-child {
77
+ border-right: 0;
78
+ }
79
+ table.M3_table tr:last-child td {
80
+ border-bottom: 0;
81
+ }
82
+ /** antd 样式调整 */
83
+ .MEditor {
84
+ /** 减少字段之间的垂直距离,表单紧凑些 */
85
+ /** ant表单项的间距太大了,浪费空间 */
86
+ }
87
+ .MEditor .ant-row {
88
+ margin-bottom: 10px;
89
+ }
90
+ .MEditor .ant-form-item,
91
+ .MEditor .ant-form-item- {
92
+ margin-bottom: 0px !important;
93
+ }
94
+ .MEditor_p,
95
+ .MEditor {
96
+ /** 选项文字折行展示 */
97
+ }
98
+ .MEditor_p .wrap,
99
+ .MEditor .wrap {
100
+ word-break: break-all;
101
+ white-space: pre-line;
102
+ }
103
+ .MEditor_p .ant-radio-wrapper,
104
+ .MEditor .ant-radio-wrapper,
105
+ .MEditor_p .ant-checkbox-wrapper,
106
+ .MEditor .ant-checkbox-wrapper {
107
+ white-space: normal;
108
+ }
109
+ .MEditor_p .ant-radio-wrapper span,
110
+ .MEditor .ant-radio-wrapper span,
111
+ .MEditor_p .ant-checkbox-wrapper span,
112
+ .MEditor .ant-checkbox-wrapper span {
113
+ word-break: break-all;
114
+ white-space: pre-line;
115
+ }
116
+ .MEditor_p .am-calendar .content,
117
+ .MEditor .am-calendar .content {
118
+ /** TODO:antd mobile的日历缩回去的时候有bug,动画不正常,这里把动画禁掉,以后如果升级antd mobile了可以试试去掉 */
119
+ animation-duration: 0s;
120
+ -webkit-animation-duration: 0s;
121
+ }
122
+ /** antd的Tabs不能100%高,加上FullHeightTab这个class就可以了 */
123
+ .FullHeightTab .ant-tabs-content {
124
+ height: 100%;
125
+ }
126
+ .FullHeightTab .ant-tabs {
127
+ height: 100%;
128
+ }
129
+
130
+ .ant-rate {
131
+ display: flex !important;
132
+ width: 100%;
133
+ }
134
+ .ant-rate .ant-rate-star {
135
+ flex: 1;
136
+ }
137
+
138
+ .m3-nps-wrapper .m3-nps-tip {
139
+ overflow: hidden;
140
+ }
141
+ .m3-nps-wrapper .m3-nps-tip span:first-child {
142
+ float: left;
143
+ }
144
+ .m3-nps-wrapper .m3-nps-tip span:last-child {
145
+ float: right;
146
+ }
147
+ .m3-nps-wrapper .ant-rate {
148
+ display: flex !important;
149
+ width: 100%;
150
+ }
151
+ .m3-nps-wrapper .ant-rate .ant-rate-star {
152
+ flex: 1;
153
+ }
154
+
155
+ .AMatrixOpenTd {
156
+ word-break: keep-all;
157
+ white-space: nowrap;
158
+ }
159
+ .AMatrix_DropdownList_sameLine {
160
+ display: flex;
161
+ }
162
+ .AMatrix_DropdownList_sameLine div {
163
+ flex: 1;
164
+ }
165
+
166
+ .paperInputBox {
167
+ border-style: none none solid none;
168
+ border-bottom: 1px solid #d9d9d9;
169
+ background: white;
170
+ border-radius: 0;
171
+ font-size: 16px;
172
+ }
173
+ .paperInputBox:disabled {
174
+ border-bottom: 1px dotted #f0f0f0;
175
+ color: #d9d9d9;
176
+ background: white;
177
+ }
178
+ .antMiddleInputBox {
179
+ font-size: 16px;
180
+ /** 以下都是ant的 */
181
+ border: 1px solid #d9d9d9;
182
+ border-radius: 2px;
183
+ background-color: #fff;
184
+ box-sizing: border-box;
185
+ margin: 0;
186
+ padding: 0;
187
+ font-variant: tabular-nums;
188
+ list-style: none;
189
+ font-feature-settings: 'tnum', "tnum", "tnum";
190
+ position: relative;
191
+ display: inline-block;
192
+ padding: 4px 11px;
193
+ color: rgba(0, 0, 0, 0.85);
194
+ font-size: 14px;
195
+ line-height: 1.5715;
196
+ transition: all 0.3s;
197
+ }
198
+ .antMiddleInputBox:disabled {
199
+ border: 1px dotted #f0f0f0;
200
+ color: #d9d9d9;
201
+ background: white;
202
+ }
203
+ .antMiddleInputBox::-moz-placeholder {
204
+ color: #d9d9d9;
205
+ }
206
+ .antMiddleInputBox:-ms-input-placeholder {
207
+ color: #d9d9d9;
208
+ }
209
+ .antMiddleInputBox::placeholder {
210
+ color: #d9d9d9;
211
+ }
212
+
213
+ /* 背景 */
214
+ /* .AForm::after{
215
+ content: "";
216
+ background: url(//hupan-web.oss-cn-hangzhou.aliyuncs.com/static/image/headImg.jpg);
217
+ opacity: 0.2;
218
+ top: 0;
219
+ left: 0;
220
+ bottom: 0;
221
+ right: 0;
222
+ position: absolute;
223
+ z-index: -1;
224
+ } */
225
+ .AForm .AForm {
226
+ /** 嵌套的子表单 */
227
+ /* box-shadow: 0 0 10px #d0cfcf; */
228
+ border: 1px solid #d9d9d9;
229
+ padding: 15px;
230
+ }
231
+ .AForm .ItemLabel {
232
+ font-weight: bold;
233
+ margin-bottom: 5px;
234
+ }
235
+ .AForm .Item {
236
+ margin-bottom: 20px;
237
+ }
238
+ .MEditor .ant-form-item-explain.ant-form-item-explain-error,
239
+ .MEditor_p .ant-form-item-explain.ant-form-item-explain-error {
240
+ color: #ff4d4f;
241
+ }
242
+
243
+ .AForm_segment {
244
+ background: white;
245
+ box-shadow: 0 0 10px #d0cfcf;
246
+ padding: 30px;
247
+ }
248
+ /* 只有第一个segment需要留上边距 */
249
+ * .AForm_segment:not(:first-child) {
250
+ margin: 25px 0 25px 0;
251
+ }
252
+ * .AForm_segment:first-child {
253
+ margin: 0px 0 25px 0;
254
+ }
255
+ .AForm_segmentTitleBar {
256
+ border-bottom: 1px solid #d9d9d9;
257
+ padding: 0 0 10px;
258
+ margin: 0 0 15px;
259
+ }
260
+ .AForm_segmentMainTitle {
261
+ font-size: 19px;
262
+ font-weight: bold;
263
+ margin-right: 15px;
264
+ }
265
+ .AForm_segmentSubTitle {
266
+ font-size: 10px;
267
+ display: block;
268
+ }
269
+ .AForm_segmentTopRight {
270
+ margin-left: 10px;
271
+ float: right;
272
+ display: inline;
273
+ }
274
+ .MEditor_p .AForm_segment {
275
+ padding: 20px;
276
+ }
277
+
278
+ .ACnAddress_p div {
279
+ width: 50%;
280
+ }
281
+ .ACnAddress_p .backfill {
282
+ width: 100%;
283
+ }
284
+ .ACnAddress .AInputBox {
285
+ width: 50% !important;
286
+ }
287
+ .ACnAddress .AGB2260 {
288
+ width: 50% !important;
289
+ }
290
+
291
+ .AArray_addBtn {
292
+ margin-top: 10px;
293
+ text-align: center;
294
+ }
295
+ .AArray_item {
296
+ flex: 1;
297
+ margin-bottom: 5px;
298
+ }
299
+
300
+ .ATable .ant-table {
301
+ background: none;
302
+ }
303
+
304
+ .MEditor .kvSet_v {
305
+ display: inline;
306
+ }
307
+ .MEditor .kvSet_h {
308
+ display: inline-block;
309
+ white-space: nowrap;
310
+ }