@looker/api-explorer 0.9.64 → 0.9.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/e2e/diffScene.spec.ts +16 -16
- package/e2e/e2e.spec.ts +4 -4
- package/e2e/helpers.ts +1 -1
- package/lib/ApiExplorer.js.map +1 -1
- package/lib/components/DocSdkUsage/DocSdkExampleCell.js.map +1 -1
- package/lib/components/DocSdkUsage/DocSdkUsage.js.map +1 -1
- package/lib/components/DocSdkUsage/utils.js.map +1 -1
- package/lib/components/DocTitle/DocTitle.js.map +1 -1
- package/lib/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.js.map +1 -1
- package/lib/components/ExploreType/ExploreProperty.js.map +1 -1
- package/lib/components/ExploreType/ExploreType.js.map +1 -1
- package/lib/components/SideNav/SideNavMethodTags.js.map +1 -1
- package/lib/components/SideNav/SideNavMethods.js.map +1 -1
- package/lib/components/SideNav/SideNavTypeTags.js.map +1 -1
- package/lib/components/SideNav/SideNavTypes.js.map +1 -1
- package/lib/components/SideNav/searchUtils.js.map +1 -1
- package/lib/esm/ApiExplorer.js.map +1 -1
- package/lib/esm/components/DocSdkUsage/DocSdkExampleCell.js.map +1 -1
- package/lib/esm/components/DocSdkUsage/DocSdkUsage.js.map +1 -1
- package/lib/esm/components/DocSdkUsage/utils.js.map +1 -1
- package/lib/esm/components/DocTitle/DocTitle.js.map +1 -1
- package/lib/esm/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.js.map +1 -1
- package/lib/esm/components/ExploreType/ExploreProperty.js.map +1 -1
- package/lib/esm/components/ExploreType/ExploreType.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavMethodTags.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavMethods.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavTypeTags.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavTypes.js.map +1 -1
- package/lib/esm/components/SideNav/searchUtils.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/docDiffUtils.js.map +1 -1
- package/lib/esm/scenes/DiffScene/diffUtils.js.map +1 -1
- package/lib/esm/scenes/ErrorDetailScene/ErrorDetailScene.js.map +1 -1
- package/lib/esm/scenes/MethodScene/components/DocRequestBody.js.map +1 -1
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponseTypes.js.map +1 -1
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponses.js.map +1 -1
- package/lib/esm/scenes/MethodScene/components/DocResponses/utils.js.map +1 -1
- package/lib/esm/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
- package/lib/esm/scenes/MethodTagScene/utils.js.map +1 -1
- package/lib/esm/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
- package/lib/esm/scenes/TypeTagScene/utils.js.map +1 -1
- package/lib/esm/state/specs/sagas.js.map +1 -1
- package/lib/esm/state/store.js.map +1 -1
- package/lib/esm/utils/apixAdaptor.js.map +1 -1
- package/lib/esm/utils/hooks/navigation.js.map +1 -1
- package/lib/esm/utils/sdkLanguage.js.map +1 -1
- package/lib/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/docDiffUtils.js.map +1 -1
- package/lib/scenes/DiffScene/diffUtils.js.map +1 -1
- package/lib/scenes/ErrorDetailScene/ErrorDetailScene.js.map +1 -1
- package/lib/scenes/MethodScene/components/DocRequestBody.js.map +1 -1
- package/lib/scenes/MethodScene/components/DocResponses/DocResponseTypes.js.map +1 -1
- package/lib/scenes/MethodScene/components/DocResponses/DocResponses.js.map +1 -1
- package/lib/scenes/MethodScene/components/DocResponses/utils.js.map +1 -1
- package/lib/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
- package/lib/scenes/MethodTagScene/utils.js.map +1 -1
- package/lib/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
- package/lib/scenes/TypeTagScene/utils.js.map +1 -1
- package/lib/state/lodes/slice.d.ts +5 -1
- package/lib/state/settings/slice.d.ts +9 -2
- package/lib/state/specs/sagas.js.map +1 -1
- package/lib/state/specs/slice.d.ts +8 -1
- package/lib/state/store.js.map +1 -1
- package/lib/test-utils/lodes.d.ts +1 -1
- package/lib/test-utils/redux.d.ts +2 -2
- package/lib/test-utils/router.d.ts +1 -1
- package/lib/utils/apixAdaptor.js.map +1 -1
- package/lib/utils/hooks/navigation.js.map +1 -1
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/sdkLanguage.js.map +1 -1
- package/package.json +10 -10
- package/src/ApiExplorer.tsx +1 -1
- package/src/components/DocMarkdown/utils.spec.ts +2 -2
- package/src/components/DocPseudo/DocParam.spec.tsx +2 -2
- package/src/components/DocPseudo/DocParams.spec.tsx +2 -2
- package/src/components/DocPseudo/DocPseudo.spec.tsx +1 -1
- package/src/components/DocSDKs/DocSDKs.spec.tsx +2 -2
- package/src/components/DocSdkUsage/DocSdkExampleCell.tsx +1 -1
- package/src/components/DocSdkUsage/DocSdkUsage.tsx +1 -1
- package/src/components/DocSdkUsage/utils.ts +3 -2
- package/src/components/DocTitle/DocTitle.tsx +1 -1
- package/src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.tsx +11 -11
- package/src/components/ExploreType/ExploreProperty.tsx +2 -2
- package/src/components/ExploreType/ExploreType.tsx +1 -1
- package/src/components/SelectorContainer/SdkLanguageSelector.spec.tsx +3 -3
- package/src/components/SideNav/SideNavMethodTags.tsx +1 -1
- package/src/components/SideNav/SideNavMethods.spec.tsx +1 -1
- package/src/components/SideNav/SideNavMethods.tsx +1 -1
- package/src/components/SideNav/SideNavTypeTags.tsx +1 -1
- package/src/components/SideNav/SideNavTypes.tsx +1 -1
- package/src/components/SideNav/searchUtils.ts +1 -1
- package/src/scenes/DiffScene/DiffScene.tsx +2 -2
- package/src/scenes/DiffScene/DocDiff/DocDiff.tsx +2 -2
- package/src/scenes/DiffScene/DocDiff/docDiffUtils.tsx +2 -2
- package/src/scenes/DiffScene/diffUtils.ts +1 -1
- package/src/scenes/ErrorDetailScene/ErrorDetailScene.tsx +1 -1
- package/src/scenes/MethodScene/components/DocOperation.spec.tsx +1 -1
- package/src/scenes/MethodScene/components/DocRequestBody.tsx +1 -1
- package/src/scenes/MethodScene/components/DocResponses/DocResponseTypes.tsx +1 -1
- package/src/scenes/MethodScene/components/DocResponses/DocResponses.tsx +1 -1
- package/src/scenes/MethodScene/components/DocResponses/utils.spec.ts +1 -1
- package/src/scenes/MethodScene/components/DocResponses/utils.ts +1 -1
- package/src/scenes/MethodTagScene/MethodTagScene.tsx +2 -2
- package/src/scenes/MethodTagScene/utils.ts +1 -1
- package/src/scenes/TypeTagScene/TypeTagScene.tsx +2 -4
- package/src/scenes/TypeTagScene/utils.ts +1 -1
- package/src/state/specs/sagas.ts +1 -1
- package/src/state/store.ts +1 -1
- package/src/utils/apixAdaptor.ts +1 -4
- package/src/utils/hooks/navigation.ts +1 -1
- package/src/utils/path.spec.ts +5 -5
- package/src/utils/sdkLanguage.spec.ts +1 -1
- package/src/utils/sdkLanguage.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -232,6 +232,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
232
232
|
* @looker/sdk-codegen-scripts bumped from 21.5.20 to 21.5.21
|
|
233
233
|
* @looker/sdk-node bumped from 24.12.1 to 24.14.0
|
|
234
234
|
|
|
235
|
+
## [0.9.66](https://github.com/looker-open-source/sdk-codegen/compare/api-explorer-v0.9.65...api-explorer-v0.9.66) (2024-09-14)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
### Bug Fixes
|
|
239
|
+
|
|
240
|
+
* fix release 24.16.2 ([#1505](https://github.com/looker-open-source/sdk-codegen/issues/1505)) ([1cd1806](https://github.com/looker-open-source/sdk-codegen/commit/1cd180615901d2daf1fb112b41f2a72d2caacf61))
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
### Dependencies
|
|
244
|
+
|
|
245
|
+
* The following workspace dependencies were updated
|
|
246
|
+
* dependencies
|
|
247
|
+
* @looker/code-editor bumped from 0.1.32 to 0.1.33
|
|
248
|
+
* @looker/extension-utils bumped from 0.1.42 to 0.1.43
|
|
249
|
+
* @looker/run-it bumped from 0.9.65 to 0.9.66
|
|
250
|
+
* @looker/sdk bumped from 24.16.0 to 24.16.1
|
|
251
|
+
* @looker/sdk-codegen bumped from 21.9.1 to 21.9.2
|
|
252
|
+
* @looker/sdk-rtl bumped from 21.6.2 to 21.6.3
|
|
253
|
+
* devDependencies
|
|
254
|
+
* @looker/sdk-codegen-scripts bumped from 21.5.22 to 21.5.23
|
|
255
|
+
* @looker/sdk-node bumped from 24.16.0 to 24.16.1
|
|
256
|
+
|
|
257
|
+
## [0.9.65](https://github.com/looker-open-source/sdk-codegen/compare/api-explorer-v0.9.64...api-explorer-v0.9.65) (2024-09-11)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
### Bug Fixes
|
|
261
|
+
|
|
262
|
+
* Remove the requests package from the TypeScript SDK ([#1491](https://github.com/looker-open-source/sdk-codegen/issues/1491)) ([670377c](https://github.com/looker-open-source/sdk-codegen/commit/670377c46a546bbd8dcc6679b8aeb041da1b4670)), closes [#1439](https://github.com/looker-open-source/sdk-codegen/issues/1439)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
### Dependencies
|
|
266
|
+
|
|
267
|
+
* The following workspace dependencies were updated
|
|
268
|
+
* dependencies
|
|
269
|
+
* @looker/code-editor bumped from 0.1.31 to 0.1.32
|
|
270
|
+
* @looker/extension-utils bumped from 0.1.41 to 0.1.42
|
|
271
|
+
* @looker/run-it bumped from 0.9.64 to 0.9.65
|
|
272
|
+
* @looker/sdk bumped from 24.14.0 to 24.16.0
|
|
273
|
+
* @looker/sdk-codegen bumped from 21.9.0 to 21.9.1
|
|
274
|
+
* @looker/sdk-rtl bumped from 21.6.1 to 21.6.2
|
|
275
|
+
* devDependencies
|
|
276
|
+
* @looker/sdk-codegen-scripts bumped from 21.5.21 to 21.5.22
|
|
277
|
+
* @looker/sdk-node bumped from 24.14.0 to 24.16.0
|
|
278
|
+
|
|
235
279
|
## [0.9.47](https://github.com/looker-open-source/sdk-codegen/compare/api-explorer-v0.9.46...api-explorer-v0.9.47) (2023-05-11)
|
|
236
280
|
|
|
237
281
|
### Features
|
package/e2e/diffScene.spec.ts
CHANGED
|
@@ -61,7 +61,7 @@ describe.skip('Diff Scene', () => {
|
|
|
61
61
|
const baseInputElement = await page.$(baseInputSelector);
|
|
62
62
|
expect(baseInputElement).not.toBeNull();
|
|
63
63
|
const baseInputValue = await page.evaluate(
|
|
64
|
-
|
|
64
|
+
e => e.value,
|
|
65
65
|
baseInputElement
|
|
66
66
|
);
|
|
67
67
|
expect(baseInputValue).toMatch('3.1');
|
|
@@ -84,7 +84,7 @@ describe.skip('Diff Scene', () => {
|
|
|
84
84
|
const compInputElement = await page.$(compInputSelector);
|
|
85
85
|
expect(compInputElement).not.toBeNull();
|
|
86
86
|
const compInputValue = await page.evaluate(
|
|
87
|
-
|
|
87
|
+
e => e.value,
|
|
88
88
|
compInputElement
|
|
89
89
|
);
|
|
90
90
|
expect(compInputValue).toEqual('');
|
|
@@ -106,7 +106,7 @@ describe.skip('Diff Scene', () => {
|
|
|
106
106
|
const switchButtonElement = await page.$(switchButtonSelector);
|
|
107
107
|
expect(switchButtonElement).not.toBeNull();
|
|
108
108
|
const switchButtonDisabled = await page.evaluate(
|
|
109
|
-
|
|
109
|
+
e => e.disabled,
|
|
110
110
|
switchButtonElement
|
|
111
111
|
);
|
|
112
112
|
expect(switchButtonDisabled).toEqual(true);
|
|
@@ -120,7 +120,7 @@ describe.skip('Diff Scene', () => {
|
|
|
120
120
|
const baseInputElement = await page.$(baseInputSelector);
|
|
121
121
|
expect(baseInputElement).not.toBeNull();
|
|
122
122
|
const baseInputValue = await page.evaluate(
|
|
123
|
-
|
|
123
|
+
e => e.value,
|
|
124
124
|
baseInputElement
|
|
125
125
|
);
|
|
126
126
|
expect(baseInputValue).toMatch('3.1');
|
|
@@ -131,7 +131,7 @@ describe.skip('Diff Scene', () => {
|
|
|
131
131
|
const compInputElement = await page.$(compInputSelector);
|
|
132
132
|
expect(compInputElement).not.toBeNull();
|
|
133
133
|
const compInputValue = await page.evaluate(
|
|
134
|
-
|
|
134
|
+
e => e.value,
|
|
135
135
|
compInputElement
|
|
136
136
|
);
|
|
137
137
|
expect(compInputValue).toMatch('4.0');
|
|
@@ -142,7 +142,7 @@ describe.skip('Diff Scene', () => {
|
|
|
142
142
|
const switchButtonElement = await page.$(switchButtonSelector);
|
|
143
143
|
expect(switchButtonElement).not.toBeNull();
|
|
144
144
|
const switchButtonDisabled = await page.evaluate(
|
|
145
|
-
|
|
145
|
+
e => e.disabled,
|
|
146
146
|
switchButtonElement
|
|
147
147
|
);
|
|
148
148
|
expect(switchButtonDisabled).toEqual(false);
|
|
@@ -153,8 +153,8 @@ describe.skip('Diff Scene', () => {
|
|
|
153
153
|
const diffResultCards = await page.$$(resultCardsSelector);
|
|
154
154
|
expect(diffResultCards).not.toHaveLength(0);
|
|
155
155
|
const page1Methods = await Promise.all(
|
|
156
|
-
diffResultCards.map(
|
|
157
|
-
page.evaluate(
|
|
156
|
+
diffResultCards.map(resultCard =>
|
|
157
|
+
page.evaluate(el => el.innerText.match(/^[a-z_]*/)[0], resultCard)
|
|
158
158
|
)
|
|
159
159
|
);
|
|
160
160
|
expect(page1Methods).toHaveLength(15);
|
|
@@ -181,7 +181,7 @@ describe.skip('Diff Scene', () => {
|
|
|
181
181
|
// Find and validate method link
|
|
182
182
|
const methodLink = await page.$(`${resultCardsSelector} a[role=link]`);
|
|
183
183
|
expect(methodLink).not.toBeNull();
|
|
184
|
-
const methodText = await page.evaluate(
|
|
184
|
+
const methodText = await page.evaluate(e => e.innerText, methodLink);
|
|
185
185
|
expect(methodText).toMatch(`delete_alert for 4.0`);
|
|
186
186
|
|
|
187
187
|
// Click and validate destination
|
|
@@ -212,8 +212,8 @@ describe.skip('Diff Scene', () => {
|
|
|
212
212
|
expect(compOptionsOnClick).not.toHaveLength(1);
|
|
213
213
|
|
|
214
214
|
// Find an option containing the text 4.0
|
|
215
|
-
const option40Index = await page.$$eval(globalOptionsSelector,
|
|
216
|
-
els.findIndex(
|
|
215
|
+
const option40Index = await page.$$eval(globalOptionsSelector, els =>
|
|
216
|
+
els.findIndex(el => el?.textContent?.match(/4\.0/))
|
|
217
217
|
);
|
|
218
218
|
const option40 = compOptionsOnClick[option40Index];
|
|
219
219
|
expect(option40).not.toBeUndefined();
|
|
@@ -231,8 +231,8 @@ describe.skip('Diff Scene', () => {
|
|
|
231
231
|
const diffResultCards = await page.$$(resultCardsSelector);
|
|
232
232
|
expect(diffResultCards).not.toHaveLength(0);
|
|
233
233
|
const diff31to40Page1Methods = await Promise.all(
|
|
234
|
-
diffResultCards.map(
|
|
235
|
-
page.evaluate(
|
|
234
|
+
diffResultCards.map(resultCard =>
|
|
235
|
+
page.evaluate(el => el.innerText.match(/^[a-z_]*/)[0], resultCard)
|
|
236
236
|
)
|
|
237
237
|
);
|
|
238
238
|
|
|
@@ -243,7 +243,7 @@ describe.skip('Diff Scene', () => {
|
|
|
243
243
|
const switchButtonElement = await page.$(switchButtonSelector);
|
|
244
244
|
expect(switchButtonElement).not.toBeNull();
|
|
245
245
|
const switchButtonDisabled = await page.evaluate(
|
|
246
|
-
|
|
246
|
+
e => e.disabled,
|
|
247
247
|
switchButtonElement
|
|
248
248
|
);
|
|
249
249
|
expect(switchButtonDisabled).toEqual(false);
|
|
@@ -257,8 +257,8 @@ describe.skip('Diff Scene', () => {
|
|
|
257
257
|
|
|
258
258
|
// Check the results again, even though they should be the same
|
|
259
259
|
const diff40to31Page1Methods = await Promise.all(
|
|
260
|
-
diffResultCards.map(
|
|
261
|
-
page.evaluate(
|
|
260
|
+
diffResultCards.map(resultCard =>
|
|
261
|
+
page.evaluate(el => el.innerText.match(/^[a-z_]*/)[0], resultCard)
|
|
262
262
|
)
|
|
263
263
|
);
|
|
264
264
|
|
package/e2e/e2e.spec.ts
CHANGED
|
@@ -85,7 +85,7 @@ describe('API Explorer', () => {
|
|
|
85
85
|
const docLinks = await page.$$('.doc-link');
|
|
86
86
|
expect(docLinks.length).toBeGreaterThan(0);
|
|
87
87
|
await docLinks[0].click();
|
|
88
|
-
const typeName = await page.evaluate(
|
|
88
|
+
const typeName = await page.evaluate(e => e.innerText, docLinks[0]);
|
|
89
89
|
await expect(page).toMatchElement('h2', { text: typeName });
|
|
90
90
|
await page.goBack();
|
|
91
91
|
|
|
@@ -152,7 +152,7 @@ describe('API Explorer', () => {
|
|
|
152
152
|
const selector = 'input[aria-label="sdk language selector"]';
|
|
153
153
|
let languageHandle = await page.$(`${selector}[value="Python"]`);
|
|
154
154
|
expect(languageHandle).not.toBeNull();
|
|
155
|
-
expect(await page.evaluate(
|
|
155
|
+
expect(await page.evaluate(x => x.value, languageHandle)).toEqual(
|
|
156
156
|
'Python'
|
|
157
157
|
);
|
|
158
158
|
await expect(page).toClick('h4', { text: 'Dashboard' });
|
|
@@ -164,7 +164,7 @@ describe('API Explorer', () => {
|
|
|
164
164
|
await pageReload();
|
|
165
165
|
languageHandle = await page.$(`${selector}[value="Kotlin"]`);
|
|
166
166
|
expect(languageHandle).not.toBeNull();
|
|
167
|
-
expect(await page.evaluate(
|
|
167
|
+
expect(await page.evaluate(x => x.value, languageHandle)).toEqual(
|
|
168
168
|
'Kotlin'
|
|
169
169
|
);
|
|
170
170
|
await expect(page).toMatchElement('h3', { text: 'Kotlin Declaration' });
|
|
@@ -261,7 +261,7 @@ describe('API Explorer', () => {
|
|
|
261
261
|
|
|
262
262
|
const body = await page.$('body');
|
|
263
263
|
const codeMatch = await page.evaluate(
|
|
264
|
-
|
|
264
|
+
e => e.innerText.match('all_dashboards\\('),
|
|
265
265
|
body
|
|
266
266
|
);
|
|
267
267
|
expect(codeMatch).not.toBeNull();
|
package/e2e/helpers.ts
CHANGED
|
@@ -54,6 +54,6 @@ export const goToPage = async (url: string): Promise<void> => {
|
|
|
54
54
|
*/
|
|
55
55
|
export const getSpecKey = async (): Promise<string> => {
|
|
56
56
|
const specSelectorHandle = await page.$('input[aria-label="spec selector"]');
|
|
57
|
-
const specKey = await page.evaluate(
|
|
57
|
+
const specKey = await page.evaluate(e => e.value, specSelectorHandle);
|
|
58
58
|
return specKey;
|
|
59
59
|
};
|
package/lib/ApiExplorer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiExplorer.js","names":["_react","_interopRequireWildcard","require","_styledComponents","_components","_FirstPage","_LastPage","_extensionUtils","_reactRedux","_reactRouterDom","_components2","_routes","_lodeUtils","_state","_utils","_templateObject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_taggedTemplateLiteral","strings","raw","slice","freeze","defineProperties","value","BodyOverride","createGlobalStyle","ApiExplorer","_ref","_location$pathname2","adaptor","examplesLodeUrl","declarationsLodeUrl","concat","apixFilesHost","headless","useLodesStoreState","working","description","useSpecStoreState","specs","useSelector","selectSpecs","spec","selectCurrentSpec","initLodesAction","useLodeActions","initialized","useSettingStoreState","initSettingsAction","setSearchPatternAction","setSdkLanguageAction","useSettingActions","initSpecsAction","setCurrentSpecAction","useSpecActions","location","useLocation","useGlobalStoreSync","hasNavigation","setHasNavigation","useState","toggleNavigation","target","hasNavigationToggle","useCallback","origin","window","data","action","currentHasNavigation","registerEnvAdaptor","useEffect","specKey","getSpecKey","unregisterEnvAdaptor","_location$pathname","maybeSpec","pathname","split","key","currentSpecKey","searchParams","URLSearchParams","search","searchPattern","sdkParam","language","sdkLanguage","findSdk","addEventListener","removeEventListener","themeOverrides","neededSpec","createElement","Fragment","ComponentsProvider","loadGoogleFonts","themeCustomizations","Loader","message","ErrorBoundary","logError","bind","Banner","Page","style","overflow","Header","Layout","hasAside","height","AsideBorder","borderRight","isOpen","Space","align","py","px","justifyItems","Heading","as","fontSize","fontWeight","color","IconButton","size","shape","icon","FirstPage","LastPage","label","HEADER_TOGGLE_LABEL","onClick","Divider","mb","appearance","SelectorContainer","ml","mr","SideNav","AppRouter","api","exports","styled","Aside","withConfig","displayName","componentId","_ref2"],"sources":["../src/ApiExplorer.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport styled, { createGlobalStyle } from 'styled-components';\nimport {\n Aside,\n ComponentsProvider,\n Divider,\n Heading,\n IconButton,\n Layout,\n Page,\n Space,\n} from '@looker/components';\nimport { FirstPage } from '@styled-icons/material/FirstPage';\nimport { LastPage } from '@styled-icons/material/LastPage';\nimport {\n registerEnvAdaptor,\n unregisterEnvAdaptor,\n} from '@looker/extension-utils';\nimport { useSelector } from 'react-redux';\nimport { useLocation } from 'react-router-dom';\n\nimport type { IApixAdaptor } from './utils';\nimport {\n Banner,\n ErrorBoundary,\n HEADER_TOGGLE_LABEL,\n Header,\n Loader,\n SelectorContainer,\n SideNav,\n} from './components';\nimport { AppRouter } from './routes';\nimport { apixFilesHost } from './utils/lodeUtils';\nimport {\n selectCurrentSpec,\n selectSpecs,\n useLodeActions,\n useLodesStoreState,\n useSettingActions,\n useSettingStoreState,\n useSpecActions,\n useSpecStoreState,\n} from './state';\nimport { findSdk, getSpecKey, useGlobalStoreSync } from './utils';\n\nexport interface ApiExplorerProps {\n adaptor: IApixAdaptor;\n examplesLodeUrl?: string;\n declarationsLodeUrl?: string;\n headless?: boolean;\n}\n\nconst BodyOverride = createGlobalStyle` html { height: 100%; overflow: hidden; } `;\n\nexport const ApiExplorer: FC<ApiExplorerProps> = ({\n adaptor,\n examplesLodeUrl = 'https://raw.githubusercontent.com/looker-open-source/sdk-codegen/main/examplesIndex.json',\n declarationsLodeUrl = `${apixFilesHost}/declarationsIndex.json`,\n headless = false,\n}) => {\n useLodesStoreState();\n const { working, description } = useSpecStoreState();\n const specs = useSelector(selectSpecs);\n const spec = useSelector(selectCurrentSpec);\n const { initLodesAction } = useLodeActions();\n const { initialized } = useSettingStoreState();\n const { initSettingsAction, setSearchPatternAction, setSdkLanguageAction } =\n useSettingActions();\n const { initSpecsAction, setCurrentSpecAction } = useSpecActions();\n\n const location = useLocation();\n useGlobalStoreSync();\n const [hasNavigation, setHasNavigation] = useState(true);\n const toggleNavigation = (target?: boolean) =>\n setHasNavigation(target || !hasNavigation);\n\n const hasNavigationToggle = useCallback((e: MessageEvent<any>) => {\n if (e.origin === window.origin && e.data.action === 'toggle_sidebar') {\n setHasNavigation((currentHasNavigation) => !currentHasNavigation);\n }\n }, []);\n\n registerEnvAdaptor(adaptor);\n\n useEffect(() => {\n initSettingsAction();\n initLodesAction({ examplesLodeUrl, declarationsLodeUrl });\n\n const specKey = getSpecKey(location);\n initSpecsAction({ specKey });\n return () => unregisterEnvAdaptor();\n }, []);\n\n useEffect(() => {\n const maybeSpec = location.pathname?.split('/')[1];\n if (spec && maybeSpec && maybeSpec !== spec.key) {\n setCurrentSpecAction({ currentSpecKey: maybeSpec });\n }\n }, [location.pathname, spec]);\n\n useEffect(() => {\n if (!initialized) return;\n const searchParams = new URLSearchParams(location.search);\n const searchPattern = searchParams.get('s') || '';\n const sdkParam = searchParams.get('sdk') || 'all';\n const { language: sdkLanguage } = findSdk(sdkParam);\n setSearchPatternAction({ searchPattern });\n setSdkLanguageAction({ sdkLanguage });\n }, [location.search]);\n\n useEffect(() => {\n if (headless) {\n window.addEventListener('message', hasNavigationToggle);\n }\n return () => {\n if (headless) {\n window.removeEventListener('message', hasNavigationToggle);\n }\n };\n }, [headless, hasNavigationToggle]);\n\n const themeOverrides = adaptor.themeOverrides();\n\n let neededSpec = location.pathname?.split('/')[1];\n if (!neededSpec) {\n neededSpec = spec?.key;\n }\n\n return (\n <>\n <ComponentsProvider\n loadGoogleFonts={themeOverrides.loadGoogleFonts}\n themeCustomizations={themeOverrides.themeCustomizations}\n >\n {working || !neededSpec || neededSpec !== spec.key ? (\n <Loader message={description} themeOverrides={themeOverrides} />\n ) : (\n <ErrorBoundary logError={adaptor.logError.bind(adaptor)}>\n <Banner adaptor={adaptor} specs={specs} />\n <Page style={{ overflow: 'hidden' }}>\n {!headless && (\n <Header spec={spec} toggleNavigation={toggleNavigation} />\n )}\n <Layout hasAside height=\"100%\">\n <AsideBorder\n borderRight\n isOpen={hasNavigation}\n headless={headless}\n >\n {headless && (\n <>\n <Space\n align=\"center\"\n py=\"u3\"\n px={hasNavigation ? 'u5' : '0'}\n justifyItems={\n hasNavigation ? 'space-between' : 'center'\n }\n >\n {hasNavigation && (\n <Heading\n as=\"h2\"\n fontSize=\"xsmall\"\n fontWeight=\"bold\"\n color=\"text2\"\n >\n API DOCUMENTATION\n </Heading>\n )}\n <IconButton\n size=\"xsmall\"\n shape=\"round\"\n icon={hasNavigation ? <FirstPage /> : <LastPage />}\n label={HEADER_TOGGLE_LABEL}\n onClick={() => toggleNavigation()}\n />\n </Space>\n {hasNavigation && (\n <>\n <Divider mb=\"u3\" appearance=\"light\" />\n <SelectorContainer\n spec={spec}\n ml=\"large\"\n mr=\"large\"\n />\n </>\n )}\n </>\n )}\n {hasNavigation && <SideNav headless={headless} spec={spec} />}\n </AsideBorder>\n <AppRouter\n specKey={spec.key}\n api={spec.api!}\n toggleNavigation={toggleNavigation}\n />\n </Layout>\n </Page>\n </ErrorBoundary>\n )}\n </ComponentsProvider>\n {!headless && <BodyOverride />}\n </>\n );\n};\n\nconst AsideBorder = styled(Aside)<{\n isOpen: boolean;\n headless: boolean;\n}>`\n width: ${({ isOpen, headless }) =>\n isOpen ? '20rem' : headless ? '2.75rem' : '0rem'};\n`;\n"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAUA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAIA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AAGA,IAAAQ,YAAA,GAAAR,OAAA;AASA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAUA,IAAAY,MAAA,GAAAZ,OAAA;AAAkE,IAAAa,eAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAhB,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AAEA;EAAiB,CACpC,CACK,CACJ,CACO,CAEC,CAAC,EACpB,CAAC3B,QAAQ,IAAItD,MAAA,CAAAsB,OAAA,CAAA2F,aAAA,CAACrE,YAAY,MAAE,CAC7B,CAAC;AAEP,CAAC;AAACsH,OAAA,CAAApH,WAAA,GAAAA,WAAA;AAEF,IAAMqF,WAAW,GAAG,IAAAgC,yBAAM,EAACC,iBAAK,CAAC,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,oBAItBC,KAAA;EAAA,IAAC;IAAEnC,MAAM;IAAE/E;EAAS,CAAC,GAAAkH,KAAA;EAAA,OAC5BnC,MAAM,GAAG,OAAO,GAAG/E,QAAQ,GAAG,SAAS,GAAG,MAAM;AAAA,EACnD"}
|
|
1
|
+
{"version":3,"file":"ApiExplorer.js","names":["_react","_interopRequireWildcard","require","_styledComponents","_components","_FirstPage","_LastPage","_extensionUtils","_reactRedux","_reactRouterDom","_components2","_routes","_lodeUtils","_state","_utils","_templateObject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_taggedTemplateLiteral","strings","raw","slice","freeze","defineProperties","value","BodyOverride","createGlobalStyle","ApiExplorer","_ref","_location$pathname2","adaptor","examplesLodeUrl","declarationsLodeUrl","concat","apixFilesHost","headless","useLodesStoreState","working","description","useSpecStoreState","specs","useSelector","selectSpecs","spec","selectCurrentSpec","initLodesAction","useLodeActions","initialized","useSettingStoreState","initSettingsAction","setSearchPatternAction","setSdkLanguageAction","useSettingActions","initSpecsAction","setCurrentSpecAction","useSpecActions","location","useLocation","useGlobalStoreSync","hasNavigation","setHasNavigation","useState","toggleNavigation","target","hasNavigationToggle","useCallback","origin","window","data","action","currentHasNavigation","registerEnvAdaptor","useEffect","specKey","getSpecKey","unregisterEnvAdaptor","_location$pathname","maybeSpec","pathname","split","key","currentSpecKey","searchParams","URLSearchParams","search","searchPattern","sdkParam","language","sdkLanguage","findSdk","addEventListener","removeEventListener","themeOverrides","neededSpec","createElement","Fragment","ComponentsProvider","loadGoogleFonts","themeCustomizations","Loader","message","ErrorBoundary","logError","bind","Banner","Page","style","overflow","Header","Layout","hasAside","height","AsideBorder","borderRight","isOpen","Space","align","py","px","justifyItems","Heading","as","fontSize","fontWeight","color","IconButton","size","shape","icon","FirstPage","LastPage","label","HEADER_TOGGLE_LABEL","onClick","Divider","mb","appearance","SelectorContainer","ml","mr","SideNav","AppRouter","api","exports","styled","Aside","withConfig","displayName","componentId","_ref2"],"sources":["../src/ApiExplorer.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport styled, { createGlobalStyle } from 'styled-components';\nimport {\n Aside,\n ComponentsProvider,\n Divider,\n Heading,\n IconButton,\n Layout,\n Page,\n Space,\n} from '@looker/components';\nimport { FirstPage } from '@styled-icons/material/FirstPage';\nimport { LastPage } from '@styled-icons/material/LastPage';\nimport {\n registerEnvAdaptor,\n unregisterEnvAdaptor,\n} from '@looker/extension-utils';\nimport { useSelector } from 'react-redux';\nimport { useLocation } from 'react-router-dom';\n\nimport type { IApixAdaptor } from './utils';\nimport {\n Banner,\n ErrorBoundary,\n HEADER_TOGGLE_LABEL,\n Header,\n Loader,\n SelectorContainer,\n SideNav,\n} from './components';\nimport { AppRouter } from './routes';\nimport { apixFilesHost } from './utils/lodeUtils';\nimport {\n selectCurrentSpec,\n selectSpecs,\n useLodeActions,\n useLodesStoreState,\n useSettingActions,\n useSettingStoreState,\n useSpecActions,\n useSpecStoreState,\n} from './state';\nimport { findSdk, getSpecKey, useGlobalStoreSync } from './utils';\n\nexport interface ApiExplorerProps {\n adaptor: IApixAdaptor;\n examplesLodeUrl?: string;\n declarationsLodeUrl?: string;\n headless?: boolean;\n}\n\nconst BodyOverride = createGlobalStyle` html { height: 100%; overflow: hidden; } `;\n\nexport const ApiExplorer: FC<ApiExplorerProps> = ({\n adaptor,\n examplesLodeUrl = 'https://raw.githubusercontent.com/looker-open-source/sdk-codegen/main/examplesIndex.json',\n declarationsLodeUrl = `${apixFilesHost}/declarationsIndex.json`,\n headless = false,\n}) => {\n useLodesStoreState();\n const { working, description } = useSpecStoreState();\n const specs = useSelector(selectSpecs);\n const spec = useSelector(selectCurrentSpec);\n const { initLodesAction } = useLodeActions();\n const { initialized } = useSettingStoreState();\n const { initSettingsAction, setSearchPatternAction, setSdkLanguageAction } =\n useSettingActions();\n const { initSpecsAction, setCurrentSpecAction } = useSpecActions();\n\n const location = useLocation();\n useGlobalStoreSync();\n const [hasNavigation, setHasNavigation] = useState(true);\n const toggleNavigation = (target?: boolean) =>\n setHasNavigation(target || !hasNavigation);\n\n const hasNavigationToggle = useCallback((e: MessageEvent<any>) => {\n if (e.origin === window.origin && e.data.action === 'toggle_sidebar') {\n setHasNavigation(currentHasNavigation => !currentHasNavigation);\n }\n }, []);\n\n registerEnvAdaptor(adaptor);\n\n useEffect(() => {\n initSettingsAction();\n initLodesAction({ examplesLodeUrl, declarationsLodeUrl });\n\n const specKey = getSpecKey(location);\n initSpecsAction({ specKey });\n return () => unregisterEnvAdaptor();\n }, []);\n\n useEffect(() => {\n const maybeSpec = location.pathname?.split('/')[1];\n if (spec && maybeSpec && maybeSpec !== spec.key) {\n setCurrentSpecAction({ currentSpecKey: maybeSpec });\n }\n }, [location.pathname, spec]);\n\n useEffect(() => {\n if (!initialized) return;\n const searchParams = new URLSearchParams(location.search);\n const searchPattern = searchParams.get('s') || '';\n const sdkParam = searchParams.get('sdk') || 'all';\n const { language: sdkLanguage } = findSdk(sdkParam);\n setSearchPatternAction({ searchPattern });\n setSdkLanguageAction({ sdkLanguage });\n }, [location.search]);\n\n useEffect(() => {\n if (headless) {\n window.addEventListener('message', hasNavigationToggle);\n }\n return () => {\n if (headless) {\n window.removeEventListener('message', hasNavigationToggle);\n }\n };\n }, [headless, hasNavigationToggle]);\n\n const themeOverrides = adaptor.themeOverrides();\n\n let neededSpec = location.pathname?.split('/')[1];\n if (!neededSpec) {\n neededSpec = spec?.key;\n }\n\n return (\n <>\n <ComponentsProvider\n loadGoogleFonts={themeOverrides.loadGoogleFonts}\n themeCustomizations={themeOverrides.themeCustomizations}\n >\n {working || !neededSpec || neededSpec !== spec.key ? (\n <Loader message={description} themeOverrides={themeOverrides} />\n ) : (\n <ErrorBoundary logError={adaptor.logError.bind(adaptor)}>\n <Banner adaptor={adaptor} specs={specs} />\n <Page style={{ overflow: 'hidden' }}>\n {!headless && (\n <Header spec={spec} toggleNavigation={toggleNavigation} />\n )}\n <Layout hasAside height=\"100%\">\n <AsideBorder\n borderRight\n isOpen={hasNavigation}\n headless={headless}\n >\n {headless && (\n <>\n <Space\n align=\"center\"\n py=\"u3\"\n px={hasNavigation ? 'u5' : '0'}\n justifyItems={\n hasNavigation ? 'space-between' : 'center'\n }\n >\n {hasNavigation && (\n <Heading\n as=\"h2\"\n fontSize=\"xsmall\"\n fontWeight=\"bold\"\n color=\"text2\"\n >\n API DOCUMENTATION\n </Heading>\n )}\n <IconButton\n size=\"xsmall\"\n shape=\"round\"\n icon={hasNavigation ? <FirstPage /> : <LastPage />}\n label={HEADER_TOGGLE_LABEL}\n onClick={() => toggleNavigation()}\n />\n </Space>\n {hasNavigation && (\n <>\n <Divider mb=\"u3\" appearance=\"light\" />\n <SelectorContainer\n spec={spec}\n ml=\"large\"\n mr=\"large\"\n />\n </>\n )}\n </>\n )}\n {hasNavigation && <SideNav headless={headless} spec={spec} />}\n </AsideBorder>\n <AppRouter\n specKey={spec.key}\n api={spec.api!}\n toggleNavigation={toggleNavigation}\n />\n </Layout>\n </Page>\n </ErrorBoundary>\n )}\n </ComponentsProvider>\n {!headless && <BodyOverride />}\n </>\n );\n};\n\nconst AsideBorder = styled(Aside)<{\n isOpen: boolean;\n headless: boolean;\n}>`\n width: ${({ isOpen, headless }) =>\n isOpen ? '20rem' : headless ? '2.75rem' : '0rem'};\n`;\n"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAUA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAIA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AAGA,IAAAQ,YAAA,GAAAR,OAAA;AASA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAUA,IAAAY,MAAA,GAAAZ,OAAA;AAAkE,IAAAa,eAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,y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,IAAI,CAACqC,GAAI;IAClB8D,GAAG,EAAEnG,IAAI,CAACmG,GAAK;IACfhF,gBAAgB,EAAEA;EAAiB,CACpC,CACK,CACJ,CACO,CAEC,CAAC,EACpB,CAAC3B,QAAQ,IAAItD,MAAA,CAAAsB,OAAA,CAAA2F,aAAA,CAACrE,YAAY,MAAE,CAC7B,CAAC;AAEP,CAAC;AAACsH,OAAA,CAAApH,WAAA,GAAAA,WAAA;AAEF,IAAMqF,WAAW,GAAG,IAAAgC,yBAAM,EAACC,iBAAK,CAAC,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,oBAItBC,KAAA;EAAA,IAAC;IAAEnC,MAAM;IAAE/E;EAAS,CAAC,GAAAkH,KAAA;EAAA,OAC5BnC,MAAM,GAAG,OAAO,GAAG/E,QAAQ,GAAG,SAAS,GAAG,MAAM;AAAA,EACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocSdkExampleCell.js","names":["_react","_interopRequireDefault","require","_components","_utils","obj","__esModule","default","DocSdkExampleCell","props","createElement","DataTableCell","style","borderBottom","getTableItemBottomBorder","hideBorderBottom","Span","overflow","width","display","children","exports"],"sources":["../../../src/components/DocSdkUsage/DocSdkExampleCell.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC, PropsWithChildren } from 'react';\nimport React from 'react';\nimport { DataTableCell, Span } from '@looker/components';\n\nimport { getTableItemBottomBorder } from './utils';\n\nexport const DocSdkExampleCell: FC<PropsWithChildren<any>> =
|
|
1
|
+
{"version":3,"file":"DocSdkExampleCell.js","names":["_react","_interopRequireDefault","require","_components","_utils","obj","__esModule","default","DocSdkExampleCell","props","createElement","DataTableCell","style","borderBottom","getTableItemBottomBorder","hideBorderBottom","Span","overflow","width","display","children","exports"],"sources":["../../../src/components/DocSdkUsage/DocSdkExampleCell.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC, PropsWithChildren } from 'react';\nimport React from 'react';\nimport { DataTableCell, Span } from '@looker/components';\n\nimport { getTableItemBottomBorder } from './utils';\n\nexport const DocSdkExampleCell: FC<PropsWithChildren<any>> = props => (\n <DataTableCell\n style={{ borderBottom: getTableItemBottomBorder(props.hideBorderBottom) }}\n >\n <Span style={{ overflow: 'hidden', width: '100%', display: 'block' }}>\n {props.children}\n </Span>\n </DataTableCell>\n);\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAAmD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE5C,IAAMG,iBAA6C,GAAGC,KAAK,IAChET,MAAA,CAAAO,OAAA,CAAAG,aAAA,CAACP,WAAA,CAAAQ,aAAa;EACZC,KAAK,EAAE;IAAEC,YAAY,EAAE,IAAAC,+BAAwB,EAACL,KAAK,CAACM,gBAAgB;EAAE;AAAE,GAE1Ef,MAAA,CAAAO,OAAA,CAAAG,aAAA,CAACP,WAAA,CAAAa,IAAI;EAACJ,KAAK,EAAE;IAAEK,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE,MAAM;IAAEC,OAAO,EAAE;EAAQ;AAAE,GAClEV,KAAK,CAACW,QACH,CACO,CAChB;AAACC,OAAA,CAAAb,iBAAA,GAAAA,iBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocSdkUsage.js","names":["_react","_interopRequireWildcard","require","_components","_sdkCodegen","_runIt","_InsertDriveFile","_reactRedux","_state","_utils","_DocSdkExampleCell","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","DocSdkUsage","_ref","method","examples","useSelector","selectExamplesLode","sdkLanguage","selectSdkLanguage","page","setPage","useState","useEffect","createElement","Fragment","languages","findExampleLanguages","name","length","sortLanguagesByPreference","pageExamples","pageLimit","paginate","prepareExampleDataTable","operationId","CollapserCard","id","heading","Card","height","px","py","mt","DataTable","caption","columns","exampleColumns","map","exampleRow","_pageExamples","isEmptyItem","filename","EMPTY_STRING","isLastItem","PER_PAGE_COUNT","nextItemEmpty","hidden","DataTableItem","permalink","key","DocSdkExampleCell","hideBorderBottom","Space","gap","Icon","icon","InsertDriveFile","color","size","Link","href","target","role","language","description","line","Box","alignSelf","Pagination","current","pages","onChange","nextPage","exports"],"sources":["../../../src/components/DocSdkUsage/DocSdkUsage.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC } from 'react';\nimport React, { useEffect, useState } from 'react';\nimport {\n Box,\n Card,\n DataTable,\n DataTableItem,\n Icon,\n Link,\n Pagination,\n Space,\n} from '@looker/components';\nimport type { IMethod } from '@looker/sdk-codegen';\nimport { findExampleLanguages } from '@looker/sdk-codegen';\nimport { CollapserCard } from '@looker/run-it';\nimport { InsertDriveFile } from '@styled-icons/material-outlined/InsertDriveFile';\nimport { useSelector } from 'react-redux';\n\nimport { selectExamplesLode, selectSdkLanguage } from '../../state';\nimport {\n EMPTY_STRING,\n PER_PAGE_COUNT,\n exampleColumns,\n prepareExampleDataTable,\n sortLanguagesByPreference,\n} from './utils';\nimport { DocSdkExampleCell } from './DocSdkExampleCell';\n\ninterface DocSdkUsageProps {\n method: IMethod;\n}\n\n/**\n * Given an SDK method, searches the examples index for its usages in various languages and renders\n * links to the source files\n */\nexport const DocSdkUsage: FC<DocSdkUsageProps> = ({ method }) => {\n const examples = useSelector(selectExamplesLode);\n const sdkLanguage = useSelector(selectSdkLanguage);\n const [page, setPage] = useState(1);\n\n useEffect(() => {\n setPage(1);\n }, [method]);\n\n if (!examples) return <></>;\n let languages = findExampleLanguages(examples, method.name);\n if (languages.length === 0) return <></>;\n\n languages = sortLanguagesByPreference(languages, sdkLanguage);\n\n const { pageExamples, pageLimit, paginate } = prepareExampleDataTable(\n languages,\n examples,\n method.operationId,\n page\n );\n\n if (pageExamples.length === 0) return <></>;\n\n return (\n <CollapserCard id=\"examples\" heading=\"SDK Examples\">\n <Card height=\"auto\" px=\"small\" py=\"xsmall\" mt=\"small\">\n <DataTable caption=\"SDK Examples\" columns={exampleColumns}>\n {pageExamples.map((exampleRow, i) => {\n const isEmptyItem = exampleRow.filename === EMPTY_STRING;\n const isLastItem =\n (i + 1) % PER_PAGE_COUNT === 0 || i + 1 === pageExamples.length;\n const nextItemEmpty =\n pageExamples[i + 1]?.filename === EMPTY_STRING;\n const hidden = isEmptyItem || isLastItem || nextItemEmpty;\n return (\n <DataTableItem\n id={exampleRow.permalink}\n key={exampleRow.permalink}\n >\n <DocSdkExampleCell hideBorderBottom={hidden}>\n <Space gap=\"xsmall\">\n {!isEmptyItem && (\n <Icon\n icon={<InsertDriveFile />}\n color=\"text1\"\n size=\"small\"\n />\n )}\n <Link\n href={exampleRow.permalink}\n target={'_blank'}\n role=\"link\"\n >\n {exampleRow.filename}\n </Link>\n </Space>\n </DocSdkExampleCell>\n <DocSdkExampleCell hideBorderBottom={hidden}>\n {exampleRow.language}\n </DocSdkExampleCell>\n <DocSdkExampleCell hideBorderBottom={hidden}>\n {exampleRow.description}\n </DocSdkExampleCell>\n <DocSdkExampleCell hideBorderBottom={hidden}>\n {exampleRow.line}\n </DocSdkExampleCell>\n </DataTableItem>\n );\n })}\n </DataTable>\n {paginate && (\n <Box alignSelf=\"center\">\n <Pagination\n current={page}\n pages={pageLimit}\n onChange={(nextPage) => {\n setPage(nextPage);\n }}\n />\n </Box>\n )}\n </Card>\n </CollapserCard>\n );\n};\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAWA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAOA,IAAAQ,kBAAA,GAAAR,OAAA;AAAwD,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAA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AClC,kBAAA,CAAAuE,iBAAiB;MAACC,gBAAgB,EAAEL;IAAO,GACzCR,UAAU,CAAC0B,WACK,CAAC,EACpB/F,MAAA,CAAAiB,OAAA,CAAA2B,aAAA,CAAClC,kBAAA,CAAAuE,iBAAiB;MAACC,gBAAgB,EAAEL;IAAO,GACzCR,UAAU,CAAC2B,IACK,CACN,CAAC;EAEpB,CAAC,CACQ,CAAC,EACX3C,QAAQ,IACPrD,MAAA,CAAAiB,OAAA,CAAA2B,aAAA,CAACzC,WAAA,CAAA8F,GAAG;IAACC,SAAS,EAAC;EAAQ,GACrBlG,MAAA,CAAAiB,OAAA,CAAA2B,aAAA,CAACzC,WAAA,CAAAgG,UAAU;IACTC,OAAO,EAAE5D,IAAK;IACd6D,KAAK,EAAEjD,SAAU;IACjBkD,QAAQ,EAAGC,QAAQ,IAAK;MACtB9D,OAAO,CAAC8D,QAAQ,CAAC;IACnB;EAAE,CACH,CACE,CAEH,CACO,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAAxE,WAAA,GAAAA,WAAA"}
|
|
1
|
+
{"version":3,"file":"DocSdkUsage.js","names":["_react","_interopRequireWildcard","require","_components","_sdkCodegen","_runIt","_InsertDriveFile","_reactRedux","_state","_utils","_DocSdkExampleCell","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","DocSdkUsage","_ref","method","examples","useSelector","selectExamplesLode","sdkLanguage","selectSdkLanguage","page","setPage","useState","useEffect","createElement","Fragment","languages","findExampleLanguages","name","length","sortLanguagesByPreference","pageExamples","pageLimit","paginate","prepareExampleDataTable","operationId","CollapserCard","id","heading","Card","height","px","py","mt","DataTable","caption","columns","exampleColumns","map","exampleRow","_pageExamples","isEmptyItem","filename","EMPTY_STRING","isLastItem","PER_PAGE_COUNT","nextItemEmpty","hidden","DataTableItem","permalink","key","DocSdkExampleCell","hideBorderBottom","Space","gap","Icon","icon","InsertDriveFile","color","size","Link","href","target","role","language","description","line","Box","alignSelf","Pagination","current","pages","onChange","nextPage","exports"],"sources":["../../../src/components/DocSdkUsage/DocSdkUsage.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC } from 'react';\nimport React, { useEffect, useState } from 'react';\nimport {\n Box,\n Card,\n DataTable,\n DataTableItem,\n Icon,\n Link,\n Pagination,\n Space,\n} from '@looker/components';\nimport type { IMethod } from '@looker/sdk-codegen';\nimport { findExampleLanguages } from '@looker/sdk-codegen';\nimport { CollapserCard } from '@looker/run-it';\nimport { InsertDriveFile } from '@styled-icons/material-outlined/InsertDriveFile';\nimport { useSelector } from 'react-redux';\n\nimport { selectExamplesLode, selectSdkLanguage } from '../../state';\nimport {\n EMPTY_STRING,\n PER_PAGE_COUNT,\n exampleColumns,\n prepareExampleDataTable,\n sortLanguagesByPreference,\n} from './utils';\nimport { DocSdkExampleCell } from './DocSdkExampleCell';\n\ninterface DocSdkUsageProps {\n method: IMethod;\n}\n\n/**\n * Given an SDK method, searches the examples index for its usages in various languages and renders\n * links to the source files\n */\nexport const DocSdkUsage: FC<DocSdkUsageProps> = ({ method }) => {\n const examples = useSelector(selectExamplesLode);\n const sdkLanguage = useSelector(selectSdkLanguage);\n const [page, setPage] = useState(1);\n\n useEffect(() => {\n setPage(1);\n }, [method]);\n\n if (!examples) return <></>;\n let languages = findExampleLanguages(examples, method.name);\n if (languages.length === 0) return <></>;\n\n languages = sortLanguagesByPreference(languages, sdkLanguage);\n\n const { pageExamples, pageLimit, paginate } = prepareExampleDataTable(\n languages,\n examples,\n method.operationId,\n page\n );\n\n if (pageExamples.length === 0) return <></>;\n\n return (\n <CollapserCard id=\"examples\" heading=\"SDK Examples\">\n <Card height=\"auto\" px=\"small\" py=\"xsmall\" mt=\"small\">\n <DataTable caption=\"SDK Examples\" columns={exampleColumns}>\n {pageExamples.map((exampleRow, i) => {\n const isEmptyItem = exampleRow.filename === EMPTY_STRING;\n const isLastItem =\n (i + 1) % PER_PAGE_COUNT === 0 || i + 1 === pageExamples.length;\n const nextItemEmpty =\n pageExamples[i + 1]?.filename === EMPTY_STRING;\n const hidden = isEmptyItem || isLastItem || nextItemEmpty;\n return (\n <DataTableItem\n id={exampleRow.permalink}\n key={exampleRow.permalink}\n >\n <DocSdkExampleCell hideBorderBottom={hidden}>\n <Space gap=\"xsmall\">\n {!isEmptyItem && (\n <Icon\n icon={<InsertDriveFile />}\n color=\"text1\"\n size=\"small\"\n />\n )}\n <Link\n href={exampleRow.permalink}\n target={'_blank'}\n role=\"link\"\n >\n {exampleRow.filename}\n </Link>\n </Space>\n </DocSdkExampleCell>\n <DocSdkExampleCell hideBorderBottom={hidden}>\n {exampleRow.language}\n </DocSdkExampleCell>\n <DocSdkExampleCell hideBorderBottom={hidden}>\n {exampleRow.description}\n </DocSdkExampleCell>\n <DocSdkExampleCell hideBorderBottom={hidden}>\n {exampleRow.line}\n </DocSdkExampleCell>\n </DataTableItem>\n );\n })}\n </DataTable>\n {paginate && (\n <Box alignSelf=\"center\">\n <Pagination\n current={page}\n pages={pageLimit}\n onChange={nextPage => {\n setPage(nextPage);\n }}\n />\n </Box>\n )}\n </Card>\n </CollapserCard>\n );\n};\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAWA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAOA,IAAAQ,kBAAA,GAAAR,OAAA;AAAwD,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAA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;IAACC,SAAS,EAAC;EAAQ,GACrBlG,MAAA,CAAAiB,OAAA,CAAA2B,aAAA,CAACzC,WAAA,CAAAgG,UAAU;IACTC,OAAO,EAAE5D,IAAK;IACd6D,KAAK,EAAEjD,SAAU;IACjBkD,QAAQ,EAAEC,QAAQ,IAAI;MACpB9D,OAAO,CAAC8D,QAAQ,CAAC;IACnB;EAAE,CACH,CACE,CAEH,CACO,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAAxE,WAAA,GAAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_sdkCodegen","require","_components","PER_PAGE_COUNT","exports","EMPTY_STRING","exampleColumns","id","title","type","size","getFileNameFromPath","path","lastForwardSlash","lastIndexOf","slice","indexOf","prepareExampleDataTable","languages","examples","operationId","currentPage","tableExamples","reduce","result","language","languageExamples","findExamples","map","exampleLink","filename","tooltip","line","lineNumber","toLowerCase","permalink","description","pageExamples","filter","example","index","pageLimit","Math","ceil","length","paginate","push","toString","getTableItemBottomBorder","hide","concat","theme","colors","ui2","sortLanguagesByPreference","sdkLanguage","some","item","idx","unshift","splice"],"sources":["../../../src/components/DocSdkUsage/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { IExampleMine } from '@looker/sdk-codegen';\nimport { findExamples } from '@looker/sdk-codegen';\nimport type { DataTableColumns } from '@looker/components';\nimport { theme } from '@looker/components';\n\nexport const PER_PAGE_COUNT = 10;\n\nexport const EMPTY_STRING = '';\n\nexport const exampleColumns: DataTableColumns = [\n {\n id: 'filename',\n title: 'Filename',\n type: 'string',\n size: 30,\n },\n {\n id: 'language',\n title: 'Language',\n type: 'string',\n size: 20,\n },\n {\n id: 'description',\n title: 'Description',\n type: 'string',\n size: 40,\n },\n {\n id: 'line',\n title: 'Line',\n type: 'number',\n size: 20,\n },\n];\n\nexport interface ExampleLinkTableRow {\n filename: string;\n language: string;\n line: string;\n permalink: string;\n description: string;\n}\n\nexport interface DataTablePage {\n /** array of sdk examples for a given page */\n pageExamples: ExampleLinkTableRow[];\n /** the page limit of the larger example set */\n pageLimit: number;\n /** flag for whether or not to paginate results */\n paginate: boolean;\n}\n\n/**\n * Gets the filename from the end of a path\n * @param path - repository path\n * @returns file name\n */\nexport function getFileNameFromPath(path: string): string {\n const lastForwardSlash = path.lastIndexOf('/');\n return lastForwardSlash === -1\n ? path\n : path.slice(lastForwardSlash + 1, path.indexOf(' '));\n}\n\n/**\n * Formats the examples for each language into a format that is displayable in a table structure\n * @param languages - languages to example mine\n * @param examples - the mined examples\n * @param operationId - the current operation id\n * @param currentPage - the current page to paginate to\n * @returns display-ready table data\n */\nexport function prepareExampleDataTable(\n languages: string[],\n examples: IExampleMine,\n operationId: string,\n currentPage: number\n): DataTablePage {\n const tableExamples = languages.reduce(function (\n result: ExampleLinkTableRow[],\n language: string\n ) {\n const languageExamples = findExamples(examples, language, operationId);\n return [\n ...result,\n ...languageExamples.map(
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_sdkCodegen","require","_components","PER_PAGE_COUNT","exports","EMPTY_STRING","exampleColumns","id","title","type","size","getFileNameFromPath","path","lastForwardSlash","lastIndexOf","slice","indexOf","prepareExampleDataTable","languages","examples","operationId","currentPage","tableExamples","reduce","result","language","languageExamples","findExamples","map","exampleLink","filename","tooltip","line","lineNumber","toLowerCase","permalink","description","pageExamples","filter","example","index","pageLimit","Math","ceil","length","paginate","push","toString","getTableItemBottomBorder","hide","concat","theme","colors","ui2","sortLanguagesByPreference","sdkLanguage","some","item","idx","unshift","splice"],"sources":["../../../src/components/DocSdkUsage/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { IExampleMine } from '@looker/sdk-codegen';\nimport { findExamples } from '@looker/sdk-codegen';\nimport type { DataTableColumns } from '@looker/components';\nimport { theme } from '@looker/components';\n\nexport const PER_PAGE_COUNT = 10;\n\nexport const EMPTY_STRING = '';\n\nexport const exampleColumns: DataTableColumns = [\n {\n id: 'filename',\n title: 'Filename',\n type: 'string',\n size: 30,\n },\n {\n id: 'language',\n title: 'Language',\n type: 'string',\n size: 20,\n },\n {\n id: 'description',\n title: 'Description',\n type: 'string',\n size: 40,\n },\n {\n id: 'line',\n title: 'Line',\n type: 'number',\n size: 20,\n },\n];\n\nexport interface ExampleLinkTableRow {\n filename: string;\n language: string;\n line: string;\n permalink: string;\n description: string;\n}\n\nexport interface DataTablePage {\n /** array of sdk examples for a given page */\n pageExamples: ExampleLinkTableRow[];\n /** the page limit of the larger example set */\n pageLimit: number;\n /** flag for whether or not to paginate results */\n paginate: boolean;\n}\n\n/**\n * Gets the filename from the end of a path\n * @param path - repository path\n * @returns file name\n */\nexport function getFileNameFromPath(path: string): string {\n const lastForwardSlash = path.lastIndexOf('/');\n return lastForwardSlash === -1\n ? path\n : path.slice(lastForwardSlash + 1, path.indexOf(' '));\n}\n\n/**\n * Formats the examples for each language into a format that is displayable in a table structure\n * @param languages - languages to example mine\n * @param examples - the mined examples\n * @param operationId - the current operation id\n * @param currentPage - the current page to paginate to\n * @returns display-ready table data\n */\nexport function prepareExampleDataTable(\n languages: string[],\n examples: IExampleMine,\n operationId: string,\n currentPage: number\n): DataTablePage {\n const tableExamples = languages.reduce(function (\n result: ExampleLinkTableRow[],\n language: string\n ) {\n const languageExamples = findExamples(examples, language, operationId);\n return [\n ...result,\n ...languageExamples.map(exampleLink => {\n return {\n filename: getFileNameFromPath(exampleLink.tooltip),\n line: exampleLink.lineNumber,\n language: language.toLowerCase(),\n permalink: exampleLink.permalink,\n description: exampleLink.description,\n };\n }),\n ];\n },\n []);\n\n const pageExamples = tableExamples.filter(\n (example, index) =>\n example &&\n index + 1 > (currentPage - 1) * PER_PAGE_COUNT &&\n index + 1 <= currentPage * PER_PAGE_COUNT\n );\n\n const pageLimit = Math.ceil(tableExamples.length / PER_PAGE_COUNT);\n const paginate = tableExamples.length > PER_PAGE_COUNT;\n\n if (tableExamples.length > PER_PAGE_COUNT) {\n while (pageExamples.length !== PER_PAGE_COUNT) {\n pageExamples.push({\n filename: EMPTY_STRING,\n line: EMPTY_STRING,\n language: EMPTY_STRING,\n permalink: pageExamples.length.toString(),\n description: EMPTY_STRING,\n });\n }\n }\n return { pageExamples, pageLimit, paginate };\n}\n\n/**\n * returns a border-bottom style value for table items\n * @param hide whether or not to hide bottom border\n */\nexport function getTableItemBottomBorder(hide: boolean): string {\n return hide ? 'none' : `solid 1px ${theme.colors.ui2}`;\n}\n\n/**\n * puts preferred language examples at front of list\n * @param languages list of languages\n * @param sdkLanguage language preference\n */\nexport function sortLanguagesByPreference(\n languages: string[],\n sdkLanguage: string\n): string[] {\n languages.some(\n (item, idx) =>\n item === sdkLanguage && languages.unshift(languages.splice(idx, 1)[0])\n );\n return languages;\n}\n"],"mappings":";;;;;;;;;;AA2BA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,EAAE;AAEzB,IAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,EAAE;AAEvB,IAAMC,cAAgC,GAAAF,OAAA,CAAAE,cAAA,GAAG,CAC9C;EACEC,EAAE,EAAE,UAAU;EACdC,KAAK,EAAE,UAAU;EACjBC,IAAI,EAAE,QAAQ;EACdC,IAAI,EAAE;AACR,CAAC,EACD;EACEH,EAAE,EAAE,UAAU;EACdC,KAAK,EAAE,UAAU;EACjBC,IAAI,EAAE,QAAQ;EACdC,IAAI,EAAE;AACR,CAAC,EACD;EACEH,EAAE,EAAE,aAAa;EACjBC,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAE,QAAQ;EACdC,IAAI,EAAE;AACR,CAAC,EACD;EACEH,EAAE,EAAE,MAAM;EACVC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,QAAQ;EACdC,IAAI,EAAE;AACR,CAAC,CACF;AAwBM,SAASC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GvB,aAAa,CAACsB,MAAM,GAAGzC,cAAc;EAEtD,IAAImB,aAAa,CAACsB,MAAM,GAAGzC,cAAc,EAAE;IACzC,OAAOkC,YAAY,CAACO,MAAM,KAAKzC,cAAc,EAAE;MAC7CkC,YAAY,CAACS,IAAI,CAAC;QAChBhB,QAAQ,EAAEzB,YAAY;QACtB2B,IAAI,EAAE3B,YAAY;QAClBoB,QAAQ,EAAEpB,YAAY;QACtB8B,SAAS,EAAEE,YAAY,CAACO,MAAM,CAACG,QAAQ,CAAC,CAAC;QACzCX,WAAW,EAAE/B;MACf,CAAC,CAAC;IACJ;EACF;EACA,OAAO;IAAEgC,YAAY;IAAEI,SAAS;IAAEI;EAAS,CAAC;AAC9C;AAMO,SAASG,wBAAwBA,CAACC,IAAa,EAAU;EAC9D,OAAOA,IAAI,GAAG,MAAM,gBAAAC,MAAA,CAAgBC,iBAAK,CAACC,MAAM,CAACC,GAAG,CAAE;AACxD;AAOO,SAASC,yBAAyBA,CACvCpC,SAAmB,EACnBqC,WAAmB,EACT;EACVrC,SAAS,CAACsC,IAAI,CACZ,CAACC,IAAI,EAAEC,GAAG,KACRD,IAAI,KAAKF,WAAW,IAAIrC,SAAS,CAACyC,OAAO,CAACzC,SAAS,CAAC0C,MAAM,CAACF,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACzE,CAAC;EACD,OAAOxC,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocTitle.js","names":["_react","_interopRequireDefault","require","_runIt","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","DocTitle","props","createElement","RunItHeading","fontSize","exports"],"sources":["../../../src/components/DocTitle/DocTitle.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React from 'react';\nimport { RunItHeading } from '@looker/run-it';\n\nexport const DocTitle: FC =
|
|
1
|
+
{"version":3,"file":"DocTitle.js","names":["_react","_interopRequireDefault","require","_runIt","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","DocTitle","props","createElement","RunItHeading","fontSize","exports"],"sources":["../../../src/components/DocTitle/DocTitle.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React from 'react';\nimport { RunItHeading } from '@looker/run-it';\n\nexport const DocTitle: FC = props => (\n <RunItHeading fontSize=\"xxxlarge\" {...props} />\n);\n"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAA8C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAEvC,IAAMQ,QAAY,GAAGC,KAAK,IAC/BtB,MAAA,CAAAM,OAAA,CAAAiB,aAAA,CAACpB,MAAA,CAAAqB,YAAY,EAAAjB,QAAA;EAACkB,QAAQ,EAAC;AAAU,GAAKH,KAAK,CAAG,CAC/C;AAACI,OAAA,CAAAL,QAAA,GAAAA,QAAA"}
|
package/lib/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SomethingWentWrong.js","names":["_react","_interopRequireDefault","require","_components","_styledComponents","_components2","obj","__esModule","default","SomethingWentWrong","_ref","header","actionMessage","altText","createElement","OuterFlex","SomethingWentWrongGraphic","HeaderText","Box","width","ActionMessage","exports","styled","Flex","withConfig","displayName","componentId","props","theme","space","xxxxlarge","h1","large","fonts","brand","fontWeights","normal","fontSizes","colors","text5","h3","small","text3"],"sources":["../../../../../src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport React from 'react';\nimport { Box, Flex } from '@looker/components';\nimport styled from 'styled-components';\nimport { SomethingWentWrongGraphic } from './components';\n\nexport interface SomethingWentWrongProps {\n header: string;\n actionMessage: string;\n altText?: string;\n}\n\nexport const SomethingWentWrong: React.FC<SomethingWentWrongProps> = ({\n header,\n actionMessage,\n altText,\n}) => (\n <OuterFlex>\n <SomethingWentWrongGraphic altText={altText} />\n <HeaderText>{header}</HeaderText>\n <Box width={520}>\n <ActionMessage>{actionMessage}</ActionMessage>\n </Box>\n </OuterFlex>\n);\n\nconst OuterFlex = styled(Flex)`\n width: 100%;\n margin-top: ${
|
|
1
|
+
{"version":3,"file":"SomethingWentWrong.js","names":["_react","_interopRequireDefault","require","_components","_styledComponents","_components2","obj","__esModule","default","SomethingWentWrong","_ref","header","actionMessage","altText","createElement","OuterFlex","SomethingWentWrongGraphic","HeaderText","Box","width","ActionMessage","exports","styled","Flex","withConfig","displayName","componentId","props","theme","space","xxxxlarge","h1","large","fonts","brand","fontWeights","normal","fontSizes","colors","text5","h3","small","text3"],"sources":["../../../../../src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport React from 'react';\nimport { Box, Flex } from '@looker/components';\nimport styled from 'styled-components';\nimport { SomethingWentWrongGraphic } from './components';\n\nexport interface SomethingWentWrongProps {\n header: string;\n actionMessage: string;\n altText?: string;\n}\n\nexport const SomethingWentWrong: React.FC<SomethingWentWrongProps> = ({\n header,\n actionMessage,\n altText,\n}) => (\n <OuterFlex>\n <SomethingWentWrongGraphic altText={altText} />\n <HeaderText>{header}</HeaderText>\n <Box width={520}>\n <ActionMessage>{actionMessage}</ActionMessage>\n </Box>\n </OuterFlex>\n);\n\nconst OuterFlex = styled(Flex)`\n width: 100%;\n margin-top: ${props => props.theme.space.xxxxlarge};\n justify-content: center;\n flex-direction: column;\n align-items: center;\n`;\n\nconst HeaderText = styled.h1`\n margin-top: ${props => props.theme.space.large};\n text-align: center;\n font-family: ${props => props.theme.fonts.brand};\n font-weight: ${props => props.theme.fontWeights.normal};\n font-size: ${props => props.theme.fontSizes.xxxxlarge};\n color: ${props => props.theme.colors.text5};\n`;\n\nconst ActionMessage = styled.h3`\n margin-top: ${props => props.theme.space.small};\n text-align: center;\n font-family: ${props => props.theme.fonts.brand};\n font-weight: ${props => props.theme.fontWeights.normal};\n font-size: ${props => props.theme.fontSizes.large};\n color: ${props => props.theme.colors.text3};\n`;\n"],"mappings":";;;;;;AAyBA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAAyD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQlD,IAAMG,kBAAqD,GAAGC,IAAA;EAAA,IAAC;IACpEC,MAAM;IACNC,aAAa;IACbC;EACF,CAAC,GAAAH,IAAA;EAAA,OACCV,MAAA,CAAAQ,OAAA,CAAAM,aAAA,CAACC,SAAS,QACRf,M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AAK,CAACC,KAAK,CAACO,WAAW,CAACC,MAAM,EACzCT,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACS,SAAS,CAACL,KAAK,EACxCL,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACU,MAAM,CAACI,KAAK,CAC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExploreProperty.js","names":["_react","_interopRequireDefault","require","_components","_Done","_Lock","_Remove","_codeEditor","_","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","TipIcon","_ref","show","tip","icon","title","createElement","Fragment","Tooltip","content","Icon","size","exports","ExplorePropertyRequired","_ref2","property","concat","fullName","required","Done","ExplorePropertyDeprecated","_ref3","deprecated","Remove","ExplorePropertyReadOnly","_ref4","readOnly","Lock","DescriptionParagraph","props","Paragraph","fontSize","m","ExplorePropertyDescription","_ref5","description","Markdown","paragraphOverride","ExplorePropertyDetail","_ref6","api","Space","style","marginLeft","Box","width","ExploreTypeLink","type","ExplorePropertyNode","_ref7","legend","typeIcon","TreeItem","detail","jsonName","ExploreProperty","_ref8","level","maxDepth","openAll","picked","pickType","intrinsic","ExplorePropertyType","open","_ref9","pickTypeProps","nest","expandable","Tree","border","label","defaultOpen","density","values","map"],"sources":["../../../src/components/ExploreType/ExploreProperty.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React from 'react';\nimport type { IconType } from '@looker/components';\nimport {\n Box,\n Icon,\n Paragraph,\n Space,\n Tooltip,\n Tree,\n TreeItem,\n} from '@looker/components';\nimport { Done } from '@styled-icons/material/Done';\nimport { Lock } from '@styled-icons/material/Lock';\nimport { Remove } from '@styled-icons/material/Remove';\nimport type { ApiModel, IProperty } from '@looker/sdk-codegen';\nimport { Markdown } from '@looker/code-editor';\nimport {\n ExploreTypeLink,\n expandable,\n pickType,\n pickTypeProps,\n typeIcon,\n} from '.';\n\ninterface TipIconProps {\n show: boolean;\n tip: string;\n icon: IconType;\n title: string;\n}\n\n/**\n * Show a tip with icon if show is true\n * @param show true to show tip and icon\n * @param tip to display on hover\n * @param icon name to use\n * @param title for icon\n * @constructor\n */\nexport const TipIcon: FC<TipIconProps> = ({ show, tip, icon, title }) => {\n if (!show) return <></>;\n return (\n <Tooltip content={tip}>\n <Icon icon={icon} size=\"xsmall\" content={tip} title={title} />\n </Tooltip>\n );\n};\n\n/**\n * Interface shared by several ExploreProperty components\n */\ninterface ExplorePropertyProps {\n /** property to explore */\n property: IProperty;\n /** the current level of the hierarchy */\n level?: number;\n /** the maximum depth to expanded nested types. -1 = all (default), 0 = no expansion */\n maxDepth?: number;\n /** open all nodes immediately? */\n openAll?: boolean;\n}\n\n/**\n * Show required status if a property is required\n * @param property to describe\n * @constructor\n */\nexport const ExplorePropertyRequired: FC<ExplorePropertyProps> = ({\n property,\n}) => {\n const tip = `${property.fullName} is required`;\n return (\n <TipIcon\n show={property.required}\n icon={<Done />}\n tip={tip}\n title=\"required property\"\n />\n );\n};\n\n/**\n * Show deprecated status if a property is deprecated\n * @param property to describe\n * @constructor\n */\nexport const ExplorePropertyDeprecated: FC<ExplorePropertyProps> = ({\n property,\n}) => {\n const tip = `${property.fullName} is deprecated`;\n return (\n <TipIcon\n show={property.deprecated}\n icon={<Remove />}\n tip={tip}\n title=\"deprecated property\"\n />\n );\n};\n\n/**\n * Show read-only status if a property is read-only\n * @param property to describe\n * @constructor\n */\nexport const ExplorePropertyReadOnly: FC<ExplorePropertyProps> = ({\n property,\n}) => {\n const tip = `${property.fullName} is read-only`;\n return (\n <TipIcon\n show={property.readOnly}\n icon={<Lock />}\n tip={tip}\n title=\"read-only property\"\n />\n );\n};\n\n/**\n * Display the property description if it's assigned\n * @param property to describe\n * @constructor\n */\nconst DescriptionParagraph: FC = (props) => (\n <Paragraph fontSize=\"small\" m=\"none\" {...props} />\n);\n\nconst ExplorePropertyDescription: FC<ExplorePropertyProps> = ({ property }) =>\n property.description ? (\n <Markdown\n source={property.description}\n paragraphOverride={DescriptionParagraph}\n />\n ) : null;\n\ninterface ExploreApiPropertyProps extends ExplorePropertyProps {\n /** parsed api */\n api: ApiModel;\n}\n\n/**\n * Show the details of the property\n * @param property\n * @constructor\n */\nexport const ExplorePropertyDetail: FC<ExploreApiPropertyProps> = ({\n property,\n api,\n}) => (\n <Space style={{ fontSize: 'small', marginLeft: '10rem' }}>\n <Box width=\"10rem\">\n <ExploreTypeLink type={property.type} api={api} />\n </Box>\n <Box width=\"5rem\">\n <ExplorePropertyRequired property={property} />\n <ExplorePropertyReadOnly property={property} />\n <ExplorePropertyDeprecated property={property} />\n </Box>\n <Box width=\"30rem\">\n <ExplorePropertyDescription property={property} />\n </Box>\n </Space>\n);\n\n/**\n * Render a potentially complex property as a non-expanding node\n * @param property to display\n * @constructor\n */\nexport const ExplorePropertyNode: FC<ExploreApiPropertyProps> = ({\n property,\n api,\n}) => {\n const legend = typeIcon(property.type);\n return (\n <TreeItem\n {...legend}\n detail={<ExplorePropertyDetail api={api} property={property} />}\n >\n {property.jsonName}\n </TreeItem>\n );\n};\n\n/**\n * Render the Tree or TreeItem for this property\n * @param property to display\n * @param level current nesting level\n * @param maxDepth maximum depth to expand\n * @param openAll expands entire tree if true\n * @constructor\n */\nexport const ExploreProperty: FC<ExploreApiPropertyProps> = ({\n property,\n api,\n level = 0,\n maxDepth = -1,\n openAll = false,\n}) => {\n const picked = pickType(property.type);\n if (!picked.intrinsic) {\n return (\n <ExplorePropertyType\n api={api}\n property={property}\n open={false}\n level={level + 1}\n maxDepth={maxDepth}\n openAll={openAll}\n />\n );\n }\n return <ExplorePropertyNode api={api} property={property} />;\n};\n\ninterface ExplorePropertyTypeProps extends ExploreApiPropertyProps {\n /** Open the node display immediately? */\n open?: boolean;\n}\n\nexport const ExplorePropertyType: FC<ExplorePropertyTypeProps> = ({\n property,\n api,\n open = true,\n level = 0,\n maxDepth = -1,\n openAll = false,\n}) => {\n const type = property.type;\n const props = pickTypeProps(type);\n const nest = expandable(level, maxDepth);\n const legend = typeIcon(type);\n if (!nest) {\n return <ExplorePropertyNode api={api} property={property} />;\n }\n return (\n <Tree\n border\n label={`${property.jsonName}`}\n icon={legend.icon}\n defaultOpen={open || openAll}\n density={-3}\n detail={<ExplorePropertyDetail api={api} property={property} />}\n >\n {Object.values(props).map((property) => (\n <ExploreProperty\n api={api}\n key={property.fullName}\n property={property}\n level={level + 1}\n maxDepth={maxDepth}\n openAll={openAll}\n />\n ))}\n </Tree>\n );\n};\n"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,CAAA,GAAAN,OAAA;AAMW,SAAAD,uBAAAQ,G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BlD,IAAI,EAAE8C,MAAM,CAAC9C,IAAK;IAClBoE,WAAW,EAAER,IAAI,IAAIL,OAAQ;IAC7Bc,OAAO,EAAE,CAAC,CAAE;IACZpB,MAAM,EAAE/E,MAAA,CAAAW,OAAA,CAAAqB,aAAA,CAACgC,qBAAqB;MAACE,GAAG,EAAEA,GAAI;MAACzB,QAAQ,EAAEA;IAAS,CAAE;EAAE,GAE/D5B,MAAM,CAACuF,MAAM,CAAC7C,KAAK,CAAC,CAAC8C,GAAG,CAAE5D,QAAQ,IACjCzC,MAAA,CAAAW,OAAA,CAAAqB,aAAA,CAACiD,eAAe;IACdf,GAAG,EAAEA,GAAI;IACT7C,GAAG,EAAEoB,QAAQ,CAACE,QAAS;IACvBF,QAAQ,EAAEA,QAAS;IACnB0C,KAAK,EAAEA,KAAK,GAAG,CAAE;IACjBC,QAAQ,EAAEA,QAAS;IACnBC,OAAO,EAAEA;EAAQ,CAClB,CACF,CACG,CAAC;AAEX,CAAC;AAAC/C,OAAA,CAAAmD,mBAAA,GAAAA,mBAAA"}
|
|
1
|
+
{"version":3,"file":"ExploreProperty.js","names":["_react","_interopRequireDefault","require","_components","_Done","_Lock","_Remove","_codeEditor","_","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","TipIcon","_ref","show","tip","icon","title","createElement","Fragment","Tooltip","content","Icon","size","exports","ExplorePropertyRequired","_ref2","property","concat","fullName","required","Done","ExplorePropertyDeprecated","_ref3","deprecated","Remove","ExplorePropertyReadOnly","_ref4","readOnly","Lock","DescriptionParagraph","props","Paragraph","fontSize","m","ExplorePropertyDescription","_ref5","description","Markdown","paragraphOverride","ExplorePropertyDetail","_ref6","api","Space","style","marginLeft","Box","width","ExploreTypeLink","type","ExplorePropertyNode","_ref7","legend","typeIcon","TreeItem","detail","jsonName","ExploreProperty","_ref8","level","maxDepth","openAll","picked","pickType","intrinsic","ExplorePropertyType","open","_ref9","pickTypeProps","nest","expandable","Tree","border","label","defaultOpen","density","values","map"],"sources":["../../../src/components/ExploreType/ExploreProperty.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React from 'react';\nimport type { IconType } from '@looker/components';\nimport {\n Box,\n Icon,\n Paragraph,\n Space,\n Tooltip,\n Tree,\n TreeItem,\n} from '@looker/components';\nimport { Done } from '@styled-icons/material/Done';\nimport { Lock } from '@styled-icons/material/Lock';\nimport { Remove } from '@styled-icons/material/Remove';\nimport type { ApiModel, IProperty } from '@looker/sdk-codegen';\nimport { Markdown } from '@looker/code-editor';\nimport {\n ExploreTypeLink,\n expandable,\n pickType,\n pickTypeProps,\n typeIcon,\n} from '.';\n\ninterface TipIconProps {\n show: boolean;\n tip: string;\n icon: IconType;\n title: string;\n}\n\n/**\n * Show a tip with icon if show is true\n * @param show true to show tip and icon\n * @param tip to display on hover\n * @param icon name to use\n * @param title for icon\n * @constructor\n */\nexport const TipIcon: FC<TipIconProps> = ({ show, tip, icon, title }) => {\n if (!show) return <></>;\n return (\n <Tooltip content={tip}>\n <Icon icon={icon} size=\"xsmall\" content={tip} title={title} />\n </Tooltip>\n );\n};\n\n/**\n * Interface shared by several ExploreProperty components\n */\ninterface ExplorePropertyProps {\n /** property to explore */\n property: IProperty;\n /** the current level of the hierarchy */\n level?: number;\n /** the maximum depth to expanded nested types. -1 = all (default), 0 = no expansion */\n maxDepth?: number;\n /** open all nodes immediately? */\n openAll?: boolean;\n}\n\n/**\n * Show required status if a property is required\n * @param property to describe\n * @constructor\n */\nexport const ExplorePropertyRequired: FC<ExplorePropertyProps> = ({\n property,\n}) => {\n const tip = `${property.fullName} is required`;\n return (\n <TipIcon\n show={property.required}\n icon={<Done />}\n tip={tip}\n title=\"required property\"\n />\n );\n};\n\n/**\n * Show deprecated status if a property is deprecated\n * @param property to describe\n * @constructor\n */\nexport const ExplorePropertyDeprecated: FC<ExplorePropertyProps> = ({\n property,\n}) => {\n const tip = `${property.fullName} is deprecated`;\n return (\n <TipIcon\n show={property.deprecated}\n icon={<Remove />}\n tip={tip}\n title=\"deprecated property\"\n />\n );\n};\n\n/**\n * Show read-only status if a property is read-only\n * @param property to describe\n * @constructor\n */\nexport const ExplorePropertyReadOnly: FC<ExplorePropertyProps> = ({\n property,\n}) => {\n const tip = `${property.fullName} is read-only`;\n return (\n <TipIcon\n show={property.readOnly}\n icon={<Lock />}\n tip={tip}\n title=\"read-only property\"\n />\n );\n};\n\n/**\n * Display the property description if it's assigned\n * @param property to describe\n * @constructor\n */\nconst DescriptionParagraph: FC = props => (\n <Paragraph fontSize=\"small\" m=\"none\" {...props} />\n);\n\nconst ExplorePropertyDescription: FC<ExplorePropertyProps> = ({ property }) =>\n property.description ? (\n <Markdown\n source={property.description}\n paragraphOverride={DescriptionParagraph}\n />\n ) : null;\n\ninterface ExploreApiPropertyProps extends ExplorePropertyProps {\n /** parsed api */\n api: ApiModel;\n}\n\n/**\n * Show the details of the property\n * @param property\n * @constructor\n */\nexport const ExplorePropertyDetail: FC<ExploreApiPropertyProps> = ({\n property,\n api,\n}) => (\n <Space style={{ fontSize: 'small', marginLeft: '10rem' }}>\n <Box width=\"10rem\">\n <ExploreTypeLink type={property.type} api={api} />\n </Box>\n <Box width=\"5rem\">\n <ExplorePropertyRequired property={property} />\n <ExplorePropertyReadOnly property={property} />\n <ExplorePropertyDeprecated property={property} />\n </Box>\n <Box width=\"30rem\">\n <ExplorePropertyDescription property={property} />\n </Box>\n </Space>\n);\n\n/**\n * Render a potentially complex property as a non-expanding node\n * @param property to display\n * @constructor\n */\nexport const ExplorePropertyNode: FC<ExploreApiPropertyProps> = ({\n property,\n api,\n}) => {\n const legend = typeIcon(property.type);\n return (\n <TreeItem\n {...legend}\n detail={<ExplorePropertyDetail api={api} property={property} />}\n >\n {property.jsonName}\n </TreeItem>\n );\n};\n\n/**\n * Render the Tree or TreeItem for this property\n * @param property to display\n * @param level current nesting level\n * @param maxDepth maximum depth to expand\n * @param openAll expands entire tree if true\n * @constructor\n */\nexport const ExploreProperty: FC<ExploreApiPropertyProps> = ({\n property,\n api,\n level = 0,\n maxDepth = -1,\n openAll = false,\n}) => {\n const picked = pickType(property.type);\n if (!picked.intrinsic) {\n return (\n <ExplorePropertyType\n api={api}\n property={property}\n open={false}\n level={level + 1}\n maxDepth={maxDepth}\n openAll={openAll}\n />\n );\n }\n return <ExplorePropertyNode api={api} property={property} />;\n};\n\ninterface ExplorePropertyTypeProps extends ExploreApiPropertyProps {\n /** Open the node display immediately? */\n open?: boolean;\n}\n\nexport const ExplorePropertyType: FC<ExplorePropertyTypeProps> = ({\n property,\n api,\n open = true,\n level = 0,\n maxDepth = -1,\n openAll = false,\n}) => {\n const type = property.type;\n const props = pickTypeProps(type);\n const nest = expandable(level, maxDepth);\n const legend = typeIcon(type);\n if (!nest) {\n return <ExplorePropertyNode api={api} property={property} />;\n }\n return (\n <Tree\n border\n label={`${property.jsonName}`}\n icon={legend.icon}\n defaultOpen={open || openAll}\n density={-3}\n detail={<ExplorePropertyDetail api={api} property={property} />}\n >\n {Object.values(props).map(property => (\n <ExploreProperty\n api={api}\n key={property.fullName}\n property={property}\n level={level + 1}\n maxDepth={maxDepth}\n openAll={openAll}\n />\n ))}\n </Tree>\n );\n};\n"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,CAAA,GAAAN,OAAA;AAMW,SAAAD,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAiBJ,IAAMQ,OAAyB,GAAGC,IAAA,IAAgC;EAAA,IAA/B;IAAEC,IAAI;IAAEC,GAAG;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAAJ,IAAA;EAClE,IAAI,CAACC,IAAI,EAAE,OAAO5B,MAAA,CAAAW,OAAA,CAAAqB,aAAA,CAAAhC,MAAA,CAAAW,OAAA,CAAAsB,QAAA,MAAI,CAAC;EACv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;EACjC,IAAMoB,IAAI,GAAG,IAAAC,YAAU,EAACX,KAAK,EAAEC,QAAQ,CAAC;EACxC,IAAMR,MAAM,GAAG,IAAAC,UAAQ,EAACJ,IAAI,CAAC;EAC7B,IAAI,CAACoB,IAAI,EAAE;IACT,OAAO7F,MAAA,CAAAW,OAAA,CAAAqB,aAAA,CAAC0C,mBAAmB;MAACR,GAAG,EAAEA,GAAI;MAACzB,QAAQ,EAAEA;IAAS,CAAE,CAAC;EAC9D;EACA,OACEzC,MAAA,CAAAW,OAAA,CAAAqB,aAAA,CAAC7B,WAAA,CAAA4F,IAAI;IACHC,MAAM;IACNC,KAAK,KAAAvD,MAAA,CAAKD,QAAQ,CAACuC,QAAQ,CAAG;IAC9BlD,IAAI,EAAE8C,MAAM,CAAC9C,IAAK;IAClBoE,WAAW,EAAER,IAAI,IAAIL,OAAQ;IAC7Bc,OAAO,EAAE,CAAC,CAAE;IACZpB,MAAM,EAAE/E,MAAA,CAAAW,OAAA,CAAAqB,aAAA,CAACgC,qBAAqB;MAACE,GAAG,EAAEA,GAAI;MAACzB,QAAQ,EAAEA;IAAS,CAAE;EAAE,GAE/D5B,MAAM,CAACuF,MAAM,CAAC7C,KAAK,CAAC,CAAC8C,GAAG,CAAC5D,QAAQ,IAChCzC,MAAA,CAAAW,OAAA,CAAAqB,aAAA,CAACiD,eAAe;IACdf,GAAG,EAAEA,GAAI;IACT7C,GAAG,EAAEoB,QAAQ,CAACE,QAAS;IACvBF,QAAQ,EAAEA,QAAS;IACnB0C,KAAK,EAAEA,KAAK,GAAG,CAAE;IACjBC,QAAQ,EAAEA,QAAS;IACnBC,OAAO,EAAEA;EAAQ,CAClB,CACF,CACG,CAAC;AAEX,CAAC;AAAC/C,OAAA,CAAAmD,mBAAA,GAAAA,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExploreType.js","names":["_react","_interopRequireDefault","require","_components","_sdkCodegen","_reactRouterDom","_Link","_utils","_","obj","__esModule","default","ExploreTypeLink","_ref","type","api","match","useRouteMatch","specKey","params","picked","pickType","name","prefix","typeLinkPrefix","suffix","typeLinkSuffix","typed","typeOfType","TypeOfType","Intrinsic","createElement","Code","fontSize","jsonName","Fragment","Link","key","fullName","to","buildPath","exports","ExploreType","_ref2","open","link","level","maxDepth","openAll","props","pickTypeProps","nest","legend","typeIcon","Tree","border","label","icon","defaultOpen","density","detail","description","TreeItem","Object","values","map","property","ExploreProperty"],"sources":["../../../src/components/ExploreType/ExploreType.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React from 'react';\nimport { Code, Tree, TreeItem } from '@looker/components';\nimport type { ApiModel, IType } from '@looker/sdk-codegen';\nimport { TypeOfType, typeOfType } from '@looker/sdk-codegen';\nimport { useRouteMatch } from 'react-router-dom';\n\nimport { Link } from '../Link';\nimport { buildPath } from '../../utils';\nimport {\n ExploreProperty,\n pickType,\n pickTypeProps,\n typeIcon,\n typeLinkPrefix,\n typeLinkSuffix,\n} from '.';\n\ninterface ExploreTypeLinkProps {\n type: IType;\n api: ApiModel;\n}\n\nexport const ExploreTypeLink: FC<ExploreTypeLinkProps> = ({ type, api }) => {\n const match = useRouteMatch<{ specKey: string }>('/:specKey');\n const specKey = match?.params.specKey;\n const picked = pickType(type);\n const name = picked.name;\n const prefix = typeLinkPrefix(type);\n const suffix = typeLinkSuffix(type);\n const typed = typeOfType(picked);\n if (typed === TypeOfType.Intrinsic)\n return <Code fontSize=\"small\">{type.jsonName}</Code>;\n return (\n <>\n {prefix}\n <Link key={type.fullName} to={buildPath(api, type, specKey!)}>\n {name}\n </Link>\n {suffix}\n </>\n );\n};\n\ninterface ExploreTypeProps {\n /** Type to explore */\n type: IType;\n /** parsed specification */\n api: ApiModel;\n /** Open the node display immediately */\n open?: boolean;\n /** Create a link to the type? */\n link?: boolean;\n /** the nesting level of the type */\n level?: number;\n /** the maximum depth to expanded nested types. -1 = all (default), 0 = no expansion */\n maxDepth?: number;\n /** open all nodes immediately? */\n openAll?: boolean;\n}\n\nexport const ExploreType: FC<ExploreTypeProps> = ({\n type,\n api,\n open = true,\n link = false,\n level = 0,\n maxDepth = -1,\n openAll = false,\n}) => {\n const props = pickTypeProps(type);\n const nest = maxDepth === -1 || level < maxDepth;\n const legend = typeIcon(type);\n return (\n <Tree\n border\n label={type.name}\n icon={legend.icon}\n defaultOpen={open || openAll}\n density={-3}\n detail={\n <>\n {!!type.description && (\n <TreeItem key={type.name}>{type.description}</TreeItem>\n )}\n {link && <ExploreTypeLink type={type} api={api} />}\n </>\n }\n >\n {nest &&\n Object.values(props).map(
|
|
1
|
+
{"version":3,"file":"ExploreType.js","names":["_react","_interopRequireDefault","require","_components","_sdkCodegen","_reactRouterDom","_Link","_utils","_","obj","__esModule","default","ExploreTypeLink","_ref","type","api","match","useRouteMatch","specKey","params","picked","pickType","name","prefix","typeLinkPrefix","suffix","typeLinkSuffix","typed","typeOfType","TypeOfType","Intrinsic","createElement","Code","fontSize","jsonName","Fragment","Link","key","fullName","to","buildPath","exports","ExploreType","_ref2","open","link","level","maxDepth","openAll","props","pickTypeProps","nest","legend","typeIcon","Tree","border","label","icon","defaultOpen","density","detail","description","TreeItem","Object","values","map","property","ExploreProperty"],"sources":["../../../src/components/ExploreType/ExploreType.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react';\nimport React from 'react';\nimport { Code, Tree, TreeItem } from '@looker/components';\nimport type { ApiModel, IType } from '@looker/sdk-codegen';\nimport { TypeOfType, typeOfType } from '@looker/sdk-codegen';\nimport { useRouteMatch } from 'react-router-dom';\n\nimport { Link } from '../Link';\nimport { buildPath } from '../../utils';\nimport {\n ExploreProperty,\n pickType,\n pickTypeProps,\n typeIcon,\n typeLinkPrefix,\n typeLinkSuffix,\n} from '.';\n\ninterface ExploreTypeLinkProps {\n type: IType;\n api: ApiModel;\n}\n\nexport const ExploreTypeLink: FC<ExploreTypeLinkProps> = ({ type, api }) => {\n const match = useRouteMatch<{ specKey: string }>('/:specKey');\n const specKey = match?.params.specKey;\n const picked = pickType(type);\n const name = picked.name;\n const prefix = typeLinkPrefix(type);\n const suffix = typeLinkSuffix(type);\n const typed = typeOfType(picked);\n if (typed === TypeOfType.Intrinsic)\n return <Code fontSize=\"small\">{type.jsonName}</Code>;\n return (\n <>\n {prefix}\n <Link key={type.fullName} to={buildPath(api, type, specKey!)}>\n {name}\n </Link>\n {suffix}\n </>\n );\n};\n\ninterface ExploreTypeProps {\n /** Type to explore */\n type: IType;\n /** parsed specification */\n api: ApiModel;\n /** Open the node display immediately */\n open?: boolean;\n /** Create a link to the type? */\n link?: boolean;\n /** the nesting level of the type */\n level?: number;\n /** the maximum depth to expanded nested types. -1 = all (default), 0 = no expansion */\n maxDepth?: number;\n /** open all nodes immediately? */\n openAll?: boolean;\n}\n\nexport const ExploreType: FC<ExploreTypeProps> = ({\n type,\n api,\n open = true,\n link = false,\n level = 0,\n maxDepth = -1,\n openAll = false,\n}) => {\n const props = pickTypeProps(type);\n const nest = maxDepth === -1 || level < maxDepth;\n const legend = typeIcon(type);\n return (\n <Tree\n border\n label={type.name}\n icon={legend.icon}\n defaultOpen={open || openAll}\n density={-3}\n detail={\n <>\n {!!type.description && (\n <TreeItem key={type.name}>{type.description}</TreeItem>\n )}\n {link && <ExploreTypeLink type={type} api={api} />}\n </>\n }\n >\n {nest &&\n Object.values(props).map(property => (\n <ExploreProperty\n api={api}\n key={property.fullName}\n property={property}\n level={level + 1}\n maxDepth={maxDepth}\n openAll={openAll}\n />\n ))}\n </Tree>\n );\n};\n"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAA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