@bdlite/domains 1.1.33 → 1.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
- import { CHANNEL_NAME } from '../constants'
3
-
4
- const { subscribe } = createSubChannelKit({ channelName: CHANNEL_NAME }, { relay: 1 })
5
-
1
+ import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
+ import { CHANNEL_NAME } from '../constants'
3
+
4
+ const { subscribe } = createSubChannelKit({ channelName: CHANNEL_NAME }, { relay: 1 })
5
+
6
6
  export const subscribeLayout = subscribe
@@ -1,6 +1,6 @@
1
- import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
- import { MENU_ITEM_CHANNEL_NAME } from '../constants'
3
-
4
- const { subscribe } = createSubChannelKit({ channelName: MENU_ITEM_CHANNEL_NAME }, { relay: 1 })
5
-
1
+ import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
+ import { MENU_ITEM_CHANNEL_NAME } from '../constants'
3
+
4
+ const { subscribe } = createSubChannelKit({ channelName: MENU_ITEM_CHANNEL_NAME }, { relay: 1 })
5
+
6
6
  export const subscribeMenuItem = subscribe
@@ -1,6 +1,6 @@
1
- import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
- import { MENU_CHANNEL_NAME } from '../constants'
3
-
4
- const { subscribe } = createSubChannelKit({ channelName: MENU_CHANNEL_NAME }, { relay: 1 })
5
-
1
+ import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
+ import { MENU_CHANNEL_NAME } from '../constants'
3
+
4
+ const { subscribe } = createSubChannelKit({ channelName: MENU_CHANNEL_NAME }, { relay: 1 })
5
+
6
6
  export const subscribeMenu = subscribe
@@ -1,23 +1,23 @@
1
- export const CHANNEL_NAME = 'domainsLayout'
2
- export const MENU_CHANNEL_NAME = 'domainsMenu'
3
- export const MENU_ITEM_CHANNEL_NAME = 'domainsMenuItem'
4
-
5
- // 初始值
6
- export const LAYOUT_MODE = {
7
- HEADER: 'header',
8
- SIDER: 'sider',
9
- BOTH: 'both',
10
- }
11
- export const DEFAULT_LAYOUT_MODE = LAYOUT_MODE.HEADER
12
-
13
- export const LAYOUT_THEME = {
14
- DARK: 'dark',
15
- LIGHT: 'light',
16
- }
17
- export const DEFAULT_LAYOUT_THEME = LAYOUT_THEME.DARK
18
-
19
- export const DEFAULT_LAYOUT_DATA = {
20
- systemName: '', showFooter: false,
21
- theme: DEFAULT_LAYOUT_THEME,
22
- layoutMode: DEFAULT_LAYOUT_MODE,
1
+ export const CHANNEL_NAME = 'domainsLayout'
2
+ export const MENU_CHANNEL_NAME = 'domainsMenu'
3
+ export const MENU_ITEM_CHANNEL_NAME = 'domainsMenuItem'
4
+
5
+ // 初始值
6
+ export const LAYOUT_MODE = {
7
+ HEADER: 'header',
8
+ SIDER: 'sider',
9
+ BOTH: 'both',
10
+ }
11
+ export const DEFAULT_LAYOUT_MODE = LAYOUT_MODE.HEADER
12
+
13
+ export const LAYOUT_THEME = {
14
+ DARK: 'dark',
15
+ LIGHT: 'light',
16
+ }
17
+ export const DEFAULT_LAYOUT_THEME = LAYOUT_THEME.DARK
18
+
19
+ export const DEFAULT_LAYOUT_DATA = {
20
+ systemName: '', showFooter: false,
21
+ theme: DEFAULT_LAYOUT_THEME,
22
+ layoutMode: DEFAULT_LAYOUT_MODE,
23
23
  }
@@ -1,13 +1,13 @@
1
- import { isObject } from '@bdlite/strategy'
2
- import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
- import { CHANNEL_NAME, DEFAULT_LAYOUT_DATA } from './constants'
4
-
5
- const { getData, subscribe, publish } = createObservableKit(DEFAULT_LAYOUT_DATA, null, { channelName: CHANNEL_NAME })
6
-
7
- export const subscribeLayout = subscribe
8
-
9
- export function publishLayout(data = {}) {
10
- if (isObject(data)) {
11
- publish({ ...getData(), ...data })
12
- }
1
+ import { isObject } from '@bdlite/strategy'
2
+ import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
+ import { CHANNEL_NAME, DEFAULT_LAYOUT_DATA } from './constants'
4
+
5
+ const { getData, subscribe, publish } = createObservableKit(DEFAULT_LAYOUT_DATA, null, { channelName: CHANNEL_NAME })
6
+
7
+ export const subscribeLayout = subscribe
8
+
9
+ export function publishLayout(data = {}) {
10
+ if (isObject(data)) {
11
+ publish({ ...getData(), ...data })
12
+ }
13
13
  }
@@ -1,15 +1,15 @@
1
- import { isObject } from '@bdlite/strategy'
2
- import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
- import { MENU_ITEM_CHANNEL_NAME } from './constants'
4
-
5
- const { getData, subscribe, publish } = createObservableKit({ selectedItem: {}, iframeUrl: '' }, null, { channelName: MENU_ITEM_CHANNEL_NAME })
6
-
7
- export const subscribeMenuItem = subscribe
8
-
9
- export const getMenuData = getData
10
-
11
- export function publishMenuItem(data = {}) {
12
- if (isObject(data)) {
13
- publish({ ...getData(), ...data })
14
- }
1
+ import { isObject } from '@bdlite/strategy'
2
+ import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
+ import { MENU_ITEM_CHANNEL_NAME } from './constants'
4
+
5
+ const { getData, subscribe, publish } = createObservableKit({ selectedItem: {}, iframeUrl: '' }, null, { channelName: MENU_ITEM_CHANNEL_NAME })
6
+
7
+ export const subscribeMenuItem = subscribe
8
+
9
+ export const getMenuData = getData
10
+
11
+ export function publishMenuItem(data = {}) {
12
+ if (isObject(data)) {
13
+ publish({ ...getData(), ...data })
14
+ }
15
15
  }
package/es/layout/menu.js CHANGED
@@ -1,15 +1,15 @@
1
- import { isObject } from '@bdlite/strategy'
2
- import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
- import { MENU_CHANNEL_NAME } from './constants'
4
-
5
- const initialData = { menu: [], globalOpenTarget: '', isPreviewMode: false }
6
- const { getData, subscribe, publish } = createObservableKit(initialData, null, { channelName: MENU_CHANNEL_NAME })
7
-
8
- export const subscribeMenu = subscribe
9
-
10
- export function publishMenu(data = {}) {
11
- if (isObject(data)) {
12
- publish({ ...getData(), ...data })
13
- }
14
- }
1
+ import { isObject } from '@bdlite/strategy'
2
+ import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
+ import { MENU_CHANNEL_NAME } from './constants'
4
+
5
+ const initialData = { menu: [], globalOpenTarget: '', isPreviewMode: false }
6
+ const { getData, subscribe, publish } = createObservableKit(initialData, null, { channelName: MENU_CHANNEL_NAME })
7
+
8
+ export const subscribeMenu = subscribe
9
+
10
+ export function publishMenu(data = {}) {
11
+ if (isObject(data)) {
12
+ publish({ ...getData(), ...data })
13
+ }
14
+ }
15
15
  export const getMenuData = getData
@@ -1,44 +1,44 @@
1
- import { isUndefined } from '@bdlite/strategy'
2
-
3
- import { createObservableKit, createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
4
-
5
- const CHANNEL_NAME = 'portrait-selector'
6
- const CURRENT_CHANNEL_NAME = `${CHANNEL_NAME}-current`
7
- const OPERATE_CHANNEL_NAME = `${CHANNEL_NAME}-operate`
8
-
9
- const { subscribe: subscribeCur } = createSubChannelKit({ channelName: CURRENT_CHANNEL_NAME }, { relay: 1 })
10
- const { subscribe: subscribeOp } = createSubChannelKit({ channelName: OPERATE_CHANNEL_NAME })
11
- let currentKit = null
12
-
13
- export const subscribeCurrent = subscribeCur
14
- export const subscribeOperate = subscribeOp
15
-
16
- export function publishCurrent(data) {
17
- if (!currentKit) {
18
- currentKit = createObservableKit({}, null, { channelName: CURRENT_CHANNEL_NAME })
19
- }
20
-
21
- if (isUndefined(data.id)) {
22
- currentKit.observable.error(new Error('tableId is undefined.'))
23
- } else {
24
- currentKit.observable.next(data)
25
- }
26
- }
27
-
28
-
29
- /**
30
- * @function operateItem
31
- * @param {object} item
32
- */
33
- export function operateItem(item = {}) {
34
- let { observable } = createObservableKit({}, null, { channelName: OPERATE_CHANNEL_NAME })
35
-
36
- if (isUndefined(item.id)) {
37
- observable.error(new Error('tableId is undefined.'))
38
- } else {
39
- observable.next(item)
40
- }
41
-
42
- observable.close() // 如果按需创建,一定要调用close,因为事件会一直被监听
43
- observable = null
1
+ import { isUndefined } from '@bdlite/strategy'
2
+
3
+ import { createObservableKit, createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
4
+
5
+ const CHANNEL_NAME = 'portrait-selector'
6
+ const CURRENT_CHANNEL_NAME = `${CHANNEL_NAME}-current`
7
+ const OPERATE_CHANNEL_NAME = `${CHANNEL_NAME}-operate`
8
+
9
+ const { subscribe: subscribeCur } = createSubChannelKit({ channelName: CURRENT_CHANNEL_NAME }, { relay: 1 })
10
+ const { subscribe: subscribeOp } = createSubChannelKit({ channelName: OPERATE_CHANNEL_NAME })
11
+ let currentKit = null
12
+
13
+ export const subscribeCurrent = subscribeCur
14
+ export const subscribeOperate = subscribeOp
15
+
16
+ export function publishCurrent(data) {
17
+ if (!currentKit) {
18
+ currentKit = createObservableKit({}, null, { channelName: CURRENT_CHANNEL_NAME })
19
+ }
20
+
21
+ if (isUndefined(data.id)) {
22
+ currentKit.observable.error(new Error('tableId is undefined.'))
23
+ } else {
24
+ currentKit.observable.next(data)
25
+ }
26
+ }
27
+
28
+
29
+ /**
30
+ * @function operateItem
31
+ * @param {object} item
32
+ */
33
+ export function operateItem(item = {}) {
34
+ let { observable } = createObservableKit({}, null, { channelName: OPERATE_CHANNEL_NAME })
35
+
36
+ if (isUndefined(item.id)) {
37
+ observable.error(new Error('tableId is undefined.'))
38
+ } else {
39
+ observable.next(item)
40
+ }
41
+
42
+ observable.close() // 如果按需创建,一定要调用close,因为事件会一直被监听
43
+ observable = null
44
44
  }
@@ -1,3 +1,3 @@
1
- export const PLUGIN_CHANNEL_NAME = 'sider-plugin';
2
-
1
+ export const PLUGIN_CHANNEL_NAME = 'sider-plugin';
2
+
3
3
  export const DEFAULT_TOP_SHOW = true;
@@ -1,13 +1,13 @@
1
- import { isObject } from '@bdlite/strategy'
2
- import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
-
4
- import { DEFAULT_TOP_SHOW } from './constants'
5
-
6
- const { getData, subscribe, publish } = createObservableKit({ topShow: DEFAULT_TOP_SHOW })
7
-
8
- export const subscribeSiderPluginStatus = subscribe
9
- export function publishSiderPluginStatus(data) {
10
- if (isObject(data)) {
11
- publish({ ...getData(), ...data })
12
- }
1
+ import { isObject } from '@bdlite/strategy'
2
+ import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
+
4
+ import { DEFAULT_TOP_SHOW } from './constants'
5
+
6
+ const { getData, subscribe, publish } = createObservableKit({ topShow: DEFAULT_TOP_SHOW })
7
+
8
+ export const subscribeSiderPluginStatus = subscribe
9
+ export function publishSiderPluginStatus(data) {
10
+ if (isObject(data)) {
11
+ publish({ ...getData(), ...data })
12
+ }
13
13
  }
@@ -1,7 +1,7 @@
1
- import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
- import { CHANNEL_NAME } from './constants'
3
-
4
- // 登录用户信息
5
- const { subscribe } = createSubChannelKit({ channelName: CHANNEL_NAME }, { relay: 1 })
6
-
1
+ import { createSubChannelKit } from '@bdlite/observable/es/create-observable-kit'
2
+ import { CHANNEL_NAME } from './constants'
3
+
4
+ // 登录用户信息
5
+ const { subscribe } = createSubChannelKit({ channelName: CHANNEL_NAME }, { relay: 1 })
6
+
7
7
  export const subscribeSysConfig = subscribe
@@ -1,11 +1,11 @@
1
- export const CHANNEL_NAME = 'system_customization_config_data'
2
-
3
- // 系统自定义数据
4
- export const DEFAULT_USERAGREEMENT = ''
5
- export const DEFAULT_TITLE = '数据治理平台'
6
- export const DEFAULT_FAVICON = '/base/images/favicon.ico'
7
- export const DEFAULT_LOGO = '/base/images/logo-fallback.svg' // '/base/images/logo.svg'
8
- export const DEFAULT_LOGINLOGO = '/base/images/login-logo.png'
9
- export const DEFAULT_COPYRIGHT = '© 2024 radar.qihoo.net 数据平台部 All Rights Reserved'
10
-
1
+ export const CHANNEL_NAME = 'system_customization_config_data'
2
+
3
+ // 系统自定义数据
4
+ export const DEFAULT_USERAGREEMENT = ''
5
+ export const DEFAULT_TITLE = '数据治理平台'
6
+ export const DEFAULT_FAVICON = '/base/images/favicon.ico'
7
+ export const DEFAULT_LOGO = '/base/images/logo-fallback.svg' // '/base/images/logo.svg'
8
+ export const DEFAULT_LOGINLOGO = '/base/images/login-logo.png'
9
+ export const DEFAULT_COPYRIGHT = '© 2024 radar.qihoo.net 数据平台部 All Rights Reserved'
10
+
11
11
  export const DEEFAULT_APP = 'govern' // govern: 治理平台, share:共享交换平台
@@ -1,117 +1,121 @@
1
- import storage from '@bdlite/helpers/es/storage'
2
- import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
-
4
- import { CHANNEL_NAME, DEFAULT_USERAGREEMENT, DEEFAULT_APP, DEFAULT_TITLE, DEFAULT_FAVICON, DEFAULT_LOGO, DEFAULT_LOGINLOGO, DEFAULT_COPYRIGHT } from './constants'
5
-
6
-
7
- const DEFAULT_CONTRACTOR_ID = null
8
-
9
-
10
- const { getData, subscribe, publish } = createObservableKit({
11
- contractName: '',
12
- contactorId: DEFAULT_CONTRACTOR_ID,
13
- logo: DEFAULT_LOGO,
14
- title: DEFAULT_TITLE,
15
- favicon: DEFAULT_FAVICON,
16
- loginLogo: DEFAULT_LOGINLOGO,
17
- copyright: DEFAULT_COPYRIGHT,
18
- useragreement: DEFAULT_USERAGREEMENT,
19
- app: DEEFAULT_APP,
20
- }, null, { channelName: CHANNEL_NAME })
21
-
22
-
23
- /**
24
- * @function getSysConfig
25
- */
26
- export function getSysConfig() {
27
- try {
28
- const {
29
- contractName = '',
30
- contactorId = DEFAULT_CONTRACTOR_ID,
31
- logo = DEFAULT_LOGO,
32
- title = DEFAULT_TITLE,
33
- favicon = DEFAULT_FAVICON,
34
- loginLogo = DEFAULT_LOGINLOGO,
35
- copyright = DEFAULT_COPYRIGHT,
36
- useragreement = DEFAULT_USERAGREEMENT,
37
- app = DEEFAULT_APP
38
- } = storage.getObject(CHANNEL_NAME)
39
-
40
- return {
41
- ...getData(),
42
- contactorId, contractName,
43
- favicon, logo, loginLogo,
44
- title: title.trim(),
45
- copyright: copyright.trim(),
46
- useragreement: useragreement.trim(),
47
- app
48
- }
49
- } catch (e) {
50
- return { ...getData() }
51
- }
52
- }
53
-
54
- /**
55
- * @function storeSysConfig
56
- * @param {?object} systemConfig
57
- */
58
- export function storeSysConfig(systemConfig) {
59
- if (!systemConfig) return
60
- const { mainLogo, copyright, eula, preload = {}, contactor, contactorInfo = {} } = systemConfig
61
- const { title, favicon, loginLogo, appRunning } = preload
62
- const nextConfig = {
63
- ...getData(),
64
- contactorId: contactor, contractName: contactorInfo?.display || '',
65
- favicon, loginLogo, logo: mainLogo,
66
- title: title?.trim(), copyright: copyright?.trim(), useragreement: eula?.trim(),
67
- app: appRunning
68
- }
69
- storage.appendObject(CHANNEL_NAME, nextConfig)
70
- publish(nextConfig)
71
- }
72
-
73
- /**
74
- * @function storePreload
75
- * @param {?object} config
76
- */
77
- export function storePreload(config) {
78
- if (!config) return
79
- const { title, favicon, loginLogo, copyright, eula, appRunning } = config
80
- const nextConfig = {
81
- ...getData(),
82
- favicon, loginLogo, app: appRunning,
83
- title: title?.trim(), copyright: copyright?.trim(), useragreement: eula?.trim()
84
- }
85
- storage.appendObject(CHANNEL_NAME, nextConfig)
86
- publish(nextConfig)
87
- }
88
-
89
- /**
90
- * @function publishPreload
91
- * @param {?object} config
92
- */
93
- export function publishPreload(config) {
94
- if (!config) return
95
- const { title, favicon, loginLogo, copyright, eula } = config
96
- publish({
97
- ...getData(),
98
- favicon, loginLogo,
99
- title: title?.trim(), copyright: copyright?.trim(), useragreement: eula?.trim()
100
- })
101
- }
102
-
103
-
104
- /**
105
- * @function subscribeSysConfig
106
- * @param {function | object} mountedFunOrConfig
107
- * @param {?function} unmountedFun
108
- * @returns {function} unsubscribe
109
- */
110
- export const subscribeSysConfig = subscribe
111
-
112
- /**
113
- * @function publishSysConfig
114
- */
115
- export function publishSysConfig() {
116
- publish(getSysConfig())
1
+ import storage from '@bdlite/helpers/es/storage'
2
+ import { createObservableKit } from '@bdlite/observable/es/create-observable-kit'
3
+
4
+ import { CHANNEL_NAME, DEFAULT_USERAGREEMENT, DEEFAULT_APP, DEFAULT_TITLE, DEFAULT_FAVICON, DEFAULT_LOGO, DEFAULT_LOGINLOGO, DEFAULT_COPYRIGHT } from './constants'
5
+
6
+
7
+ const DEFAULT_CONTRACTOR_ID = null
8
+
9
+
10
+ const { getData, subscribe, publish } = createObservableKit({
11
+ contractName: '',
12
+ contactorId: DEFAULT_CONTRACTOR_ID,
13
+ logo: DEFAULT_LOGO,
14
+ title: DEFAULT_TITLE,
15
+ favicon: DEFAULT_FAVICON,
16
+ loginLogo: DEFAULT_LOGINLOGO,
17
+ copyright: DEFAULT_COPYRIGHT,
18
+ useragreement: DEFAULT_USERAGREEMENT,
19
+ app: DEEFAULT_APP,
20
+ loginTypes : '1,2,3,4,5,6'
21
+ }, null, { channelName: CHANNEL_NAME })
22
+
23
+
24
+ /**
25
+ * @function getSysConfig
26
+ */
27
+ export function getSysConfig() {
28
+ try {
29
+ const {
30
+ contractName = '',
31
+ contactorId = DEFAULT_CONTRACTOR_ID,
32
+ logo = DEFAULT_LOGO,
33
+ title = DEFAULT_TITLE,
34
+ favicon = DEFAULT_FAVICON,
35
+ loginLogo = DEFAULT_LOGINLOGO,
36
+ copyright = DEFAULT_COPYRIGHT,
37
+ useragreement = DEFAULT_USERAGREEMENT,
38
+ app = DEEFAULT_APP,
39
+ loginTypes = '1,2,3,4,5,6'
40
+ } = storage.getObject(CHANNEL_NAME)
41
+
42
+ return {
43
+ ...getData(),
44
+ contactorId, contractName,
45
+ favicon, logo, loginLogo,
46
+ title: title.trim(),
47
+ copyright: copyright.trim(),
48
+ useragreement: useragreement.trim(),
49
+ app,
50
+ loginTypes
51
+ }
52
+ } catch (e) {
53
+ return { ...getData() }
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @function storeSysConfig
59
+ * @param {?object} systemConfig
60
+ */
61
+ export function storeSysConfig(systemConfig) {
62
+ if (!systemConfig) return
63
+ const { mainLogo, copyright, eula, preload = {}, contactor, contactorInfo = {} } = systemConfig
64
+ const { title, favicon, loginLogo, appRunning, loginTypes } = preload
65
+ const nextConfig = {
66
+ ...getData(),
67
+ contactorId: contactor, contractName: contactorInfo?.display || '',
68
+ favicon, loginLogo, logo: mainLogo,
69
+ title: title?.trim(), copyright: copyright?.trim(), useragreement: eula?.trim(),
70
+ app: appRunning,
71
+ loginTypes
72
+ }
73
+ storage.appendObject(CHANNEL_NAME, nextConfig)
74
+ publish(nextConfig)
75
+ }
76
+
77
+ /**
78
+ * @function storePreload
79
+ * @param {?object} config
80
+ */
81
+ export function storePreload(config) {
82
+ if (!config) return
83
+ const { title, favicon, loginLogo, copyright, eula, appRunning, loginTypes } = config
84
+ const nextConfig = {
85
+ ...getData(),
86
+ favicon, loginLogo, app: appRunning,
87
+ title: title?.trim(), copyright: copyright?.trim(), useragreement: eula?.trim(), loginTypes
88
+ }
89
+ storage.appendObject(CHANNEL_NAME, nextConfig)
90
+ publish(nextConfig)
91
+ }
92
+
93
+ /**
94
+ * @function publishPreload
95
+ * @param {?object} config
96
+ */
97
+ export function publishPreload(config) {
98
+ if (!config) return
99
+ const { title, favicon, loginLogo, copyright, eula, loginTypes } = config
100
+ publish({
101
+ ...getData(),
102
+ favicon, loginLogo,
103
+ title: title?.trim(), copyright: copyright?.trim(), useragreement: eula?.trim(), loginTypes
104
+ })
105
+ }
106
+
107
+
108
+ /**
109
+ * @function subscribeSysConfig
110
+ * @param {function | object} mountedFunOrConfig
111
+ * @param {?function} unmountedFun
112
+ * @returns {function} unsubscribe
113
+ */
114
+ export const subscribeSysConfig = subscribe
115
+
116
+ /**
117
+ * @function publishSysConfig
118
+ */
119
+ export function publishSysConfig() {
120
+ publish(getSysConfig())
117
121
  }