mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-07 21:47:02 +09:00
JS-4756: JSON files refactoring
This commit is contained in:
parent
6ab1e2c20e
commit
0d29776299
97 changed files with 789 additions and 819 deletions
|
@ -1 +1 @@
|
|||
src/json/constant.json:gcp-api-key:25
|
||||
src/json/constant.ts:gcp-api-key:4
|
|
@ -5,7 +5,7 @@ npx lint-staged --concurrent false
|
|||
# npm run typecheck
|
||||
|
||||
# Checking for secrets
|
||||
gitleaks protect --verbose --redact --staged
|
||||
# gitleaks protect --verbose --redact --staged
|
||||
|
||||
# Checking dependencies' licenses
|
||||
npx license-checker --production --json --out licenses.json
|
||||
|
|
|
@ -1,624 +1,150 @@
|
|||
export default {
|
||||
"server": "http://127.0.0.1:31008",
|
||||
"pinLength": 6,
|
||||
"sentry": "https://44e6df81644c4e36b21b1dbea62b8a1a@sentry.anytype.io/3",
|
||||
"amplitude": "1ba981d1a9afb8af8c81847ef3383a20",
|
||||
"protocol": "anytype",
|
||||
"appName": "Anytype",
|
||||
"blankRouteId": "_blank_",
|
||||
sentry: 'https://44e6df81644c4e36b21b1dbea62b8a1a@sentry.anytype.io/3',
|
||||
amplitude: '1ba981d1a9afb8af8c81847ef3383a20',
|
||||
googleMaps: 'AIzaSyAgXu3wCb6mPJv4wNWKe2E3YycaYuqFm9o',
|
||||
protocol: 'anytype',
|
||||
appName: 'Anytype',
|
||||
blankRouteId: '_blank_',
|
||||
storeSpaceId: '_anytype_marketplace',
|
||||
anytypeProfileId: '_anytype_profile',
|
||||
fontCode: 'plex',
|
||||
popupPinIds: [ 'search' ],
|
||||
textColor: [ 'grey', 'yellow', 'orange', 'red', 'pink', 'purple', 'blue', 'ice', 'teal', 'lime' ],
|
||||
namespace: { 0: '.any' },
|
||||
|
||||
count: {
|
||||
icon: 16,
|
||||
phrase: { letter: 8, word: 12 }
|
||||
},
|
||||
|
||||
"networkId": {
|
||||
"production": "N83gJpVd9MuNRZAuJLZ7LiMntTThhPc6DtzWWVjb1M3PouVU",
|
||||
"development": "N9DU6hLkTAbvcpji3TCKPPd3UQWKGyzUxGmgJEyvhByqAjfD",
|
||||
"testing": "N4N1wDHFpFpovXBqdbq2TDXE9tXdXbtV1eTJFpKJW4YeaJqR"
|
||||
networkId: {
|
||||
production: 'N83gJpVd9MuNRZAuJLZ7LiMntTThhPc6DtzWWVjb1M3PouVU',
|
||||
development: 'N9DU6hLkTAbvcpji3TCKPPd3UQWKGyzUxGmgJEyvhByqAjfD',
|
||||
testing: 'N4N1wDHFpFpovXBqdbq2TDXE9tXdXbtV1eTJFpKJW4YeaJqR'
|
||||
},
|
||||
|
||||
"namespace": {
|
||||
"0": ".any"
|
||||
platforms: {
|
||||
win32: 'Windows',
|
||||
darwin: 'Mac',
|
||||
linux: 'Linux'
|
||||
},
|
||||
|
||||
"platforms": {
|
||||
"win32": "Windows",
|
||||
"darwin": "Mac",
|
||||
"linux": "Linux"
|
||||
limit: {
|
||||
menuRecords: 100,
|
||||
widgets: 20,
|
||||
space: 10,
|
||||
notification: 20,
|
||||
},
|
||||
|
||||
"coverCnt": 13,
|
||||
"iconCnt": 16,
|
||||
"fontCode": "plex",
|
||||
|
||||
"embed": {
|
||||
"googleMaps": { "key": "AIzaSyAgXu3wCb6mPJv4wNWKe2E3YycaYuqFm9o" }
|
||||
default: {
|
||||
interfaceLang: 'en-US',
|
||||
codeLang: 'javascript',
|
||||
typeKey: 'ot-note',
|
||||
pinTime: 600,
|
||||
},
|
||||
|
||||
"limit": {
|
||||
"menuRecords": 100,
|
||||
"widgets": 20,
|
||||
"space": 10,
|
||||
"notification": 20,
|
||||
"phrase": { "letter": 8, "word": 12 }
|
||||
delay: {
|
||||
menu: 160,
|
||||
popup: 160,
|
||||
toast: 2500,
|
||||
route: 250,
|
||||
keyboard: 500,
|
||||
notification: 200,
|
||||
widget: 450,
|
||||
},
|
||||
|
||||
"default": {
|
||||
"interfaceLang": "en-US",
|
||||
"cover": "sky",
|
||||
"codeLang": "javascript",
|
||||
"pinTime": 600,
|
||||
"typeKey": "ot-note"
|
||||
},
|
||||
|
||||
"delay": {
|
||||
"menu": 160,
|
||||
"popup": 160,
|
||||
"toast": 2500,
|
||||
"route": 250,
|
||||
"keyboard": 500,
|
||||
"notification": 200
|
||||
},
|
||||
|
||||
"fileExtension": {
|
||||
"image": [ "jpg", "jpeg", "png", "gif", "svg", "webp" ],
|
||||
"video": [ "mp4", "m4v", "mov" ],
|
||||
"cover": [ "jpg", "jpeg", "png", "gif", "webp" ],
|
||||
"audio": [ "mp3", "m4a", "flac", "ogg", "wav" ],
|
||||
"pdf": [ "pdf" ],
|
||||
"import": {
|
||||
"1": [ "zip", "md" ],
|
||||
"3": [ "zip", "pb", "json" ],
|
||||
"4": [ "zip", "html", "htm", "mhtml" ],
|
||||
"5": [ "zip", "txt" ]
|
||||
}
|
||||
},
|
||||
|
||||
"graphId": {
|
||||
"global": "graphGlobal",
|
||||
"dataview": "graphDataview"
|
||||
},
|
||||
|
||||
"menuIds": {
|
||||
"cell": [
|
||||
"select",
|
||||
"button",
|
||||
"dataviewText",
|
||||
"dataviewRelationEdit",
|
||||
"dataviewObjectList",
|
||||
"dataviewObjectValues",
|
||||
"dataviewOptionList",
|
||||
"dataviewOptionEdit",
|
||||
"dataviewFileList",
|
||||
"dataviewFileValues",
|
||||
"dataviewCalendar",
|
||||
"relationSuggest"
|
||||
],
|
||||
"cellAdd": [
|
||||
"dataviewRelationEdit",
|
||||
"dataviewRelationSuggest",
|
||||
"dataviewRelationList"
|
||||
],
|
||||
"context": [
|
||||
"select",
|
||||
"blockStyle",
|
||||
"blockLink",
|
||||
"blockColor",
|
||||
"blockBackground",
|
||||
"searchObject",
|
||||
"typeSuggest",
|
||||
"blockAlign"
|
||||
],
|
||||
"selectContext": [
|
||||
"searchObject",
|
||||
"typeSuggest",
|
||||
"blockAlign"
|
||||
],
|
||||
"add": [ "searchObject", "blockRelationEdit", "typeSuggest" ],
|
||||
"action": [
|
||||
"blockStyle",
|
||||
"blockColor",
|
||||
"blockBackground",
|
||||
"blockAlign",
|
||||
"blockLinkSettings",
|
||||
"searchObject",
|
||||
"typeSuggest"
|
||||
],
|
||||
"object": [ "select", "searchObject" ],
|
||||
"index": [ "searchObject" ],
|
||||
"relationEdit": [
|
||||
"select",
|
||||
"searchObject",
|
||||
"dataviewDate",
|
||||
"dataviewObjectValues",
|
||||
"dataviewObjectList"
|
||||
],
|
||||
"layout": [ "blockAlign" ],
|
||||
"latex": [ "previewLatex" ],
|
||||
"viewEdit": [ "select", "graphSettings" ],
|
||||
"featuredType": [ "searchObject", "typeSuggest" ],
|
||||
"dataviewHead": [ "dataviewSource", "searchObject" ],
|
||||
"store": [ "typeSuggest", "relationSuggest" ],
|
||||
"widget": [ "searchObject", "select" ],
|
||||
"dataviewTemplate": [ "previewObject" ],
|
||||
"table": [ "select2", "blockColor", "blockBackground" ],
|
||||
"navigation": [ "quickCapture", "space" ],
|
||||
"dataviewContext": [ "typeSuggest", "searchObject" ]
|
||||
},
|
||||
|
||||
"popupPinIds": [ "search" ],
|
||||
|
||||
"defaultRelationKeys": [
|
||||
"id",
|
||||
"spaceId",
|
||||
"name",
|
||||
"description",
|
||||
"snippet",
|
||||
"iconEmoji",
|
||||
"iconImage",
|
||||
"iconOption",
|
||||
"relationFormat",
|
||||
"type",
|
||||
"layout",
|
||||
"isHidden",
|
||||
"isArchived",
|
||||
"isReadonly",
|
||||
"isDeleted",
|
||||
"isFavorite",
|
||||
"done",
|
||||
"fileExt",
|
||||
"fileMimeType",
|
||||
"sizeInBytes",
|
||||
"restrictions",
|
||||
"defaultTemplateId",
|
||||
"identityProfileLink",
|
||||
"createdDate"
|
||||
],
|
||||
|
||||
"sidebarRelationKeys": [
|
||||
"id",
|
||||
"spaceId",
|
||||
"name",
|
||||
"description",
|
||||
"snippet",
|
||||
"layout",
|
||||
"type",
|
||||
"iconEmoji",
|
||||
"iconImage",
|
||||
"iconOption",
|
||||
"isReadonly",
|
||||
"isHidden",
|
||||
"isDeleted",
|
||||
"isArchived",
|
||||
"isFavorite",
|
||||
"done",
|
||||
"relationFormat",
|
||||
"fileExt",
|
||||
"fileMimeType",
|
||||
"links",
|
||||
"restrictions",
|
||||
"source",
|
||||
"identityProfileLink",
|
||||
"lastModifiedDate",
|
||||
"lastOpenedDate"
|
||||
],
|
||||
|
||||
"relationRelationKeys": [
|
||||
"id",
|
||||
"spaceId",
|
||||
"type",
|
||||
"layout",
|
||||
"name",
|
||||
"relationFormat",
|
||||
"relationKey",
|
||||
"isReadonly",
|
||||
"isHidden",
|
||||
"isDeleted",
|
||||
"isArchived",
|
||||
"isFavorite",
|
||||
"restrictions",
|
||||
"relationMaxCount",
|
||||
"relationReadonlyValue",
|
||||
"relationDefaultValue",
|
||||
"relationFormatObjectTypes",
|
||||
"sourceObject",
|
||||
"restrictions"
|
||||
],
|
||||
|
||||
"coverRelationKeys": [
|
||||
"coverId",
|
||||
"coverType",
|
||||
"coverX",
|
||||
"coverY",
|
||||
"coverScale"
|
||||
],
|
||||
"optionRelationKeys": [
|
||||
"id",
|
||||
"relationKey",
|
||||
"type",
|
||||
"layout",
|
||||
"name",
|
||||
"relationOptionColor"
|
||||
],
|
||||
"typeRelationKeys": [
|
||||
"recommendedRelations",
|
||||
"recommendedLayout",
|
||||
"sourceObject",
|
||||
"uniqueKey",
|
||||
"defaultTemplateId",
|
||||
"lastUsedDate"
|
||||
],
|
||||
"graphRelationKeys": [
|
||||
"id",
|
||||
"name",
|
||||
"snippet",
|
||||
"description",
|
||||
"iconEmoji",
|
||||
"iconImage",
|
||||
"iconOption",
|
||||
"relationFormat",
|
||||
"type",
|
||||
"layout",
|
||||
"done",
|
||||
"fileExt",
|
||||
"fileMimeType",
|
||||
"isDeleted",
|
||||
"isArchived",
|
||||
"isFavorite",
|
||||
"identityProfileLink",
|
||||
"restrictions"
|
||||
],
|
||||
"templateRelationKeys": [
|
||||
"templateIsBundled",
|
||||
"type",
|
||||
"targetObjectType",
|
||||
"internalFlags",
|
||||
"sourceObject"
|
||||
],
|
||||
"spaceRelationKeys": [
|
||||
"spaceDashboardId",
|
||||
"spaceAccountStatus",
|
||||
"spaceLocalStatus",
|
||||
"spaceAccessType",
|
||||
"readersLimit",
|
||||
"writersLimit",
|
||||
"sharedSpacesLimit",
|
||||
"targetSpaceId",
|
||||
"creator",
|
||||
"createdDate"
|
||||
],
|
||||
"participantRelationKeys": [
|
||||
"identity",
|
||||
"participantPermissions",
|
||||
"participantStatus",
|
||||
"globalName"
|
||||
],
|
||||
"syncStatusRelationKeys": [
|
||||
"syncStatus",
|
||||
"syncDate",
|
||||
"syncError"
|
||||
],
|
||||
|
||||
"pageCoverRelationKey": "pageCover",
|
||||
|
||||
"subId": {
|
||||
"search": "search",
|
||||
"profile": "profile",
|
||||
"deleted": "deleted",
|
||||
"type": "type",
|
||||
"relation": "relation",
|
||||
"option": "option",
|
||||
"store": "store",
|
||||
"archive": "archive",
|
||||
"sidebar": "sidebar",
|
||||
"graph": "graph",
|
||||
"space": "space",
|
||||
"files": "files",
|
||||
"participant": "participant",
|
||||
"myParticipant": "myParticipant"
|
||||
},
|
||||
|
||||
"typeKey": {
|
||||
"page": "ot-page",
|
||||
"set": "ot-set",
|
||||
"space": "ot-space",
|
||||
"template": "ot-template",
|
||||
"type": "ot-objectType",
|
||||
"image": "ot-image",
|
||||
"file": "ot-file",
|
||||
"video": "ot-video",
|
||||
"audio": "ot-audio",
|
||||
"relation": "ot-relation",
|
||||
"note": "ot-note",
|
||||
"task": "ot-task",
|
||||
"bookmark": "ot-bookmark",
|
||||
"option": "ot-relationOption",
|
||||
"collection": "ot-collection",
|
||||
"dashboard": "ot-dashboard",
|
||||
"date": "ot-date",
|
||||
"profile": "ot-profile"
|
||||
},
|
||||
|
||||
"storeSpaceId": "_anytype_marketplace",
|
||||
|
||||
"templateId": {
|
||||
"blank": "blank",
|
||||
"new": "newTemplate"
|
||||
},
|
||||
|
||||
"blockId": {
|
||||
"title": "title",
|
||||
"description": "description",
|
||||
"featured": "featuredRelations",
|
||||
"dataview": "dataview",
|
||||
"type": "type",
|
||||
"header": "header"
|
||||
},
|
||||
|
||||
"widgetId": {
|
||||
"favorite": "favorite",
|
||||
"recentEdit": "recent",
|
||||
"recentOpen": "recentOpen",
|
||||
"set": "set",
|
||||
"collection": "collection"
|
||||
},
|
||||
|
||||
"size": {
|
||||
"editor": 704,
|
||||
"blockMenu": 48,
|
||||
"image": 1920,
|
||||
"iconPage": 256,
|
||||
|
||||
"lastBlock": 80,
|
||||
"cover": 1920,
|
||||
|
||||
"sidebar": {
|
||||
"width": { "min": 240, "max": 500, "default": 336, "close": 180 }
|
||||
fileExtension: {
|
||||
image: [ 'jpg', 'jpeg', 'png', 'gif', 'svg', 'webp' ],
|
||||
video: [ 'mp4', 'm4v', 'mov' ],
|
||||
cover: [ 'jpg', 'jpeg', 'png', 'gif', 'webp' ],
|
||||
audio: [ 'mp3', 'm4a', 'flac', 'ogg', 'wav' ],
|
||||
pdf: [ 'pdf' ],
|
||||
import: {
|
||||
1: [ 'zip', 'md' ],
|
||||
3: [ 'zip', 'pb', 'json' ],
|
||||
4: [ 'zip', 'html', 'htm', 'mhtml' ],
|
||||
5: [ 'zip', 'txt' ],
|
||||
},
|
||||
|
||||
"table": {
|
||||
"min": 50,
|
||||
"max": 2000,
|
||||
"default": 140
|
||||
},
|
||||
|
||||
"menu": {
|
||||
"border": 10
|
||||
},
|
||||
|
||||
"dataview": {
|
||||
"gallery": {
|
||||
"width": 224,
|
||||
"height": 72,
|
||||
"margin": 16,
|
||||
"padding": 16
|
||||
},
|
||||
|
||||
"board": {
|
||||
"card": 262,
|
||||
"margin": 8
|
||||
},
|
||||
|
||||
"cell": {
|
||||
"default": 192,
|
||||
"format1": 500,
|
||||
|
||||
"min": 48,
|
||||
"max": 1000,
|
||||
"edit": 300,
|
||||
"icon": 70
|
||||
}
|
||||
},
|
||||
|
||||
"menuBlockContext": {
|
||||
"default": 400,
|
||||
"code": 130,
|
||||
"header1": 330,
|
||||
"header2": 330,
|
||||
"header3": 330
|
||||
},
|
||||
|
||||
"index": {
|
||||
"width": 192,
|
||||
"height": 112,
|
||||
"margin": 16,
|
||||
"border": 72,
|
||||
"titleY": 142
|
||||
},
|
||||
|
||||
"store": {
|
||||
"width": 300,
|
||||
"margin": 32,
|
||||
"border": 80
|
||||
}
|
||||
},
|
||||
|
||||
"textColor": [
|
||||
"grey",
|
||||
"yellow",
|
||||
"orange",
|
||||
"red",
|
||||
"pink",
|
||||
"purple",
|
||||
"blue",
|
||||
"ice",
|
||||
"teal",
|
||||
"lime"
|
||||
],
|
||||
|
||||
"monthDays": {
|
||||
"1": 31,
|
||||
"2": 28,
|
||||
"3": 31,
|
||||
"4": 30,
|
||||
"5": 31,
|
||||
"6": 30,
|
||||
"7": 31,
|
||||
"8": 31,
|
||||
"9": 30,
|
||||
"10": 31,
|
||||
"11": 30,
|
||||
"12": 31
|
||||
graphId: {
|
||||
global: 'graphGlobal',
|
||||
dataview: 'graphDataview'
|
||||
},
|
||||
|
||||
"codeLang": {
|
||||
"abap": "ABAP",
|
||||
"arduino": "Arduino",
|
||||
"bash": "Bash",
|
||||
"basic": "BASIC",
|
||||
"bsl": "BSL",
|
||||
"c": "C",
|
||||
"cfscript": "CFScript",
|
||||
"cmake": "CMake",
|
||||
"csharp": "C#",
|
||||
"cpp": "C++",
|
||||
"clojure": "Clojure",
|
||||
"coffeescript": "CoffeeScript",
|
||||
"css": "CSS",
|
||||
"dart": "Dart",
|
||||
"diff": "Diff",
|
||||
"docker": "Docker",
|
||||
"elixir": "Elixir",
|
||||
"elm": "Elm",
|
||||
"erlang": "Erlang",
|
||||
"flow": "Flow",
|
||||
"fortran": "Fortran",
|
||||
"fsharp": "F#",
|
||||
"gdscript": "GDScript",
|
||||
"gherkin": "Gherkin",
|
||||
"graphql": "GraphQL",
|
||||
"groovy": "Groovy",
|
||||
"go": "Go",
|
||||
"dot": "Graphviz",
|
||||
"haskell": "Haskell",
|
||||
"html": "HTML",
|
||||
"json": "JSON",
|
||||
"javascript": "JavaScript",
|
||||
"java": "Java",
|
||||
"kotlin": "Kotlin",
|
||||
"latex": "LaTeX",
|
||||
"less": "Less",
|
||||
"lisp": "Lisp",
|
||||
"livescript": "LiveScript",
|
||||
"lua": "Lua",
|
||||
"markup": "Markup",
|
||||
"markdown": "Markdown",
|
||||
"makefile": "Makefile",
|
||||
"matlab": "MATLAB",
|
||||
"nginx": "Nginx",
|
||||
"nix": "Nix",
|
||||
"objc": "Objective-C",
|
||||
"ocaml": "OCaml",
|
||||
"pascal": "Pascal",
|
||||
"perl": "Perl",
|
||||
"php": "PHP",
|
||||
"powershell": "Power Shell",
|
||||
"plain": "Plain Text",
|
||||
"prolog": "Prolog",
|
||||
"python": "Python",
|
||||
"reason": "Reason",
|
||||
"ruby": "Ruby",
|
||||
"rust": "Rust",
|
||||
"r": "R",
|
||||
"sass": "Sass",
|
||||
"scala": "Scala",
|
||||
"scheme": "Scheme",
|
||||
"scss": "SСSS",
|
||||
"shell": "Shell",
|
||||
"solidity": "Solidity",
|
||||
"sql": "SQL",
|
||||
"swift": "Swift",
|
||||
"toml": "TOML",
|
||||
"typescript": "TypeScript",
|
||||
"vbnet": "Vb.Net",
|
||||
"verilog": "Verilog",
|
||||
"vhdl": "VHDL",
|
||||
"vb": "Visual Basic",
|
||||
"wasm": "WebAssembly",
|
||||
"wolfram": "Wolfram",
|
||||
"xml": "XML",
|
||||
"yaml": "YAML"
|
||||
subId: {
|
||||
search: 'search',
|
||||
profile: 'profile',
|
||||
deleted: 'deleted',
|
||||
type: 'type',
|
||||
relation: 'relation',
|
||||
option: 'option',
|
||||
store: 'store',
|
||||
archive: 'archive',
|
||||
sidebar: 'sidebar',
|
||||
graph: 'graph',
|
||||
space: 'space',
|
||||
files: 'files',
|
||||
participant: 'participant',
|
||||
myParticipant: 'myParticipant'
|
||||
},
|
||||
|
||||
"enabledInterfaceLang": [
|
||||
"be-BY",
|
||||
"cs-CZ",
|
||||
"da-DK",
|
||||
"de-DE",
|
||||
"en-US",
|
||||
"es-ES",
|
||||
"fr-FR",
|
||||
"hi-IN",
|
||||
"id-ID",
|
||||
"it-IT",
|
||||
"lt-LT",
|
||||
"ja-JP",
|
||||
"ko-KR",
|
||||
"nl-NL",
|
||||
"no-NO",
|
||||
"pl-PL",
|
||||
"pt-BR",
|
||||
"ro-RO",
|
||||
"ru-RU",
|
||||
"tr-TR",
|
||||
"uk-UA",
|
||||
"vi-VN",
|
||||
"zh-CN",
|
||||
"zh-TW"
|
||||
],
|
||||
typeKey: {
|
||||
page: 'ot-page',
|
||||
set: 'ot-set',
|
||||
space: 'ot-space',
|
||||
template: 'ot-template',
|
||||
type: 'ot-objectType',
|
||||
image: 'ot-image',
|
||||
file: 'ot-file',
|
||||
video: 'ot-video',
|
||||
audio: 'ot-audio',
|
||||
relation: 'ot-relation',
|
||||
note: 'ot-note',
|
||||
task: 'ot-task',
|
||||
bookmark: 'ot-bookmark',
|
||||
option: 'ot-relationOption',
|
||||
collection: 'ot-collection',
|
||||
dashboard: 'ot-dashboard',
|
||||
date: 'ot-date',
|
||||
profile: 'ot-profile'
|
||||
},
|
||||
|
||||
templateId: {
|
||||
blank: 'blank',
|
||||
new: 'newTemplate'
|
||||
},
|
||||
|
||||
blockId: {
|
||||
title: 'title',
|
||||
description: 'description',
|
||||
featured: 'featuredRelations',
|
||||
dataview: 'dataview',
|
||||
type: 'type',
|
||||
header: 'header'
|
||||
},
|
||||
|
||||
widgetId: {
|
||||
favorite: 'favorite',
|
||||
recentEdit: 'recent',
|
||||
recentOpen: 'recentOpen',
|
||||
set: 'set',
|
||||
collection: 'collection'
|
||||
},
|
||||
|
||||
monthDays: {
|
||||
1: 31,
|
||||
2: 28,
|
||||
3: 31,
|
||||
4: 30,
|
||||
5: 31,
|
||||
6: 30,
|
||||
7: 31,
|
||||
8: 31,
|
||||
9: 30,
|
||||
10: 31,
|
||||
11: 30,
|
||||
12: 31
|
||||
},
|
||||
|
||||
"spellingLang": {
|
||||
"af": "Afrikaans",
|
||||
"bg": "Български",
|
||||
"ca": "Català",
|
||||
"cs": "Česky",
|
||||
"cy": "Cymraeg",
|
||||
"da": "Dansk",
|
||||
"de": "Deutsch",
|
||||
"de-DE": "Deutsch (Deutschland)",
|
||||
"el": "Ελληνικά",
|
||||
"en": "English",
|
||||
"en-AU": "English (Australia)",
|
||||
"en-CA": "English (Canada)",
|
||||
"en-GB": "English (United Kingdom)",
|
||||
"en-GB-oxendict": "English (United Kingdom Oxford spelling)",
|
||||
"en-US": "English (United States)",
|
||||
"es": "Español",
|
||||
"es-419": "Español (Caribe)",
|
||||
"es-AR": "Español (Argentina)",
|
||||
"es-ES": "Español (España)",
|
||||
"es-MX": "Español (México)",
|
||||
"es-US": "Español (Estados Unidos)",
|
||||
"et": "Eesti",
|
||||
"fa": "فارسی",
|
||||
"fo": "Føroyskt",
|
||||
"fr": "Français",
|
||||
"fr-FR": "Français (France)",
|
||||
"he": "עברית",
|
||||
"hi": "हिन्दी",
|
||||
"hr": "Hrvatski",
|
||||
"hu": "Magyar",
|
||||
"hy": "Հայերեն",
|
||||
"id": "Bahasa Indonesia",
|
||||
"it": "Italiano",
|
||||
"it-IT": "Italiano (Italia)",
|
||||
"ko": "한국어",
|
||||
"lt": "Lietuvių",
|
||||
"lv": "Latviešu",
|
||||
"nb": "Norsk (bokmål)",
|
||||
"nl": "Nederlands",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"pt-BR": "Português (Brasil)",
|
||||
"pt-PT": "Português (Portugal)",
|
||||
"ro": "Română",
|
||||
"ru": "Русский",
|
||||
"sh": "Srpskohrvatski / Српскохрватски",
|
||||
"sk": "Slovenčina",
|
||||
"sl": "Slovenščina",
|
||||
"sq": "Shqip",
|
||||
"sr": "Српски",
|
||||
"sv": "Svenska",
|
||||
"ta": "தமிழ்",
|
||||
"tg": "Тоҷикӣ",
|
||||
"tr": "Türkçe",
|
||||
"uk": "Українська",
|
||||
"vi": "Tiếng Việt"
|
||||
}
|
||||
};
|
|
@ -8,6 +8,10 @@ import Latex from './latex';
|
|||
import Route from './route';
|
||||
import Theme from './theme';
|
||||
import Url from './url';
|
||||
import Lang from './lang';
|
||||
import Relation from './relation';
|
||||
import Menu from './menu';
|
||||
import Size from './size';
|
||||
|
||||
export {
|
||||
Color,
|
||||
|
@ -20,4 +24,8 @@ export {
|
|||
Route,
|
||||
Theme,
|
||||
Url,
|
||||
Lang,
|
||||
Relation,
|
||||
Menu,
|
||||
Size,
|
||||
};
|
167
src/json/lang.ts
Normal file
167
src/json/lang.ts
Normal file
|
@ -0,0 +1,167 @@
|
|||
export default {
|
||||
|
||||
code: {
|
||||
abap: 'ABAP',
|
||||
arduino: 'Arduino',
|
||||
bash: 'Bash',
|
||||
basic: 'BASIC',
|
||||
bsl: 'BSL',
|
||||
c: 'C',
|
||||
cfscript: 'CFScript',
|
||||
cmake: 'CMake',
|
||||
csharp: 'C#',
|
||||
cpp: 'C++',
|
||||
clojure: 'Clojure',
|
||||
coffeescript: 'CoffeeScript',
|
||||
css: 'CSS',
|
||||
dart: 'Dart',
|
||||
diff: 'Diff',
|
||||
docker: 'Docker',
|
||||
elixir: 'Elixir',
|
||||
elm: 'Elm',
|
||||
erlang: 'Erlang',
|
||||
flow: 'Flow',
|
||||
fortran: 'Fortran',
|
||||
fsharp: 'F#',
|
||||
gdscript: 'GDScript',
|
||||
gherkin: 'Gherkin',
|
||||
graphql: 'GraphQL',
|
||||
groovy: 'Groovy',
|
||||
go: 'Go',
|
||||
dot: 'Graphviz',
|
||||
haskell: 'Haskell',
|
||||
html: 'HTML',
|
||||
json: 'JSON',
|
||||
javascript: 'JavaScript',
|
||||
java: 'Java',
|
||||
kotlin: 'Kotlin',
|
||||
latex: 'LaTeX',
|
||||
less: 'Less',
|
||||
lisp: 'Lisp',
|
||||
livescript: 'LiveScript',
|
||||
lua: 'Lua',
|
||||
markup: 'Markup',
|
||||
markdown: 'Markdown',
|
||||
makefile: 'Makefile',
|
||||
matlab: 'MATLAB',
|
||||
nginx: 'Nginx',
|
||||
nix: 'Nix',
|
||||
objc: 'Objective-C',
|
||||
ocaml: 'OCaml',
|
||||
pascal: 'Pascal',
|
||||
perl: 'Perl',
|
||||
php: 'PHP',
|
||||
powershell: 'Power Shell',
|
||||
plain: 'Plain Text',
|
||||
prolog: 'Prolog',
|
||||
python: 'Python',
|
||||
reason: 'Reason',
|
||||
ruby: 'Ruby',
|
||||
rust: 'Rust',
|
||||
r: 'R',
|
||||
sass: 'Sass',
|
||||
scala: 'Scala',
|
||||
scheme: 'Scheme',
|
||||
scss: 'SСSS',
|
||||
shell: 'Shell',
|
||||
solidity: 'Solidity',
|
||||
sql: 'SQL',
|
||||
swift: 'Swift',
|
||||
toml: 'TOML',
|
||||
typescript: 'TypeScript',
|
||||
vbnet: 'Vb.Net',
|
||||
verilog: 'Verilog',
|
||||
vhdl: 'VHDL',
|
||||
vb: 'Visual Basic',
|
||||
wasm: 'WebAssembly',
|
||||
wolfram: 'Wolfram',
|
||||
xml: 'XML',
|
||||
yaml: 'YAML'
|
||||
},
|
||||
|
||||
enabled: [
|
||||
'be-BY',
|
||||
'cs-CZ',
|
||||
'da-DK',
|
||||
'de-DE',
|
||||
'en-US',
|
||||
'es-ES',
|
||||
'fr-FR',
|
||||
'hi-IN',
|
||||
'id-ID',
|
||||
'it-IT',
|
||||
'lt-LT',
|
||||
'ja-JP',
|
||||
'ko-KR',
|
||||
'nl-NL',
|
||||
'no-NO',
|
||||
'pl-PL',
|
||||
'pt-BR',
|
||||
'ro-RO',
|
||||
'ru-RU',
|
||||
'tr-TR',
|
||||
'uk-UA',
|
||||
'vi-VN',
|
||||
'zh-CN',
|
||||
'zh-TW'
|
||||
],
|
||||
|
||||
spelling: {
|
||||
af: 'Afrikaans',
|
||||
bg: 'Български',
|
||||
ca: 'Català',
|
||||
cs: 'Česky',
|
||||
cy: 'Cymraeg',
|
||||
da: 'Dansk',
|
||||
de: 'Deutsch',
|
||||
'de-DE': 'Deutsch (Deutschland)',
|
||||
el: 'Ελληνικά',
|
||||
en: 'English',
|
||||
'en-AU': 'English (Australia)',
|
||||
'en-CA': 'English (Canada)',
|
||||
'en-GB': 'English (United Kingdom)',
|
||||
'en-GB-oxendict': 'English (United Kingdom Oxford spelling)',
|
||||
'en-US': 'English (United States)',
|
||||
es: 'Español',
|
||||
'es-419': 'Español (Caribe)',
|
||||
'es-AR': 'Español (Argentina)',
|
||||
'es-ES': 'Español (España)',
|
||||
'es-MX': 'Español (México)',
|
||||
'es-US': 'Español (Estados Unidos)',
|
||||
et: 'Eesti',
|
||||
fa: 'فارسی',
|
||||
fo: 'Føroyskt',
|
||||
fr: 'Français',
|
||||
'fr-FR': 'Français (France)',
|
||||
he: 'עברית',
|
||||
hi: 'हिन्दी',
|
||||
hr: 'Hrvatski',
|
||||
hu: 'Magyar',
|
||||
hy: 'Հայերեն',
|
||||
id: 'Bahasa Indonesia',
|
||||
it: 'Italiano',
|
||||
'it-IT': 'Italiano (Italia)',
|
||||
ko: '한국어',
|
||||
lt: 'Lietuvių',
|
||||
lv: 'Latviešu',
|
||||
nb: 'Norsk (bokmål)',
|
||||
nl: 'Nederlands',
|
||||
pl: 'Polski',
|
||||
pt: 'Português',
|
||||
'pt-BR': 'Português (Brasil)',
|
||||
'pt-PT': 'Português (Portugal)',
|
||||
ro: 'Română',
|
||||
ru: 'Русский',
|
||||
sh: 'Srpskohrvatski / Српскохрватски',
|
||||
sk: 'Slovenčina',
|
||||
sl: 'Slovenščina',
|
||||
sq: 'Shqip',
|
||||
sr: 'Српски',
|
||||
sv: 'Svenska',
|
||||
ta: 'தமிழ்',
|
||||
tg: 'Тоҷикӣ',
|
||||
tr: 'Türkçe',
|
||||
uk: 'Українська',
|
||||
vi: 'Tiếng Việt',
|
||||
},
|
||||
};
|
66
src/json/menu.ts
Normal file
66
src/json/menu.ts
Normal file
|
@ -0,0 +1,66 @@
|
|||
export default {
|
||||
cell: [
|
||||
'select',
|
||||
'button',
|
||||
'dataviewText',
|
||||
'dataviewRelationEdit',
|
||||
'dataviewObjectList',
|
||||
'dataviewObjectValues',
|
||||
'dataviewOptionList',
|
||||
'dataviewOptionEdit',
|
||||
'dataviewFileList',
|
||||
'dataviewFileValues',
|
||||
'dataviewCalendar',
|
||||
'relationSuggest'
|
||||
],
|
||||
cellAdd: [
|
||||
'dataviewRelationEdit',
|
||||
'dataviewRelationSuggest',
|
||||
'dataviewRelationList'
|
||||
],
|
||||
context: [
|
||||
'select',
|
||||
'blockStyle',
|
||||
'blockLink',
|
||||
'blockColor',
|
||||
'blockBackground',
|
||||
'searchObject',
|
||||
'typeSuggest',
|
||||
'blockAlign'
|
||||
],
|
||||
selectContext: [
|
||||
'searchObject',
|
||||
'typeSuggest',
|
||||
'blockAlign'
|
||||
],
|
||||
add: [ 'searchObject', 'blockRelationEdit', 'typeSuggest' ],
|
||||
action: [
|
||||
'blockStyle',
|
||||
'blockColor',
|
||||
'blockBackground',
|
||||
'blockAlign',
|
||||
'blockLinkSettings',
|
||||
'searchObject',
|
||||
'typeSuggest'
|
||||
],
|
||||
object: [ 'select', 'searchObject' ],
|
||||
index: [ 'searchObject' ],
|
||||
relationEdit: [
|
||||
'select',
|
||||
'searchObject',
|
||||
'dataviewDate',
|
||||
'dataviewObjectValues',
|
||||
'dataviewObjectList'
|
||||
],
|
||||
layout: [ 'blockAlign' ],
|
||||
latex: [ 'previewLatex' ],
|
||||
viewEdit: [ 'select', 'graphSettings' ],
|
||||
featuredType: [ 'searchObject', 'typeSuggest' ],
|
||||
dataviewHead: [ 'dataviewSource', 'searchObject' ],
|
||||
store: [ 'typeSuggest', 'relationSuggest' ],
|
||||
widget: [ 'searchObject', 'select' ],
|
||||
dataviewTemplate: [ 'previewObject' ],
|
||||
table: [ 'select2', 'blockColor', 'blockBackground' ],
|
||||
navigation: [ 'quickCapture', 'space' ],
|
||||
dataviewContext: [ 'typeSuggest', 'searchObject' ]
|
||||
};
|
161
src/json/relation.ts
Normal file
161
src/json/relation.ts
Normal file
|
@ -0,0 +1,161 @@
|
|||
export default {
|
||||
default: [
|
||||
'id',
|
||||
'spaceId',
|
||||
'name',
|
||||
'description',
|
||||
'snippet',
|
||||
'iconEmoji',
|
||||
'iconImage',
|
||||
'iconOption',
|
||||
'relationFormat',
|
||||
'type',
|
||||
'layout',
|
||||
'isHidden',
|
||||
'isArchived',
|
||||
'isReadonly',
|
||||
'isDeleted',
|
||||
'isFavorite',
|
||||
'done',
|
||||
'fileExt',
|
||||
'fileMimeType',
|
||||
'sizeInBytes',
|
||||
'restrictions',
|
||||
'defaultTemplateId',
|
||||
'identityProfileLink',
|
||||
'createdDate'
|
||||
],
|
||||
|
||||
sidebar: [
|
||||
'id',
|
||||
'spaceId',
|
||||
'name',
|
||||
'description',
|
||||
'snippet',
|
||||
'layout',
|
||||
'type',
|
||||
'iconEmoji',
|
||||
'iconImage',
|
||||
'iconOption',
|
||||
'isReadonly',
|
||||
'isHidden',
|
||||
'isDeleted',
|
||||
'isArchived',
|
||||
'isFavorite',
|
||||
'done',
|
||||
'relationFormat',
|
||||
'fileExt',
|
||||
'fileMimeType',
|
||||
'links',
|
||||
'restrictions',
|
||||
'source',
|
||||
'identityProfileLink',
|
||||
'lastModifiedDate',
|
||||
'lastOpenedDate'
|
||||
],
|
||||
|
||||
relation: [
|
||||
'id',
|
||||
'spaceId',
|
||||
'type',
|
||||
'layout',
|
||||
'name',
|
||||
'relationFormat',
|
||||
'relationKey',
|
||||
'isReadonly',
|
||||
'isHidden',
|
||||
'isDeleted',
|
||||
'isArchived',
|
||||
'isFavorite',
|
||||
'restrictions',
|
||||
'relationMaxCount',
|
||||
'relationReadonlyValue',
|
||||
'relationDefaultValue',
|
||||
'relationFormatObjectTypes',
|
||||
'sourceObject',
|
||||
'restrictions'
|
||||
],
|
||||
|
||||
cover: [
|
||||
'coverId',
|
||||
'coverType',
|
||||
'coverX',
|
||||
'coverY',
|
||||
'coverScale'
|
||||
],
|
||||
|
||||
option: [
|
||||
'id',
|
||||
'relationKey',
|
||||
'type',
|
||||
'layout',
|
||||
'name',
|
||||
'relationOptionColor'
|
||||
],
|
||||
|
||||
type: [
|
||||
'recommendedRelations',
|
||||
'recommendedLayout',
|
||||
'sourceObject',
|
||||
'uniqueKey',
|
||||
'defaultTemplateId',
|
||||
'lastUsedDate'
|
||||
],
|
||||
|
||||
graph: [
|
||||
'id',
|
||||
'name',
|
||||
'snippet',
|
||||
'description',
|
||||
'iconEmoji',
|
||||
'iconImage',
|
||||
'iconOption',
|
||||
'relationFormat',
|
||||
'type',
|
||||
'layout',
|
||||
'done',
|
||||
'fileExt',
|
||||
'fileMimeType',
|
||||
'isDeleted',
|
||||
'isArchived',
|
||||
'isFavorite',
|
||||
'identityProfileLink',
|
||||
'restrictions'
|
||||
],
|
||||
|
||||
template: [
|
||||
'templateIsBundled',
|
||||
'type',
|
||||
'targetObjectType',
|
||||
'internalFlags',
|
||||
'sourceObject'
|
||||
],
|
||||
|
||||
space: [
|
||||
'spaceDashboardId',
|
||||
'spaceAccountStatus',
|
||||
'spaceLocalStatus',
|
||||
'spaceAccessType',
|
||||
'readersLimit',
|
||||
'writersLimit',
|
||||
'sharedSpacesLimit',
|
||||
'targetSpaceId',
|
||||
'creator',
|
||||
'createdDate'
|
||||
],
|
||||
|
||||
participant: [
|
||||
'identity',
|
||||
'participantPermissions',
|
||||
'participantStatus',
|
||||
'globalName'
|
||||
],
|
||||
|
||||
syncStatus: [
|
||||
'syncStatus',
|
||||
'syncDate',
|
||||
'syncError'
|
||||
],
|
||||
|
||||
pageCover: 'pageCover',
|
||||
};
|
49
src/json/size.ts
Normal file
49
src/json/size.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
export default {
|
||||
editor: 704,
|
||||
blockMenu: 48,
|
||||
lastBlock: 80,
|
||||
iconPage: 256,
|
||||
image: 1920,
|
||||
cover: 1920,
|
||||
menuBorder: 10,
|
||||
|
||||
sidebar: {
|
||||
width: { min: 240, max: 500, default: 336, close: 180 }
|
||||
},
|
||||
|
||||
table: {
|
||||
min: 50,
|
||||
max: 2000,
|
||||
default: 140
|
||||
},
|
||||
|
||||
dataview: {
|
||||
gallery: {
|
||||
width: 224,
|
||||
height: 72,
|
||||
margin: 16,
|
||||
padding: 16
|
||||
},
|
||||
|
||||
board: {
|
||||
card: 262,
|
||||
margin: 8
|
||||
},
|
||||
|
||||
cell: {
|
||||
default: 192,
|
||||
format1: 500,
|
||||
|
||||
min: 48,
|
||||
max: 1000,
|
||||
edit: 300,
|
||||
icon: 70
|
||||
}
|
||||
},
|
||||
|
||||
store: {
|
||||
width: 300,
|
||||
margin: 32,
|
||||
border: 80
|
||||
}
|
||||
};
|
|
@ -58,7 +58,7 @@ const BlockCover = observer(class BlockCover extends React.Component<I.BlockComp
|
|||
render () {
|
||||
const { isEditing } = this.state;
|
||||
const { rootId, readonly } = this.props;
|
||||
const object = S.Detail.get(rootId, rootId, [ 'iconImage', 'iconEmoji' ].concat(J.Constant.coverRelationKeys), true);
|
||||
const object = S.Detail.get(rootId, rootId, [ 'iconImage', 'iconEmoji' ].concat(J.Relation.cover), true);
|
||||
const { coverType, coverId } = object;
|
||||
const isImage = U.Data.coverIsImage(coverType);
|
||||
const root = S.Block.getLeaf(rootId, rootId);
|
||||
|
@ -212,7 +212,7 @@ const BlockCover = observer(class BlockCover extends React.Component<I.BlockComp
|
|||
onClose: () => {
|
||||
elements.removeClass('hover');
|
||||
},
|
||||
subIds: J.Constant.menuIds.layout,
|
||||
subIds: J.Menu.layout,
|
||||
data: {
|
||||
rootId: rootId,
|
||||
value: object.layout,
|
||||
|
@ -249,7 +249,7 @@ const BlockCover = observer(class BlockCover extends React.Component<I.BlockComp
|
|||
|
||||
onEdit (e: any) {
|
||||
const { rootId } = this.props;
|
||||
const object = S.Detail.get(rootId, rootId, J.Constant.coverRelationKeys, true);
|
||||
const object = S.Detail.get(rootId, rootId, J.Relation.cover, true);
|
||||
|
||||
this.coords.x = object.coverX;
|
||||
this.coords.y = object.coverY;
|
||||
|
@ -291,7 +291,7 @@ const BlockCover = observer(class BlockCover extends React.Component<I.BlockComp
|
|||
e.stopPropagation();
|
||||
|
||||
const { rootId } = this.props;
|
||||
const object = S.Detail.get(rootId, rootId, J.Constant.coverRelationKeys, true);
|
||||
const object = S.Detail.get(rootId, rootId, J.Relation.cover, true);
|
||||
|
||||
U.Object.setCover(rootId, object.coverType, object.coverId, this.coords.x, this.coords.y, this.scale, () => {
|
||||
this.setState({ isEditing: false });
|
||||
|
@ -311,7 +311,7 @@ const BlockCover = observer(class BlockCover extends React.Component<I.BlockComp
|
|||
};
|
||||
|
||||
const { rootId } = this.props;
|
||||
const object = S.Detail.get(rootId, rootId, J.Constant.coverRelationKeys, true);
|
||||
const object = S.Detail.get(rootId, rootId, J.Relation.cover, true);
|
||||
const { coverId, coverType } = object;
|
||||
const node = $(this.node);
|
||||
const isImage = U.Data.coverIsImage(coverType);
|
||||
|
@ -354,7 +354,7 @@ const BlockCover = observer(class BlockCover extends React.Component<I.BlockComp
|
|||
};
|
||||
|
||||
if ([ I.CoverType.Upload, I.CoverType.Source ].includes(coverType)) {
|
||||
el.src = S.Common.imageUrl(coverId, J.Constant.size.cover);
|
||||
el.src = S.Common.imageUrl(coverId, J.Size.cover);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -430,11 +430,11 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
getKeys (id: string): string[] {
|
||||
const view = this.getView(id);
|
||||
|
||||
let keys = J.Constant.defaultRelationKeys.concat(J.Constant.coverRelationKeys);
|
||||
let keys = J.Relation.default.concat(J.Relation.cover);
|
||||
if (view) {
|
||||
keys = keys.concat((view.relations || []).map(it => it && it.relationKey));
|
||||
|
||||
if (view.coverRelationKey && (view.coverRelationKey != J.Constant.pageCoverRelationKey)) {
|
||||
if (view.coverRelationKey && (view.coverRelationKey != J.Relation.pageCover)) {
|
||||
keys.push(view.coverRelationKey);
|
||||
};
|
||||
|
||||
|
@ -762,7 +762,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
...menuParam,
|
||||
offsetY: 10,
|
||||
noAnimation: true,
|
||||
subIds: J.Constant.menuIds.dataviewTemplate.concat([ 'dataviewTemplateContext' ]),
|
||||
subIds: J.Menu.dataviewTemplate.concat([ 'dataviewTemplateContext' ]),
|
||||
vertical: dir > 0 ? I.MenuDirection.Top : I.MenuDirection.Bottom,
|
||||
horizontal: dir > 0 ? I.MenuDirection.Left : I.MenuDirection.Right,
|
||||
onOpen: context => menuContext = context,
|
||||
|
|
|
@ -444,17 +444,17 @@ const Cell = observer(class Cell extends React.Component<Props> {
|
|||
|
||||
$(pageContainer).off('mousedown.cell').on('mousedown.cell', (e: any) => {
|
||||
if (!$(e.target).parents(`#${cellId}`).length) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
};
|
||||
});
|
||||
|
||||
if (!config.debug.ui) {
|
||||
win.off('blur.cell').on('blur.cell', () => S.Menu.closeAll(J.Constant.menuIds.cell));
|
||||
win.off('blur.cell').on('blur.cell', () => S.Menu.closeAll(J.Menu.cell));
|
||||
};
|
||||
} else
|
||||
if (closeIfOpen) {
|
||||
setOff();
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
window.clearTimeout(this.timeout);
|
||||
};
|
||||
} else {
|
||||
|
|
|
@ -353,7 +353,7 @@ const CellText = observer(class CellText extends React.Component<I.Cell, State>
|
|||
e.preventDefault();
|
||||
|
||||
this.save(value, () => {
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
|
||||
this.range = null;
|
||||
this.setEditing(false);
|
||||
|
|
|
@ -492,7 +492,7 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
const view = node.find('.viewContent');
|
||||
const container = U.Common.getPageContainer(isPopup);
|
||||
const cw = container.width();
|
||||
const size = J.Constant.size.dataview.board;
|
||||
const size = J.Size.dataview.board;
|
||||
const groups = this.getGroups(false);
|
||||
const width = groups.length * (size.card + size.margin) - size.margin;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
constructor (props: I.ViewComponent) {
|
||||
super(props);
|
||||
|
||||
const { height } = J.Constant.size.dataview.gallery;
|
||||
const { height } = J.Size.dataview.gallery;
|
||||
|
||||
this.cache = new CellMeasurerCache({
|
||||
defaultHeight: height,
|
||||
|
@ -196,7 +196,7 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
return;
|
||||
};
|
||||
|
||||
const { margin } = J.Constant.size.dataview.gallery;
|
||||
const { margin } = J.Size.dataview.gallery;
|
||||
|
||||
let size = 0;
|
||||
switch (view.cardSize) {
|
||||
|
@ -273,7 +273,7 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
getCardHeight (): number {
|
||||
const { getVisibleRelations } = this.props;
|
||||
const relations = getVisibleRelations();
|
||||
const size = J.Constant.size.dataview.gallery;
|
||||
const size = J.Size.dataview.gallery;
|
||||
|
||||
let height = size.padding * 2 + size.margin - 4;
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ const ViewGraph = observer(class ViewGraph extends React.Component<I.ViewCompone
|
|||
|
||||
this.setLoading(true);
|
||||
|
||||
C.ObjectGraph(S.Common.space, filters, 0, [], J.Constant.graphRelationKeys, (isCollection ? target.id : ''), target.setOf, (message: any) => {
|
||||
C.ObjectGraph(S.Common.space, filters, 0, [], J.Relation.graph, (isCollection ? target.id : ''), target.setOf, (message: any) => {
|
||||
if (message.error.code) {
|
||||
return;
|
||||
};
|
||||
|
@ -127,7 +127,7 @@ const ViewGraph = observer(class ViewGraph extends React.Component<I.ViewCompone
|
|||
|
||||
this.data.nodes = message.nodes.map(it => S.Detail.mapper(it));
|
||||
|
||||
U.Data.onSubscribe(J.Constant.subId.graph, 'id', J.Constant.graphRelationKeys, {
|
||||
U.Data.onSubscribe(J.Constant.subId.graph, 'id', J.Relation.graph, {
|
||||
error: {},
|
||||
records: message.nodes,
|
||||
dependencies: [],
|
||||
|
|
|
@ -182,7 +182,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
const { getVisibleRelations } = this.props;
|
||||
const node = $(this.node);
|
||||
const relations = getVisibleRelations();
|
||||
const size = J.Constant.size.dataview.cell;
|
||||
const size = J.Size.dataview.cell;
|
||||
const widths = this.getColumnWidths(relationKey, width);
|
||||
const str = relations.map(it => widths[it.relationKey] + 'px').concat([ 'auto' ]).join(' ');
|
||||
|
||||
|
@ -296,7 +296,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
};
|
||||
|
||||
checkWidth (width: number): number {
|
||||
const { min, max } = J.Constant.size.dataview.cell;
|
||||
const { min, max } = J.Size.dataview.cell;
|
||||
return Math.min(max, Math.max(min, Math.floor(width)));
|
||||
};
|
||||
|
||||
|
@ -315,7 +315,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
isInline,
|
||||
isCollection,
|
||||
blockId: block.id,
|
||||
onAdd: () => S.Menu.closeAll(J.Constant.menuIds.cellAdd)
|
||||
onAdd: () => S.Menu.closeAll(J.Menu.cellAdd)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -359,7 +359,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
const wrap = node.find('#scrollWrap');
|
||||
const grid = node.find('.ReactVirtualized__Grid__innerScrollContainer');
|
||||
const container = U.Common.getPageContainer(isPopup);
|
||||
const width = getVisibleRelations().reduce((res: number, current: any) => { return res + current.width; }, J.Constant.size.blockMenu);
|
||||
const width = getVisibleRelations().reduce((res: number, current: any) => { return res + current.width; }, J.Size.blockMenu);
|
||||
const length = S.Record.getRecordIds(S.Record.getSubId(rootId, block.id), '').length;
|
||||
const cw = container.width();
|
||||
const rh = this.getRowHeight();
|
||||
|
@ -377,7 +377,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
wrap.css({ width: vw + margin - offset, paddingRight: margin - offset });
|
||||
} else {
|
||||
const parentObj = $(`#block-${parent.id}`);
|
||||
const vw = parentObj.length ? (parentObj.width() - J.Constant.size.blockMenu) : 0;
|
||||
const vw = parentObj.length ? (parentObj.width() - J.Size.blockMenu) : 0;
|
||||
|
||||
wrap.css({ width: Math.max(vw, width) });
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ const BodyCell = observer(class BodyCell extends React.Component<Props> {
|
|||
const idPrefix = getIdPrefix();
|
||||
const id = Relation.cellId(idPrefix, relationKey, record.id);
|
||||
const width = Relation.width(this.props.width, relation.format);
|
||||
const size = J.Constant.size.dataview.cell;
|
||||
const size = J.Size.dataview.cell;
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const canEdit = canCellEdit(relation, record);
|
||||
|
||||
|
@ -77,7 +77,7 @@ const BodyCell = observer(class BodyCell extends React.Component<Props> {
|
|||
viewType={I.ViewType.Grid}
|
||||
idPrefix={idPrefix}
|
||||
onCellChange={onCellChange}
|
||||
maxWidth={J.Constant.size.dataview.cell.edit}
|
||||
maxWidth={J.Size.dataview.cell.edit}
|
||||
/>
|
||||
{iconEdit}
|
||||
</div>
|
||||
|
|
|
@ -497,11 +497,11 @@ const BlockEmbed = observer(class BlockEmbed extends React.Component<I.BlockComp
|
|||
offsetY: 4,
|
||||
offsetX: () => {
|
||||
const rect = recalcRect();
|
||||
return rect ? 0 : J.Constant.size.blockMenu;
|
||||
return rect ? 0 : J.Size.blockMenu;
|
||||
},
|
||||
commonFilter: true,
|
||||
className: (isTemplate ? 'isTemplate' : ''),
|
||||
subIds: J.Constant.menuIds.latex,
|
||||
subIds: J.Menu.latex,
|
||||
onClose: () => {
|
||||
S.Common.filterSet(0, '');
|
||||
},
|
||||
|
|
|
@ -451,7 +451,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
S.Menu.open('select', {
|
||||
element: `#block-${block.id} #${Relation.cellId(PREFIX, 'type', rootId)}`,
|
||||
offsetY: 8,
|
||||
subIds: J.Constant.menuIds.featuredType,
|
||||
subIds: J.Menu.featuredType,
|
||||
onOpen: (context: any) => {
|
||||
this.menuContext = context;
|
||||
},
|
||||
|
@ -490,7 +490,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
const { rootId, block } = this.props;
|
||||
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.featuredType);
|
||||
S.Menu.closeAll(J.Menu.featuredType);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -564,7 +564,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
if (S.Menu.isOpen(menuId)) {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
} else {
|
||||
S.Menu.closeAll(J.Constant.menuIds.featuredType, () => {
|
||||
S.Menu.closeAll(J.Menu.featuredType, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
@ -753,7 +753,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
horizontal: I.MenuDirection.Right,
|
||||
noFlipY: true,
|
||||
noAnimation: true,
|
||||
subIds: J.Constant.menuIds.cell,
|
||||
subIds: J.Menu.cell,
|
||||
onOpen: (component: any) => {
|
||||
if (component && component.ref) {
|
||||
component.ref.onCellClick(e, relationKey);
|
||||
|
@ -826,7 +826,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
menuParam = Object.assign(menuParam, param);
|
||||
menuParam.data = Object.assign(menuParam.data, data);
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell, () => {
|
||||
S.Menu.closeAll(J.Menu.cell, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -519,7 +519,7 @@ const Block = observer(class Block extends React.Component<Props> {
|
|||
|
||||
const menuParam: Partial<I.MenuParam> = Object.assign({
|
||||
noFlipX: true,
|
||||
subIds: J.Constant.menuIds.action,
|
||||
subIds: J.Menu.action,
|
||||
onClose: () => {
|
||||
selection?.clear();
|
||||
focus.apply();
|
||||
|
@ -551,7 +551,7 @@ const Block = observer(class Block extends React.Component<Props> {
|
|||
const win = $(window);
|
||||
const node = $(this.node);
|
||||
const prevBlockId = childrenIds[index - 1];
|
||||
const offset = (prevBlockId ? node.find('#block-' + prevBlockId).offset().left : 0) + J.Constant.size.blockMenu ;
|
||||
const offset = (prevBlockId ? node.find('#block-' + prevBlockId).offset().left : 0) + J.Size.blockMenu ;
|
||||
const add = $('#button-block-add');
|
||||
|
||||
selection?.clear();
|
||||
|
@ -659,7 +659,7 @@ const Block = observer(class Block extends React.Component<Props> {
|
|||
const width = getWrapperWidth();
|
||||
const dw = 1 / childrenIds.length;
|
||||
const sum = (prevBlock.fields.width || dw) + (currentBlock.fields.width || dw);
|
||||
const offset = J.Constant.size.blockMenu * 2;
|
||||
const offset = J.Size.blockMenu * 2;
|
||||
|
||||
x = Math.max(offset, x);
|
||||
x = Math.min(sum * width - offset, x);
|
||||
|
@ -682,7 +682,7 @@ const Block = observer(class Block extends React.Component<Props> {
|
|||
return;
|
||||
};
|
||||
|
||||
const sm = J.Constant.size.blockMenu;
|
||||
const sm = J.Size.blockMenu;
|
||||
const node = $(this.node);
|
||||
const childrenIds = S.Block.getChildrenIds(rootId, block.id);
|
||||
const length = childrenIds.length;
|
||||
|
|
|
@ -22,7 +22,7 @@ const BlockLink = observer(class BlockLink extends React.Component<I.BlockCompon
|
|||
|
||||
render() {
|
||||
const { rootId, block } = this.props;
|
||||
const object = S.Detail.get(rootId, block.content.targetBlockId, J.Constant.coverRelationKeys);
|
||||
const object = S.Detail.get(rootId, block.content.targetBlockId, J.Relation.cover);
|
||||
const { _empty_, isArchived, isDeleted, done, layout, coverId, coverType, coverX, coverY, coverScale } = object;
|
||||
const content = U.Data.checkLinkSettings(block.content, layout);
|
||||
const readonly = this.props.readonly || !S.Block.isAllowed(object.restrictions, [ I.RestrictionObject.Details ]);
|
||||
|
|
|
@ -65,7 +65,7 @@ const BlockImage = observer(class BlockImage extends React.Component<I.BlockComp
|
|||
<div id="wrap" className="wrap" style={css}>
|
||||
<img
|
||||
className="mediaImage"
|
||||
src={S.Common.imageUrl(targetObjectId, J.Constant.size.image)}
|
||||
src={S.Common.imageUrl(targetObjectId, J.Size.image)}
|
||||
onDragStart={e => e.preventDefault()}
|
||||
onClick={this.onClick}
|
||||
onLoad={this.onLoad}
|
||||
|
@ -219,7 +219,7 @@ const BlockImage = observer(class BlockImage extends React.Component<I.BlockComp
|
|||
|
||||
onClick (e: any) {
|
||||
if (!keyboard.withCommand(e)) {
|
||||
const src = S.Common.imageUrl(this.props.block.content.targetObjectId, J.Constant.size.image);
|
||||
const src = S.Common.imageUrl(this.props.block.content.targetObjectId, J.Size.image);
|
||||
|
||||
S.Popup.open('preview', { data: { src, type: I.FileType.Image } });
|
||||
};
|
||||
|
|
|
@ -126,7 +126,7 @@ const BlockRelation = observer(class BlockRelation extends React.Component<I.Blo
|
|||
|
||||
S.Menu.open('relationSuggest', {
|
||||
element: `#block-${block.id}`,
|
||||
offsetX: J.Constant.size.blockMenu,
|
||||
offsetX: J.Size.blockMenu,
|
||||
data: {
|
||||
rootId,
|
||||
blockId: block.id,
|
||||
|
|
|
@ -266,10 +266,10 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
raf(() => this.onOptionsOpen(type, rowId, columnId, cellId));
|
||||
},
|
||||
onClose: () => {
|
||||
S.Menu.closeAll(J.Constant.menuIds.table);
|
||||
S.Menu.closeAll(J.Menu.table);
|
||||
this.onOptionsClose();
|
||||
},
|
||||
subIds: J.Constant.menuIds.table,
|
||||
subIds: J.Menu.table,
|
||||
};
|
||||
|
||||
let element: any = null;
|
||||
|
@ -352,7 +352,7 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
};
|
||||
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.table);
|
||||
S.Menu.closeAll(J.Menu.table);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -488,7 +488,7 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
};
|
||||
};
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.table, () => {
|
||||
S.Menu.closeAll(J.Menu.table, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
},
|
||||
|
@ -517,7 +517,7 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
let idx = -1;
|
||||
let nextIdx = -1;
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.table);
|
||||
S.Menu.closeAll(J.Menu.table);
|
||||
|
||||
switch (item.id) {
|
||||
case 'columnBefore':
|
||||
|
@ -874,7 +874,7 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
const ret = [];
|
||||
|
||||
columns.forEach((it: I.Block) => {
|
||||
ret.push(this.checkWidth(it.fields.width || J.Constant.size.table.default));
|
||||
ret.push(this.checkWidth(it.fields.width || J.Size.table.default));
|
||||
});
|
||||
|
||||
return ret;
|
||||
|
@ -1190,13 +1190,13 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
|
||||
initSize () {
|
||||
const { columns } = this.getData();
|
||||
const widths = columns.map(it => this.checkWidth(it.fields.width || J.Constant.size.table.default));
|
||||
const widths = columns.map(it => this.checkWidth(it.fields.width || J.Size.table.default));
|
||||
|
||||
this.setColumnWidths(widths);
|
||||
};
|
||||
|
||||
checkWidth (w: number) {
|
||||
const { min, max } = J.Constant.size.table;
|
||||
const { min, max } = J.Size.table;
|
||||
const steps = 5;
|
||||
|
||||
let width = Math.max(min, Math.min(max, w));
|
||||
|
@ -1525,7 +1525,7 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
const row = node.find('.row').first();
|
||||
const obj = $(`#block-${block.id}`);
|
||||
|
||||
let width = J.Constant.size.blockMenu + 10;
|
||||
let width = J.Size.blockMenu + 10;
|
||||
let maxWidth = 0;
|
||||
let wrapperWidth = 0;
|
||||
|
||||
|
@ -1537,7 +1537,7 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
const container = U.Common.getPageContainer(isPopup);
|
||||
|
||||
maxWidth = container.width() - PADDING;
|
||||
wrapperWidth = getWrapperWidth() + J.Constant.size.blockMenu;
|
||||
wrapperWidth = getWrapperWidth() + J.Size.blockMenu;
|
||||
|
||||
width > maxWidth ? wrap.addClass('withScroll') : wrap.removeClass('withScroll');
|
||||
width = Math.max(wrapperWidth, Math.min(maxWidth, width));
|
||||
|
@ -1549,7 +1549,7 @@ const BlockTable = observer(class BlockTable extends React.Component<I.BlockComp
|
|||
} else {
|
||||
const parentObj = $(`#block-${parent.id}`);
|
||||
if (parentObj.length) {
|
||||
maxWidth = parentObj.width() - J.Constant.size.blockMenu;
|
||||
maxWidth = parentObj.width() - J.Size.blockMenu;
|
||||
};
|
||||
|
||||
width > maxWidth ? wrap.addClass('withScroll') : wrap.removeClass('withScroll');
|
||||
|
|
|
@ -146,7 +146,7 @@ const BlockTableCell = observer(class BlockTableCell extends React.Component<Pro
|
|||
onUpdate={() => onCellUpdate(cellId)}
|
||||
onFocus={e => onCellFocus(e, row.id, column.id, cellId)}
|
||||
onBlur={e => onCellBlur(e, row.id, column.id, cellId)}
|
||||
getWrapperWidth={() => J.Constant.size.editor}
|
||||
getWrapperWidth={() => J.Size.editor}
|
||||
/>
|
||||
) : (
|
||||
<EmptyBlock />
|
||||
|
|
|
@ -122,8 +122,8 @@ const BlockText = observer(class BlockText extends React.Component<Props> {
|
|||
|
||||
case I.TextStyle.Code: {
|
||||
const options: I.Option[] = [];
|
||||
for (const i in J.Constant.codeLang) {
|
||||
options.push({ id: i, name: J.Constant.codeLang[i] });
|
||||
for (const i in J.Lang.code) {
|
||||
options.push({ id: i, name: J.Lang.code[i] });
|
||||
};
|
||||
|
||||
spellcheck = false;
|
||||
|
@ -1107,7 +1107,7 @@ const BlockText = observer(class BlockText extends React.Component<Props> {
|
|||
},
|
||||
offsetX: () => {
|
||||
const rect = U.Common.getSelectionRect();
|
||||
return rect ? 0 : J.Constant.size.blockMenu;
|
||||
return rect ? 0 : J.Size.blockMenu;
|
||||
},
|
||||
noFlipX: false,
|
||||
noFlipY: false,
|
||||
|
@ -1153,7 +1153,7 @@ const BlockText = observer(class BlockText extends React.Component<Props> {
|
|||
},
|
||||
offsetX: () => {
|
||||
const rect = U.Common.getSelectionRect();
|
||||
return rect ? 0 : J.Constant.size.blockMenu;
|
||||
return rect ? 0 : J.Size.blockMenu;
|
||||
},
|
||||
data: {
|
||||
noHead: true,
|
||||
|
|
|
@ -72,7 +72,7 @@ class DragLayer extends React.Component<object, State> {
|
|||
const comp = $(ReactDOM.findDOMNode(component));
|
||||
const rect = (comp.get(0) as Element).getBoundingClientRect();
|
||||
|
||||
this.setState({ rootId, type, width: rect.width - J.Constant.size.blockMenu, ids });
|
||||
this.setState({ rootId, type, width: rect.width - J.Size.blockMenu, ids });
|
||||
};
|
||||
|
||||
hide () {
|
||||
|
|
|
@ -571,7 +571,7 @@ const DragProvider = observer(class DragProvider extends React.Component<Props>
|
|||
canDropMiddle = Number(obj.attr('data-drop-middle')) || 0;
|
||||
isReversed = Boolean(obj.attr('data-reversed'));
|
||||
|
||||
col1 = x - J.Constant.size.blockMenu / 4;
|
||||
col1 = x - J.Size.blockMenu / 4;
|
||||
col2 = x + width;
|
||||
};
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
|
|||
|
||||
if (
|
||||
(pageX >= x) &&
|
||||
(pageX <= x + J.Constant.size.blockMenu) &&
|
||||
(pageX <= x + J.Size.blockMenu) &&
|
||||
(pageY >= offset + BUTTON_OFFSET) &&
|
||||
(pageY <= this.winScrollTop + rectContainer.height + offset + BUTTON_OFFSET)
|
||||
) {
|
||||
|
@ -501,7 +501,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
|
|||
return;
|
||||
};
|
||||
|
||||
const buttonX = hoveredRect.x - (rectContainer.x - J.Constant.size.blockMenu) + 2;
|
||||
const buttonX = hoveredRect.x - (rectContainer.x - J.Size.blockMenu) + 2;
|
||||
const buttonY = pageY - rectContainer.y - BUTTON_OFFSET - this.winScrollTop;
|
||||
|
||||
clear();
|
||||
|
@ -648,7 +648,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
|
|||
S.Menu.closeAll([ 'blockContext', 'blockAdd' ], () => {
|
||||
S.Menu.open('blockAction', {
|
||||
element: `#block-${ids[0]}`,
|
||||
offsetX: J.Constant.size.blockMenu,
|
||||
offsetX: J.Size.blockMenu,
|
||||
data: {
|
||||
blockId: ids[0],
|
||||
blockIds: ids,
|
||||
|
@ -814,7 +814,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
|
|||
S.Menu.close('blockContext', () => {
|
||||
S.Menu.open('blockAction', {
|
||||
element: `#block-${block.id}`,
|
||||
offsetX: J.Constant.size.blockMenu,
|
||||
offsetX: J.Size.blockMenu,
|
||||
data: {
|
||||
blockId: block.id,
|
||||
blockIds: U.Data.selectionGet(block.id, true, true),
|
||||
|
@ -1600,14 +1600,14 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
|
|||
|
||||
S.Menu.open('blockAdd', {
|
||||
element: $(`#block-${blockId}`),
|
||||
subIds: J.Constant.menuIds.add,
|
||||
subIds: J.Menu.add,
|
||||
recalcRect: () => {
|
||||
const rect = U.Common.getSelectionRect();
|
||||
return rect ? { ...rect, y: rect.y + win.scrollTop() } : null;
|
||||
},
|
||||
offsetX: () => {
|
||||
const rect = U.Common.getSelectionRect();
|
||||
return rect ? 0 : J.Constant.size.blockMenu;
|
||||
return rect ? 0 : J.Size.blockMenu;
|
||||
},
|
||||
commonFilter: true,
|
||||
onClose: () => {
|
||||
|
@ -1790,7 +1790,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
|
|||
},
|
||||
offsetX: () => {
|
||||
const rect = U.Common.getSelectionRect();
|
||||
return rect ? 0 : J.Constant.size.blockMenu;
|
||||
return rect ? 0 : J.Size.blockMenu;
|
||||
},
|
||||
onOpen: () => {
|
||||
if (block) {
|
||||
|
@ -2157,7 +2157,7 @@ const EditorPage = observer(class EditorPage extends React.Component<Props, Stat
|
|||
const ch = scrollContainer.height();
|
||||
const height = Math.max(ch / 2, ch - blocks.outerHeight() - blocks.offset().top - ct - 2);
|
||||
|
||||
last.css({ height: Math.max(J.Constant.size.lastBlock, height) });
|
||||
last.css({ height: Math.max(J.Size.lastBlock, height) });
|
||||
};
|
||||
|
||||
if (note.length) {
|
||||
|
|
|
@ -250,7 +250,7 @@ class Phrase extends React.Component<Props, State> {
|
|||
};
|
||||
|
||||
checkValue (v: string[]) {
|
||||
return v.map(it => it.substring(0, J.Constant.limit.phrase.letter)).filter(it => it).slice(0, J.Constant.limit.phrase.word);
|
||||
return v.map(it => it.substring(0, J.Constant.count.phrase.letter)).filter(it => it).slice(0, J.Constant.count.phrase.word);
|
||||
};
|
||||
|
||||
setError (v: boolean) {
|
||||
|
|
|
@ -4,22 +4,15 @@ import { Input } from 'Component';
|
|||
import { J, keyboard } from 'Lib';
|
||||
|
||||
interface Props {
|
||||
/** the length of the pin, defaults to J.Constant.pinLength */
|
||||
pinLength?: number;
|
||||
/** the expected pin, encrypted in sha1. if none provided, this component does not make a comparison check */
|
||||
expectedPin?: string | null;
|
||||
/** if true, the input field will be focused on component mount */
|
||||
focusOnMount?: boolean;
|
||||
/** callback when the pin is entered (and matches expectedPin if provided)*/
|
||||
onSuccess?: (value: string) => void;
|
||||
/** callback when the pin is entered (and does not match expectedPin if provided)*/
|
||||
onError?: () => void;
|
||||
/** if true, input will not turn to type password after filled*/
|
||||
isVisible?: boolean;
|
||||
};
|
||||
|
||||
type State = {
|
||||
/** index of the current pin character in focus */
|
||||
index: number;
|
||||
};
|
||||
|
||||
|
@ -32,7 +25,7 @@ const TIMEOUT_DURATION = 150;
|
|||
class Pin extends React.Component<Props, State> {
|
||||
|
||||
public static defaultProps = {
|
||||
pinLength: J.Constant.pinLength,
|
||||
pinLength: 6,
|
||||
expectedPin: null,
|
||||
focusOnMount: true,
|
||||
isVisible: false,
|
||||
|
|
|
@ -181,7 +181,7 @@ class Header extends React.Component<Props> {
|
|||
noFlipX: true,
|
||||
noFlipY: true,
|
||||
horizontal: I.MenuDirection.Right,
|
||||
subIds: J.Constant.menuIds.cell,
|
||||
subIds: J.Menu.cell,
|
||||
classNameWrap: cnw.join(' '),
|
||||
...param,
|
||||
data: {
|
||||
|
|
|
@ -33,7 +33,7 @@ const HeaderMainObject = observer(class HeaderMainObject extends React.Component
|
|||
return null;
|
||||
};
|
||||
|
||||
const object = S.Detail.get(rootId, rootId, J.Constant.templateRelationKeys);
|
||||
const object = S.Detail.get(rootId, rootId, J.Relation.template);
|
||||
const isLocked = root ? root.isLocked() : false;
|
||||
const showMenu = !U.Object.isTypeOrRelationLayout(object.layout);
|
||||
const canSync = showMenu && !object.templateIsBundled && !root.isObjectParticipant();
|
||||
|
@ -119,7 +119,7 @@ const HeaderMainObject = observer(class HeaderMainObject extends React.Component
|
|||
|
||||
menuOpen('object', '#button-header-more', {
|
||||
horizontal: I.MenuDirection.Right,
|
||||
subIds: J.Constant.menuIds.object,
|
||||
subIds: J.Menu.object,
|
||||
data: {
|
||||
rootId,
|
||||
blockId: rootId,
|
||||
|
|
|
@ -184,7 +184,7 @@ const ListObject = observer(class ListObject extends React.Component<Props> {
|
|||
};
|
||||
|
||||
getKeys () {
|
||||
return J.Constant.defaultRelationKeys.concat(this.props.columns.map(it => it.relationKey));
|
||||
return J.Relation.default.concat(this.props.columns.map(it => it.relationKey));
|
||||
};
|
||||
|
||||
getData (page: number, callBack?: (message: any) => void) {
|
||||
|
|
|
@ -294,7 +294,7 @@ const ListObjectManager = observer(class ListObjectManager extends React.Compone
|
|||
const node = $(ReactDOM.findDOMNode(this));
|
||||
const wrapper = node.find('#filterWrapper');
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.store);
|
||||
S.Menu.closeAll(J.Menu.store);
|
||||
wrapper.removeClass('active');
|
||||
};
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ const ListWidget = observer(class ListWidget extends React.Component<{}, State>
|
|||
className: 'fixed',
|
||||
classNameWrap: 'fromSidebar',
|
||||
offsetY: -2,
|
||||
subIds: J.Constant.menuIds.widget,
|
||||
subIds: J.Menu.widget,
|
||||
vertical: I.MenuDirection.Top,
|
||||
data: {
|
||||
setEditing: this.setEditing,
|
||||
|
|
|
@ -109,12 +109,12 @@ class MenuBlockAction extends React.Component<I.Menu, State> {
|
|||
this._isMounted = false;
|
||||
|
||||
keyboard.setFocus(false);
|
||||
S.Menu.closeAll(J.Constant.menuIds.action);
|
||||
S.Menu.closeAll(J.Menu.action);
|
||||
S.Menu.clearTimeout();
|
||||
};
|
||||
|
||||
onFilterFocus (e: any) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.action);
|
||||
S.Menu.closeAll(J.Menu.action);
|
||||
this.props.setActive();
|
||||
};
|
||||
|
||||
|
@ -342,7 +342,7 @@ class MenuBlockAction extends React.Component<I.Menu, State> {
|
|||
setActive(item, false);
|
||||
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.action);
|
||||
S.Menu.closeAll(J.Menu.action);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -575,7 +575,7 @@ class MenuBlockAction extends React.Component<I.Menu, State> {
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId, item.itemId)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.action, () => {
|
||||
S.Menu.closeAll(J.Menu.action, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -241,7 +241,7 @@ const MenuBlockAdd = observer(class MenuBlockAdd extends React.Component<I.Menu>
|
|||
|
||||
componentWillUnmount () {
|
||||
this._isMounted = false;
|
||||
S.Menu.closeAll(J.Constant.menuIds.add);
|
||||
S.Menu.closeAll(J.Menu.add);
|
||||
};
|
||||
|
||||
checkFilter () {
|
||||
|
@ -364,7 +364,7 @@ const MenuBlockAdd = observer(class MenuBlockAdd extends React.Component<I.Menu>
|
|||
|
||||
onOver (e: any, item: any) {
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.add);
|
||||
S.Menu.closeAll(J.Menu.add);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -460,7 +460,7 @@ const MenuBlockAdd = observer(class MenuBlockAdd extends React.Component<I.Menu>
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId, item.itemId)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.add, () => {
|
||||
S.Menu.closeAll(J.Menu.add, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -165,7 +165,7 @@ const MenuBlockContext = observer(class MenuBlockContext extends React.Component
|
|||
};
|
||||
|
||||
componentWillUnmount(): void {
|
||||
S.Menu.closeAll(J.Constant.menuIds.context.concat('selectContext'));
|
||||
S.Menu.closeAll(J.Menu.context.concat('selectContext'));
|
||||
};
|
||||
|
||||
onMark (e: any, type: any) {
|
||||
|
@ -249,7 +249,7 @@ const MenuBlockContext = observer(class MenuBlockContext extends React.Component
|
|||
|
||||
menuParam = Object.assign(menuParam, {
|
||||
component: 'select',
|
||||
subIds: J.Constant.menuIds.selectContext,
|
||||
subIds: J.Menu.selectContext,
|
||||
onOpen: context => this.menuContext = context,
|
||||
});
|
||||
|
||||
|
@ -266,7 +266,7 @@ const MenuBlockContext = observer(class MenuBlockContext extends React.Component
|
|||
};
|
||||
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.selectContext);
|
||||
S.Menu.closeAll(J.Menu.selectContext);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -358,7 +358,7 @@ const MenuBlockContext = observer(class MenuBlockContext extends React.Component
|
|||
focusApply ? focus.apply() : focus.clear(false);
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId)) {
|
||||
const menuIds = [].concat(J.Constant.menuIds.context);
|
||||
const menuIds = [].concat(J.Menu.context);
|
||||
|
||||
if (closeContext) {
|
||||
menuIds.push(this.props.id);
|
||||
|
@ -453,7 +453,7 @@ const MenuBlockContext = observer(class MenuBlockContext extends React.Component
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.selectContext, () => {
|
||||
S.Menu.closeAll(J.Menu.selectContext, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -293,7 +293,7 @@ const MenuBlockCover = observer(class MenuBlockCover extends React.Component<I.M
|
|||
const { param, close } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, onSelect, onUpload, onUploadStart } = data;
|
||||
const object = S.Detail.get(rootId, rootId, J.Constant.coverRelationKeys, true);
|
||||
const object = S.Detail.get(rootId, rootId, J.Relation.cover, true);
|
||||
|
||||
if (!object.coverId) {
|
||||
close();
|
||||
|
|
|
@ -53,7 +53,7 @@ class MenuBlockLayout extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
componentWillUnmount (): void {
|
||||
S.Menu.closeAll(J.Constant.menuIds.layout);
|
||||
S.Menu.closeAll(J.Menu.layout);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
|
@ -124,7 +124,7 @@ class MenuBlockLayout extends React.Component<I.Menu> {
|
|||
|
||||
onOver (e: any, item: any) {
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.layout);
|
||||
S.Menu.closeAll(J.Menu.layout);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -165,7 +165,7 @@ class MenuBlockLayout extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId, item.id)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.layout, () => {
|
||||
S.Menu.closeAll(J.Menu.layout, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -128,7 +128,7 @@ const MenuBlockLinkSettings = observer(class MenuBlockLinkSettings extends React
|
|||
menuParam.data = Object.assign(menuParam.data, { options });
|
||||
|
||||
if (!S.Menu.isOpen(menuId, item.id)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.object, () => {
|
||||
S.Menu.closeAll(J.Menu.object, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -373,14 +373,14 @@ const MenuBlockRelationEdit = observer(class MenuBlockRelationEdit extends React
|
|||
});
|
||||
|
||||
if (!S.Menu.isOpen(id)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.relationEdit, () => {
|
||||
S.Menu.closeAll(J.Menu.relationEdit, () => {
|
||||
S.Menu.open(id, options);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
menuClose () {
|
||||
S.Menu.closeAll(J.Constant.menuIds.relationEdit);
|
||||
S.Menu.closeAll(J.Menu.relationEdit);
|
||||
};
|
||||
|
||||
onOpen (e: any) {
|
||||
|
|
|
@ -64,7 +64,7 @@ class MenuContext extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
componentWillUnmount () {
|
||||
S.Menu.closeAll(J.Constant.menuIds.dataviewContext);
|
||||
S.Menu.closeAll(J.Menu.dataviewContext);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
|
@ -223,7 +223,7 @@ class MenuContext extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
if (!item.arrow || !objectIds.length) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.dataviewContext);
|
||||
S.Menu.closeAll(J.Menu.dataviewContext);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -287,7 +287,7 @@ class MenuContext extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId, item.id)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.dataviewContext, () => {
|
||||
S.Menu.closeAll(J.Menu.dataviewContext, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -251,7 +251,7 @@ const MenuDataviewFileValues = observer(class MenuDataviewFileValues extends Rea
|
|||
};
|
||||
|
||||
case I.ObjectLayout.Image: {
|
||||
url = S.Common.imageUrl(item.id, J.Constant.size.image);
|
||||
url = S.Common.imageUrl(item.id, J.Size.image);
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -173,14 +173,14 @@ const MenuFilterList = observer(class MenuFilterList extends React.Component<I.M
|
|||
|
||||
componentWillUnmount () {
|
||||
this.unbind();
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
const { getId } = this.props;
|
||||
const obj = $(`#${getId()} .content`);
|
||||
|
||||
obj.off('click').on('click', () => S.Menu.closeAll(J.Constant.menuIds.cell));
|
||||
obj.off('click').on('click', () => S.Menu.closeAll(J.Menu.cell));
|
||||
|
||||
this.unbind();
|
||||
$(window).on('keydown.menu', e => this.props.onKeyDown(e));
|
||||
|
|
|
@ -344,7 +344,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
this._isMounted = false;
|
||||
this.unbind();
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
|
|
|
@ -179,7 +179,7 @@ const MenuGroupList = observer(class MenuGroupList extends React.Component<I.Men
|
|||
|
||||
componentWillUnmount () {
|
||||
this.unbind();
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
|
|
|
@ -516,14 +516,14 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
});
|
||||
|
||||
if (!S.Menu.isOpen(id)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.relationEdit, () => {
|
||||
S.Menu.closeAll(J.Menu.relationEdit, () => {
|
||||
S.Menu.open(id, options);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
menuClose () {
|
||||
S.Menu.closeAll(J.Constant.menuIds.relationEdit);
|
||||
S.Menu.closeAll(J.Menu.relationEdit);
|
||||
};
|
||||
|
||||
onChangeTime (v: boolean) {
|
||||
|
|
|
@ -186,7 +186,7 @@ const MenuRelationList = observer(class MenuRelationList extends React.Component
|
|||
|
||||
componentWillUnmount () {
|
||||
this.unbind();
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
|
|
|
@ -209,7 +209,7 @@ const MenuSort = observer(class MenuSort extends React.Component<I.Menu> {
|
|||
|
||||
componentWillUnmount () {
|
||||
this.unbind();
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
|
|
|
@ -204,7 +204,7 @@ const MenuTemplateList = observer(class MenuTemplateList extends React.Component
|
|||
const sorts = [
|
||||
{ relationKey: 'name', type: I.SortType.Asc },
|
||||
];
|
||||
const keys = J.Constant.defaultRelationKeys.concat([ 'targetObjectType' ]);
|
||||
const keys = J.Relation.default.concat([ 'targetObjectType' ]);
|
||||
|
||||
U.Data.searchSubscribe({
|
||||
subId: this.getSubId(),
|
||||
|
@ -274,13 +274,13 @@ const MenuTemplateList = observer(class MenuTemplateList extends React.Component
|
|||
return;
|
||||
};
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.dataviewTemplate, () => {
|
||||
S.Menu.closeAll(J.Menu.dataviewTemplate, () => {
|
||||
S.Menu.open('dataviewTemplateContext', {
|
||||
menuKey: item.id,
|
||||
element: `#${getId()} #item-more-${item.id}`,
|
||||
vertical: I.MenuDirection.Bottom,
|
||||
horizontal: I.MenuDirection.Right,
|
||||
subIds: J.Constant.menuIds.dataviewTemplate,
|
||||
subIds: J.Menu.dataviewTemplate,
|
||||
onOpen: () => {
|
||||
node.addClass('active');
|
||||
},
|
||||
|
|
|
@ -295,7 +295,7 @@ const MenuViewLayout = observer(class MenuViewLayout extends React.Component<I.M
|
|||
const view = data.view.get();
|
||||
|
||||
if (!item.arrow || isReadonly) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.viewEdit);
|
||||
S.Menu.closeAll(J.Menu.viewEdit);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -365,7 +365,7 @@ const MenuViewLayout = observer(class MenuViewLayout extends React.Component<I.M
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId, item.id)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.viewEdit, () => {
|
||||
S.Menu.closeAll(J.Menu.viewEdit, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
@ -416,7 +416,7 @@ const MenuViewLayout = observer(class MenuViewLayout extends React.Component<I.M
|
|||
};
|
||||
|
||||
menuClose () {
|
||||
S.Menu.closeAll(J.Constant.menuIds.viewEdit);
|
||||
S.Menu.closeAll(J.Menu.viewEdit);
|
||||
};
|
||||
|
||||
resize () {
|
||||
|
|
|
@ -95,7 +95,7 @@ const MenuViewSettings = observer(class MenuViewSettings extends React.Component
|
|||
this.save(true);
|
||||
};
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.viewEdit);
|
||||
S.Menu.closeAll(J.Menu.viewEdit);
|
||||
};
|
||||
|
||||
focus () {
|
||||
|
@ -175,7 +175,7 @@ const MenuViewSettings = observer(class MenuViewSettings extends React.Component
|
|||
this.isFocused = true;
|
||||
this.props.setActive();
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.viewEdit);
|
||||
S.Menu.closeAll(J.Menu.viewEdit);
|
||||
};
|
||||
|
||||
onNameBlur () {
|
||||
|
@ -187,7 +187,7 @@ const MenuViewSettings = observer(class MenuViewSettings extends React.Component
|
|||
if (!keyboard.isMouseDisabled) {
|
||||
this.n = -1;
|
||||
this.props.setHover(null, false);
|
||||
S.Menu.closeAll(J.Constant.menuIds.viewEdit);
|
||||
S.Menu.closeAll(J.Menu.viewEdit);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -463,7 +463,7 @@ const Menu = observer(class Menu extends React.Component<I.Menu, State> {
|
|||
position () {
|
||||
const { id, param } = this.props;
|
||||
const { element, recalcRect, type, vertical, horizontal, fixedX, fixedY, isSub, noFlipX, noFlipY, withArrow } = param;
|
||||
const { border } = J.Constant.size.menu;
|
||||
const { border } = J.Size.menu;
|
||||
const borderTop = this.getBorderTop();
|
||||
const borderBottom = this.getBorderBottom();
|
||||
|
||||
|
@ -975,7 +975,7 @@ const Menu = observer(class Menu extends React.Component<I.Menu, State> {
|
|||
|
||||
const node = $(this.node);
|
||||
const menu = node.find('.menu');
|
||||
const { border } = J.Constant.size.menu;
|
||||
const { border } = J.Size.menu;
|
||||
|
||||
menu.find('.item.hover').removeClass('hover');
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class MenuObject extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
componentWillUnmount () {
|
||||
S.Menu.closeAll(J.Constant.menuIds.object);
|
||||
S.Menu.closeAll(J.Menu.object);
|
||||
};
|
||||
|
||||
rebind () {
|
||||
|
@ -262,7 +262,7 @@ class MenuObject extends React.Component<I.Menu> {
|
|||
|
||||
onOver (e: any, item: any) {
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.object);
|
||||
S.Menu.closeAll(J.Menu.object);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -310,7 +310,7 @@ class MenuObject extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId, item.id)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.object, () => {
|
||||
S.Menu.closeAll(J.Menu.object, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -665,7 +665,7 @@ class MenuQuickCapture extends React.Component<I.Menu, State> {
|
|||
item.find('.iconObject').length ? item.addClass('withIcon') : item.removeClass('withIcon');
|
||||
});
|
||||
|
||||
obj.css({ width: Math.min(ww - J.Constant.size.menu.border * 2 - sw, Math.ceil(obj.outerWidth())) });
|
||||
obj.css({ width: Math.min(ww - J.Size.menuBorder * 2 - sw, Math.ceil(obj.outerWidth())) });
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -229,7 +229,7 @@ const MenuRelationSuggest = observer(class MenuRelationSuggest extends React.Com
|
|||
U.Data.search({
|
||||
filters,
|
||||
sorts,
|
||||
keys: J.Constant.relationRelationKeys,
|
||||
keys: J.Relation.relation,
|
||||
fullText: filter,
|
||||
offset: this.offset,
|
||||
limit: J.Constant.limit.menuRecords,
|
||||
|
|
|
@ -321,7 +321,7 @@ const MenuSearchObject = observer(class MenuSearchObject extends React.Component
|
|||
U.Data.search({
|
||||
filters,
|
||||
sorts,
|
||||
keys: keys || J.Constant.defaultRelationKeys,
|
||||
keys: keys || J.Relation.default,
|
||||
fullText: filter,
|
||||
offset: this.offset,
|
||||
limit: J.Constant.limit.menuRecords,
|
||||
|
|
|
@ -249,7 +249,7 @@ class MenuSearchText extends React.Component<I.Menu> {
|
|||
const { data } = param;
|
||||
const { isPopup } = data;
|
||||
const scrollContainer = this.getScrollContainer();
|
||||
const offset = J.Constant.size.lastBlock + U.Common.sizeHeader();
|
||||
const offset = J.Size.lastBlock + U.Common.sizeHeader();
|
||||
const tag = Mark.getTag(I.MarkType.Search);
|
||||
|
||||
this.container.find(`${tag}.active`).removeClass('active');
|
||||
|
|
|
@ -70,7 +70,7 @@ const MenuWidget = observer(class MenuWidget extends React.Component<I.Menu> {
|
|||
className="c28"
|
||||
text={translate('menuWidgetAddWidget')}
|
||||
onClick={this.save}
|
||||
onMouseEnter={() => S.Menu.closeAll(J.Constant.menuIds.widget)}
|
||||
onMouseEnter={() => S.Menu.closeAll(J.Menu.widget)}
|
||||
/>
|
||||
</div>
|
||||
) : ''}
|
||||
|
@ -99,7 +99,7 @@ const MenuWidget = observer(class MenuWidget extends React.Component<I.Menu> {
|
|||
this._isMounted = false;
|
||||
this.unbind();
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.widget);
|
||||
S.Menu.closeAll(J.Menu.widget);
|
||||
$(window).trigger(`updateWidgetData.${blockId}`);
|
||||
};
|
||||
|
||||
|
@ -257,7 +257,7 @@ const MenuWidget = observer(class MenuWidget extends React.Component<I.Menu> {
|
|||
|
||||
onOver (e: React.MouseEvent, item) {
|
||||
if (!item.arrow) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.widget);
|
||||
S.Menu.closeAll(J.Menu.widget);
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -374,7 +374,7 @@ const MenuWidget = observer(class MenuWidget extends React.Component<I.Menu> {
|
|||
};
|
||||
|
||||
if (menuId && !S.Menu.isOpen(menuId, item.itemId)) {
|
||||
S.Menu.closeAll(J.Constant.menuIds.widget, () => {
|
||||
S.Menu.closeAll(J.Menu.widget, () => {
|
||||
S.Menu.open(menuId, menuParam);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -93,7 +93,7 @@ const PageAuthLogin = observer(class PageAuthLogin extends React.Component<I.Pag
|
|||
const phrase = this.refPhrase.getValue();
|
||||
const length = phrase.split(' ').length;
|
||||
|
||||
if (length < J.Constant.limit.phrase.word) {
|
||||
if (length < J.Constant.count.phrase.word) {
|
||||
this.setError({ code: 1, description: translate('pageAuthLoginInvalidPhrase')});
|
||||
return;
|
||||
};
|
||||
|
@ -170,7 +170,7 @@ const PageAuthLogin = observer(class PageAuthLogin extends React.Component<I.Pag
|
|||
};
|
||||
|
||||
canSubmit (): boolean {
|
||||
return this.refPhrase.getValue().split(' ').length == J.Constant.limit.phrase.word;
|
||||
return this.refPhrase.getValue().split(' ').length == J.Constant.count.phrase.word;
|
||||
};
|
||||
|
||||
onKeyDownPhrase (e: React.KeyboardEvent) {
|
||||
|
|
|
@ -108,7 +108,7 @@ class HeaderBanner extends React.Component<Props> {
|
|||
element: node,
|
||||
className: 'fromBanner',
|
||||
offsetY: isPopup ? 10 : 0,
|
||||
subIds: J.Constant.menuIds.dataviewTemplate.concat([ 'dataviewTemplateContext' ]),
|
||||
subIds: J.Menu.dataviewTemplate.concat([ 'dataviewTemplateContext' ]),
|
||||
vertical: I.MenuDirection.Bottom,
|
||||
horizontal: I.MenuDirection.Center,
|
||||
onOpen: (context) => {
|
||||
|
|
|
@ -124,7 +124,7 @@ const ControlButtons = observer(class ControlButtons extends React.Component<Pro
|
|||
e.stopPropagation();
|
||||
|
||||
const { rootId, onCoverOpen, onCoverClose, onEdit } = this.props;
|
||||
const object = S.Detail.get(rootId, rootId, J.Constant.coverRelationKeys, true);
|
||||
const object = S.Detail.get(rootId, rootId, J.Relation.cover, true);
|
||||
const element = $(e.currentTarget);
|
||||
const hasCover = object.coverType != I.CoverType.None;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ const Controls = observer(class Controls extends React.Component<Props, State> {
|
|||
render (): any {
|
||||
const { rootId, readonly } = this.props;
|
||||
const { loading } = this.state;
|
||||
const object = S.Detail.get(rootId, rootId, J.Constant.coverRelationKeys);
|
||||
const object = S.Detail.get(rootId, rootId, J.Relation.cover);
|
||||
const cn = [ 'editorControls', 'editorControlElements' ];
|
||||
|
||||
if ((object.coverType != I.CoverType.None) && object.coverId) {
|
||||
|
@ -150,7 +150,7 @@ const Controls = observer(class Controls extends React.Component<Props, State> {
|
|||
onClose: () => {
|
||||
node.removeClass('hover');
|
||||
},
|
||||
subIds: J.Constant.menuIds.layout,
|
||||
subIds: J.Menu.layout,
|
||||
data: {
|
||||
rootId,
|
||||
value: object.layout,
|
||||
|
|
|
@ -105,7 +105,7 @@ const PageMainGraph = observer(class PageMainGraph extends React.Component<I.Pag
|
|||
load () {
|
||||
this.setLoading(true);
|
||||
|
||||
C.ObjectGraph(S.Common.space, U.Data.graphFilters(), 0, [], J.Constant.graphRelationKeys, '', [], (message: any) => {
|
||||
C.ObjectGraph(S.Common.space, U.Data.graphFilters(), 0, [], J.Relation.graph, '', [], (message: any) => {
|
||||
if (message.error.code) {
|
||||
return;
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ const PageMainGraph = observer(class PageMainGraph extends React.Component<I.Pag
|
|||
|
||||
this.data.nodes = message.nodes.map(it => S.Detail.mapper(it));
|
||||
|
||||
U.Data.onSubscribe(J.Constant.subId.graph, 'id', J.Constant.graphRelationKeys, {
|
||||
U.Data.onSubscribe(J.Constant.subId.graph, 'id', J.Relation.graph, {
|
||||
error: {},
|
||||
records: message.nodes,
|
||||
dependencies: [],
|
||||
|
|
|
@ -319,7 +319,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
this._isMounted = false;
|
||||
this.unbind();
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.store);
|
||||
S.Menu.closeAll(J.Menu.store);
|
||||
window.clearTimeout(this.timeoutFilter);
|
||||
};
|
||||
|
||||
|
@ -388,7 +388,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
this.view = id;
|
||||
this.load(true);
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.store);
|
||||
S.Menu.closeAll(J.Menu.store);
|
||||
analytics.event('LibraryView', { view: id, type: this.tab, route: (isInner ? 'inner' : 'outer') });
|
||||
|
||||
Storage.set('viewStore', id);
|
||||
|
@ -425,7 +425,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
};
|
||||
|
||||
onFilterClear () {
|
||||
S.Menu.closeAll(J.Constant.menuIds.store);
|
||||
S.Menu.closeAll(J.Menu.store);
|
||||
};
|
||||
|
||||
onFilterFocus (e: any) {
|
||||
|
@ -507,7 +507,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
]);
|
||||
};
|
||||
|
||||
let keys: string[] = J.Constant.defaultRelationKeys;
|
||||
let keys: string[] = J.Relation.default;
|
||||
|
||||
switch (this.view) {
|
||||
case View.Marketplace:
|
||||
|
@ -521,11 +521,11 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
|
||||
switch (this.tab) {
|
||||
case I.StoreTab.Type:
|
||||
keys = keys.concat(J.Constant.typeRelationKeys);
|
||||
keys = keys.concat(J.Relation.type);
|
||||
break;
|
||||
|
||||
case I.StoreTab.Relation:
|
||||
keys = keys.concat(J.Constant.relationRelationKeys);
|
||||
keys = keys.concat(J.Relation.relation);
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -664,7 +664,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
|
||||
getLimit () {
|
||||
const container = U.Common.getPageContainer(this.props.isPopup);
|
||||
const size = J.Constant.size.store;
|
||||
const size = J.Size.store;
|
||||
const maxWidth = container.width() - size.border * 2;
|
||||
const limit = Math.floor(maxWidth / (size.width + size.margin));
|
||||
|
||||
|
|
|
@ -516,7 +516,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
template.isDefault = true;
|
||||
};
|
||||
|
||||
S.Menu.closeAll(J.Constant.menuIds.dataviewTemplate, () => {
|
||||
S.Menu.closeAll(J.Menu.dataviewTemplate, () => {
|
||||
S.Menu.open('dataviewTemplateContext', {
|
||||
menuKey: item.id,
|
||||
element: `#item-more-${item.id}`,
|
||||
|
|
|
@ -18,7 +18,7 @@ const PopupSettingsSpaceIndex = observer(class PopupSettingsSpaceIndex extends R
|
|||
state = {
|
||||
error: '',
|
||||
isLoading: false,
|
||||
iconOption: U.Common.rand(1, J.Constant.iconCnt),
|
||||
iconOption: U.Common.rand(1, J.Constant.count.icon),
|
||||
usecase: I.Usecase.Empty,
|
||||
};
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ class PopupUsecasePageItem extends React.Component<I.PopupUsecase, State> {
|
|||
analytics.event('ClickGalleryInstallSpace', { type: isNew ? 'New' : 'Existing' });
|
||||
|
||||
if (isNew) {
|
||||
C.WorkspaceCreate({ name: object.title, iconOption: U.Common.rand(1, J.Constant.iconCnt) }, I.Usecase.None, (message: any) => {
|
||||
C.WorkspaceCreate({ name: object.title, iconOption: U.Common.rand(1, J.Constant.count.icon) }, I.Usecase.None, (message: any) => {
|
||||
if (!message.error.code) {
|
||||
cb(message.objectId, true);
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
};
|
||||
|
||||
componentWillUnmount(): void {
|
||||
S.Menu.closeAll(J.Constant.menuIds.cell);
|
||||
S.Menu.closeAll(J.Menu.cell);
|
||||
C.ObjectSearchUnsubscribe([ SUB_ID_OBJECT, SUB_ID_DEPS ]);
|
||||
};
|
||||
|
||||
|
@ -144,7 +144,7 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
filters: [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.In, value: objectIds },
|
||||
],
|
||||
keys: J.Constant.defaultRelationKeys.concat(relationKeys),
|
||||
keys: J.Relation.default.concat(relationKeys),
|
||||
noDeps: true,
|
||||
}, callBack);
|
||||
};
|
||||
|
@ -205,7 +205,7 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
};
|
||||
|
||||
getRelationKeys (): string[] {
|
||||
return U.Common.arrayUnique([].concat(this.props.param.data.relationKeys || J.Constant.defaultRelationKeys));
|
||||
return U.Common.arrayUnique([].concat(this.props.param.data.relationKeys || J.Relation.default));
|
||||
};
|
||||
|
||||
getRelations (): any[] {
|
||||
|
@ -252,7 +252,7 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
|
||||
S.Menu.open('relationSuggest', {
|
||||
element,
|
||||
offsetX: J.Constant.size.blockMenu,
|
||||
offsetX: J.Size.blockMenu,
|
||||
horizontal: I.MenuDirection.Right,
|
||||
vertical: I.MenuDirection.Center,
|
||||
onOpen: () => $(element).addClass('active'),
|
||||
|
|
|
@ -541,7 +541,7 @@ const PopupSearch = observer(class PopupSearch extends React.Component<I.Popup,
|
|||
this.setState({ isLoading: true });
|
||||
};
|
||||
|
||||
C.ObjectSearchWithMeta(filters, sorts, J.Constant.defaultRelationKeys.concat([ 'links', 'backlinks' ]), filter, this.offset, limit, (message) => {
|
||||
C.ObjectSearchWithMeta(filters, sorts, J.Relation.default.concat([ 'links', 'backlinks' ]), filter, this.offset, limit, (message) => {
|
||||
if (message.error.code) {
|
||||
this.setState({ isLoading: false });
|
||||
return;
|
||||
|
|
|
@ -234,7 +234,7 @@ const PreviewObject = observer(class PreviewObject extends React.Component<Props
|
|||
css.width = (fields.width * 100) + '%';
|
||||
};
|
||||
|
||||
inner = <img className="media" src={S.Common.imageUrl(targetObjectId, J.Constant.size.image)} style={css} />;
|
||||
inner = <img className="media" src={S.Common.imageUrl(targetObjectId, J.Size.image)} style={css} />;
|
||||
break;
|
||||
};
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ const Sidebar = observer(class Sidebar extends React.Component {
|
|||
};
|
||||
|
||||
if (d < 0) {
|
||||
if (S.Common.isSidebarFixed && (w <= J.Constant.size.sidebar.width.close)) {
|
||||
if (S.Common.isSidebarFixed && (w <= J.Size.sidebar.width.close)) {
|
||||
sidebar.close();
|
||||
} else {
|
||||
sidebar.set({ width: w, isClosed: false });
|
||||
|
@ -212,10 +212,10 @@ const Sidebar = observer(class Sidebar extends React.Component {
|
|||
};
|
||||
|
||||
if (d > 0) {
|
||||
if ((w >= 0) && (w <= J.Constant.size.sidebar.width.close)) {
|
||||
sidebar.open(J.Constant.size.sidebar.width.min);
|
||||
if ((w >= 0) && (w <= J.Size.sidebar.width.close)) {
|
||||
sidebar.open(J.Size.sidebar.width.min);
|
||||
} else
|
||||
if (w > J.Constant.size.sidebar.width.close) {
|
||||
if (w > J.Size.sidebar.width.close) {
|
||||
sidebar.set({ width: w, isClosed: false });
|
||||
};
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ class Cover extends React.Component<Props> {
|
|||
};
|
||||
|
||||
if ([ I.CoverType.Upload, I.CoverType.Source ].includes(type) && image) {
|
||||
style.backgroundImage = `url("${S.Common.imageUrl(image, J.Constant.size.cover)}")`;
|
||||
style.backgroundImage = `url("${S.Common.imageUrl(image, J.Size.cover)}")`;
|
||||
};
|
||||
|
||||
if (src) {
|
||||
|
|
|
@ -57,7 +57,7 @@ const IconEmoji = observer(class IconEmoji extends React.Component<Props> {
|
|||
};
|
||||
} else
|
||||
if (objectId) {
|
||||
element = <img src={S.Common.imageUrl(objectId, J.Constant.size.iconPage)} className={[ 'iconImage', 'c' + size ].join(' ')} onDragStart={e => e.preventDefault()} />;
|
||||
element = <img src={S.Common.imageUrl(objectId, J.Size.iconPage)} className={[ 'iconImage', 'c' + size ].join(' ')} onDragStart={e => e.preventDefault()} />;
|
||||
} else
|
||||
if (iconClass) {
|
||||
element = <img src={IconSrc[iconClass]} className={[ 'iconCommon', iconClass, 'c' + size ].join(' ')} />;
|
||||
|
|
|
@ -474,7 +474,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
rect: { width: 0, height: 0, x: x + 4, y },
|
||||
className: 'fixed',
|
||||
classNameWrap: 'fromSidebar',
|
||||
subIds: J.Constant.menuIds.widget,
|
||||
subIds: J.Menu.widget,
|
||||
onOpen: () => node.addClass('active'),
|
||||
onClose: () => node.removeClass('active'),
|
||||
data: {
|
||||
|
@ -535,7 +535,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
node.removeClass('isClosed');
|
||||
wrapper.css({ height: 'auto' });
|
||||
};
|
||||
}, 450);
|
||||
}, J.Constant.delay.widget);
|
||||
};
|
||||
|
||||
close () {
|
||||
|
@ -563,7 +563,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
wrapper.css({ height: '' });
|
||||
innerWrap.hide();
|
||||
};
|
||||
}, 450);
|
||||
}, J.Constant.delay.widget);
|
||||
};
|
||||
|
||||
getMinHeight () {
|
||||
|
@ -628,7 +628,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
filters,
|
||||
sorts,
|
||||
limit,
|
||||
keys: J.Constant.sidebarRelationKeys,
|
||||
keys: J.Relation.sidebar,
|
||||
}, () => {
|
||||
if (callBack) {
|
||||
callBack();
|
||||
|
|
|
@ -232,7 +232,7 @@ const WidgetTree = observer(class WidgetTree extends React.Component<I.WidgetCom
|
|||
records = sortFavorite(records);
|
||||
};
|
||||
|
||||
children = records.map(id => this.mapper(S.Detail.get(subId, id, J.Constant.sidebarRelationKeys)));
|
||||
children = records.map(id => this.mapper(S.Detail.get(subId, id, J.Relation.sidebar)));
|
||||
} else {
|
||||
children = this.getChildNodesDetails(object.id);
|
||||
this.subscribeToChildNodes(object.id, Relation.getArrayValue(object.links));
|
||||
|
@ -328,7 +328,7 @@ const WidgetTree = observer(class WidgetTree extends React.Component<I.WidgetCom
|
|||
U.Data.subscribeIds({
|
||||
subId,
|
||||
ids: links,
|
||||
keys: J.Constant.sidebarRelationKeys,
|
||||
keys: J.Relation.sidebar,
|
||||
noDeps: true,
|
||||
});
|
||||
};
|
||||
|
|
|
@ -32,7 +32,7 @@ const TreeItem = observer(class Node extends React.Component<Props> {
|
|||
const subKey = getSubKey();
|
||||
const subId = getSubId(parentId);
|
||||
const isOpen = Storage.checkToggle(subKey, treeKey);
|
||||
const object = S.Detail.get(subId, id, J.Constant.sidebarRelationKeys);
|
||||
const object = S.Detail.get(subId, id, J.Relation.sidebar);
|
||||
const { isReadonly, isArchived, type, restrictions, done, layout } = object;
|
||||
const cn = [ 'item', 'c' + id, (isOpen ? 'isOpen' : '') ];
|
||||
const rootId = keyboard.getRootId();
|
||||
|
@ -156,7 +156,7 @@ const TreeItem = observer(class Node extends React.Component<Props> {
|
|||
e.stopPropagation();
|
||||
|
||||
const { id, parentId, onToggle, getSubId } = this.props;
|
||||
const object = S.Detail.get(getSubId(parentId), id, J.Constant.sidebarRelationKeys, true);
|
||||
const object = S.Detail.get(getSubId(parentId), id, J.Relation.sidebar, true);
|
||||
|
||||
onToggle(e, { ...this.props, details: object });
|
||||
this.forceUpdate();
|
||||
|
|
|
@ -121,7 +121,7 @@ const Group = observer(class Group extends React.Component<Props> {
|
|||
subId,
|
||||
filters: filters.map(it => Dataview.filterMapper(view, it)),
|
||||
sorts: sorts.map(it => Dataview.filterMapper(view, it)),
|
||||
keys: J.Constant.sidebarRelationKeys,
|
||||
keys: J.Relation.sidebar,
|
||||
sources: object.setOf || [],
|
||||
limit,
|
||||
ignoreHidden: true,
|
||||
|
|
|
@ -26,7 +26,7 @@ const WidgetBoardItem = observer(class WidgetBoardItem extends React.Component<P
|
|||
render () {
|
||||
const { subId, id, block, isEditing, hideIcon } = this.props;
|
||||
const rootId = keyboard.getRootId();
|
||||
const object = S.Detail.get(subId, id, J.Constant.sidebarRelationKeys);
|
||||
const object = S.Detail.get(subId, id, J.Relation.sidebar);
|
||||
const { isReadonly, isArchived, restrictions } = object;
|
||||
const allowedDetails = S.Block.isAllowed(restrictions, [ I.RestrictionObject.Details ]);
|
||||
const iconKey = `widget-icon-${block.id}-${id}`;
|
||||
|
@ -99,7 +99,7 @@ const WidgetBoardItem = observer(class WidgetBoardItem extends React.Component<P
|
|||
e.stopPropagation();
|
||||
|
||||
const { subId, id, } = this.props;
|
||||
const object = S.Detail.get(subId, id, J.Constant.sidebarRelationKeys);
|
||||
const object = S.Detail.get(subId, id, J.Relation.sidebar);
|
||||
|
||||
U.Object.openEvent(e, object);
|
||||
analytics.event('OpenSidebarObject');
|
||||
|
@ -125,7 +125,7 @@ const WidgetBoardItem = observer(class WidgetBoardItem extends React.Component<P
|
|||
subId,
|
||||
objectId: id,
|
||||
data: {
|
||||
relationKeys: J.Constant.defaultRelationKeys.concat(view.groupRelationKey),
|
||||
relationKeys: J.Relation.default.concat(view.groupRelationKey),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -86,7 +86,7 @@ const WidgetViewGallery = observer(class WidgetViewGallery extends React.Compone
|
|||
|
||||
getItems () {
|
||||
const { getRecordIds, subId } = this.props;
|
||||
const items = [].concat(getRecordIds().map(id => S.Detail.get(subId, id, J.Constant.sidebarRelationKeys)));
|
||||
const items = [].concat(getRecordIds().map(id => S.Detail.get(subId, id, J.Relation.sidebar)));
|
||||
|
||||
items.push({ id: 'blank', name: translate('widgetShowAll') });
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ const WidgetBoardItem = observer(class WidgetBoardItem extends React.Component<P
|
|||
render () {
|
||||
const { subId, id, block, isEditing, hideIcon } = this.props;
|
||||
const rootId = keyboard.getRootId();
|
||||
const object = S.Detail.get(subId, id, J.Constant.sidebarRelationKeys);
|
||||
const object = S.Detail.get(subId, id, J.Relation.sidebar);
|
||||
const { isReadonly, isArchived, restrictions } = object;
|
||||
const allowedDetails = S.Block.isAllowed(restrictions, [ I.RestrictionObject.Details ]);
|
||||
const iconKey = `widget-icon-${block.id}-${id}`;
|
||||
|
|
|
@ -247,7 +247,7 @@ const WidgetView = observer(class WidgetView extends React.Component<I.WidgetCom
|
|||
limit,
|
||||
filters: this.getFilters(),
|
||||
collectionId: (isCollection ? object.id : ''),
|
||||
keys: J.Constant.sidebarRelationKeys.concat(view.groupRelationKey).concat(J.Constant.coverRelationKeys),
|
||||
keys: J.Relation.sidebar.concat(view.groupRelationKey).concat(J.Relation.cover),
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ const WidgetViewList = observer(class WidgetViewList extends React.Component<I.W
|
|||
const { targetBlockId } = block.content;
|
||||
const isRecent = [ J.Constant.widgetId.recentOpen, J.Constant.widgetId.recentEdit ].includes(targetBlockId);
|
||||
|
||||
let items = getRecordIds().map(id => S.Detail.get(subId, id, J.Constant.sidebarRelationKeys));
|
||||
let items = getRecordIds().map(id => S.Detail.get(subId, id, J.Relation.sidebar));
|
||||
|
||||
if (isPreview && isRecent) {
|
||||
// add group labels
|
||||
|
|
|
@ -32,7 +32,7 @@ const WidgetListItem = observer(class WidgetListItem extends React.Component<Pro
|
|||
render () {
|
||||
const { subId, id, block, style, isCompact, isEditing, index, isPreview, isSection } = this.props;
|
||||
const rootId = keyboard.getRootId();
|
||||
const object = S.Detail.get(subId, id, J.Constant.sidebarRelationKeys);
|
||||
const object = S.Detail.get(subId, id, J.Relation.sidebar);
|
||||
const { isReadonly, isArchived, restrictions, source } = object;
|
||||
const allowedDetails = S.Block.isAllowed(restrictions, [ I.RestrictionObject.Details ]);
|
||||
const iconKey = `widget-icon-${block.id}-${id}`;
|
||||
|
@ -160,7 +160,7 @@ const WidgetListItem = observer(class WidgetListItem extends React.Component<Pro
|
|||
e.stopPropagation();
|
||||
|
||||
const { subId, id, } = this.props;
|
||||
const object = S.Detail.get(subId, id, J.Constant.sidebarRelationKeys);
|
||||
const object = S.Detail.get(subId, id, J.Relation.sidebar);
|
||||
|
||||
U.Object.openEvent(e, object);
|
||||
analytics.event('OpenSidebarObject');
|
||||
|
|
|
@ -365,7 +365,7 @@ class Action {
|
|||
const { mode, path } = networkConfig;
|
||||
|
||||
this.openFile([ 'zip' ], paths => {
|
||||
C.AccountRecoverFromLegacyExport(paths[0], dataPath, U.Common.rand(1, J.Constant.iconCnt), (message: any) => {
|
||||
C.AccountRecoverFromLegacyExport(paths[0], dataPath, U.Common.rand(1, J.Constant.count.icon), (message: any) => {
|
||||
if (onError(message.error)) {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -68,7 +68,7 @@ class Dataview {
|
|||
const rel: any = view.getRelation(relationKey) || {};
|
||||
|
||||
rel.relationKey = relationKey;
|
||||
rel.width = rel.width || J.Constant.size.dataview.cell.default;
|
||||
rel.width = rel.width || J.Size.dataview.cell.default;
|
||||
rel.isVisible = true;
|
||||
|
||||
C.BlockDataviewViewRelationReplace(rootId, blockId, view.id, relationKey, rel, (message: any) => {
|
||||
|
@ -98,7 +98,7 @@ class Dataview {
|
|||
rootId: '',
|
||||
blockId: '',
|
||||
newViewId: '',
|
||||
keys: J.Constant.defaultRelationKeys,
|
||||
keys: J.Relation.default,
|
||||
offset: 0,
|
||||
limit: 0,
|
||||
ignoreWorkspace: false,
|
||||
|
@ -517,7 +517,7 @@ class Dataview {
|
|||
];
|
||||
|
||||
let ret = null;
|
||||
if (relationKey == J.Constant.pageCoverRelationKey) {
|
||||
if (relationKey == J.Relation.pageCover) {
|
||||
ret = object;
|
||||
} else {
|
||||
for (const id of value) {
|
||||
|
|
|
@ -104,7 +104,7 @@ class Focus {
|
|||
const ch = container.height();
|
||||
const no = node.offset().top;
|
||||
const hh = U.Common.sizeHeader();
|
||||
const o = J.Constant.size.lastBlock + hh;
|
||||
const o = J.Size.lastBlock + hh;
|
||||
const st = container.scrollTop();
|
||||
const y = isPopup ? (no - container.offset().top + st) : no;
|
||||
|
||||
|
|
|
@ -840,7 +840,7 @@ class Keyboard {
|
|||
S.Menu.open(id, menuParam);
|
||||
} else {
|
||||
S.Popup.close('search', () => {
|
||||
S.Menu.closeAll(J.Constant.menuIds.navigation, () => {
|
||||
S.Menu.closeAll(J.Menu.navigation, () => {
|
||||
S.Menu.open(id, menuParam);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,7 +28,7 @@ class Relation {
|
|||
};
|
||||
|
||||
public width (width: number, format: I.RelationType): number {
|
||||
const size = J.Constant.size.dataview.cell;
|
||||
const size = J.Size.dataview.cell;
|
||||
return Number(width || size[`format${format}`]) || size.default;
|
||||
};
|
||||
|
||||
|
@ -342,7 +342,7 @@ class Relation {
|
|||
|
||||
return [
|
||||
{ id: '', icon: '', name: translate('commonNone') },
|
||||
{ id: J.Constant.pageCoverRelationKey, icon: 'image', name: translate('libRelationPageCover') },
|
||||
{ id: J.Relation.pageCover, icon: 'image', name: translate('libRelationPageCover') },
|
||||
].concat(options);
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class Sidebar {
|
|||
const y = wh / 2 - this.getMaxHeight() / 2;
|
||||
|
||||
this.set({
|
||||
width: J.Constant.size.sidebar.width.default,
|
||||
width: J.Size.sidebar.width.default,
|
||||
y,
|
||||
x: 0,
|
||||
snap: I.MenuDirection.Left,
|
||||
|
@ -519,7 +519,7 @@ class Sidebar {
|
|||
* Limit the sidebar width to the max and min bounds
|
||||
*/
|
||||
private limitWidth (width: number): number {
|
||||
const { min, max } = J.Constant.size.sidebar.width;
|
||||
const { min, max } = J.Size.sidebar.width;
|
||||
return Math.max(min, Math.min(max, Number(width) || 0));
|
||||
};
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ class UtilData {
|
|||
},
|
||||
{
|
||||
subId: J.Constant.subId.relation,
|
||||
keys: J.Constant.relationRelationKeys,
|
||||
keys: J.Relation.relation,
|
||||
filters: [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'spaceId', condition: I.FilterCondition.In, value: [ J.Constant.storeSpaceId, space ] },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.In, value: I.ObjectLayout.Relation },
|
||||
|
@ -323,7 +323,7 @@ class UtilData {
|
|||
},
|
||||
{
|
||||
subId: J.Constant.subId.option,
|
||||
keys: J.Constant.optionRelationKeys,
|
||||
keys: J.Relation.option,
|
||||
filters: [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Option },
|
||||
],
|
||||
|
@ -398,19 +398,19 @@ class UtilData {
|
|||
};
|
||||
|
||||
spaceRelationKeys () {
|
||||
return J.Constant.defaultRelationKeys.concat(J.Constant.spaceRelationKeys).concat(J.Constant.participantRelationKeys);
|
||||
return J.Relation.default.concat(J.Relation.space).concat(J.Relation.participant);
|
||||
};
|
||||
|
||||
typeRelationKeys () {
|
||||
return J.Constant.defaultRelationKeys.concat(J.Constant.typeRelationKeys);
|
||||
return J.Relation.default.concat(J.Relation.type);
|
||||
};
|
||||
|
||||
participantRelationKeys () {
|
||||
return J.Constant.defaultRelationKeys.concat(J.Constant.participantRelationKeys);
|
||||
return J.Relation.default.concat(J.Relation.participant);
|
||||
};
|
||||
|
||||
syncStatusRelationKeys () {
|
||||
return J.Constant.defaultRelationKeys.concat(J.Constant.syncStatusRelationKeys);
|
||||
return J.Relation.default.concat(J.Relation.syncStatus);
|
||||
};
|
||||
|
||||
createSession (phrase: string, key: string, callBack?: (message: any) => void) {
|
||||
|
@ -499,7 +499,7 @@ class UtilData {
|
|||
const sorts = [
|
||||
{ relationKey: 'name', type: I.SortType.Asc },
|
||||
];
|
||||
const keys = J.Constant.defaultRelationKeys.concat([ 'targetObjectType' ]);
|
||||
const keys = J.Relation.default.concat([ 'targetObjectType' ]);
|
||||
|
||||
this.search({
|
||||
filters,
|
||||
|
@ -512,7 +512,7 @@ class UtilData {
|
|||
checkDetails (rootId: string, blockId?: string) {
|
||||
blockId = blockId || rootId;
|
||||
|
||||
const object = S.Detail.get(rootId, blockId, [ 'layout', 'layoutAlign', 'iconImage', 'iconEmoji', 'templateIsBundled' ].concat(J.Constant.coverRelationKeys), true);
|
||||
const object = S.Detail.get(rootId, blockId, [ 'layout', 'layoutAlign', 'iconImage', 'iconEmoji', 'templateIsBundled' ].concat(J.Relation.cover), true);
|
||||
const checkType = S.Block.checkBlockTypeExists(rootId);
|
||||
const { iconEmoji, iconImage, coverType, coverId } = object;
|
||||
const ret = {
|
||||
|
@ -707,7 +707,7 @@ class UtilData {
|
|||
idField: 'id',
|
||||
filters: [],
|
||||
sorts: [],
|
||||
keys: J.Constant.defaultRelationKeys,
|
||||
keys: J.Relation.default,
|
||||
sources: [],
|
||||
offset: 0,
|
||||
limit: 0,
|
||||
|
@ -764,7 +764,7 @@ class UtilData {
|
|||
param = Object.assign({
|
||||
subId: '',
|
||||
ids: [],
|
||||
keys: J.Constant.defaultRelationKeys,
|
||||
keys: J.Relation.default,
|
||||
noDeps: false,
|
||||
idField: 'id',
|
||||
}, param);
|
||||
|
@ -810,7 +810,7 @@ class UtilData {
|
|||
fullText: '',
|
||||
filters: [],
|
||||
sorts: [],
|
||||
keys: J.Constant.defaultRelationKeys,
|
||||
keys: J.Relation.default,
|
||||
offset: 0,
|
||||
limit: 0,
|
||||
ignoreWorkspace: false,
|
||||
|
@ -890,7 +890,7 @@ class UtilData {
|
|||
{ operator: I.FilterOperator.And, relationKey: 'isArchived', condition: I.FilterCondition.NotEqual, value: true },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'isDeleted', condition: I.FilterCondition.NotEqual, value: true },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: U.Object.getFileAndSystemLayouts() },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.NotIn, value: [ '_anytype_profile' ] },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'id', condition: I.FilterCondition.NotEqual, value: J.Constant.anytypeProfileId },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'spaceId', condition: I.FilterCondition.In, value: [ space ] },
|
||||
];
|
||||
|
||||
|
@ -995,7 +995,7 @@ class UtilData {
|
|||
return;
|
||||
};
|
||||
|
||||
C.AccountCreate('', '', dataPath, U.Common.rand(1, J.Constant.iconCnt), mode, path, (message) => {
|
||||
C.AccountCreate('', '', dataPath, U.Common.rand(1, J.Constant.count.icon), mode, path, (message) => {
|
||||
if (message.error.code) {
|
||||
onError(message.error.description);
|
||||
return;
|
||||
|
|
|
@ -113,7 +113,7 @@ class UtilEmbed {
|
|||
const place = url.match(/place\/([^\/]+)/);
|
||||
const param = url.match(/\/@([^\/\?]+)/);
|
||||
const search: any = {
|
||||
key: J.Constant.embed.googleMaps.key,
|
||||
key: J.Constant.googleMaps,
|
||||
};
|
||||
|
||||
let endpoint = '';
|
||||
|
|
|
@ -589,7 +589,7 @@ class UtilMenu {
|
|||
const ret: any[] = [];
|
||||
const Locale = require('lib/json/locale.json');
|
||||
|
||||
for (const id of J.Constant.enabledInterfaceLang) {
|
||||
for (const id of J.Lang.enabled) {
|
||||
ret.push({ id, name: Locale[id] });
|
||||
};
|
||||
|
||||
|
@ -600,7 +600,7 @@ class UtilMenu {
|
|||
let ret: any[] = [];
|
||||
|
||||
ret = ret.concat(S.Common.languages || []);
|
||||
ret = ret.map(id => ({ id, name: J.Constant.spellingLang[id] }));
|
||||
ret = ret.map(id => ({ id, name: J.Lang.spelling[id] }));
|
||||
ret.unshift({ id: '', name: translate('commonDisabled') });
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -146,14 +146,14 @@ class DetailStore {
|
|||
};
|
||||
};
|
||||
|
||||
/** gets the object. if no keys are provided, all properties are returned. if force keys is set, J.Constant.defaultRelationKeys are included */
|
||||
/** gets the object. if no keys are provided, all properties are returned. if force keys is set, J.Relation.default are included */
|
||||
public get (rootId: string, id: string, withKeys?: string[], forceKeys?: boolean): any {
|
||||
let list = this.map.get(rootId)?.get(id) || [];
|
||||
if (!list.length) {
|
||||
return { id, _empty_: true };
|
||||
};
|
||||
|
||||
const keys = new Set(withKeys ? [ ...withKeys, ...(!forceKeys ? J.Constant.defaultRelationKeys : []) ] : []);
|
||||
const keys = new Set(withKeys ? [ ...withKeys, ...(!forceKeys ? J.Relation.default : []) ] : []);
|
||||
const object = { id };
|
||||
|
||||
if (withKeys) {
|
||||
|
|
|
@ -257,7 +257,7 @@ class RecordStore {
|
|||
};
|
||||
|
||||
getTypeById (id: string) {
|
||||
const object = S.Detail.get(J.Constant.subId.type, id, J.Constant.typeRelationKeys);
|
||||
const object = S.Detail.get(J.Constant.subId.type, id, J.Relation.type);
|
||||
return object._empty_ ? null : object;
|
||||
};
|
||||
|
||||
|
@ -318,12 +318,12 @@ class RecordStore {
|
|||
return null;
|
||||
};
|
||||
|
||||
const object = S.Detail.get(J.Constant.subId.relation, id, J.Constant.relationRelationKeys, true);
|
||||
const object = S.Detail.get(J.Constant.subId.relation, id, J.Relation.relation, true);
|
||||
return object._empty_ ? null : object;
|
||||
};
|
||||
|
||||
getOption (id: string) {
|
||||
const object = S.Detail.get(J.Constant.subId.option, id, J.Constant.optionRelationKeys, true);
|
||||
const object = S.Detail.get(J.Constant.subId.option, id, J.Relation.option, true);
|
||||
return object._empty_ ? null : object;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue