linting
parent
2399765145
commit
8fa4fcb054
|
|
@ -264,11 +264,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
function moveOccupancyTypeField(clickEvent) {
|
||||
const buttonElement = clickEvent.currentTarget;
|
||||
const occupancyTypeFieldId = clickEvent.currentTarget.closest('.container--occupancyTypeField').dataset.occupancyTypeFieldId;
|
||||
cityssm.postJSON(los.urlPrefix +
|
||||
'/admin/' +
|
||||
(buttonElement.dataset.direction === 'up'
|
||||
cityssm.postJSON(`${los.urlPrefix}/admin/${buttonElement.dataset.direction === 'up'
|
||||
? 'doMoveOccupancyTypeFieldUp'
|
||||
: 'doMoveOccupancyTypeFieldDown'), {
|
||||
: // eslint-disable-next-line no-secrets/no-secrets
|
||||
'doMoveOccupancyTypeFieldDown'}`, {
|
||||
occupancyTypeFieldId,
|
||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||
}, occupancyTypeResponseHandler);
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ type ResponseJSON =
|
|||
modalElement.querySelector(
|
||||
'#occupancyTypeFieldEdit--isRequired'
|
||||
) as HTMLSelectElement
|
||||
).value = (occupancyTypeField.isRequired ?? false) ? '1' : '0'
|
||||
).value = occupancyTypeField.isRequired ?? false ? '1' : '0'
|
||||
|
||||
minimumLengthElement = modalElement.querySelector(
|
||||
'#occupancyTypeFieldEdit--minimumLength'
|
||||
|
|
@ -481,11 +481,12 @@ type ResponseJSON =
|
|||
).dataset.occupancyTypeFieldId
|
||||
|
||||
cityssm.postJSON(
|
||||
los.urlPrefix +
|
||||
'/admin/' +
|
||||
(buttonElement.dataset.direction === 'up'
|
||||
`${los.urlPrefix}/admin/${
|
||||
buttonElement.dataset.direction === 'up'
|
||||
? 'doMoveOccupancyTypeFieldUp'
|
||||
: 'doMoveOccupancyTypeFieldDown'),
|
||||
: // eslint-disable-next-line no-secrets/no-secrets
|
||||
'doMoveOccupancyTypeFieldDown'
|
||||
}`,
|
||||
{
|
||||
occupancyTypeFieldId,
|
||||
moveToEnd: clickEvent.shiftKey ? '1' : '0'
|
||||
|
|
|
|||
|
|
@ -211,18 +211,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
/*
|
||||
* Colours
|
||||
*/
|
||||
const hues = ['red', 'green', 'orange', 'blue', 'pink', 'yellow', 'purple'];
|
||||
const hues = [
|
||||
'red',
|
||||
'green',
|
||||
'orange',
|
||||
'blue',
|
||||
'pink',
|
||||
'yellow',
|
||||
'purple'
|
||||
];
|
||||
const luminosity = ['bright', 'light', 'dark'];
|
||||
function getRandomColor(seedString) {
|
||||
let actualSeedString = seedString;
|
||||
if (actualSeedString.length < 2) {
|
||||
actualSeedString = actualSeedString + 'a1';
|
||||
actualSeedString += 'a1';
|
||||
}
|
||||
return exports.randomColor({
|
||||
seed: actualSeedString + actualSeedString,
|
||||
hue: hues[actualSeedString.codePointAt(actualSeedString.length - 1) % hues.length],
|
||||
luminosity: luminosity[actualSeedString.codePointAt(actualSeedString.length - 2) %
|
||||
luminosity.length]
|
||||
hue: hues[actualSeedString.codePointAt(actualSeedString.length - 1) %
|
||||
hues.length],
|
||||
luminosity: luminosity[actualSeedString.codePointAt(actualSeedString.length - 2) % luminosity.length]
|
||||
});
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -7,10 +7,29 @@ import type { Options as BulmaCalendarOptions } from 'bulma-calendar'
|
|||
|
||||
import type * as globalTypes from '../types/globalTypes.js'
|
||||
|
||||
type RandomColorHue =
|
||||
| 'red'
|
||||
| 'orange'
|
||||
| 'yellow'
|
||||
| 'green'
|
||||
| 'blue'
|
||||
| 'purple'
|
||||
| 'pink'
|
||||
| 'monochrome'
|
||||
type RandomColorLuminosity = 'bright' | 'light' | 'dark'
|
||||
|
||||
declare const cityssm: cityssmGlobal
|
||||
declare const bulmaJS: BulmaJS
|
||||
declare const exports: Record<string, unknown> & {
|
||||
aliases: Record<string, string>
|
||||
randomColor: (options?: {
|
||||
hue?: RandomColorHue
|
||||
luminosity?: RandomColorLuminosity
|
||||
count?: number
|
||||
seed?: number | string
|
||||
format?: 'rgb' | 'rgba' | 'rgbArray' | 'hsl' | 'hsla' | 'hslArray' | 'hex'
|
||||
alpha?: number
|
||||
}) => string
|
||||
}
|
||||
;(() => {
|
||||
/*
|
||||
|
|
@ -301,25 +320,35 @@ declare const exports: Record<string, unknown> & {
|
|||
* Colours
|
||||
*/
|
||||
|
||||
const hues = ['red', 'green', 'orange', 'blue', 'pink', 'yellow', 'purple']
|
||||
const luminosity = ['bright', 'light', 'dark']
|
||||
const hues = [
|
||||
'red',
|
||||
'green',
|
||||
'orange',
|
||||
'blue',
|
||||
'pink',
|
||||
'yellow',
|
||||
'purple'
|
||||
] as RandomColorHue[]
|
||||
const luminosity = ['bright', 'light', 'dark'] as RandomColorLuminosity[]
|
||||
|
||||
function getRandomColor(seedString: string): string {
|
||||
let actualSeedString = seedString
|
||||
|
||||
if (actualSeedString.length < 2) {
|
||||
actualSeedString = actualSeedString + 'a1'
|
||||
actualSeedString += 'a1'
|
||||
}
|
||||
|
||||
return exports.randomColor({
|
||||
seed: actualSeedString + actualSeedString,
|
||||
hue: hues[
|
||||
actualSeedString.codePointAt(actualSeedString.length - 1)! % hues.length
|
||||
(actualSeedString.codePointAt(actualSeedString.length - 1) as number) %
|
||||
hues.length
|
||||
],
|
||||
luminosity:
|
||||
luminosity[
|
||||
actualSeedString.codePointAt(actualSeedString.length - 2)! %
|
||||
luminosity.length
|
||||
(actualSeedString.codePointAt(
|
||||
actualSeedString.length - 2
|
||||
) as number) % luminosity.length
|
||||
]
|
||||
})
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue