iguazio.dashboard-react-controls 2.0.12 → 2.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.
|
@@ -263,7 +263,8 @@ const FormChipCell = _ref => {
|
|
|
263
263
|
const validateChip = _ref3 => {
|
|
264
264
|
let {
|
|
265
265
|
key,
|
|
266
|
-
value
|
|
266
|
+
value,
|
|
267
|
+
disabled
|
|
267
268
|
} = _ref3;
|
|
268
269
|
const validateField = (value, field) => {
|
|
269
270
|
const [newRules, isValidField] = (0, _validation.checkPatternsValidity)(validationRules[field].filter(rule => rule.pattern), value);
|
|
@@ -274,7 +275,7 @@ const FormChipCell = _ref => {
|
|
|
274
275
|
label: rule.label
|
|
275
276
|
}));
|
|
276
277
|
};
|
|
277
|
-
return [validateField(key, 'key'), validateField(value, 'value')];
|
|
278
|
+
return disabled ? [null, null] : [validateField(key, 'key'), validateField(value, 'value')];
|
|
278
279
|
};
|
|
279
280
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
280
281
|
className: chipsClassName,
|
package/dist/scss/mixins.scss
CHANGED
|
@@ -91,13 +91,19 @@
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
@mixin statusState($color) {
|
|
94
|
+
@mixin statusState($color, $bordered) {
|
|
95
95
|
display: inline-block;
|
|
96
96
|
width: 8px;
|
|
97
97
|
height: 8px;
|
|
98
98
|
min-width: 8px;
|
|
99
|
-
background-color: $color;
|
|
100
99
|
border-radius: 50%;
|
|
100
|
+
|
|
101
|
+
@if $bordered == true {
|
|
102
|
+
background-color: transparent;
|
|
103
|
+
border: 1.5px solid $color;
|
|
104
|
+
} @else {
|
|
105
|
+
background-color: $color;
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
@mixin chipFont($color) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.required = exports.getValidationRules = exports.checkPatternsValidityAsync = exports.checkPatternsValidity = void 0;
|
|
6
|
+
exports.required = exports.getValidationRules = exports.getInternalLabelsValidationRule = exports.checkPatternsValidityAsync = exports.checkPatternsValidity = void 0;
|
|
7
7
|
var _lodash = _interopRequireWildcard(require("lodash"));
|
|
8
8
|
var _constants = require("../constants");
|
|
9
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -224,15 +224,6 @@ const generateRule = {
|
|
|
224
224
|
label: _constants.validation.REQUIRED.LABEL,
|
|
225
225
|
pattern: new RegExp('\\S')
|
|
226
226
|
};
|
|
227
|
-
},
|
|
228
|
-
checkForValidCustomLabels: internalLabels => {
|
|
229
|
-
return {
|
|
230
|
-
name: 'customLabels',
|
|
231
|
-
label: 'System-defined labels cannot be modified.',
|
|
232
|
-
pattern: value => {
|
|
233
|
-
return !internalLabels.includes(value);
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
227
|
}
|
|
237
228
|
};
|
|
238
229
|
const commonRules = {
|
|
@@ -325,15 +316,14 @@ const validationRules = {
|
|
|
325
316
|
tag: [generateRule.validCharacters('a-z A-Z 0-9 - _ .'), generateRule.beginEndWith('a-z A-Z 0-9'), generateRule.length({
|
|
326
317
|
max: 56
|
|
327
318
|
})],
|
|
328
|
-
combobox: [generateRule.required()]
|
|
329
|
-
labels: [internalLabels => generateRule.checkForValidCustomLabels(internalLabels)]
|
|
319
|
+
combobox: [generateRule.required()]
|
|
330
320
|
},
|
|
331
321
|
project: {
|
|
332
322
|
name: [generateRule.validCharacters('a-z 0-9 -'), generateRule.beginWith('a-z'), generateRule.endWith('a-z 0-9'), generateRule.length({
|
|
333
323
|
max: 63
|
|
334
324
|
}), generateRule.required()],
|
|
335
325
|
labels: {
|
|
336
|
-
key:
|
|
326
|
+
key: commonRules.k8sLabels.key,
|
|
337
327
|
value: commonRules.k8sLabels.value
|
|
338
328
|
},
|
|
339
329
|
params: {
|
|
@@ -360,7 +350,7 @@ const validationRules = {
|
|
|
360
350
|
label: {
|
|
361
351
|
key: [generateRule.validCharactersWithPrefix('a-z A-Z 0-9 - _ .'), generateRule.beginEndWith('a-z A-Z 0-9'), generateRule.length({
|
|
362
352
|
max: 75
|
|
363
|
-
})
|
|
353
|
+
})],
|
|
364
354
|
value: generateRule.length({
|
|
365
355
|
max: 255
|
|
366
356
|
})
|
|
@@ -372,16 +362,27 @@ const validationRules = {
|
|
|
372
362
|
* Returns the list of validation rules for `type`, optionally appending provided additional rules.
|
|
373
363
|
* @function getValidationRules
|
|
374
364
|
* @param {string} type - The property path to the list of validation rules.
|
|
375
|
-
* @param {Array.<Object>} [additionalRules] - Additional rules to append.
|
|
376
|
-
* @param {Array.<Object>} [customData] - Additional data to be passed to the custom rule functions.
|
|
365
|
+
* @param {Array.<Object> | Object} [additionalRules] - Additional rules or rule to append.
|
|
377
366
|
* @returns {Array.<Object>} The rule list of type `type` with `additionalRules` appended to it if provided.
|
|
378
367
|
*/
|
|
379
|
-
const getValidationRules = (type, additionalRules
|
|
380
|
-
return _lodash.default.chain(validationRules).get(type).defaultTo([]).cloneDeep().
|
|
381
|
-
|
|
382
|
-
|
|
368
|
+
const getValidationRules = (type, additionalRules) => {
|
|
369
|
+
return _lodash.default.chain(validationRules).get(type).defaultTo([]).cloneDeep().concat(_lodash.default.defaultTo(additionalRules, [])).value();
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Creates a validation rule to ensure system-defined labels cannot be modified.
|
|
374
|
+
* @function getInternalLabelsValidationRule
|
|
375
|
+
* @param {string} internalLabels - An array of defined labels that should not be modified.
|
|
376
|
+
* @returns {Object} The rule that checks if a value is not in the internal labels.
|
|
377
|
+
*/
|
|
378
|
+
exports.getValidationRules = getValidationRules;
|
|
379
|
+
const getInternalLabelsValidationRule = internalLabels => {
|
|
380
|
+
return {
|
|
381
|
+
name: 'customLabels',
|
|
382
|
+
label: 'System-defined labels cannot be modified.',
|
|
383
|
+
pattern: value => {
|
|
384
|
+
return !internalLabels.includes(value);
|
|
383
385
|
}
|
|
384
|
-
|
|
385
|
-
}).concat(_lodash.default.defaultTo(additionalRules, [])).value();
|
|
386
|
+
};
|
|
386
387
|
};
|
|
387
|
-
exports.
|
|
388
|
+
exports.getInternalLabelsValidationRule = getInternalLabelsValidationRule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iguazio.dashboard-react-controls",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|