plain-design 1.0.0-beta.33 → 1.0.0-beta.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. package/dist/plain-design.commonjs.min.js +18 -18
  2. package/dist/plain-design.min.css +1 -1
  3. package/dist/plain-design.min.js +18 -18
  4. package/dist/report.html +38 -38
  5. package/package.json +3 -2
  6. package/src/packages/components/Dropdown/dropdown.public.scss +10 -0
  7. package/src/packages/components/Dropdown/dropdown.utils.tsx +3 -1
  8. package/src/packages/components/Dropdown/index.tsx +2 -2
  9. package/src/packages/components/DropdownSeparator/index.tsx +8 -0
  10. package/src/packages/entry.tsx +1 -0
  11. package/src/pages/data/address.json +0 -39317
  12. package/src/pages/data/data-1.json +0 -754
  13. package/src/pages/data/data-2.json +0 -3006
  14. package/src/pages/data/data-200.json +0 -5206
  15. package/src/pages/data/data-2000.json +0 -51954
  16. package/src/pages/data/data-50.json +0 -2075
  17. package/src/pages/data/data.json +0 -30002
  18. package/src/pages/data/demo.json +0 -1702
  19. package/src/pages/data/mock.database.js +0 -43
  20. package/src/pages/data/mock.js +0 -141
  21. package/src/pages/data/tree.data.json +0 -87
  22. package/src/pages/env/config/local.js +0 -3
  23. package/src/pages/env/config/prod.js +0 -3
  24. package/src/pages/env/config/undefined.js +0 -1
  25. package/src/pages/env/env.d.ts +0 -4
  26. package/src/pages/env/index.ts +0 -1
  27. package/src/pages/history/createHistory.ts +0 -94
  28. package/src/pages/history/history.utils.ts +0 -64
  29. package/src/pages/index/App.tsx +0 -17
  30. package/src/pages/index/Demo/DemoLine.tsx +0 -23
  31. package/src/pages/index/Demo/DemoRow.scss +0 -131
  32. package/src/pages/index/Demo/DemoRow.tsx +0 -71
  33. package/src/pages/index/Demo/DemoRow.utils.ts +0 -23
  34. package/src/pages/index/Demo/DemoRowController.tsx +0 -45
  35. package/src/pages/index/Demo/index.ts +0 -8
  36. package/src/pages/index/app.scss +0 -197
  37. package/src/pages/index/components/AutoTable/AutoHeightAutoRow.tsx +0 -56
  38. package/src/pages/index/components/AutoTable/AutoHeightFixedRow.tsx +0 -50
  39. package/src/pages/index/components/AutoTable/AutoTableBasicUsage.tsx +0 -75
  40. package/src/pages/index/components/AutoTable/AutoTableCascade.tsx +0 -99
  41. package/src/pages/index/components/AutoTable/AutoTableDefaultSearch.tsx +0 -73
  42. package/src/pages/index/components/AutoTable/AutoTableFiles.tsx +0 -26
  43. package/src/pages/index/components/AutoTable/AutoTableFill.tsx +0 -51
  44. package/src/pages/index/components/AutoTable/AutoTableGroupUsage.tsx +0 -71
  45. package/src/pages/index/components/AutoTable/AutoTableObjectPicker.tsx +0 -181
  46. package/src/pages/index/components/AutoTable/AutoTableOvList.tsx +0 -80
  47. package/src/pages/index/components/AutoTable/AutoTableProductList.tsx +0 -98
  48. package/src/pages/index/components/AutoTable/AutoTableRowFormatter.tsx +0 -58
  49. package/src/pages/index/components/AutoTable/FixedHeightAutoRow.tsx +0 -50
  50. package/src/pages/index/components/AutoTable/FixedHeightFixedRow.tsx +0 -49
  51. package/src/pages/index/components/bus/DemoAddress.tsx +0 -181
  52. package/src/pages/index/components/bus/DemoAddressCascade.tsx +0 -132
  53. package/src/pages/index/components/bus/DemoFilter.tsx +0 -184
  54. package/src/pages/index/components/columns/DemoPlcAddress.tsx +0 -161
  55. package/src/pages/index/components/columns/DemoPlcDate.tsx +0 -363
  56. package/src/pages/index/components/columns/DemoPlcSelect.tsx +0 -505
  57. package/src/pages/index/components/columns/DemoPlcTime.tsx +0 -293
  58. package/src/pages/index/components/columns/DemoTableColumns.tsx +0 -88
  59. package/src/pages/index/components/form/DemoFormBasic.tsx +0 -516
  60. package/src/pages/index/components/form/DemoFormBlur.tsx +0 -204
  61. package/src/pages/index/components/form/DemoFormDynamicFields.tsx +0 -54
  62. package/src/pages/index/components/form/DemoFormEditControl.tsx +0 -164
  63. package/src/pages/index/components/form/DemoFormElement.tsx +0 -207
  64. package/src/pages/index/components/form/DemoFormLayout.scss +0 -7
  65. package/src/pages/index/components/form/DemoFormLayout.tsx +0 -311
  66. package/src/pages/index/components/form/DemoFormSimplify.tsx +0 -587
  67. package/src/pages/index/components/form/DemoFormSize.tsx +0 -274
  68. package/src/pages/index/components/form/DemoFormVertical.tsx +0 -280
  69. package/src/pages/index/components/normal/DemoAlert.tsx +0 -66
  70. package/src/pages/index/components/normal/DemoBadge.tsx +0 -53
  71. package/src/pages/index/components/normal/DemoButton.tsx +0 -300
  72. package/src/pages/index/components/normal/DemoCard.tsx +0 -176
  73. package/src/pages/index/components/normal/DemoCarousel.tsx +0 -230
  74. package/src/pages/index/components/normal/DemoCascade.tsx +0 -880
  75. package/src/pages/index/components/normal/DemoCheckbox.scss +0 -24
  76. package/src/pages/index/components/normal/DemoCheckbox.tsx +0 -294
  77. package/src/pages/index/components/normal/DemoCollapse.tsx +0 -104
  78. package/src/pages/index/components/normal/DemoColor.scss +0 -20
  79. package/src/pages/index/components/normal/DemoColor.tsx +0 -82
  80. package/src/pages/index/components/normal/DemoColorPicker.tsx +0 -163
  81. package/src/pages/index/components/normal/DemoDate.tsx +0 -443
  82. package/src/pages/index/components/normal/DemoDialog.tsx +0 -507
  83. package/src/pages/index/components/normal/DemoDropdown.tsx +0 -463
  84. package/src/pages/index/components/normal/DemoGrid.scss +0 -26
  85. package/src/pages/index/components/normal/DemoGrid.tsx +0 -181
  86. package/src/pages/index/components/normal/DemoIcon.tsx +0 -39
  87. package/src/pages/index/components/normal/DemoImage.tsx +0 -122
  88. package/src/pages/index/components/normal/DemoInput.scss +0 -0
  89. package/src/pages/index/components/normal/DemoInput.tsx +0 -790
  90. package/src/pages/index/components/normal/DemoKeepAlive.tsx +0 -505
  91. package/src/pages/index/components/normal/DemoLayout.tsx +0 -144
  92. package/src/pages/index/components/normal/DemoList.scss +0 -15
  93. package/src/pages/index/components/normal/DemoList.tsx +0 -82
  94. package/src/pages/index/components/normal/DemoLoading.tsx +0 -86
  95. package/src/pages/index/components/normal/DemoNumber.tsx +0 -269
  96. package/src/pages/index/components/normal/DemoPagination.tsx +0 -164
  97. package/src/pages/index/components/normal/DemoPopup.tsx +0 -695
  98. package/src/pages/index/components/normal/DemoProgress.tsx +0 -133
  99. package/src/pages/index/components/normal/DemoRadio.scss +0 -16
  100. package/src/pages/index/components/normal/DemoRadio.tsx +0 -188
  101. package/src/pages/index/components/normal/DemoRate.tsx +0 -77
  102. package/src/pages/index/components/normal/DemoScroll.scss +0 -22
  103. package/src/pages/index/components/normal/DemoScroll.tsx +0 -300
  104. package/src/pages/index/components/normal/DemoSegment.tsx +0 -71
  105. package/src/pages/index/components/normal/DemoSelect.tsx +0 -819
  106. package/src/pages/index/components/normal/DemoSlider.tsx +0 -128
  107. package/src/pages/index/components/normal/DemoSortList.tsx +0 -70
  108. package/src/pages/index/components/normal/DemoStackCard.tsx +0 -356
  109. package/src/pages/index/components/normal/DemoStep.scss +0 -18
  110. package/src/pages/index/components/normal/DemoStep.tsx +0 -291
  111. package/src/pages/index/components/normal/DemoTab.tsx +0 -338
  112. package/src/pages/index/components/normal/DemoTag.tsx +0 -100
  113. package/src/pages/index/components/normal/DemoTime.tsx +0 -403
  114. package/src/pages/index/components/normal/DemoToggle.tsx +0 -56
  115. package/src/pages/index/components/normal/DemoTooltip.tsx +0 -120
  116. package/src/pages/index/components/normal/DemoTree.tsx +0 -1183
  117. package/src/pages/index/components/normal/DemoUpload.tsx +0 -484
  118. package/src/pages/index/components/normal/DemoVirtualList.tsx +0 -464
  119. package/src/pages/index/components/service/DemoDialogService.tsx +0 -249
  120. package/src/pages/index/components/service/DemoFileService.tsx +0 -110
  121. package/src/pages/index/components/service/DemoImagePreviewer.tsx +0 -185
  122. package/src/pages/index/components/service/DemoMessageService.tsx +0 -100
  123. package/src/pages/index/components/service/DemoNoticeService.tsx +0 -99
  124. package/src/pages/index/components/service/DemoPopupService.tsx +0 -325
  125. package/src/pages/index/components/table/DemoPlcOperation.tsx +0 -307
  126. package/src/pages/index/components/table/DemoTableBasic.tsx +0 -220
  127. package/src/pages/index/components/table/DemoTableCheck.tsx +0 -78
  128. package/src/pages/index/components/table/DemoTableClassAndStyle.scss +0 -18
  129. package/src/pages/index/components/table/DemoTableClassAndStyle.tsx +0 -112
  130. package/src/pages/index/components/table/DemoTableColDraggable.tsx +0 -80
  131. package/src/pages/index/components/table/DemoTableEdit.tsx +0 -136
  132. package/src/pages/index/components/table/DemoTableExpand.tsx +0 -203
  133. package/src/pages/index/components/table/DemoTableFixed.tsx +0 -131
  134. package/src/pages/index/components/table/DemoTableFormatter.tsx +0 -66
  135. package/src/pages/index/components/table/DemoTableOverflowTooltip.tsx +0 -67
  136. package/src/pages/index/components/table/DemoTableRowDraggable.tsx +0 -106
  137. package/src/pages/index/components/table/DemoTableSlots.tsx +0 -153
  138. package/src/pages/index/components/table/DemoTableSpan.tsx +0 -167
  139. package/src/pages/index/components/table/DemoTableTree.tsx +0 -976
  140. package/src/pages/index/components/table/DemoVirtualTable.tsx +0 -274
  141. package/src/pages/index/components/test/DemoI18n.tsx +0 -27
  142. package/src/pages/index/components/test/DemoI18n2.jsx +0 -11
  143. package/src/pages/index/home/AppContent.tsx +0 -69
  144. package/src/pages/index/home/AppHead.tsx +0 -18
  145. package/src/pages/index/home/AppHome.tsx +0 -31
  146. package/src/pages/index/home/AppMenu.tsx +0 -38
  147. package/src/pages/index/home/menus.tsx +0 -220
  148. package/src/pages/index/home/plain-design.png +0 -0
  149. package/src/pages/index/main.tsx +0 -23
  150. package/src/pages/index/nav/$nav.ts +0 -41
  151. package/src/pages/index/pages.d.ts +0 -6
  152. package/src/pages/libs/iconfont-fontcls/demo.css +0 -539
  153. package/src/pages/libs/iconfont-fontcls/demo_index.html +0 -303
  154. package/src/pages/libs/iconfont-fontcls/iconfont.css +0 -35
  155. package/src/pages/libs/iconfont-fontcls/iconfont.js +0 -1
  156. package/src/pages/libs/iconfont-fontcls/iconfont.json +0 -44
  157. package/src/pages/libs/iconfont-fontcls/iconfont.ttf +0 -0
  158. package/src/pages/libs/iconfont-fontcls/iconfont.woff +0 -0
  159. package/src/pages/libs/iconfont-fontcls/iconfont.woff2 +0 -0
  160. package/src/pages/libs/iconfont-symbol/demo.css +0 -539
  161. package/src/pages/libs/iconfont-symbol/demo_index.html +0 -303
  162. package/src/pages/libs/iconfont-symbol/iconfont.css +0 -35
  163. package/src/pages/libs/iconfont-symbol/iconfont.js +0 -1
  164. package/src/pages/libs/iconfont-symbol/iconfont.json +0 -44
  165. package/src/pages/libs/iconfont-symbol/iconfont.ttf +0 -0
  166. package/src/pages/libs/iconfont-symbol/iconfont.woff +0 -0
  167. package/src/pages/libs/iconfont-symbol/iconfont.woff2 +0 -0
  168. package/src/pages/libs/install.iconfont-fontcls.tsx +0 -11
  169. package/src/pages/libs/install.iconfont-symbol.scss +0 -7
  170. package/src/pages/libs/install.iconfont-symbol.tsx +0 -14
  171. package/src/pages/module/address.ts +0 -27
  172. package/src/pages/module/http.ts +0 -24
  173. package/src/pages/module/index.ts +0 -19
  174. package/src/pages/module/object.ts +0 -5
  175. package/src/pages/module/ov.tsx +0 -13
  176. package/src/pages/module/upload.ts +0 -9
  177. package/src/pages/module/useTableOption.ts +0 -28
@@ -1,43 +0,0 @@
1
- /*
2
- const fs = require('fs')
3
- const path = require('path')
4
- const mock = require('mockjs').mock
5
-
6
- const createGeneratoe = (options) => {
7
- const {length} = options
8
- return () => {
9
- return options[Math.floor(Math.random() * length)]
10
- }
11
- }
12
-
13
- const nextFlag = createGeneratoe(['Y', 'N'])
14
- const nextSelect = createGeneratoe(['potential', 'store', 'consumer'])
15
-
16
- function generate() {
17
- const data = (mock({
18
- [`array|${100}`]: [
19
- {
20
- id: '@guid',
21
- created_at: '@datetime',
22
- created_by: '@first',
23
- updated_at: '@datetime',
24
- updated_by: '@first',
25
- normal_text: '@first',
26
- long_text: '@paragraph',
27
- 'number_val|1-100': 100,
28
- flag: nextFlag,
29
- select_val: nextSelect,
30
- color_val: '@color',
31
- date_val: '@datetime',
32
- time_val: '@time',
33
- parent_id: '',
34
- image_id: '',
35
- }
36
- ]
37
- })).array;
38
-
39
- fs.writeFileSync(path.resolve(__dirname, `./demo.json`), JSON.stringify(data, null, 2,))
40
- }
41
-
42
- generate()
43
- */
@@ -1,141 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { mock, Random } = require('mockjs');
4
-
5
- function generate() {
6
- [
7
- { file: 'data-50.json', num: 50 },
8
- // { file: 'data-200.json', num: 200 },
9
- // { file: 'data-2000.json', num: 2000 },
10
- ].forEach((item) => {
11
-
12
- const statusOptions = ['primary', 'success', 'warn', 'error', 'secondary'];
13
-
14
- const getRandomStatusList = () => {
15
- const count = Math.ceil(Math.random() * 3);
16
- const array = [];
17
- while (array.length < count) {
18
- const index = parseInt(Math.random() * statusOptions.length - 1);
19
- const item = statusOptions[index];
20
- if (array.indexOf(item) === -1) {
21
- array.push(item);
22
- }
23
- }
24
- return array;
25
- };
26
-
27
- const getRandomDateList = () => {
28
- const count = Math.ceil(Math.random() * 3);
29
- const array = [];
30
- while (array.length < count) {
31
- const value = Random.date();
32
- if (array.indexOf(value) === -1) {
33
- array.push(value);
34
- }
35
- }
36
- return array;
37
- };
38
-
39
- fs.writeFileSync(path.resolve(__dirname, `./${item.file}`), JSON.stringify(
40
- (() => {
41
- const { array } = (mock({
42
- [`array|${item.num}`]: [
43
- {
44
- "id|+1": 0,
45
- color: '@color',
46
- name: '@first',
47
- "star|0-10": 5,
48
- "flag": () => Math.random() > 0.5 ? 'Y' : 'N',
49
- "size|40-80": 60,
50
- addr: '@county(true)',
51
- url: '@url',
52
- domain: '@domain',
53
- protocol: '@protocol',
54
- email: '@email',
55
- ip: '@ip',
56
-
57
- tel: (() => {
58
- const prefix = ['139', '136', '132', '181', '172', '191'];
59
- const getNumber = () => {
60
- let arr = [];
61
- while (arr.length < 8) {
62
- arr.push(parseInt(Math.random() * 9));
63
- }
64
- return arr.join('');
65
- };
66
- return () => {
67
- let randomPrefix = Math.min(Math.floor(Math.random() * prefix.length), prefix.length - 1);
68
- return prefix[randomPrefix] + getNumber();
69
- };
70
- })(),
71
- 'num|0-999999': 0,
72
- 'float|0-1000.2': 0,
73
- 'percent|0.4': 0,
74
-
75
- status: () => statusOptions[parseInt(Math.random() * statusOptions.length - 1)],
76
- statusList: getRandomStatusList,
77
- statusArrayJson: () => JSON.stringify(getRandomStatusList()),
78
- statusArrayString: () => getRandomStatusList().join(','),
79
-
80
- date: '@date',
81
- dateList: getRandomDateList,
82
- dateArrayJson: () => JSON.stringify(getRandomDateList()),
83
- dateArrayString: () => getRandomDateList().join(','),
84
- }
85
- ]
86
- }));
87
- array.forEach(item => {
88
- /*dateNumber测试值格式化*/
89
- item.dateNumber = item.date.replace(/-/g, '');
90
-
91
- /*startDate以及endDate测试日期范围*/
92
- const startDate = Random.date();
93
- let endDateObj = new Date(new Date(startDate.replace(/-/g, '/')).getTime() + (24 * 60 * 60 * 1000) * (parseInt(Math.random() * 500)));
94
- const endDate = `${endDateObj.getFullYear()}-${String(endDateObj.getMonth() + 1).padStart(2, '0')}-${String(endDateObj.getDate()).padStart(2, '0')}`;
95
- item.startDate = startDate;
96
- item.endDate = endDate;
97
-
98
- /*startDatetime以及endDatetime测试日期时间范围*/
99
- const startDatetime = `${Random.date()} ${Random.time()}`;
100
- endDateObj = new Date(new Date(startDatetime.replace(/-/g, '/')).getTime() + parseInt(Math.random() * 864000000));
101
- item.startDatetime = startDatetime;
102
- item.endDatetime = [
103
- endDateObj.getFullYear(),
104
- endDateObj.getMonth() + 1,
105
- endDateObj.getDate(),
106
- ].map(i => String(i).padStart(2, '0')).join('-') + ' ' + [
107
- endDateObj.getHours(),
108
- endDateObj.getMinutes(),
109
- endDateObj.getSeconds(),
110
- ].map(i => String(i).padStart(2, '0')).join(':');
111
-
112
- /*测试time*/
113
- item.time = Random.time();
114
- item.timeNumber = item.time.replace(/:/g, '');
115
-
116
- /*startTime以及endTime测试时间范围*/
117
- let dateObj = new Date();
118
- const [hour, minute, second] = item.time.split(':');
119
- dateObj.setHours(hour);
120
- dateObj.setMinutes(minute);
121
- dateObj.setSeconds(second);
122
- const startTimestamp = dateObj.getTime();
123
- dateObj.setHours(23);
124
- dateObj.setMinutes(59);
125
- dateObj.setSeconds(59);
126
- const endTimestamp = dateObj.getTime();
127
- item.startTime = item.time;
128
- dateObj = new Date((Math.random() * (endTimestamp - startTimestamp)) + startTimestamp);
129
- item.endTime = [dateObj.getHours(), dateObj.getMinutes(), dateObj.getSeconds()].map(i => String(i).padStart(2, '0')).join(':');
130
-
131
- });
132
- return array;
133
- })(),
134
- null,
135
- 2,
136
- ))
137
- ;
138
- });
139
- }
140
-
141
- generate();
@@ -1,87 +0,0 @@
1
- [
2
- {
3
- "id": "1",
4
- "name": "浙江省 1",
5
- "subs": [
6
- {
7
- "id": "1-1",
8
- "name": "杭州市 1-1",
9
- "subs": [
10
- {
11
- "id": "1-1-1",
12
- "name": "西湖区 1-1-1"
13
- }
14
- ]
15
- },
16
- {
17
- "id": "1-2",
18
- "name": "宁波市 1-2",
19
- "subs": []
20
- },
21
- {
22
- "id": "1-3",
23
- "name": "温州市 1-3"
24
- }
25
- ]
26
- },
27
- {
28
- "id": "2",
29
- "name": "福建省 2",
30
- "subs": [
31
- {
32
- "id": "2-1",
33
- "name": "厦门市 2-1",
34
- "subs": [
35
- {
36
- "id": "2-1-1",
37
- "name": "思明区 2-1-1"
38
- }
39
- ]
40
- },
41
- {
42
- "id": "2-2",
43
- "name": "宁德市 2-2",
44
- "subs": [
45
- {
46
- "id": "2-2-1",
47
- "name": "蕉城区 2-2-1"
48
- },
49
- {
50
- "id": "2-2-2",
51
- "name": "古田县 2-2-2"
52
- }
53
- ]
54
- }
55
- ]
56
- },
57
- {
58
- "id": "3",
59
- "name": "四川省 3",
60
- "subs": [
61
- {
62
- "id": "3-1",
63
- "name": "成都市 3-1",
64
- "subs": [
65
- {
66
- "id": "3-1-1",
67
- "name": "武侯区 3-1-1"
68
- },
69
- {
70
- "id": "3-1-2",
71
- "name": "都江堰市 3-1-2"
72
- }
73
- ]
74
- },
75
- {
76
- "id": "3-2",
77
- "name": "泸州市 3-2",
78
- "subs": [
79
- {
80
- "id": "3-2-1",
81
- "name": "泸县 3-2-1"
82
- }
83
- ]
84
- }
85
- ]
86
- }
87
- ]
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- baseURL: 'http://localhost:7001',
3
- };
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- baseURL: 'http://1.116.13.72:7001',
3
- };
@@ -1 +0,0 @@
1
- module.exports = {};
@@ -1,4 +0,0 @@
1
- declare const APP_ENV: {
2
- baseURL: string,
3
- secret_key: string,
4
- };
@@ -1 +0,0 @@
1
- export const env = APP_ENV;
@@ -1,94 +0,0 @@
1
- import qs from 'qs';
2
- import {HistoryUtils, iChangeListener, iHistoryConfig, iHistoryHandler, iHistoryMeta} from "./history.utils";
3
-
4
- export function createHistoryCreator(handler: iHistoryHandler) {
5
- return ({ base }: iHistoryConfig) => {
6
-
7
- if (!base) {base = '/';}
8
- if (base.charAt(0) !== '/') {base = `/${base}`;}
9
-
10
- const utils = {
11
- getMeta: (url: string): iHistoryMeta => {
12
- url = handler.getPath(url);
13
- if (url.charAt(0) !== '/') {url = `/${url}`;}
14
- if (url.indexOf(base) === 0) {url = url.slice(base.length);}
15
- return HistoryUtils.decodePath(url);
16
- }
17
- };
18
-
19
- const historyState = { route: utils.getMeta(HistoryUtils.getLocationMeta().fullPath), };
20
-
21
- const methods = {
22
- push: (path: string, query?: Record<string, any>, hash?: string) => {
23
- let url = path;
24
- if (!!query) {
25
- url += '?' + qs.stringify(query);
26
- }
27
- if (!!hash) {
28
- url += '#' + hash;
29
- }
30
- handler.push(HistoryUtils.pathJoin(base, url));
31
- },
32
- back: () => {window.history.back();},
33
- onPathChange: (() => {
34
-
35
- let listeners: iChangeListener[] = [];
36
-
37
- const oldPushState = window.history.pushState;
38
-
39
- function newPushState(state: any, title: string, path: string) {
40
- const meta = utils.getMeta(path);
41
- if (meta.fullPath === historyState.route.fullPath) {return; }
42
- historyState.route = meta;
43
- listeners.forEach(fn => fn(meta));
44
- return oldPushState.apply(window.history, [state, title, path]);
45
- }
46
-
47
- window.history.pushState = newPushState;
48
-
49
- window.addEventListener('popstate', () => {
50
- const meta = utils.getMeta(HistoryUtils.getLocationMeta().fullPath);
51
- historyState.route = meta;
52
- listeners.forEach(fn => fn(meta));
53
- });
54
-
55
- return (listener: iChangeListener) => {
56
- listeners.push(listener);
57
- return () => {
58
- const index = listeners.indexOf(listener);
59
- index > -1 && listeners.splice(index, 1);
60
- };
61
- };
62
- })(),
63
- };
64
-
65
- return {
66
- state: historyState,
67
- ...methods,
68
- };
69
- };
70
- }
71
-
72
- export const createHashHistory = createHistoryCreator(({
73
- getPath: (path: string) => {
74
- const separatorIndex = path.indexOf('#');
75
- if (separatorIndex === -1) {
76
- return "";
77
- }
78
- return path.slice(separatorIndex + 1);
79
- },
80
- push: (path) => {
81
- const url = new URL(window.location.href);
82
- url.hash = path;
83
- window.history.pushState({}, '', `${url.pathname}${url.search}${url.hash}`);
84
- },
85
- }));
86
-
87
- export const createBrowserHistory = createHistoryCreator(({
88
- getPath: (path: string) => {
89
- return path;
90
- },
91
- push: (path) => {
92
- window.history.pushState({}, '', path);
93
- },
94
- }));
@@ -1,64 +0,0 @@
1
- import qs from "qs";
2
-
3
- export const HistoryUtils = (() => {
4
-
5
- const pathJoin = (...paths: (string | null | undefined)[]) => {
6
- let ret = paths.map((path, index) => {
7
- if (!path) {return index === 0 ? paths.length > 0 ? '' : '/' : '';}
8
- if (path.charAt(0) !== '/' && path.indexOf('http') !== 0) {path = '/' + path;}
9
- if (path.charAt(path.length - 1) == '/') {path = path.slice(0, -1);}
10
- return path;
11
- }).join('');
12
- if (!ret) {
13
- ret = '/';
14
- }
15
- return ret;
16
- };
17
-
18
- const decodePath = (url: string): { fullPath: string, path: string, hash: string, query: any } => {
19
- if (url.charAt(0) !== '/') {url = `/${url}`;}
20
- let path = "";
21
- let hash = "";
22
- let queryString = "";
23
- const [leftPart1, rightPart1] = url.split('?');
24
- path = leftPart1;
25
- if (!!rightPart1) {
26
- const [leftPart2, rightPart2] = rightPart1.split('#');
27
- queryString = leftPart2;
28
- hash = decodeURIComponent(rightPart2);
29
- }
30
- return { fullPath: decodeURIComponent(url), path, hash, query: !queryString ? {} : qs.parse(queryString) };
31
- };
32
-
33
- const getLocationMeta = () => {
34
- const { pathname, search, hash } = new URL(window.location.href);
35
- const fullPath = `${pathname}${search}${hash}`;
36
- return { pathname, search, hash, fullPath };
37
- };
38
-
39
- return {
40
- pathJoin,
41
- decodePath,
42
- getLocationMeta,
43
- };
44
- })();
45
-
46
- export interface iHistoryConfig {
47
- base: string, // publicPath部署路径
48
- }
49
-
50
- export interface iHistoryMeta {
51
- fullPath: string, // 全路径地址
52
- path: string, // 当前路径
53
- hash?: string, // 哈希值
54
- query?: Record<string, any>, // 查询参数
55
- }
56
-
57
- export interface iHistoryHandler {
58
- getPath: (path: string) => string;// 从全路径中取出来需要解析成meta的字符串。hash路由解析的时候仅需要全路径中的hash
59
- push: (url: string) => void, // 具体的push动作
60
- }
61
-
62
- export interface iChangeListener {
63
- (meta: iHistoryMeta): void; // 监听器函数类型
64
- }
@@ -1,17 +0,0 @@
1
- import {designPage} from 'plain-design-composition';
2
- import './app.scss';
3
- import {AppHome} from "./home/AppHome";
4
- import {DemoRowController} from "./Demo/DemoRowController";
5
- import {Application, ClientZoom, PageThemeUtils} from "../../packages";
6
-
7
- PageThemeUtils.state.zoom != null && ClientZoom.set(PageThemeUtils.state.zoom);
8
-
9
- export const App = designPage(() => {
10
- return () => (
11
- <DemoRowController>
12
- <Application configuration={PageThemeUtils.configuration.value}>
13
- <AppHome/>
14
- </Application>
15
- </DemoRowController>
16
- );
17
- });
@@ -1,23 +0,0 @@
1
- import {designComponent} from "plain-design-composition";
2
-
3
- export const DemoLine = designComponent({
4
- name: 'demo-line',
5
- props: {
6
- title: { type: String },
7
- labelWidth: { type: String },
8
- },
9
- slots: ['default'],
10
- setup({ props, slots }) {
11
-
12
- return {
13
- render: () => (
14
- <div className="demo-line">
15
- {!!props.title && <div className="demo-line-title"><span>{props.title}</span></div>}
16
- <div className="demo-line-content">
17
- {slots.default()}
18
- </div>
19
- </div>
20
- )
21
- };
22
- },
23
- });
@@ -1,131 +0,0 @@
1
- .demo-row {
2
-
3
- border-bottom: dashed 1px var(--app-border-color);
4
- padding-bottom: 40px;
5
-
6
- & + .demo-row {
7
- margin-top: 40px;
8
- }
9
-
10
- .demo-row-title {
11
- font-size: 14px;
12
- color: plv(text-2);
13
- padding-bottom: 40px;
14
- position: relative;
15
-
16
- span {
17
- cursor: pointer;
18
- }
19
-
20
- .demo-row-icon-expand {
21
- position: absolute;
22
- color: var(--primary-6);
23
- right: calc(100% + 12px);
24
- height: 1em;
25
- line-height: 1em;
26
- }
27
- }
28
-
29
- .demo-row-content {
30
- font-size: 14px;
31
- color: plv(text-2);
32
-
33
- & > *:not(.demo-line) {
34
- margin-right: 8px;
35
- }
36
- }
37
-
38
- &:not(.demo-row-show) {
39
- padding-bottom: 0;
40
- }
41
-
42
- &.demo-row-group {
43
- background-color: plv(background-color);
44
- box-shadow: none;
45
-
46
- & > .demo-row-title {
47
- background-color: plv(background-color);
48
- }
49
-
50
- & > .demo-row-content {
51
- padding: 8px 12px;
52
- }
53
- }
54
- }
55
-
56
- .demo-line {
57
- margin-bottom: 6px;
58
-
59
- .demo-line-title {
60
- display: block;
61
- font-size: 12px;
62
- color: #606266;
63
- padding: 8px 9px 8px 0;
64
- position: relative;
65
-
66
- &:after {
67
- position: absolute;
68
- bottom: 50%;
69
- border-top: 1px dashed plv(border-color);
70
- content: '';
71
- left: 0;
72
- right: 0;
73
- }
74
-
75
- span {
76
- background: plv(background-lite);
77
- position: relative;
78
- z-index: 1;
79
- padding: 0 12px;
80
- font-weight: bold;
81
- text-transform: uppercase;
82
- }
83
- }
84
-
85
- .demo-line-content {
86
- display: inline-block;
87
-
88
- & > * {
89
- margin-right: 8px !important;
90
- }
91
- }
92
- }
93
-
94
- .demo-row-collector-operator {
95
- position: fixed;
96
- bottom: 8px;
97
- right: 0;
98
- display: flex;
99
- align-items: center;
100
-
101
- & > div {
102
- padding: 8px 16px;
103
- background-color: plv(background-color);
104
- border: solid 1px var(--app-border-color);
105
- font-size: 12px;
106
- cursor: pointer;
107
- color: plv(text-2);
108
- display: flex;
109
- align-items: center;
110
-
111
- &:first-child {
112
- border-right: none;
113
- border-bottom-left-radius: plv(box-size-normal-border-radius);
114
- border-top-left-radius: plv(box-size-normal-border-radius);
115
- }
116
-
117
- &:last-child {
118
- border-bottom-right-radius: 0;
119
- border-top-right-radius: 0;
120
- border-right: none;
121
- }
122
-
123
- & > span {
124
- margin-right: 6px;
125
- }
126
-
127
- &:active {
128
- background-color: plv(background-hover);
129
- }
130
- }
131
- }
@@ -1,71 +0,0 @@
1
- import {designComponent, reactive, useClasses} from "plain-design-composition";
2
- import './DemoRow.scss';
3
- import {DemoRowCollector} from "./DemoRowController";
4
- import {DemoRowCache} from "./DemoRow.utils";
5
- import {$nav} from "../nav/$nav";
6
- import {Icon} from "../../../packages";
7
-
8
- export const DemoRow = designComponent({
9
- name: 'demo-row',
10
- props: {
11
- title: { type: String },
12
- group: { type: Boolean },
13
- },
14
- emits: {
15
- change: (val: boolean) => true
16
- },
17
- slots: ['default'],
18
- provideRefer: true,
19
- setup({ props, slots, event }) {
20
-
21
- DemoRowCollector.child();
22
-
23
- const demoRow = DemoRow.use.inject(null) as { props: { title?: string } } | null;
24
-
25
- const id = [$nav.state.route.path, !!demoRow ? demoRow.props.title : '', props.title].filter(Boolean).join(' >> ');
26
-
27
- const state = reactive({
28
- show: DemoRowCache.get(id),
29
- });
30
-
31
- const methods = {
32
- set(val: boolean) {
33
- state.show = val;
34
- DemoRowCache.set(id, state.show);
35
- event.emit.change(state.show);
36
- },
37
- };
38
-
39
- const handler = {
40
- clickTitle: () => {
41
- methods.set(!state.show);
42
- }
43
- };
44
-
45
- const classes = useClasses(() => ['demo-row', { 'demo-row-show': state.show, 'demo-row-group': props.group }]);
46
-
47
- return {
48
- refer: {
49
- id,
50
- state,
51
- methods,
52
- props,
53
- },
54
- render: () => (
55
- <div className={classes.value}>
56
- {!!props.title && (
57
- <div className="demo-row-title">
58
- <Icon icon={state.show ? 'pi-caret-down' : 'pi-caret-right'} className="demo-row-icon-expand"/>
59
- <span onClick={handler.clickTitle}>{props.title}</span>
60
- </div>
61
- )}
62
- {state.show && (
63
- <div className="demo-row-content">
64
- {slots.default()}
65
- </div>
66
- )}
67
- </div>
68
- )
69
- };
70
- },
71
- });