@next-bricks/presentational 0.2.0 → 0.3.1

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 (66) hide show
  1. package/dist/bricks.json +8 -2
  2. package/dist/chunks/{1646.1b2b1f78.js → 1646.676c5e05.js} +2 -2
  3. package/dist/chunks/{1646.1b2b1f78.js.map → 1646.676c5e05.js.map} +1 -1
  4. package/dist/chunks/2188.a2e126be.js +2 -0
  5. package/dist/chunks/2188.a2e126be.js.map +1 -0
  6. package/dist/chunks/2618.dba17012.js +2 -0
  7. package/dist/chunks/2618.dba17012.js.map +1 -0
  8. package/dist/chunks/3494.fe060414.js +2 -0
  9. package/dist/chunks/{3494.84891647.js.map → 3494.fe060414.js.map} +1 -1
  10. package/dist/chunks/4131.f0c0719c.js +2 -0
  11. package/dist/chunks/4131.f0c0719c.js.map +1 -0
  12. package/dist/chunks/4717.0a332514.js +2 -0
  13. package/dist/chunks/4717.0a332514.js.map +1 -0
  14. package/dist/chunks/4791.c2fe7889.js +2 -0
  15. package/dist/chunks/4791.c2fe7889.js.map +1 -0
  16. package/dist/chunks/5636.da9df68d.js +2 -0
  17. package/dist/chunks/5636.da9df68d.js.map +1 -0
  18. package/dist/chunks/5939.90677f2b.js +3 -0
  19. package/dist/chunks/5939.90677f2b.js.LICENSE.txt +14 -0
  20. package/dist/chunks/5939.90677f2b.js.map +1 -0
  21. package/dist/chunks/7746.35d6fad6.js +2 -0
  22. package/dist/chunks/{7746.f9981ee0.js.map → 7746.35d6fad6.js.map} +1 -1
  23. package/dist/chunks/7822.2a73ff6a.js +2 -0
  24. package/dist/chunks/{7822.035ae6c9.js.map → 7822.2a73ff6a.js.map} +1 -1
  25. package/dist/chunks/9549.cbddb484.js +2 -0
  26. package/dist/chunks/9549.cbddb484.js.map +1 -0
  27. package/dist/chunks/code-display.868bcfb3.js +2 -0
  28. package/dist/chunks/code-display.868bcfb3.js.map +1 -0
  29. package/dist/chunks/general-alert.0364e2e1.js +3 -0
  30. package/dist/chunks/{general-alert.45feb86c.js.map → general-alert.0364e2e1.js.map} +1 -1
  31. package/dist/chunks/general-descriptions.1f9eb383.js +3 -0
  32. package/dist/chunks/{general-descriptions.eeaba6b9.js.map → general-descriptions.1f9eb383.js.map} +1 -1
  33. package/dist/chunks/main.58f0f46a.js +2 -0
  34. package/dist/chunks/main.58f0f46a.js.map +1 -0
  35. package/dist/index.dd382278.js +2 -0
  36. package/dist/index.dd382278.js.map +1 -0
  37. package/dist/manifest.json +51 -0
  38. package/dist/types.json +198 -141
  39. package/dist-types/bootstrap.d.ts +1 -0
  40. package/dist-types/code-display/i18n.d.ts +13 -0
  41. package/dist-types/code-display/index.d.ts +54 -0
  42. package/dist-types/code-display/index.spec.d.ts +1 -0
  43. package/docs/code-display.md +19 -0
  44. package/package.json +3 -3
  45. package/dist/chunks/2993.b7a673be.js +0 -2
  46. package/dist/chunks/2993.b7a673be.js.map +0 -1
  47. package/dist/chunks/3494.84891647.js +0 -2
  48. package/dist/chunks/4131.2bf7a912.js +0 -2
  49. package/dist/chunks/4131.2bf7a912.js.map +0 -1
  50. package/dist/chunks/4717.c43a82f7.js +0 -2
  51. package/dist/chunks/4717.c43a82f7.js.map +0 -1
  52. package/dist/chunks/4823.5d7d9ee5.js +0 -3
  53. package/dist/chunks/4823.5d7d9ee5.js.map +0 -1
  54. package/dist/chunks/7746.f9981ee0.js +0 -2
  55. package/dist/chunks/7822.035ae6c9.js +0 -2
  56. package/dist/chunks/9549.e948586a.js +0 -2
  57. package/dist/chunks/9549.e948586a.js.map +0 -1
  58. package/dist/chunks/general-alert.45feb86c.js +0 -3
  59. package/dist/chunks/general-descriptions.eeaba6b9.js +0 -3
  60. package/dist/chunks/general-descriptions.eeaba6b9.js.LICENSE.txt +0 -5
  61. package/dist/chunks/main.24d9f2b5.js +0 -2
  62. package/dist/chunks/main.24d9f2b5.js.map +0 -1
  63. package/dist/index.6544e1fa.js +0 -2
  64. package/dist/index.6544e1fa.js.map +0 -1
  65. /package/dist/chunks/{4823.5d7d9ee5.js.LICENSE.txt → general-alert.0364e2e1.js.LICENSE.txt} +0 -0
  66. /package/dist/chunks/{general-alert.45feb86c.js.LICENSE.txt → general-descriptions.1f9eb383.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -3,82 +3,58 @@
3
3
  "properties": [
4
4
  {
5
5
  "name": "descriptionTitle",
6
- "types": {
7
- "type": "union",
8
- "types": [
9
- {
10
- "type": "keyword",
11
- "value": "string"
12
- }
13
- ]
6
+ "annotation": {
7
+ "type": "keyword",
8
+ "value": "string"
14
9
  }
15
10
  },
16
11
  {
17
12
  "name": "list",
18
- "types": {
19
- "type": "union",
20
- "types": [
21
- {
22
- "type": "array",
23
- "elementType": {
24
- "type": "reference",
25
- "typeName": "DescriptionItem"
26
- }
13
+ "annotation": {
14
+ "type": "array",
15
+ "elementType": {
16
+ "type": "reference",
17
+ "typeName": {
18
+ "type": "identifier",
19
+ "name": "DescriptionItem"
27
20
  }
28
- ]
21
+ }
29
22
  }
30
23
  },
31
24
  {
32
25
  "name": "showCard",
33
- "types": {
34
- "type": "union",
35
- "types": [
36
- {
37
- "type": "keyword",
38
- "value": "boolean"
39
- }
40
- ]
26
+ "annotation": {
27
+ "type": "keyword",
28
+ "value": "boolean"
41
29
  }
42
30
  },
43
31
  {
44
32
  "name": "column",
45
- "types": {
46
- "type": "union",
47
- "types": [
48
- {
49
- "type": "keyword",
50
- "value": "number"
51
- }
52
- ]
33
+ "annotation": {
34
+ "type": "keyword",
35
+ "value": "number"
53
36
  }
54
37
  },
55
38
  {
56
39
  "name": "layout",
57
- "types": {
58
- "type": "union",
59
- "types": [
60
- {
61
- "type": "reference",
62
- "typeName": "Layout"
63
- }
64
- ]
40
+ "annotation": {
41
+ "type": "reference",
42
+ "typeName": {
43
+ "type": "identifier",
44
+ "name": "Layout"
45
+ }
65
46
  }
66
47
  },
67
48
  {
68
49
  "name": "bordered",
69
- "types": {
70
- "type": "union",
71
- "types": [
72
- {
73
- "type": "keyword",
74
- "value": "boolean"
75
- }
76
- ]
50
+ "annotation": {
51
+ "type": "keyword",
52
+ "value": "boolean"
77
53
  }
78
54
  },
79
55
  {
80
56
  "name": "hideGroups",
81
- "types": {
57
+ "annotation": {
82
58
  "type": "union",
83
59
  "types": [
84
60
  {
@@ -97,60 +73,80 @@
97
73
  },
98
74
  {
99
75
  "name": "dataSource",
100
- "types": {
101
- "type": "union",
102
- "types": [
103
- {
104
- "type": "reference",
105
- "typeName": "Record",
106
- "typeParameters": [
107
- {
108
- "type": "keyword",
109
- "value": "string"
110
- },
111
- {
112
- "type": "keyword",
113
- "value": "any"
114
- }
115
- ]
116
- }
117
- ]
76
+ "annotation": {
77
+ "type": "reference",
78
+ "typeName": {
79
+ "type": "identifier",
80
+ "name": "Record"
81
+ },
82
+ "typeParameters": {
83
+ "type": "typeParameterInstantiation",
84
+ "params": [
85
+ {
86
+ "type": "keyword",
87
+ "value": "string"
88
+ },
89
+ {
90
+ "type": "keyword",
91
+ "value": "unknown"
92
+ }
93
+ ]
94
+ }
118
95
  }
119
96
  }
120
97
  ],
98
+ "events": [],
99
+ "methods": [],
121
100
  "types": [
122
101
  {
123
- "name": "DescriptionItem",
124
102
  "type": "interface",
125
- "annotation": [
103
+ "name": "DescriptionItem",
104
+ "body": [
126
105
  {
127
106
  "type": "propertySignature",
128
- "name": "label",
129
- "property": {
107
+ "key": {
108
+ "type": "identifier",
109
+ "name": "label"
110
+ },
111
+ "annotation": {
130
112
  "type": "keyword",
131
113
  "value": "string"
132
- }
114
+ },
115
+ "computed": false
133
116
  },
134
117
  {
135
118
  "type": "propertySignature",
136
- "name": "field",
137
- "property": {
119
+ "key": {
120
+ "type": "identifier",
121
+ "name": "field"
122
+ },
123
+ "annotation": {
138
124
  "type": "keyword",
139
125
  "value": "string"
140
- }
126
+ },
127
+ "optional": true,
128
+ "computed": false
141
129
  },
142
130
  {
143
131
  "type": "propertySignature",
144
- "name": "group",
145
- "property": {
132
+ "key": {
133
+ "type": "identifier",
134
+ "name": "group"
135
+ },
136
+ "annotation": {
146
137
  "type": "keyword",
147
138
  "value": "string"
148
- }
139
+ },
140
+ "optional": true,
141
+ "computed": false
149
142
  },
150
143
  {
151
144
  "type": "propertySignature",
152
- "name": "text",
153
- "property": {
145
+ "key": {
146
+ "type": "identifier",
147
+ "name": "text"
148
+ },
149
+ "annotation": {
154
150
  "type": "union",
155
151
  "types": [
156
152
  {
@@ -162,30 +158,40 @@
162
158
  "value": "number"
163
159
  }
164
160
  ]
165
- }
161
+ },
162
+ "optional": true,
163
+ "computed": false
166
164
  },
167
165
  {
168
166
  "type": "propertySignature",
169
- "name": "useBrick",
170
- "property": {
167
+ "key": {
168
+ "type": "identifier",
169
+ "name": "useBrick"
170
+ },
171
+ "annotation": {
171
172
  "type": "reference",
172
- "typeName": "UseSingleBrickConf"
173
- }
173
+ "typeName": {
174
+ "type": "identifier",
175
+ "name": "UseSingleBrickConf"
176
+ }
177
+ },
178
+ "optional": true,
179
+ "computed": false
174
180
  }
175
181
  ]
176
182
  },
177
183
  {
178
- "name": "Layout",
179
184
  "type": "typeAlias",
185
+ "name": "Layout",
180
186
  "annotation": {
181
187
  "type": "union",
182
188
  "types": [
183
189
  {
184
- "type": "literal",
190
+ "type": "jsLiteral",
185
191
  "value": "horizontal"
186
192
  },
187
193
  {
188
- "type": "literal",
194
+ "type": "jsLiteral",
189
195
  "value": "vertical"
190
196
  }
191
197
  ]
@@ -197,107 +203,158 @@
197
203
  "properties": [
198
204
  {
199
205
  "name": "type",
200
- "types": {
206
+ "annotation": {
201
207
  "type": "reference",
202
- "typeName": "AlertType"
208
+ "typeName": {
209
+ "type": "identifier",
210
+ "name": "AlertType"
211
+ }
203
212
  }
204
213
  },
205
214
  {
206
215
  "name": "hasTitle",
207
- "types": {
208
- "type": "union",
209
- "types": [
210
- {
211
- "type": "keyword",
212
- "value": "boolean"
213
- }
214
- ]
216
+ "annotation": {
217
+ "type": "keyword",
218
+ "value": "boolean"
215
219
  }
216
220
  },
217
221
  {
218
222
  "name": "closable",
219
- "types": {
220
- "type": "union",
221
- "types": [
222
- {
223
- "type": "keyword",
224
- "value": "boolean"
225
- }
226
- ]
223
+ "annotation": {
224
+ "type": "keyword",
225
+ "value": "boolean"
227
226
  }
228
227
  },
229
228
  {
230
229
  "name": "localStorageKey",
231
- "types": {
232
- "type": "union",
233
- "types": [
234
- {
235
- "type": "keyword",
236
- "value": "string"
237
- }
238
- ]
230
+ "annotation": {
231
+ "type": "keyword",
232
+ "value": "string"
239
233
  }
240
234
  },
241
235
  {
242
236
  "name": "disableUrlNamespace",
243
- "types": {
244
- "type": "union",
245
- "types": [
246
- {
247
- "type": "keyword",
248
- "value": "boolean"
249
- }
250
- ]
237
+ "annotation": {
238
+ "type": "keyword",
239
+ "value": "boolean"
251
240
  }
252
241
  }
253
242
  ],
243
+ "events": [],
244
+ "methods": [],
254
245
  "types": [
255
246
  {
247
+ "type": "enum",
256
248
  "name": "AlertType",
257
- "type": "enums",
258
249
  "members": [
259
250
  {
260
- "name": {
261
- "type": "stringLiteral",
251
+ "type": "enumMember",
252
+ "id": {
253
+ "type": "jsLiteral",
262
254
  "value": "SUCCESS"
263
255
  },
264
- "value": {
265
- "type": "stringLiteral",
256
+ "initializer": {
257
+ "type": "jsLiteral",
266
258
  "value": "success"
267
259
  }
268
260
  },
269
261
  {
270
- "name": {
271
- "type": "stringLiteral",
262
+ "type": "enumMember",
263
+ "id": {
264
+ "type": "jsLiteral",
272
265
  "value": "INFO"
273
266
  },
274
- "value": {
275
- "type": "stringLiteral",
267
+ "initializer": {
268
+ "type": "jsLiteral",
276
269
  "value": "info"
277
270
  }
278
271
  },
279
272
  {
280
- "name": {
281
- "type": "stringLiteral",
273
+ "type": "enumMember",
274
+ "id": {
275
+ "type": "jsLiteral",
282
276
  "value": "WARNING"
283
277
  },
284
- "value": {
285
- "type": "stringLiteral",
278
+ "initializer": {
279
+ "type": "jsLiteral",
286
280
  "value": "warning"
287
281
  }
288
282
  },
289
283
  {
290
- "name": {
291
- "type": "stringLiteral",
284
+ "type": "enumMember",
285
+ "id": {
286
+ "type": "jsLiteral",
292
287
  "value": "ERROR"
293
288
  },
294
- "value": {
295
- "type": "stringLiteral",
289
+ "initializer": {
290
+ "type": "jsLiteral",
296
291
  "value": "error"
297
292
  }
298
293
  }
299
294
  ]
300
295
  }
301
296
  ]
297
+ },
298
+ "presentational.code-display": {
299
+ "properties": [
300
+ {
301
+ "name": "value",
302
+ "annotation": {
303
+ "type": "keyword",
304
+ "value": "string"
305
+ }
306
+ },
307
+ {
308
+ "name": "language",
309
+ "annotation": {
310
+ "type": "keyword",
311
+ "value": "string"
312
+ }
313
+ },
314
+ {
315
+ "name": "hideLineNumber",
316
+ "annotation": {
317
+ "type": "keyword",
318
+ "value": "boolean"
319
+ }
320
+ },
321
+ {
322
+ "name": "maxLines",
323
+ "annotation": {
324
+ "type": "keyword",
325
+ "value": "number"
326
+ }
327
+ },
328
+ {
329
+ "name": "minLines",
330
+ "annotation": {
331
+ "type": "keyword",
332
+ "value": "number"
333
+ }
334
+ },
335
+ {
336
+ "name": "showCopyButton",
337
+ "annotation": {
338
+ "type": "keyword",
339
+ "value": "boolean"
340
+ }
341
+ },
342
+ {
343
+ "name": "showExportButton",
344
+ "annotation": {
345
+ "type": "keyword",
346
+ "value": "boolean"
347
+ }
348
+ },
349
+ {
350
+ "name": "exportFileName",
351
+ "annotation": {
352
+ "type": "keyword",
353
+ "value": "string"
354
+ }
355
+ }
356
+ ],
357
+ "events": [],
358
+ "methods": []
302
359
  }
303
360
  }
@@ -1,2 +1,3 @@
1
1
  import "./descriptions/index.js";
2
2
  import "./general-alert/index.js";
3
+ import "./code-display/index.js";
@@ -0,0 +1,13 @@
1
+ export declare enum K {
2
+ COPY_SUCCESS = "COPY_SUCCESS",
3
+ COPY_FAILED = "COPY_FAILED"
4
+ }
5
+ export declare const NS = "bricks/presentational/code-display";
6
+ export declare const locales: {
7
+ en: Locale;
8
+ zh: Locale;
9
+ };
10
+ type Locale = {
11
+ [key in K]: string;
12
+ };
13
+ export {};
@@ -0,0 +1,54 @@
1
+ /// <reference types="react" />
2
+ import { ReactNextElement } from "@next-core/react-element";
3
+ import "@next-core/theme";
4
+ import "prismjs/plugins/line-numbers/prism-line-numbers.js";
5
+ export interface CodeDisplayProps {
6
+ value?: string;
7
+ language?: string;
8
+ hideLineNumber?: boolean;
9
+ maxLines?: number;
10
+ minLines?: number;
11
+ showCopyButton?: boolean;
12
+ showExportButton?: boolean;
13
+ exportFileName?: string;
14
+ }
15
+ /**
16
+ * 代码展示
17
+ */
18
+ export declare class CodeDisplay extends ReactNextElement implements CodeDisplayProps {
19
+ /**
20
+ * 代码内容
21
+ */
22
+ accessor value: string | undefined;
23
+ /**
24
+ * 语言,具体查阅 [Supported languages](https://prismjs.com/#supported-languages)
25
+ */
26
+ accessor language: string | undefined;
27
+ /**
28
+ * 是否隐藏行号
29
+ */
30
+ accessor hideLineNumber: boolean | undefined;
31
+ /**
32
+ * 最大行数
33
+ */
34
+ accessor maxLines: number | undefined;
35
+ /**
36
+ * 最小行数
37
+ */
38
+ accessor minLines: number | undefined;
39
+ /**
40
+ * 是否显示复制按钮
41
+ */
42
+ accessor showCopyButton: boolean;
43
+ /**
44
+ * 是否显示导出按钮
45
+ */
46
+ accessor showExportButton: boolean | undefined;
47
+ /**
48
+ * 导出的文件名
49
+ * @default download.txt
50
+ */
51
+ accessor exportFileName: string | undefined;
52
+ render(): JSX.Element;
53
+ }
54
+ export declare function CodeDisplayComponent(props: CodeDisplayProps): JSX.Element;
@@ -0,0 +1 @@
1
+ import "./";
@@ -0,0 +1,19 @@
1
+ 代码展示
2
+
3
+ ## Examples
4
+
5
+ ### Basic
6
+
7
+ ```yaml preview
8
+ - brick: presentational.code-display
9
+ properties:
10
+ language: javascript
11
+ value: |
12
+ function onSubmit (e) {
13
+ const fn = () => 123;
14
+ const job = {
15
+ title: 'Developer',
16
+ company: 'Facebook'
17
+ };
18
+ }
19
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/presentational",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/presentational",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,8 +34,8 @@
34
34
  "postpublish": "mv package.json.bak package.json"
35
35
  },
36
36
  "devDependencies": {
37
- "@next-core/build-next-bricks": "^1.10.0",
37
+ "@next-core/build-next-bricks": "^1.12.0",
38
38
  "@next-core/test-next": "^1.0.6"
39
39
  },
40
- "gitHead": "d24d177295f0f3edbf6d28b1d9b6ae87c2f506ec"
40
+ "gitHead": "e0be55e5d98d72d58a8ae382fb70123977c0bf2f"
41
41
  }