@bigbinary/neeto-fields-frontend 1.1.7 → 1.1.8
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/dist/index.cjs.js +636 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +637 -30
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs.js
CHANGED
|
@@ -5285,7 +5285,7 @@ var titles = {
|
|
|
5285
5285
|
field_other: "Fields",
|
|
5286
5286
|
addField: "Add new field",
|
|
5287
5287
|
editField: "Edit field",
|
|
5288
|
-
deleteField: "Delete field
|
|
5288
|
+
deleteField: "Delete field?",
|
|
5289
5289
|
fieldName: "Field name",
|
|
5290
5290
|
fieldKind: "Field type",
|
|
5291
5291
|
required: "Required",
|
|
@@ -5342,7 +5342,8 @@ var fields = {
|
|
|
5342
5342
|
};
|
|
5343
5343
|
var messages = {
|
|
5344
5344
|
noFields: "There are no {{title}} to show",
|
|
5345
|
-
confirmDelete: "
|
|
5345
|
+
confirmDelete: "You are permanently deleting the field <strong>{{name}}</strong>. This action can't be undone.",
|
|
5346
|
+
confirmDeleteWithCount: "You are permanently deleting the field <strong>{{name}}</strong> which holds values for <strong>{{count}} {{resource}}</strong>. The values will be lost on deleting the field. This action can't be undone.",
|
|
5346
5347
|
manageFieldFor: "Manage fields for {{resource}}",
|
|
5347
5348
|
manageTitleForResource: "Manage {{title}} for {{resource}}",
|
|
5348
5349
|
titleForResource: "{{title}} for {{resource}}",
|
|
@@ -6402,6 +6403,7 @@ var FIELDS_URL = "".concat(NEETO_FIELDS_URL, "/fields");
|
|
|
6402
6403
|
var FIELD_VALUES_URL = "".concat(NEETO_FIELDS_URL, "/field_values");
|
|
6403
6404
|
var FIELD_VALUE_URL = "".concat(NEETO_FIELDS_URL, "/field_values/:fieldValueId");
|
|
6404
6405
|
var FIELD_URL = "".concat(NEETO_FIELDS_URL, "/fields/:fieldId");
|
|
6406
|
+
var DEPENDENCIES_URL = "".concat(NEETO_FIELDS_URL, "/fields/:fieldId/dependencies");
|
|
6405
6407
|
var FIELDS_REORDER_URL = "".concat(FIELDS_URL, "/reorder");
|
|
6406
6408
|
var CONFIGS_URL = "".concat(NEETO_FIELDS_URL, "/configs");
|
|
6407
6409
|
var SINGULAR = {
|
|
@@ -6431,6 +6433,11 @@ var fieldUrl = function fieldUrl(fieldId) {
|
|
|
6431
6433
|
fieldId: fieldId
|
|
6432
6434
|
});
|
|
6433
6435
|
};
|
|
6436
|
+
var dependenciesUrl = function dependenciesUrl(fieldId) {
|
|
6437
|
+
return utils.buildUrl(DEPENDENCIES_URL, {
|
|
6438
|
+
fieldId: fieldId
|
|
6439
|
+
});
|
|
6440
|
+
};
|
|
6434
6441
|
var fetch$1 = function fetch(_ref) {
|
|
6435
6442
|
var resourceType = _ref.resourceType,
|
|
6436
6443
|
ownerId = _ref.ownerId,
|
|
@@ -6474,25 +6481,37 @@ var update$1 = function update(_ref4) {
|
|
|
6474
6481
|
var reorder = function reorder(payload) {
|
|
6475
6482
|
return axios__default["default"].patch(FIELDS_REORDER_URL, payload);
|
|
6476
6483
|
};
|
|
6484
|
+
var dependencies = function dependencies(_ref5) {
|
|
6485
|
+
var fieldId = _ref5.fieldId,
|
|
6486
|
+
ownerId = _ref5.ownerId;
|
|
6487
|
+
return axios__default["default"].get(dependenciesUrl(fieldId), {
|
|
6488
|
+
params: {
|
|
6489
|
+
ownerId: ownerId
|
|
6490
|
+
}
|
|
6491
|
+
});
|
|
6492
|
+
};
|
|
6477
6493
|
var fieldsApi = {
|
|
6478
6494
|
fetch: fetch$1,
|
|
6479
6495
|
create: create$1,
|
|
6480
6496
|
show: show,
|
|
6481
6497
|
destroy: destroy$1,
|
|
6482
6498
|
update: update$1,
|
|
6483
|
-
reorder: reorder
|
|
6499
|
+
reorder: reorder,
|
|
6500
|
+
dependencies: dependencies
|
|
6484
6501
|
};
|
|
6485
6502
|
|
|
6486
6503
|
var QUERY_KEYS = {
|
|
6487
6504
|
FIELDS: "fields",
|
|
6488
6505
|
FIELD_VALUES: "field_values",
|
|
6489
|
-
CONFIGS: "configurations"
|
|
6506
|
+
CONFIGS: "configurations",
|
|
6507
|
+
DEPENDENCIES: "dependencies"
|
|
6490
6508
|
};
|
|
6491
6509
|
var DEFAULT_STALE_TIME = 3600000; // 1 hour
|
|
6492
6510
|
|
|
6493
6511
|
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6494
6512
|
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6495
|
-
var FIELDS = QUERY_KEYS.FIELDS
|
|
6513
|
+
var FIELDS = QUERY_KEYS.FIELDS,
|
|
6514
|
+
DEPENDENCIES = QUERY_KEYS.DEPENDENCIES;
|
|
6496
6515
|
var useFetchFields = function useFetchFields(_ref, options) {
|
|
6497
6516
|
var resourceType = _ref.resourceType,
|
|
6498
6517
|
ownerId = _ref.ownerId,
|
|
@@ -6535,6 +6554,16 @@ var useShowField = function useShowField(_ref2, options) {
|
|
|
6535
6554
|
});
|
|
6536
6555
|
}, options);
|
|
6537
6556
|
};
|
|
6557
|
+
var useFetchDependencies = function useFetchDependencies(_ref3, options) {
|
|
6558
|
+
var fieldId = _ref3.fieldId,
|
|
6559
|
+
ownerId = _ref3.ownerId;
|
|
6560
|
+
return reactQuery.useQuery([DEPENDENCIES, fieldId], function () {
|
|
6561
|
+
return fieldsApi.dependencies({
|
|
6562
|
+
fieldId: fieldId,
|
|
6563
|
+
ownerId: ownerId
|
|
6564
|
+
});
|
|
6565
|
+
}, options);
|
|
6566
|
+
};
|
|
6538
6567
|
var useUpdateField = function useUpdateField(options) {
|
|
6539
6568
|
var queryClient = reactQuery.useQueryClient();
|
|
6540
6569
|
return reactQuery.useMutation(fieldsApi.update, _objectSpread$8(_objectSpread$8({}, options), {}, {
|
|
@@ -7045,6 +7074,517 @@ var FieldsPane = function FieldsPane(_ref) {
|
|
|
7045
7074
|
}, props)));
|
|
7046
7075
|
};
|
|
7047
7076
|
|
|
7077
|
+
function commonjsRequire(path) {
|
|
7078
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
7079
|
+
}
|
|
7080
|
+
|
|
7081
|
+
var pluralize$1 = {exports: {}};
|
|
7082
|
+
|
|
7083
|
+
/* global define */
|
|
7084
|
+
pluralize$1.exports;
|
|
7085
|
+
|
|
7086
|
+
(function (module, exports) {
|
|
7087
|
+
(function (root, pluralize) {
|
|
7088
|
+
/* istanbul ignore else */
|
|
7089
|
+
if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') {
|
|
7090
|
+
// Node.
|
|
7091
|
+
module.exports = pluralize();
|
|
7092
|
+
} else {
|
|
7093
|
+
// Browser global.
|
|
7094
|
+
root.pluralize = pluralize();
|
|
7095
|
+
}
|
|
7096
|
+
})(commonjsGlobal, function () {
|
|
7097
|
+
// Rule storage - pluralize and singularize need to be run sequentially,
|
|
7098
|
+
// while other rules can be optimized using an object for instant lookups.
|
|
7099
|
+
var pluralRules = [];
|
|
7100
|
+
var singularRules = [];
|
|
7101
|
+
var uncountables = {};
|
|
7102
|
+
var irregularPlurals = {};
|
|
7103
|
+
var irregularSingles = {};
|
|
7104
|
+
|
|
7105
|
+
/**
|
|
7106
|
+
* Sanitize a pluralization rule to a usable regular expression.
|
|
7107
|
+
*
|
|
7108
|
+
* @param {(RegExp|string)} rule
|
|
7109
|
+
* @return {RegExp}
|
|
7110
|
+
*/
|
|
7111
|
+
function sanitizeRule (rule) {
|
|
7112
|
+
if (typeof rule === 'string') {
|
|
7113
|
+
return new RegExp('^' + rule + '$', 'i');
|
|
7114
|
+
}
|
|
7115
|
+
|
|
7116
|
+
return rule;
|
|
7117
|
+
}
|
|
7118
|
+
|
|
7119
|
+
/**
|
|
7120
|
+
* Pass in a word token to produce a function that can replicate the case on
|
|
7121
|
+
* another word.
|
|
7122
|
+
*
|
|
7123
|
+
* @param {string} word
|
|
7124
|
+
* @param {string} token
|
|
7125
|
+
* @return {Function}
|
|
7126
|
+
*/
|
|
7127
|
+
function restoreCase (word, token) {
|
|
7128
|
+
// Tokens are an exact match.
|
|
7129
|
+
if (word === token) return token;
|
|
7130
|
+
|
|
7131
|
+
// Lower cased words. E.g. "hello".
|
|
7132
|
+
if (word === word.toLowerCase()) return token.toLowerCase();
|
|
7133
|
+
|
|
7134
|
+
// Upper cased words. E.g. "WHISKY".
|
|
7135
|
+
if (word === word.toUpperCase()) return token.toUpperCase();
|
|
7136
|
+
|
|
7137
|
+
// Title cased words. E.g. "Title".
|
|
7138
|
+
if (word[0] === word[0].toUpperCase()) {
|
|
7139
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
|
7140
|
+
}
|
|
7141
|
+
|
|
7142
|
+
// Lower cased words. E.g. "test".
|
|
7143
|
+
return token.toLowerCase();
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
/**
|
|
7147
|
+
* Interpolate a regexp string.
|
|
7148
|
+
*
|
|
7149
|
+
* @param {string} str
|
|
7150
|
+
* @param {Array} args
|
|
7151
|
+
* @return {string}
|
|
7152
|
+
*/
|
|
7153
|
+
function interpolate (str, args) {
|
|
7154
|
+
return str.replace(/\$(\d{1,2})/g, function (match, index) {
|
|
7155
|
+
return args[index] || '';
|
|
7156
|
+
});
|
|
7157
|
+
}
|
|
7158
|
+
|
|
7159
|
+
/**
|
|
7160
|
+
* Replace a word using a rule.
|
|
7161
|
+
*
|
|
7162
|
+
* @param {string} word
|
|
7163
|
+
* @param {Array} rule
|
|
7164
|
+
* @return {string}
|
|
7165
|
+
*/
|
|
7166
|
+
function replace (word, rule) {
|
|
7167
|
+
return word.replace(rule[0], function (match, index) {
|
|
7168
|
+
var result = interpolate(rule[1], arguments);
|
|
7169
|
+
|
|
7170
|
+
if (match === '') {
|
|
7171
|
+
return restoreCase(word[index - 1], result);
|
|
7172
|
+
}
|
|
7173
|
+
|
|
7174
|
+
return restoreCase(match, result);
|
|
7175
|
+
});
|
|
7176
|
+
}
|
|
7177
|
+
|
|
7178
|
+
/**
|
|
7179
|
+
* Sanitize a word by passing in the word and sanitization rules.
|
|
7180
|
+
*
|
|
7181
|
+
* @param {string} token
|
|
7182
|
+
* @param {string} word
|
|
7183
|
+
* @param {Array} rules
|
|
7184
|
+
* @return {string}
|
|
7185
|
+
*/
|
|
7186
|
+
function sanitizeWord (token, word, rules) {
|
|
7187
|
+
// Empty string or doesn't need fixing.
|
|
7188
|
+
if (!token.length || uncountables.hasOwnProperty(token)) {
|
|
7189
|
+
return word;
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
var len = rules.length;
|
|
7193
|
+
|
|
7194
|
+
// Iterate over the sanitization rules and use the first one to match.
|
|
7195
|
+
while (len--) {
|
|
7196
|
+
var rule = rules[len];
|
|
7197
|
+
|
|
7198
|
+
if (rule[0].test(word)) return replace(word, rule);
|
|
7199
|
+
}
|
|
7200
|
+
|
|
7201
|
+
return word;
|
|
7202
|
+
}
|
|
7203
|
+
|
|
7204
|
+
/**
|
|
7205
|
+
* Replace a word with the updated word.
|
|
7206
|
+
*
|
|
7207
|
+
* @param {Object} replaceMap
|
|
7208
|
+
* @param {Object} keepMap
|
|
7209
|
+
* @param {Array} rules
|
|
7210
|
+
* @return {Function}
|
|
7211
|
+
*/
|
|
7212
|
+
function replaceWord (replaceMap, keepMap, rules) {
|
|
7213
|
+
return function (word) {
|
|
7214
|
+
// Get the correct token and case restoration functions.
|
|
7215
|
+
var token = word.toLowerCase();
|
|
7216
|
+
|
|
7217
|
+
// Check against the keep object map.
|
|
7218
|
+
if (keepMap.hasOwnProperty(token)) {
|
|
7219
|
+
return restoreCase(word, token);
|
|
7220
|
+
}
|
|
7221
|
+
|
|
7222
|
+
// Check against the replacement map for a direct word replacement.
|
|
7223
|
+
if (replaceMap.hasOwnProperty(token)) {
|
|
7224
|
+
return restoreCase(word, replaceMap[token]);
|
|
7225
|
+
}
|
|
7226
|
+
|
|
7227
|
+
// Run all the rules against the word.
|
|
7228
|
+
return sanitizeWord(token, word, rules);
|
|
7229
|
+
};
|
|
7230
|
+
}
|
|
7231
|
+
|
|
7232
|
+
/**
|
|
7233
|
+
* Check if a word is part of the map.
|
|
7234
|
+
*/
|
|
7235
|
+
function checkWord (replaceMap, keepMap, rules, bool) {
|
|
7236
|
+
return function (word) {
|
|
7237
|
+
var token = word.toLowerCase();
|
|
7238
|
+
|
|
7239
|
+
if (keepMap.hasOwnProperty(token)) return true;
|
|
7240
|
+
if (replaceMap.hasOwnProperty(token)) return false;
|
|
7241
|
+
|
|
7242
|
+
return sanitizeWord(token, token, rules) === token;
|
|
7243
|
+
};
|
|
7244
|
+
}
|
|
7245
|
+
|
|
7246
|
+
/**
|
|
7247
|
+
* Pluralize or singularize a word based on the passed in count.
|
|
7248
|
+
*
|
|
7249
|
+
* @param {string} word The word to pluralize
|
|
7250
|
+
* @param {number} count How many of the word exist
|
|
7251
|
+
* @param {boolean} inclusive Whether to prefix with the number (e.g. 3 ducks)
|
|
7252
|
+
* @return {string}
|
|
7253
|
+
*/
|
|
7254
|
+
function pluralize (word, count, inclusive) {
|
|
7255
|
+
var pluralized = count === 1
|
|
7256
|
+
? pluralize.singular(word) : pluralize.plural(word);
|
|
7257
|
+
|
|
7258
|
+
return (inclusive ? count + ' ' : '') + pluralized;
|
|
7259
|
+
}
|
|
7260
|
+
|
|
7261
|
+
/**
|
|
7262
|
+
* Pluralize a word.
|
|
7263
|
+
*
|
|
7264
|
+
* @type {Function}
|
|
7265
|
+
*/
|
|
7266
|
+
pluralize.plural = replaceWord(
|
|
7267
|
+
irregularSingles, irregularPlurals, pluralRules
|
|
7268
|
+
);
|
|
7269
|
+
|
|
7270
|
+
/**
|
|
7271
|
+
* Check if a word is plural.
|
|
7272
|
+
*
|
|
7273
|
+
* @type {Function}
|
|
7274
|
+
*/
|
|
7275
|
+
pluralize.isPlural = checkWord(
|
|
7276
|
+
irregularSingles, irregularPlurals, pluralRules
|
|
7277
|
+
);
|
|
7278
|
+
|
|
7279
|
+
/**
|
|
7280
|
+
* Singularize a word.
|
|
7281
|
+
*
|
|
7282
|
+
* @type {Function}
|
|
7283
|
+
*/
|
|
7284
|
+
pluralize.singular = replaceWord(
|
|
7285
|
+
irregularPlurals, irregularSingles, singularRules
|
|
7286
|
+
);
|
|
7287
|
+
|
|
7288
|
+
/**
|
|
7289
|
+
* Check if a word is singular.
|
|
7290
|
+
*
|
|
7291
|
+
* @type {Function}
|
|
7292
|
+
*/
|
|
7293
|
+
pluralize.isSingular = checkWord(
|
|
7294
|
+
irregularPlurals, irregularSingles, singularRules
|
|
7295
|
+
);
|
|
7296
|
+
|
|
7297
|
+
/**
|
|
7298
|
+
* Add a pluralization rule to the collection.
|
|
7299
|
+
*
|
|
7300
|
+
* @param {(string|RegExp)} rule
|
|
7301
|
+
* @param {string} replacement
|
|
7302
|
+
*/
|
|
7303
|
+
pluralize.addPluralRule = function (rule, replacement) {
|
|
7304
|
+
pluralRules.push([sanitizeRule(rule), replacement]);
|
|
7305
|
+
};
|
|
7306
|
+
|
|
7307
|
+
/**
|
|
7308
|
+
* Add a singularization rule to the collection.
|
|
7309
|
+
*
|
|
7310
|
+
* @param {(string|RegExp)} rule
|
|
7311
|
+
* @param {string} replacement
|
|
7312
|
+
*/
|
|
7313
|
+
pluralize.addSingularRule = function (rule, replacement) {
|
|
7314
|
+
singularRules.push([sanitizeRule(rule), replacement]);
|
|
7315
|
+
};
|
|
7316
|
+
|
|
7317
|
+
/**
|
|
7318
|
+
* Add an uncountable word rule.
|
|
7319
|
+
*
|
|
7320
|
+
* @param {(string|RegExp)} word
|
|
7321
|
+
*/
|
|
7322
|
+
pluralize.addUncountableRule = function (word) {
|
|
7323
|
+
if (typeof word === 'string') {
|
|
7324
|
+
uncountables[word.toLowerCase()] = true;
|
|
7325
|
+
return;
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7328
|
+
// Set singular and plural references for the word.
|
|
7329
|
+
pluralize.addPluralRule(word, '$0');
|
|
7330
|
+
pluralize.addSingularRule(word, '$0');
|
|
7331
|
+
};
|
|
7332
|
+
|
|
7333
|
+
/**
|
|
7334
|
+
* Add an irregular word definition.
|
|
7335
|
+
*
|
|
7336
|
+
* @param {string} single
|
|
7337
|
+
* @param {string} plural
|
|
7338
|
+
*/
|
|
7339
|
+
pluralize.addIrregularRule = function (single, plural) {
|
|
7340
|
+
plural = plural.toLowerCase();
|
|
7341
|
+
single = single.toLowerCase();
|
|
7342
|
+
|
|
7343
|
+
irregularSingles[single] = plural;
|
|
7344
|
+
irregularPlurals[plural] = single;
|
|
7345
|
+
};
|
|
7346
|
+
|
|
7347
|
+
/**
|
|
7348
|
+
* Irregular rules.
|
|
7349
|
+
*/
|
|
7350
|
+
[
|
|
7351
|
+
// Pronouns.
|
|
7352
|
+
['I', 'we'],
|
|
7353
|
+
['me', 'us'],
|
|
7354
|
+
['he', 'they'],
|
|
7355
|
+
['she', 'they'],
|
|
7356
|
+
['them', 'them'],
|
|
7357
|
+
['myself', 'ourselves'],
|
|
7358
|
+
['yourself', 'yourselves'],
|
|
7359
|
+
['itself', 'themselves'],
|
|
7360
|
+
['herself', 'themselves'],
|
|
7361
|
+
['himself', 'themselves'],
|
|
7362
|
+
['themself', 'themselves'],
|
|
7363
|
+
['is', 'are'],
|
|
7364
|
+
['was', 'were'],
|
|
7365
|
+
['has', 'have'],
|
|
7366
|
+
['this', 'these'],
|
|
7367
|
+
['that', 'those'],
|
|
7368
|
+
// Words ending in with a consonant and `o`.
|
|
7369
|
+
['echo', 'echoes'],
|
|
7370
|
+
['dingo', 'dingoes'],
|
|
7371
|
+
['volcano', 'volcanoes'],
|
|
7372
|
+
['tornado', 'tornadoes'],
|
|
7373
|
+
['torpedo', 'torpedoes'],
|
|
7374
|
+
// Ends with `us`.
|
|
7375
|
+
['genus', 'genera'],
|
|
7376
|
+
['viscus', 'viscera'],
|
|
7377
|
+
// Ends with `ma`.
|
|
7378
|
+
['stigma', 'stigmata'],
|
|
7379
|
+
['stoma', 'stomata'],
|
|
7380
|
+
['dogma', 'dogmata'],
|
|
7381
|
+
['lemma', 'lemmata'],
|
|
7382
|
+
['schema', 'schemata'],
|
|
7383
|
+
['anathema', 'anathemata'],
|
|
7384
|
+
// Other irregular rules.
|
|
7385
|
+
['ox', 'oxen'],
|
|
7386
|
+
['axe', 'axes'],
|
|
7387
|
+
['die', 'dice'],
|
|
7388
|
+
['yes', 'yeses'],
|
|
7389
|
+
['foot', 'feet'],
|
|
7390
|
+
['eave', 'eaves'],
|
|
7391
|
+
['goose', 'geese'],
|
|
7392
|
+
['tooth', 'teeth'],
|
|
7393
|
+
['quiz', 'quizzes'],
|
|
7394
|
+
['human', 'humans'],
|
|
7395
|
+
['proof', 'proofs'],
|
|
7396
|
+
['carve', 'carves'],
|
|
7397
|
+
['valve', 'valves'],
|
|
7398
|
+
['looey', 'looies'],
|
|
7399
|
+
['thief', 'thieves'],
|
|
7400
|
+
['groove', 'grooves'],
|
|
7401
|
+
['pickaxe', 'pickaxes'],
|
|
7402
|
+
['passerby', 'passersby']
|
|
7403
|
+
].forEach(function (rule) {
|
|
7404
|
+
return pluralize.addIrregularRule(rule[0], rule[1]);
|
|
7405
|
+
});
|
|
7406
|
+
|
|
7407
|
+
/**
|
|
7408
|
+
* Pluralization rules.
|
|
7409
|
+
*/
|
|
7410
|
+
[
|
|
7411
|
+
[/s?$/i, 's'],
|
|
7412
|
+
[/[^\u0000-\u007F]$/i, '$0'],
|
|
7413
|
+
[/([^aeiou]ese)$/i, '$1'],
|
|
7414
|
+
[/(ax|test)is$/i, '$1es'],
|
|
7415
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'],
|
|
7416
|
+
[/(e[mn]u)s?$/i, '$1s'],
|
|
7417
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'],
|
|
7418
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'],
|
|
7419
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'],
|
|
7420
|
+
[/(seraph|cherub)(?:im)?$/i, '$1im'],
|
|
7421
|
+
[/(her|at|gr)o$/i, '$1oes'],
|
|
7422
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'],
|
|
7423
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'],
|
|
7424
|
+
[/sis$/i, 'ses'],
|
|
7425
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'],
|
|
7426
|
+
[/([^aeiouy]|qu)y$/i, '$1ies'],
|
|
7427
|
+
[/([^ch][ieo][ln])ey$/i, '$1ies'],
|
|
7428
|
+
[/(x|ch|ss|sh|zz)$/i, '$1es'],
|
|
7429
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'],
|
|
7430
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'],
|
|
7431
|
+
[/(pe)(?:rson|ople)$/i, '$1ople'],
|
|
7432
|
+
[/(child)(?:ren)?$/i, '$1ren'],
|
|
7433
|
+
[/eaux$/i, '$0'],
|
|
7434
|
+
[/m[ae]n$/i, 'men'],
|
|
7435
|
+
['thou', 'you']
|
|
7436
|
+
].forEach(function (rule) {
|
|
7437
|
+
return pluralize.addPluralRule(rule[0], rule[1]);
|
|
7438
|
+
});
|
|
7439
|
+
|
|
7440
|
+
/**
|
|
7441
|
+
* Singularization rules.
|
|
7442
|
+
*/
|
|
7443
|
+
[
|
|
7444
|
+
[/s$/i, ''],
|
|
7445
|
+
[/(ss)$/i, '$1'],
|
|
7446
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'],
|
|
7447
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],
|
|
7448
|
+
[/ies$/i, 'y'],
|
|
7449
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],
|
|
7450
|
+
[/\b(mon|smil)ies$/i, '$1ey'],
|
|
7451
|
+
[/\b((?:tit)?m|l)ice$/i, '$1ouse'],
|
|
7452
|
+
[/(seraph|cherub)im$/i, '$1'],
|
|
7453
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'],
|
|
7454
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'],
|
|
7455
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, '$1'],
|
|
7456
|
+
[/(test)(?:is|es)$/i, '$1is'],
|
|
7457
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'],
|
|
7458
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'],
|
|
7459
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'],
|
|
7460
|
+
[/(alumn|alg|vertebr)ae$/i, '$1a'],
|
|
7461
|
+
[/(cod|mur|sil|vert|ind)ices$/i, '$1ex'],
|
|
7462
|
+
[/(matr|append)ices$/i, '$1ix'],
|
|
7463
|
+
[/(pe)(rson|ople)$/i, '$1rson'],
|
|
7464
|
+
[/(child)ren$/i, '$1'],
|
|
7465
|
+
[/(eau)x?$/i, '$1'],
|
|
7466
|
+
[/men$/i, 'man']
|
|
7467
|
+
].forEach(function (rule) {
|
|
7468
|
+
return pluralize.addSingularRule(rule[0], rule[1]);
|
|
7469
|
+
});
|
|
7470
|
+
|
|
7471
|
+
/**
|
|
7472
|
+
* Uncountable rules.
|
|
7473
|
+
*/
|
|
7474
|
+
[
|
|
7475
|
+
// Singular words with no plurals.
|
|
7476
|
+
'adulthood',
|
|
7477
|
+
'advice',
|
|
7478
|
+
'agenda',
|
|
7479
|
+
'aid',
|
|
7480
|
+
'aircraft',
|
|
7481
|
+
'alcohol',
|
|
7482
|
+
'ammo',
|
|
7483
|
+
'analytics',
|
|
7484
|
+
'anime',
|
|
7485
|
+
'athletics',
|
|
7486
|
+
'audio',
|
|
7487
|
+
'bison',
|
|
7488
|
+
'blood',
|
|
7489
|
+
'bream',
|
|
7490
|
+
'buffalo',
|
|
7491
|
+
'butter',
|
|
7492
|
+
'carp',
|
|
7493
|
+
'cash',
|
|
7494
|
+
'chassis',
|
|
7495
|
+
'chess',
|
|
7496
|
+
'clothing',
|
|
7497
|
+
'cod',
|
|
7498
|
+
'commerce',
|
|
7499
|
+
'cooperation',
|
|
7500
|
+
'corps',
|
|
7501
|
+
'debris',
|
|
7502
|
+
'diabetes',
|
|
7503
|
+
'digestion',
|
|
7504
|
+
'elk',
|
|
7505
|
+
'energy',
|
|
7506
|
+
'equipment',
|
|
7507
|
+
'excretion',
|
|
7508
|
+
'expertise',
|
|
7509
|
+
'firmware',
|
|
7510
|
+
'flounder',
|
|
7511
|
+
'fun',
|
|
7512
|
+
'gallows',
|
|
7513
|
+
'garbage',
|
|
7514
|
+
'graffiti',
|
|
7515
|
+
'hardware',
|
|
7516
|
+
'headquarters',
|
|
7517
|
+
'health',
|
|
7518
|
+
'herpes',
|
|
7519
|
+
'highjinks',
|
|
7520
|
+
'homework',
|
|
7521
|
+
'housework',
|
|
7522
|
+
'information',
|
|
7523
|
+
'jeans',
|
|
7524
|
+
'justice',
|
|
7525
|
+
'kudos',
|
|
7526
|
+
'labour',
|
|
7527
|
+
'literature',
|
|
7528
|
+
'machinery',
|
|
7529
|
+
'mackerel',
|
|
7530
|
+
'mail',
|
|
7531
|
+
'media',
|
|
7532
|
+
'mews',
|
|
7533
|
+
'moose',
|
|
7534
|
+
'music',
|
|
7535
|
+
'mud',
|
|
7536
|
+
'manga',
|
|
7537
|
+
'news',
|
|
7538
|
+
'only',
|
|
7539
|
+
'personnel',
|
|
7540
|
+
'pike',
|
|
7541
|
+
'plankton',
|
|
7542
|
+
'pliers',
|
|
7543
|
+
'police',
|
|
7544
|
+
'pollution',
|
|
7545
|
+
'premises',
|
|
7546
|
+
'rain',
|
|
7547
|
+
'research',
|
|
7548
|
+
'rice',
|
|
7549
|
+
'salmon',
|
|
7550
|
+
'scissors',
|
|
7551
|
+
'series',
|
|
7552
|
+
'sewage',
|
|
7553
|
+
'shambles',
|
|
7554
|
+
'shrimp',
|
|
7555
|
+
'software',
|
|
7556
|
+
'species',
|
|
7557
|
+
'staff',
|
|
7558
|
+
'swine',
|
|
7559
|
+
'tennis',
|
|
7560
|
+
'traffic',
|
|
7561
|
+
'transportation',
|
|
7562
|
+
'trout',
|
|
7563
|
+
'tuna',
|
|
7564
|
+
'wealth',
|
|
7565
|
+
'welfare',
|
|
7566
|
+
'whiting',
|
|
7567
|
+
'wildebeest',
|
|
7568
|
+
'wildlife',
|
|
7569
|
+
'you',
|
|
7570
|
+
/pok[eé]mon$/i,
|
|
7571
|
+
// Regexes.
|
|
7572
|
+
/[^aeiou]ese$/i, // "chinese", "japanese"
|
|
7573
|
+
/deer$/i, // "deer", "reindeer"
|
|
7574
|
+
/fish$/i, // "fish", "blowfish", "angelfish"
|
|
7575
|
+
/measles$/i,
|
|
7576
|
+
/o[iu]s$/i, // "carnivorous"
|
|
7577
|
+
/pox$/i, // "chickpox", "smallpox"
|
|
7578
|
+
/sheep$/i
|
|
7579
|
+
].forEach(pluralize.addUncountableRule);
|
|
7580
|
+
|
|
7581
|
+
return pluralize;
|
|
7582
|
+
});
|
|
7583
|
+
} (pluralize$1, pluralize$1.exports));
|
|
7584
|
+
|
|
7585
|
+
var pluralizeExports = pluralize$1.exports;
|
|
7586
|
+
var pluralize = /*@__PURE__*/getDefaultExportFromCjs(pluralizeExports);
|
|
7587
|
+
|
|
7048
7588
|
var Menu = neetoui.Dropdown.Menu,
|
|
7049
7589
|
MenuItem = neetoui.Dropdown.MenuItem;
|
|
7050
7590
|
var buildDefaultColumns = function buildDefaultColumns(_ref) {
|
|
@@ -7166,32 +7706,38 @@ var renderMenuBarFilters = function renderMenuBarFilters(_ref3) {
|
|
|
7166
7706
|
})
|
|
7167
7707
|
}));
|
|
7168
7708
|
};
|
|
7169
|
-
var
|
|
7170
|
-
var _findBy;
|
|
7709
|
+
var getResourceName = function getResourceName(_ref4) {
|
|
7171
7710
|
var isOwnerBased = _ref4.isOwnerBased,
|
|
7172
7711
|
owners = _ref4.owners,
|
|
7173
7712
|
selectedVal = _ref4.selectedVal,
|
|
7174
|
-
nameAliases = _ref4.nameAliases
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7713
|
+
nameAliases = _ref4.nameAliases;
|
|
7714
|
+
if (isOwnerBased) {
|
|
7715
|
+
var _findBy;
|
|
7716
|
+
return (_findBy = pure.findBy({
|
|
7717
|
+
id: selectedVal
|
|
7718
|
+
}, owners)) === null || _findBy === void 0 ? void 0 : _findBy.name;
|
|
7719
|
+
}
|
|
7720
|
+
return nameAliases[selectedVal] || selectedVal;
|
|
7721
|
+
};
|
|
7722
|
+
var getDashBoardTitle = function getDashBoardTitle(_ref5) {
|
|
7723
|
+
var resourceName = _ref5.resourceName,
|
|
7724
|
+
isSingleResource = _ref5.isSingleResource,
|
|
7725
|
+
showStateFilter = _ref5.showStateFilter,
|
|
7726
|
+
selectedState = _ref5.selectedState,
|
|
7727
|
+
title = _ref5.title;
|
|
7182
7728
|
var displayTitle = title;
|
|
7183
7729
|
if (showStateFilter && !isSingleResource) {
|
|
7184
7730
|
displayTitle = t$1("messages.stateTitleForResource", {
|
|
7185
7731
|
state: selectedState,
|
|
7186
7732
|
title: title,
|
|
7187
|
-
resource:
|
|
7733
|
+
resource: resourceName
|
|
7188
7734
|
});
|
|
7189
7735
|
} else if (showStateFilter && isSingleResource) {
|
|
7190
7736
|
displayTitle = "".concat(selectedState, " ").concat(title);
|
|
7191
7737
|
} else if (!showStateFilter && !isSingleResource) {
|
|
7192
7738
|
displayTitle = t$1("messages.titleForResource", {
|
|
7193
7739
|
title: title,
|
|
7194
|
-
resource:
|
|
7740
|
+
resource: resourceName
|
|
7195
7741
|
});
|
|
7196
7742
|
}
|
|
7197
7743
|
return pure.humanize(displayTitle);
|
|
@@ -7214,6 +7760,24 @@ var renderNoDataHelpText = function renderNoDataHelpText(title, url) {
|
|
|
7214
7760
|
}
|
|
7215
7761
|
});
|
|
7216
7762
|
};
|
|
7763
|
+
var getDeletionConfirmationMessage = function getDeletionConfirmationMessage(_ref6) {
|
|
7764
|
+
var resource = _ref6.resource,
|
|
7765
|
+
fieldName = _ref6.fieldName,
|
|
7766
|
+
affectedResourcesCount = _ref6.affectedResourcesCount;
|
|
7767
|
+
return affectedResourcesCount > 0 ? /*#__PURE__*/React__default["default"].createElement(Trans, {
|
|
7768
|
+
i18nKey: "messages.confirmDeleteWithCount",
|
|
7769
|
+
values: {
|
|
7770
|
+
resource: pluralize(resource, affectedResourcesCount),
|
|
7771
|
+
name: fieldName,
|
|
7772
|
+
count: affectedResourcesCount
|
|
7773
|
+
}
|
|
7774
|
+
}) : /*#__PURE__*/React__default["default"].createElement(Trans, {
|
|
7775
|
+
i18nKey: "messages.confirmDelete",
|
|
7776
|
+
values: {
|
|
7777
|
+
name: fieldName
|
|
7778
|
+
}
|
|
7779
|
+
});
|
|
7780
|
+
};
|
|
7217
7781
|
|
|
7218
7782
|
var fetchConfigs = function fetchConfigs() {
|
|
7219
7783
|
return axios__default["default"].get(CONFIGS_URL);
|
|
@@ -7388,18 +7952,23 @@ var useFieldsDashboard = function useFieldsDashboard(_ref) {
|
|
|
7388
7952
|
};
|
|
7389
7953
|
var isSingleResource = menuItems.length === 1;
|
|
7390
7954
|
var isMenuBarNeeded = showStateFilter || !isSingleResource;
|
|
7391
|
-
var
|
|
7392
|
-
return
|
|
7955
|
+
var resourceName = React.useMemo(function () {
|
|
7956
|
+
return getResourceName({
|
|
7393
7957
|
isOwnerBased: isOwnerBased,
|
|
7394
|
-
owners: menuItems,
|
|
7395
|
-
selectedVal: resource,
|
|
7396
7958
|
nameAliases: nameAliases,
|
|
7959
|
+
owners: menuItems,
|
|
7960
|
+
selectedVal: resource
|
|
7961
|
+
});
|
|
7962
|
+
}, [menuItems, resource]);
|
|
7963
|
+
var headerDisplayTitle = React.useMemo(function () {
|
|
7964
|
+
return getDashBoardTitle({
|
|
7965
|
+
resourceName: resourceName,
|
|
7397
7966
|
showStateFilter: showStateFilter,
|
|
7398
7967
|
selectedState: state,
|
|
7399
7968
|
isSingleResource: isSingleResource,
|
|
7400
7969
|
title: title
|
|
7401
7970
|
});
|
|
7402
|
-
}, [
|
|
7971
|
+
}, [state, isSingleResource, resourceName]);
|
|
7403
7972
|
var menuBarFilters = React.useMemo(function () {
|
|
7404
7973
|
return renderMenuBarFilters({
|
|
7405
7974
|
selectedState: state,
|
|
@@ -7437,6 +8006,7 @@ var useFieldsDashboard = function useFieldsDashboard(_ref) {
|
|
|
7437
8006
|
selectedState: state,
|
|
7438
8007
|
selectedMenu: resource,
|
|
7439
8008
|
// resource will be ownerId if showOwnersInMenu is true, else it will be resourceType
|
|
8009
|
+
ownerId: ownerId,
|
|
7440
8010
|
isFieldsFetching: isFieldsFetching,
|
|
7441
8011
|
isFieldsLoading: isFieldsLoading,
|
|
7442
8012
|
isDeleting: isDeleting,
|
|
@@ -7456,6 +8026,41 @@ var useFieldsDashboard = function useFieldsDashboard(_ref) {
|
|
|
7456
8026
|
};
|
|
7457
8027
|
};
|
|
7458
8028
|
|
|
8029
|
+
var DeleteAlert = function DeleteAlert(_ref) {
|
|
8030
|
+
var selectedField = _ref.selectedField,
|
|
8031
|
+
ownerId = _ref.ownerId,
|
|
8032
|
+
isDeleteAlertOpen = _ref.isDeleteAlertOpen,
|
|
8033
|
+
isDeleting = _ref.isDeleting,
|
|
8034
|
+
resourceTypeName = _ref.resourceTypeName,
|
|
8035
|
+
handleAlertClose = _ref.handleAlertClose,
|
|
8036
|
+
handleDelete = _ref.handleDelete;
|
|
8037
|
+
var _useTranslation = useTranslation(),
|
|
8038
|
+
t = _useTranslation.t;
|
|
8039
|
+
var _useFetchDependencies = useFetchDependencies({
|
|
8040
|
+
fieldId: selectedField.id,
|
|
8041
|
+
ownerId: ownerId
|
|
8042
|
+
}, {
|
|
8043
|
+
enabled: isDeleteAlertOpen && pure.isNotEmpty(selectedField)
|
|
8044
|
+
}),
|
|
8045
|
+
_useFetchDependencies2 = _useFetchDependencies.data,
|
|
8046
|
+
_useFetchDependencies3 = _useFetchDependencies2 === void 0 ? {} : _useFetchDependencies2,
|
|
8047
|
+
affectedResourcesCount = _useFetchDependencies3.affectedResourcesCount;
|
|
8048
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, {
|
|
8049
|
+
affectedResourcesCount: affectedResourcesCount,
|
|
8050
|
+
isOpen: isDeleteAlertOpen,
|
|
8051
|
+
isSubmitting: isDeleting,
|
|
8052
|
+
submitButtonLabel: t("labels.delete"),
|
|
8053
|
+
title: t("titles.deleteField"),
|
|
8054
|
+
message: getDeletionConfirmationMessage({
|
|
8055
|
+
resource: resourceTypeName,
|
|
8056
|
+
affectedResourcesCount: affectedResourcesCount,
|
|
8057
|
+
fieldName: selectedField === null || selectedField === void 0 ? void 0 : selectedField.name
|
|
8058
|
+
}),
|
|
8059
|
+
onClose: handleAlertClose,
|
|
8060
|
+
onSubmit: handleDelete
|
|
8061
|
+
});
|
|
8062
|
+
};
|
|
8063
|
+
|
|
7459
8064
|
var FieldsTable = function FieldsTable(_ref) {
|
|
7460
8065
|
var totalCount = _ref.totalCount,
|
|
7461
8066
|
isLoading = _ref.isLoading,
|
|
@@ -11905,6 +12510,7 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
|
|
|
11905
12510
|
selectedField = _useFieldsDashboard.selectedField,
|
|
11906
12511
|
selectedState = _useFieldsDashboard.selectedState,
|
|
11907
12512
|
selectedMenu = _useFieldsDashboard.selectedMenu,
|
|
12513
|
+
ownerId = _useFieldsDashboard.ownerId,
|
|
11908
12514
|
isFieldsFetching = _useFieldsDashboard.isFieldsFetching,
|
|
11909
12515
|
isFieldsLoading = _useFieldsDashboard.isFieldsLoading,
|
|
11910
12516
|
isDeleting = _useFieldsDashboard.isDeleting,
|
|
@@ -11989,13 +12595,14 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
|
|
|
11989
12595
|
ownerId: isOwnerBased ? selectedMenu : "",
|
|
11990
12596
|
onClose: handleReorderPaneClose,
|
|
11991
12597
|
allFields: allFields
|
|
11992
|
-
}), /*#__PURE__*/React__default["default"].createElement(
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
12598
|
+
}), /*#__PURE__*/React__default["default"].createElement(DeleteAlert, {
|
|
12599
|
+
handleAlertClose: handleAlertClose,
|
|
12600
|
+
handleDelete: handleDelete,
|
|
12601
|
+
isDeleteAlertOpen: isDeleteAlertOpen,
|
|
12602
|
+
isDeleting: isDeleting,
|
|
12603
|
+
ownerId: ownerId,
|
|
12604
|
+
selectedField: selectedField,
|
|
12605
|
+
resourceTypeName: isOwnerBased ? resourceType : selectedMenu
|
|
11999
12606
|
}));
|
|
12000
12607
|
};
|
|
12001
12608
|
|