@beseif-solutions/prow-core 0.3.11 → 0.3.12

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.
@@ -102,8 +102,10 @@ export type SelectFieldChoice<Values = string | number | boolean | File, Extend
102
102
  key: string;
103
103
  value: Values;
104
104
  } & Extend;
105
+ declare const RICH_TEXT_PROPS: readonly ["bold", "italic", "underline", "strike", "code", "heading", "blockquote", "codeBlock", "bulletList", "orderedList", "horizontalRule", "hardBreak"];
105
106
  type CustomDisplayTextField = {
106
107
  format: `textarea` | `rich-text` | `markdown`;
108
+ props?: typeof RICH_TEXT_PROPS[number][];
107
109
  };
108
110
  type IDETextField = {
109
111
  format: `code`;
@@ -9,6 +9,20 @@ const lodash_1 = __importDefault(require("lodash"));
9
9
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
10
10
  const context_1 = __importDefault(require("./context"));
11
11
  const where_1 = require("./where");
12
+ const RICH_TEXT_PROPS = [
13
+ `bold`,
14
+ `italic`,
15
+ `underline`,
16
+ `strike`,
17
+ `code`,
18
+ `heading`,
19
+ `blockquote`,
20
+ `codeBlock`,
21
+ `bulletList`,
22
+ `orderedList`,
23
+ `horizontalRule`,
24
+ `hardBreak`,
25
+ ];
12
26
  const conditionSchema = () => joi_1.default.object({
13
27
  condition: joi_1.default.object().required(),
14
28
  overrides: joi_1.default.object().required(),
@@ -93,6 +107,11 @@ const stringInputFieldSchema = () => joi_1.default.object({
93
107
  then: joi_1.default.string(),
94
108
  otherwise: joi_1.default.forbidden(),
95
109
  }),
110
+ props: joi_1.default.when(`format`, {
111
+ is: joi_1.default.valid(`textarea`, `markdown`, `rich-text`),
112
+ then: joi_1.default.array().items(joi_1.default.string().valid(...RICH_TEXT_PROPS)),
113
+ otherwise: joi_1.default.forbidden(),
114
+ }),
96
115
  }));
97
116
  const numberInputFieldSchema = () => joi_1.default.object({
98
117
  default: defaultSchema(joi_1.default.number()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beseif-solutions/prow-core",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Prow core functionalities and classes",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -156,8 +156,24 @@ export type SelectFieldChoice<Values = string | number | boolean | File, Extend
156
156
  } & Extend;
157
157
 
158
158
  /* custom display configuration */
159
+ const RICH_TEXT_PROPS = [
160
+ `bold`,
161
+ `italic`,
162
+ `underline`,
163
+ `strike`,
164
+ `code`,
165
+ `heading`,
166
+ `blockquote`,
167
+ `codeBlock`,
168
+ `bulletList`,
169
+ `orderedList`,
170
+ `horizontalRule`,
171
+ `hardBreak`,
172
+ ] as const;
173
+
159
174
  type CustomDisplayTextField = {
160
175
  format: `textarea` | `rich-text` | `markdown`,
176
+ props?: typeof RICH_TEXT_PROPS[number][];
161
177
  };
162
178
 
163
179
  type IDETextField = {
@@ -291,6 +307,13 @@ const stringInputFieldSchema = () =>
291
307
  then: Joi.string(),
292
308
  otherwise: Joi.forbidden(),
293
309
  }),
310
+ props: Joi.when(`format`, {
311
+ is: Joi.valid(`textarea`, `markdown`, `rich-text`),
312
+ then: Joi.array().items(
313
+ Joi.string().valid(...RICH_TEXT_PROPS)
314
+ ),
315
+ otherwise: Joi.forbidden(),
316
+ }),
294
317
  })
295
318
  );
296
319